
		
		
		
		
		// Removes the blank space before and after the passed string (if any)

	function trim(myString) {
		
		return myString.replace(/^\s+/g,'').replace(/\s+$/g,'');

	}





		// Validates the submitted bingo before posting the form
		// Stops the submit if bingo is not a 5 digit number
		// To do : Also accept reprinted bingos ?

	function validateBingoSearch(form_id) {

			// Trim the string
		searched_bingo = trim(form_id.elements[0].value);

			// Escape the example
		if(searched_bingo=='Ex: 20547') form_id.elements[0].value = searched_bingo = '20547';

			// Patern to meet: 5 digit number
		patern=new RegExp("^[0-9]{5}$","g");
		
		if(!patern.test(searched_bingo)) {
			
			alert("Bitte geben Sie eine gültige SLI-Nummer ein");
			return false;

		} else {

			return true;

		}

	}





		// Checks for a valid email address
		// Returns true in case of a valid email ortherwise returns false
	
	function checkEmail(email) {

		//emailRegexp = new RegExp("^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+[.]{1}[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]{2,8}$", "g");
		//emailRegexp = new RegExp("^[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z_+])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9}$", "g");

                emailRegexp = new RegExp("[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", "g");

		if(emailRegexp.test(email)) return true; else return false;

	}





	// Handles ajax requests to server
	// Param 1: [string]	The file to call (full path from root)
	// Param 2: [string]	The parameters to pass ("&" separed)
	// Param 3: [string]	The name of the html element to be parsed with the ajax results

	function makeAjaxRequest(php_executor,settings,returnResponseToHtml) {

		htmlElementToParse = document.getElementById(returnResponseToHtml);

		var random = new Date();
		var req = null; 
		if (window.XMLHttpRequest) { 
			req = new XMLHttpRequest();
			if (req.overrideMimeType) {req.overrideMimeType('text/xml');}
		} else if (window.ActiveXObject) {
			try { req = new ActiveXObject("Msxml2.XMLHTTP"); }
			catch (e) {
				try { req = new ActiveXObject("Microsoft.XMLHTTP"); }
				catch (e) {}
			}
		}

		req.onreadystatechange = function() { 
			if(req.readyState == 4) { 
				htmlElementToParse.innerHTML += req.responseText; 
			} 
		}; 

		req.open("GET",php_executor+"?"+settings+'&random='+random.getTime(),true);
		req.send(null);

	}





	// Handles ajax requests to server for an SLI request (return code)
	// Param 1: [string]	The file to call (full path from root)
	// Param 2: [string]	The parameters to pass ("&" separed)
	// Param 3: [string]	The name of the html element to be parsed with the ajax resultss

	function makeAjaxRequestSli(php_executor,settings,returnResponseToHtml) {

		htmlElementToParse = document.getElementById(returnResponseToHtml);

		var random = new Date();
		var req = null; 
		if (window.XMLHttpRequest) { 
			req = new XMLHttpRequest();
			if (req.overrideMimeType) {req.overrideMimeType('text/xml');}
		} else if (window.ActiveXObject) {
			try { req = new ActiveXObject("Msxml2.XMLHTTP"); }
			catch (e) {
				try { req = new ActiveXObject("Microsoft.XMLHTTP"); }
				catch (e) {}
			}
		}

		req.onreadystatechange = function() { 
			if(req.readyState == 4) { 
				// htmlElementToParse.innerHTML += req.responseText; 

				switch(req.responseText) {

					case '0': 
						
							// Provided information don't match AIB database !
							// Show the subscription form
							
								// Hide the "wait" div
							if(document.getElementById('wait')) document.getElementById('wait').style.display='none';

							if(document.getElementById('wait_1')) document.getElementById('wait_1').style.display='none';
							if(document.getElementById('wait_2')) document.getElementById('wait_2').style.display='none';
							if(document.getElementById('wait_3')) document.getElementById('wait_3').style.display='none';

							//ForceClick('a_subscription_form');
							//ForceClick('a_login_form');
							
								// Force click on the login form, with an error message
							ForceClick('a_login_form_error');
						break;

					case '1': 

						//document.getElementById('wait').style.display='none';

							// Successful
						//htmlElementToParse.innerHTML = '<p><b>Merci pour votre demande.</b></p><p>Elle va être envoyée au fabricant.<br />Vous recevrez rapidement par email les compléments d\'information que vous désirez.</p>'; 

							/**
							 *
							 * 20081120
							 * Reply directly in the "wait" div
							 *
							 */

							// Make sure the login box says "your are logged in"...
						document.getElementById('login').innerHTML = '<h3><a href="/index.php?id=278" title="Sie sind angemeldet">Sie sind angemeldet</a></h3>';
						
						if(document.getElementById('wait')) document.getElementById('wait').innerHTML = '<p><b>Ihre Anfrage wird bearbeitet.</b></p><p>Vielen Dank!</p>';

						if(document.getElementById('wait_1')) document.getElementById('wait_1').innerHTML = '<p><b>Ihre Anfrage wird bearbeitet.</b></p><p>Vielen Dank!</p>';
						if(document.getElementById('wait_2')) document.getElementById('wait_2').innerHTML = '<p><b>Ihre Anfrage wird bearbeitet.</b></p><p>Vielen Dank!</p>';
						if(document.getElementById('wait_3')) document.getElementById('wait_3').innerHTML = '<p><b>Ihre Anfrage wird bearbeitet.</b></p><p>Vielen Dank!</p>';

						if(document.getElementById('wait')) window.setTimeout ("document.getElementById('wait').style.display='none';",4000);

						if(document.getElementById('wait_1')) window.setTimeout ("document.getElementById('wait_1').style.display='none';",4000);
						if(document.getElementById('wait_2')) window.setTimeout ("document.getElementById('wait_2').style.display='none';",4000);
						if(document.getElementById('wait_3')) window.setTimeout ("document.getElementById('wait_3').style.display='none';",4000);

						break;

				}

			} 
		};

		req.open("GET",php_executor+"?"+settings+'&random='+random.getTime(),true);
		req.send(null);

	}





		// Validates the SLI Enquiry Form beform submitting
		// The submission is done via AJAX so do ALWAYS return FALSE otherwise form will be submitted !
		//
		// 1) Check for correct email and for a password
		// 2) Submit via AJAX / SOAP
		// 3) Returns the results in correct div (Confirm / invalid password / open form for registration... )
		// 4) If positive match, use this form to autologin the user ! (So that the user won't need to put his password again)

	function execSliRequest() {

		var prefix = '';
		if(execSliRequest.arguments[0] && parseInt(execSliRequest.arguments[0]) ) prefix = '_'+arguments[0];

			// Ensure the div's content is still the "waiting animation"
		document.getElementById('wait'+prefix).innerHTML = '<table><tr><td width="100" align="right"><img src="fileadmin/templates/img/interne/wait.gif" /></td><td>Ihre Anfrage wird bearbeitet,<br />Bitte haben Sie etwas Geduld.</td></tr></table>';

		error = '';
		errors = false;
		
		if(document.sli_form) {
		
			bingo					= document.sli_form.bingo.value;
			email					= document.sli_form.email.value;
			password			= document.sli_form.password.value;
			already_authed	= document.sli_form.already_authed.value;
			content_uid		= document.sli_form.content_uid.value;
			displaympuid		= document.sli_form.displaympuid.value;

				// Overwrite with the given values, if any
			if(execSliRequest.arguments[0]) email = execSliRequest.arguments[0];
			if(execSliRequest.arguments[1]) password = execSliRequest.arguments[1];
		
		} else {

			bingo					= execSliRequest.arguments[1];
			email					= execSliRequest.arguments[2];
			password			= execSliRequest.arguments[3];
			already_authed	= execSliRequest.arguments[4];
			content_uid		= execSliRequest.arguments[5];
			displaympuid		= execSliRequest.arguments[6];

		}

		document.getElementById('wait'+prefix).style.display='block';

			// Proceed with the lead
		makeAjaxRequestSli('index.php','id=285&tx_etim_pi1[do]=SliEnquire&tx_etim_pi1[bingo]='+bingo+'&tx_etim_pi1[email]='+email+'&tx_etim_pi1[password]='+password+'&tx_etim_pi1[already_authed]='+already_authed+'&tx_etim_pi1[product_uid]='+content_uid+'&tx_etim_pi1[displayMpUid]='+displaympuid,'service_lecteur_wrap');

			// Always return false otherwise form is truely submitted (and we'll be gone on home page)
		return false;

	}





	function ForceClick(a_id) {

		var target=document.getElementById(a_id);

		if(document.dispatchEvent) { 
			var oEvent = document.createEvent( "MouseEvents" );
			oEvent.initMouseEvent("click", true, true,window, 1, 1, 1, 1, 1, false, false, false, false, 0, target);
			target.dispatchEvent( oEvent );
		} else {
			if(document.fireEvent) { // IE
				target.fireEvent("onclick");
			} 
		}

	}




		/**
		 *
		 * Swap the thumbs amongst a tab view
		 *
		 */
	
	function swapThumbs(prefix,id) {

		for(i=1;i<6;i++) if(document.getElementById(prefix+i)) document.getElementById(prefix+i).style.display='none';

		document.getElementById(prefix+id).style.display='block';

	}





		/**
		 *
		 * Function validateWebsiteSearch :: validates a searched string before submitting
		 * Requirement : must not be empty
		 *
		 */
	
	function validateWebsiteSearch(form_id) {

			// Trim the string
		qry = trim(form_id.elements[2].value);
		
			// Not etmpy
		if(!qry || qry=='Suche') { alert("Bitte geben Sie ein gültiges Schlagwort ein."); return false; }

			// More than 2 chars
		if(qry.length<3) { alert("Bitte geben Sie ein gültiges Schlagwort mit mehr als 2 Zeichen ein."); return false; }

		bingoPattern =new RegExp("^([0-9]{5,6})","g");

			// If match bingo structure, submit bingo search engine in stead
		if(bingoPattern.exec(qry)) {
			document.bingo_search.elements('tx_etim_pi1[bingo]').value = RegExp.$1;
			document.bingo_search.submit();
			return false;
		}

		return true;

	}





		/**
		 *
		 * Function showPlayIcon :: used for the tab view "video" on the home page in order to show the play icon when the mouse is over a thumbnail
		 *
		 */
	
	function showPlayIcon(img_id) {

		some_image = document.getElementById(img_id);
		some_image.style.display = 'block';

	} // end of function showPlayIcon





		/**
		 *
		 * Function hidePlayIcon :: used for the tab view "video" on the home page in order to hide the play icon when the mouse is out of an "activated" thumbnail
		 *
		 */
	
	function hidePlayIcon(img_id) {

		some_image = document.getElementById(img_id);
		some_image.style.display = 'none';

	} // end of function hidePlayIcon





		/**
		 *
		 * Function reloadResults :: tweaks the search engine's tab views to resubmit the form with the correct check box cheked
		 *
		 */
	
	function reloadResults(which) {

		form_id = document.forms[0];

			// Uncheck the two boxes
		form_id.elements[0].checked = false;
		form_id.elements[1].checked = false;

		switch(which) {

				// Case enable local website only
			case 'local' : 
				form_id.elements[0].checked = true;
				break;

				// Enable Industry Select only
			case 'is' : 
				form_id.elements[1].checked = true;
				break;

				// Enable all
			case 'all' : 
				form_id.elements[0].checked = true;
				form_id.elements[1].checked = true;
				break;

		} // switch

			// Finaly, submit the form
		form_id.elements[3].click();

	} // end of function reloadResults





		/**
		 *
		 * Function fixSwords :: write the swords in t he first engine box
		 *
		 */
	
	function fixSwords(swords) {

		if(trim(swords)) document.forms[0].elements[2].value = swords;

	}





		/**
		 *
		 * Function activateSubscriptionForm :: activate all the elements of the subscription form and turn alphas back to 100%
		 *
		 */
	
	function activateSubscriptionForm() {

		var some_form = document.subscription;

			// Activate all the fields
		for(i=0;i<some_form.elements.length;i++) some_form.elements[i].disabled = false; 

			// Set 100% opacity on all steps
		for(i=1;i<6;i++) {
			
			var some_div = document.getElementById('disabled_'+i);
			
			if(some_div) {
			
				some_div.style.filter						= 'Alpha(opacity=100)';
				some_div.style.opacity					= '1';

			}

		}

		return;

	}
	
	
	
	
	
		/**
		 *
		 * Function deActivateSubscriptionForm :: deactivate all the elements of the subscription form and turn alphas back to 50%
		 *
		 */
	
	function deActivateSubscriptionForm() {

		var some_form = document.subscription;

			// Activate all the fields
		for(i=0;i<some_form.elements.length;i++) if(some_form.elements[i].name!='receive') some_form.elements[i].disabled = true; 

			// Set 100% opacity on all steps
		for(i=1;i<6;i++) {
			
			var some_div = document.getElementById('disabled_'+i);
			
			if(some_div) {
			
				some_div.style.filter						= 'Alpha(opacity=50)';
				some_div.style.opacity					= '.50';

			}

		}

		alert('Achtung, um TR zu erhalten, klicken Sie auf JA');

		return;

	}

	
	
	
	
		/**
		 *
		 * Function ValidateSubscription :: validates the different steps of the subscription process
		 *
		 */
	
	function ValidateSubscription(step) {

		error = 'Achtung, folgende Felder sind nicht ausgefüllt oder inkorrekt:\n\n';
		errors = false;

		switch(step) {



				// First screen
			case 'step_1':

					// receive must be set to 1 BUT unable to submit if not equal to 1, so don't check for this !
					// country should be other than 0
					// kind must be checked

					// email & email2 must be non-empty, equal, valid email addresses
					// pass & pass2 must be non-empty, equal, not shorter than 6 chars

				country	= document.subscription.country;
				kind			= document.subscription.kind;
				email		= document.subscription.email;
				email2		= document.subscription.email2;
				pass		= document.subscription.pass;
				pass2		= document.subscription.pass2;

					// Reset the borders
				country.style.border		="1px solid #000";
				email.style.border			="1px solid #000";
				email2.style.border			="1px solid #000";
				pass.style.border			="1px solid #000";
				pass2.style.border			="1px solid #000";

					// Country
				if(country.value==0) {errors = true; error += 'Bitte geben Sie Ihr Land ein.\n'; country.style.border="1px solid #f00"; country.focus(); }

					// Kind, only two options
				if(kind[0].checked==false && kind[1].checked==false) {errors = true; error += 'Bitte geben Sie an, welche Hilfe Sie benötigen.\n';}

					// Email 1
				if(!trim(email.value) || (!checkEmail(email.value))) { errors = true; error += 'Bitte bestätigen Sie Ihre E-Mail Adresse.\n'; email.style.border="1px solid #f00"; email.focus(); }

					// Email addresses correspond ?
				if(trim(email.value) != trim(email2.value)) { errors = true; error += 'Bitte stellen Sie sicher, dass Ihr E-mail stimmt.\n'; email.style.border="1px solid #f00"; email2.style.border="1px solid #f00"; email2.focus(); }

					// Password 1
				if(!trim(pass.value) || trim(pass.value).length<6) { errors = true; error += 'Bitte geben Sie ein gültiges Passwort ein (mindestens 6 Zeichen).\n'; pass.style.border="1px solid #f00"; }

					// Password 1 & 2 equal ?
				if(trim(pass.value) != trim(pass2.value)) { errors = true; error += 'Bitte stellen Sie sicher, dass Ihr Passwort stimmt.\n'; pass.style.border="1px solid #f00"; pass2.style.border="1px solid #f00"; pass2.focus(); }
				
				if(errors) {
					
						// Alert the errors
					alert(error);

					return(false);
					
				} else {

						// This trick is used to validate step 4 ==> if everything is ok with this step, just return true;
					if(ValidateSubscription.arguments[1]==true) return true;

						// At this stage, we can attach an "onclick" event to tab view 1 & 2
					document.getElementById('tab_1').onclick=function () { ForceClick('tab_page_1'); }
					document.getElementById('tab_2').onclick=function () { ForceClick('tab_page_2'); }
					document.getElementById('tab_3').onclick=function () { return; }
					document.getElementById('tab_4').onclick=function () { return; }

						// Swap the activated tab
					document.getElementById('tab_1').className = '';
					document.getElementById('tab_2').className = '';
					document.getElementById('tab_3').className = '';
					document.getElementById('tab_4').className = '';

						// From here, going to two
					document.getElementById('tab_2').className = 'over';
					
						// Go to page 2
					ForceClick('tab_page_2');

				}
				
				break;





				// First screen
			case 'step_2':

					// title, firstname, name, company, address_1, address_4 and country must be set

				title							= document.subscription.title;
				firstname					= document.subscription.firstname;
				fname						= document.subscription.fname;
				company					= document.subscription.company;
				address_1					= document.subscription.address_1;
				address_4					= document.subscription.address_4;
				country						= document.subscription.country;

					// Reset the borders
				title.style.border				="1px solid #000";
				firstname.style.border		="1px solid #000";
				fname.style.border			="1px solid #000";
				company.style.border		="1px solid #000";
				address_1.style.border	="1px solid #000";
				address_4.style.border	="1px solid #000";
				country.style.border		="1px solid #000";

					// Country
				if(title.value==0) {errors = true; error += 'Bitte geben Sie Ihren Titel ein.\n'; title.style.border="1px solid #f00"; title.focus(); }

					// firstname
				if(!trim(firstname.value)) { errors = true; error += 'Bitte geben Sie Ihren Vornamen ein.\n'; firstname.style.border="1px solid #f00"; firstname.focus(); }

					// name
				if(!trim(fname.value)) { errors = true; error += 'Bitte geben Sie Ihren Namen ein.\n'; fname.style.border="1px solid #f00"; fname.focus(); }

					// name
				if(!trim(company.value)) { errors = true; error += 'Bitte geben Sie die Firma ein, für die Sie arbeiten.\n'; company.style.border="1px solid #f00"; company.focus(); }

					// name
				if(!trim(address_1.value)) { errors = true; error += 'Bitte geben Sie Ihre postalische Adresse ein.\n'; address_1.style.border="1px solid #f00"; address_1.focus(); }

					// name
				if(!trim(address_4.value)) { errors = true; error += 'Bitte geben Sie Ihre Postleitzahl und Stadt ein.\n'; address_4.style.border="1px solid #f00"; address_4.focus(); }

					// country
				if(country.value==0) { errors = true; error += 'Bitte geben Sie Ihr Land ein.\n'; country.style.border="1px solid #f00"; country.focus(); }



				
				if(errors) {
					
						// Alert the errors
					alert(error);

					return false;
					
				} else {

						// Swap the activated tab
					document.getElementById('tab_1').className = '';
					document.getElementById('tab_2').className = '';
					document.getElementById('tab_3').className = '';

						// From here, going to two
					document.getElementById('tab_2').className = 'over';
					
						// Go to page 2
					ForceClick('tab_page_2');

				}
				
				break;



				// First screen
			case 'step_2_press':

					// title, firstname, name, company, address_1 and address_4 must be set
					// For press, validate country as well

				title				= document.subscription.title;
				firstname		= document.subscription.firstname;
				fname			= document.subscription.fname;
				company		= document.subscription.company;
				address_1		= document.subscription.address_1;
				address_4		= document.subscription.address_4;
				country			= document.subscription.country;
				email	 			= document.subscription.email;

					// Reset the borders
				title.style.border					="1px solid #000";
				firstname.style.border		="1px solid #000";
				fname.style.border				="1px solid #000";
				company.style.border		="1px solid #000";
				address_1.style.border		="1px solid #000";
				address_4.style.border		="1px solid #000";
				country.style.border			="1px solid #000";
				email.style.border			="1px solid #000";

					// title
				if(title.value==0) {errors = true; error += 'Bitte geben Sie Ihren Titel ein.\n'; title.style.border="1px solid #f00"; title.focus(); }

					// firstname
				if(!trim(firstname.value)) { errors = true; error += 'Bitte geben Sie Ihren Namen ein.\n'; firstname.style.border="1px solid #f00"; firstname.focus(); }

					// name
				if(!trim(fname.value)) { errors = true; error += 'Bitte geben Sie Ihren Vornamen ein.\n'; fname.style.border="1px solid #f00"; fname.focus(); }

					// name
				if(!trim(company.value)) { errors = true; error += 'Bitte geben Sie die Firma ein, für die Sie arbeiten.\n'; company.style.border="1px solid #f00"; company.focus(); }

					// name
				if(!trim(address_1.value)) { errors = true; error += 'Bitte geben Sie Ihre postalische Adresse ein.\n'; address_1.style.border="1px solid #f00"; address_1.focus(); }

					// name
				if(!trim(address_4.value)) { errors = true; error += 'Bitte geben Sie Ihre Postleitzahl und Stadt ein.\n'; address_4.style.border="1px solid #f00"; address_4.focus(); }

					// Country
				if(country.value==0) {errors = true; error += 'Bitte geben Sie Ihr Land ein.\n'; country.style.border="1px solid #f00"; country.focus(); }

					// Email
				if(!trim(email.value) || (!checkEmail(email.value))) { errors = true; error += 'Bitte bestätigen Sie Ihre E-Mail Adresse.\n'; email.style.border="1px solid #f00"; email.focus(); }



				
				if(errors) {
					
						// Alert the errors
					alert(error);

					return false;
					
				} else {

						// Swap the activated tab
					document.getElementById('tab_1').className = '';
					document.getElementById('tab_2').className = '';
					document.getElementById('tab_3').className = '';

						// From here, going to two
					document.getElementById('tab_2').className = 'over';
					
						// Go to page 2
					ForceClick('tab_page_2');

				}
				
				break;



				// First screen
			case 'step_3':

					// question_65, _66 && _67 must be set
					// If others is checked (last option) then question_##_other can not be empty

				question_65 = document.subscription.question_65;
				question_66 = document.subscription.question_66;
				question_67 = document.subscription.question_67;

				question_65_other = document.subscription.question_65_other;
				question_67_other = document.subscription.question_67_other;

					// Reset the borders
				question_65.style.border		="1px solid #000";
				question_66.style.border		="1px solid #000";
				question_67.style.border		="1px solid #000";

				question_65_other.style.border="1px solid #000";
				question_67_other.style.border="1px solid #000";

					// question_65
				if(question_65.value==0) {errors = true; error += 'Bitte beantworten Sie die erste Frage.\n'; question_65.style.border="1px solid #f00"; question_65.focus(); }

					// Question 26
				if(question_66.value==0) {errors = true; error += 'Bitte beantworten Sie die zweite Frage.\n'; question_66.style.border="1px solid #f00"; question_66.focus(); }

					// Question 27
				if(question_67.value==0) {errors = true; error += 'Bitte beantworten Sie die dritte Frage.\n'; question_67.style.border="1px solid #f00"; question_67.focus(); }

				// Bitte beantworten Sie die vierte Frage
				// Bitte beantworten Sie die fünfte Frage


					// Question 25 requires an additional answer, ensure the field is not empty
				if(question_65_other.style.display=='block') if(!trim(question_65_other.value)) { errors = true; error += 'Bitte geben Sie eine Antwort auf die erste Frage ein.\n'; question_65_other.style.border="1px solid #f00"; question_65_other.focus(); }

					// Question 27 requires an additional answer, ensure the field is not empty
				if(question_67_other.style.display=='block') if(!trim(question_67_other.value)) { errors = true; error += 'Bitte geben Sie eine Antwort auf die dritte Frage ein.\n'; question_67_other.style.border="1px solid #f00"; question_67_other.focus(); }

				// Bitte geben Sie eine Antwort auf die dritte Frage ein
				// Bitte geben Sie eine Frage auf die vierte Frage ein

				
				if(errors) {
					
						// Alert the errors
					alert(error);

					return false;
					
				} else {

						// Swap the activated tab
					document.getElementById('tab_1').className = '';
					document.getElementById('tab_2').className = '';
					document.getElementById('tab_3').className = '';

						// From here, going to two
					document.getElementById('tab_3').className = 'over';
					
						// Go to page 2
					ForceClick('tab_page_3');

				}
				
				break;



				// First screen
			case 'step_4':

					// country should be other than 0
				country	= document.subscription.country;

					// Reset the borders
				country.style.border		="1px solid #000";

					// Country
				if(country.value==0) {errors = true; error += 'Bitte geben Sie Ihr Land ein.\n'; country.style.border="1px solid #f00"; country.focus(); }
				
				if(errors) {
					
						// Alert the errors
					alert(error);

					return(false);
					
				} else {

						// Good to go, submit
					document.subscription.submit();

				}
				
				break;




		} // switch steps
		
	}





		/**
		 *
		 * swapSuppliersTabs :: swaps between the products and the ads of a supplier
		 *
		 */

	function swapSuppliersTabs(IdToDisplay) {

			// Hide all tabs
		if(document.getElementById('suppliers_products')) document.getElementById('suppliers_products').style.display='none';
		if(document.getElementById('suppliers_adverts')) document.getElementById('suppliers_adverts').style.display='none';
		
			// Show the one clicked
		document.getElementById(IdToDisplay).style.display='block';

			// Remove the css class
		if(document.getElementById('a_suppliers_products')) document.getElementById('a_suppliers_products').className = '';
		if(document.getElementById('a_suppliers_adverts')) document.getElementById('a_suppliers_adverts').className = '';

			// Attach it to the correct link
		if(document.getElementById('a_'+IdToDisplay)) document.getElementById('a_'+IdToDisplay).className = 'over';

		return;

	}





		/**
		 *
		 * Function show_SliAdditionalInformation : triggers the display or not of a div
		 * That contains additional information about the SLI service, when mouse over the sli button
		 *
		 */
	
	function show_SliAdditionalInformation(status) {

		var prefix = '';
		if(show_SliAdditionalInformation.arguments[1]) prefix = '_'+arguments[1];

		if(!document.getElementById('sliAdditionalInformation'+prefix)) return;
		
		someDiv = document.getElementById('sliAdditionalInformation'+prefix);

		if(status && someDiv.style.display!='block') someDiv.style.display='block';

		if(!status && someDiv.style.display=='block') someDiv.style.display='none';

		return;

	}





		/**
		 *
		 * Function that ensures that at least one of the checkboxes of the search is checked (either to perform a search in IndustrySelect OR in the local website) BUT one of them must always be checked
		 *
		 */
	
	function search_evalNonEmptySources () {

		checkedStatus = new Array();

			// Loop the forms
		for(i=0;i<document.forms.length;i++) {

				// Ensure we touch the right one
			if(document.forms[i].name == 'search') {

					// Take care of the boxes
				for(j=0;j<document.forms[i].elements.length;j++) {

						// Ensure we're touching the boxes
					if(document.forms[i].elements[j].type=='checkbox') {

						checkedStatus.push(document.forms[i].elements[j].checked);

					}

				} // Foreach elements

					// If both boxes are unchecked, check one of them
				if(checkedStatus[0]==false && checkedStatus[1]==false) document.forms[i].elements[0].checked=true;

					// Reset the array
				checkedStatus = new Array();

			} // If search

		} // Foreach forms

	} // search_evalNonEmptySources 





		/**
		 *
		 * Function that sets a url as home page, for both firefox and IE
		 *
		 */
	
	function setAsHomePage() {

			// IE
		if (document.all) {
			document.body.style.behavior="url(#default#homepage)";
			document.body.setHomePage("http://www.technische-revue.eu");
		} else if (window.sidebar) {
			// FF / Gecko
			if(window.netscape) {
				try {
					netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
				} catch(e) {
					alert("Please define the home page manually");
				}
			}
	
			var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
			prefs.setCharPref("browser.startup.homepage","http://www.technische-revue.eu");

		}

	}





		// Increment the amount of clicks on the website of a supplier (in the database)
	function incrmnt_www(supplier_id) {

		if(!supplier_id) return;

		make_ajax_request('fileadmin/php/incrmnt_www.php','supplier_uid='+supplier_id);
	}





		// Increment the amount of clicks on the details of a supplier (in the database)
	function incrmnt_open_details(supplier_id) {

		if(!supplier_id) return;

		make_ajax_request('fileadmin/php/incrmnt_open_details.php','supplier_uid='+supplier_id);
	}





		// Handle the ajax request to server
	function make_ajax_request(php_executor,settings) {
		var random = new Date();
		var req = null; 
		if (window.XMLHttpRequest) { 
			req = new XMLHttpRequest();
			if (req.overrideMimeType) {req.overrideMimeType('text/xml');}
		} else if (window.ActiveXObject) {
			try { req = new ActiveXObject("Msxml2.XMLHTTP"); }
			catch (e) {
				try { req = new ActiveXObject("Microsoft.XMLHTTP"); }
				catch (e) {}
			}
		}

		req.onreadystatechange = function() { if(req.readyState == 4) { return(req.responseText); } }; 

		req.open("GET",php_executor+"?"+settings+'&random='+random.getTime(),true);
		req.send(null);

	}
	
	
	
	sfHover = function() {
		var sfEls = document.getElementById("nav").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		} // for
		
		if(document.getElementById('nav_select_left')) {
			var sfEls = document.getElementById("nav_select_left").getElementsByTagName("LI");
			for (var i=0; i<sfEls.length; i++) {
				sfEls[i].onmouseover=function() {
					this.className+=" sfhover";
				}
				sfEls[i].onmouseout=function() {
					this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
				}
			} // for			
		} // if id found
		
		if(document.getElementById('nav_select_right')) {
			var sfEls = document.getElementById("nav_select_right").getElementsByTagName("LI");
			for (var i=0; i<sfEls.length; i++) {
				sfEls[i].onmouseover=function() {
					this.className+=" sfhover";
				}
				sfEls[i].onmouseout=function() {
					this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
				}
			} // for			
		} // if id found		
		
	} // funcition
	
	if (window.attachEvent) window.attachEvent("onload", sfHover);
	

