/* ====================================================================== * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED.  IN NO EVENT SHALL THE PRODUCER OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE.THE PRODUCER:Andreas ImhofEDV-DienstleistungenCH-Guemligen, Switzerlandwww.aiedv.chCREATED: 2006Version: 1.1Version date: 20090412======================================================================*/// the variable 'cur_lang_ID' to identify the current browser language as an integer is set by 'get-language.js'var numloginlanguages = 3;	// currently en and de only						// [0] = en						// [1] = de						// [2] = fr						// [3] = it						// ....var numloginlanguage_strings = 10;	// predefine 120 strings in numloginlanguages languages: [numloginlanguage_strings][numloginlanguages]var login_lang_arr = new Array(numloginlanguage_strings);for (var idx = 0; idx < numloginlanguage_strings; idx++) {	// the index pointer records already inserted into res_arr	login_lang_arr[idx] = new Array(numloginlanguages);}// predefine the language dependant stringslogin_lang_arr[0][0] = "The Password and retyped password must be identical!";login_lang_arr[0][1] = "Das Passwort und die Passwort-Best\u00e4tigung m\u00fcssen identisch sein!";login_lang_arr[0][2] = "The Password and retyped password must be identical!";login_lang_arr[1][0] = "The Password must contain at least 5 characters!";login_lang_arr[1][1] = "Das Passwort wuss aus mindestens 5 Zeichen bestehen!";login_lang_arr[1][2] = "The Password must contain at least 5 characters!";login_lang_arr[2][0] = "You should set the preferences of your browser to allow Cookies! This enables the Download Center to do a direct 'Sign in' without always asking for an account before letting you in!";login_lang_arr[2][1] = "Sie sollten die Einstellungen Ihres Browser so \u00e4ndern, dass Cookies f\u00fcr diese Seite erlaubt sind! Dies w\u00fcrde es dem Download Center erlauben, Sie ohne weitere Anmeldungen einzulassen!";login_lang_arr[2][2] = "You should set the preferences of your browser to allow Cookies! This enables the Download Center to do a direct 'Sign in' without always asking for an account before letting you in!";function checkCookies() {	var cookiesAllowed = navigator.cookieEnabled;	if (cookiesAllowed == true) return;	// show message to allow cookies	alert(login_lang_arr[2][cur_lang_ID]);	return;}var red = "#FFD8D8";var white = "#FFFFFF";function do_user_action(what,the_productcode) {	if (what == 0) {		return(true);	}	var request = "";	switch (what) {		case 1: // display product info before downloading			request += "download.aspx";		case 2: // download or get download info mail			if (what == 2) request += "download.aspx";			if (the_productcode != null) document.getElementById("productcode").value = the_productcode;			document.getElementById("requesttype").value = "" + what;	// the aspx what to do with this product code			document.send_form.action = request;			document.send_form.target = "_self";			// returned new document			document.send_form.submit();			break;		case 3: // buy now			var orderwin = window.open("","Secure_Order");			request += "orderform/orderform_ssl.aspx";			document.send_form.action = request;			document.send_form.target = "Secure_Order";			// returned new document			document.send_form.submit();			break;		case 9: //login			request += "download.aspx?a=login";			document.send_form.action = request;			document.send_form.target = "_self";			// returned new document			document.send_form.submit();			break;	}	return(false);}/** * login into the downloads center *  * what: 0 = direct login with email and password *       1 = create new account */function do_user_login(what) {	var request = "download.aspx";	// choose the asp to call	switch (what) {		case 1: // direct login			document.getElementById("loginstate").value = "1";			document.getElementById("loginemail").value = document.getElementById("loginname").value;			document.send_form.action = request;			document.send_form.target = "_self";			document.send_form.submit();			return(false);		case 30: // forgotten password: send email			document.getElementById("loginstate").value = "30";			document.send_form.action = request + "?a=login";			document.send_form.target = "_self";			document.send_form.submit();			return(false);		case 20: // create new account			// are both passwords identical?			if (document.getElementById("pwd").value.length < 5) {				alert(login_lang_arr[1][cur_lang_ID]);				document.getElementById("pwd").value = document.getElementById("pwdretyped").value = "";				document.getElementById("pwd").focus;				return(false);			}			// are both passwords identical?			if (document.getElementById("pwd").value != document.getElementById("pwdretyped").value) {				document.getElementById("pwd").style.backgroundColor = red;				document.getElementById("pwdretyped").style.backgroundColor = red;				alert(login_lang_arr[0][cur_lang_ID]);				document.getElementById("pwd").value = document.getElementById("pwdretyped").value = "";				document.getElementById("pwd").focus;				return(false);			}				document.getElementById("loginstate").value = "20";			document.send_form.action = request + "?a=login";			document.send_form.target = "_self";			document.send_form.submit();			return(true);		case 3: // clear the new account formform			document.send_form.reset();			check_userFormData(true);			break;	}	return(false);}function check_userFormData(set_Button_States) {	// make some basic checks													// if form data is complete	var form_is_incomplete = true;	do {		if ( (document.getElementById("firstname").value == "")			|| (document.getElementById("name").value == "")//			|| (document.getElementById("companyname").value == "")//			|| (document.getElementById("address").value == "")			|| (document.getElementById("email").value == "")//			|| (document.getElementById("zip").value == "")//			|| (document.getElementById("town").value == "")			|| (document.getElementById("country").value == "")			|| (document.getElementById("pwd").value == "")			|| (document.getElementById("pwdretyped").value == "")			) {			if (document.getElementById("firstname").value == "") document.getElementById("firstname").style.backgroundColor = red;			else  document.getElementById("firstname").style.backgroundColor = white;			if (document.getElementById("name").value == "") document.getElementById("name").style.backgroundColor = red;			else  document.getElementById("name").style.backgroundColor = white;//			if (document.getElementById("companyname").value == "") document.getElementById("companyname").style.backgroundColor = red;//			else  document.getElementById("companyname").style.backgroundColor = white;//			if (document.getElementById("address").value == "") document.getElementById("address").style.backgroundColor = red;//			else  document.getElementById("address").style.backgroundColor = white;//			if (document.getElementById("zip").value == "") document.getElementById("zip").style.backgroundColor = red;//			else  document.getElementById("zip").style.backgroundColor = white;//			if (document.getElementById("town").value == "") document.getElementById("town").style.backgroundColor = red;//			else  document.getElementById("town").style.backgroundColor = white;			if (document.getElementById("country").value == "") {				document.getElementById("countryChooser").style.backgroundColor = red;			}			else {				document.getElementById("countryChooser").style.backgroundColor = white;			}			if (document.getElementById("email").value == "") document.getElementById("email").style.backgroundColor = red;			else  document.getElementById("email").style.backgroundColor = white;			try {				if (document.getElementById("pwd").value == "") document.getElementById("pwd").style.backgroundColor = red;				else  document.getElementById("pwd").style.backgroundColor = white;				if (document.getElementById("pwdretyped").value == "") document.getElementById("pwdretyped").style.backgroundColor = red;				else  document.getElementById("pwdretyped").style.backgroundColor = white;			}			catch (exception) {}			break;		}		// is given email ok?		var isvalidmail = validateEmailAddress(document.getElementById("email").value);		if (isvalidmail == false) {			document.getElementById("email").style.backgroundColor = red;			break;		}				// all required fields are filled in		document.getElementById("firstname").style.backgroundColor = white;		document.getElementById("name").style.backgroundColor = white;		document.getElementById("companyname").style.backgroundColor = white;		document.getElementById("address").style.backgroundColor = white;		document.getElementById("email").style.backgroundColor = white;		document.getElementById("zip").style.backgroundColor = white;		document.getElementById("town").style.backgroundColor = white;		document.getElementById("countryChooser").style.backgroundColor = white;		document.getElementById("pwd").style.backgroundColor = white;		document.getElementById("pwdretyped").style.backgroundColor = white;		form_is_incomplete = false;	} while(false);		if (set_Button_States) {		try {			document.getElementById("send_accountdata").disabled = form_is_incomplete;			if (form_is_incomplete) {				document.getElementById("send_accountdata").className = 'btn_off';			}			else {				document.getElementById("send_accountdata").className = 'btn_light';			}		}		catch (exception) {}	}	return(form_is_incomplete);}/************************************************* * check if valid email address */function emailcheck(str) {	var at="@";	var dot=".";	var lat=str.indexOf(at);	var lstr=str.length;	var ldot=str.indexOf(dot);		if (lstr < 5) return false;	if ( (str.indexOf(",") >= 0) || (str.indexOf(";") >= 0) || (str.indexOf(":") >= 0) || (str.indexOf("!") >= 0) || (str.indexOf("?") >= 0)  || (str.indexOf(" ") >= 0) 		|| (str.indexOf("=") >= 0) || (str.indexOf("/") >= 0) || (str.indexOf("\\") >= 0) || (str.indexOf("*") >= 0) || (str.indexOf("<") >= 0) || (str.indexOf(">") >= 0) 		) return false;	if (str.indexOf(at)<=0) return false;	if (str.indexOf(at)==lstr) return false;	if ((str.indexOf(dot)<3) || (str.indexOf(dot)==lstr-1) || (str.indexOf(dot)==lstr-2)) return false;	if (str.indexOf(at,(lat+1))!=-1)  return false;	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) return false;	if (str.indexOf(dot,(lat+2))==-1) return false;	return true;}function check_directLoginFormData(set_Button_States) {	// make some basic checks													// if form data is complete	var form_is_incomplete = true;	do {		var loginname_is_empty = false;		// the fields 'name' and 'user' may never be empty!		if ( (document.getElementById("loginname").value == "")			|| (document.getElementById("loginpassword").value == "")			) {			var emailok = validateEmailAddress(document.getElementById("loginname").value);			if (emailok == false) {				loginname_is_empty = true;				document.getElementById("loginname").style.backgroundColor = red;			}			else  document.getElementById("loginname").style.backgroundColor = white;			if (document.getElementById("loginpassword").value == "") document.getElementById("loginpassword").style.backgroundColor = red;			else  document.getElementById("loginpassword").style.backgroundColor = white;			break;		}		// all required fields are filled in		document.getElementById("loginname").style.backgroundColor = white;		document.getElementById("loginpassword").style.backgroundColor = white;		form_is_incomplete = false;	} while(false);		if (set_Button_States) {		document.getElementById("directloginBtn").disabled = form_is_incomplete;		if (form_is_incomplete == true) {			document.getElementById("directloginBtn").className = 'btn_off';		}		else {			document.getElementById("directloginBtn").className = 'btn_light';		}				document.getElementById("forgottenpasswordBtn").disabled = loginname_is_empty;		if (loginname_is_empty == true) document.getElementById("forgottenpasswordBtn").className = 'btn_off';		else document.getElementById("forgottenpasswordBtn").className = 'btn_light';	}	return(form_is_incomplete);}/** * check if an email address has correct syntax */function validateEmailAddress(email) {	if (email == "") {	// email address is empty		return false;	}	if (email.length < 5) return false;	if ( (email.indexOf(",") >= 0) || (email.indexOf(";") >= 0) || (email.indexOf(":") >= 0) || (email.indexOf("!") >= 0) || (email.indexOf("?") >= 0)  || (email.indexOf(" ") >= 0) 		|| (email.indexOf("=") >= 0) || (email.indexOf("/") >= 0) || (email.indexOf("\\") >= 0) || (email.indexOf("*") >= 0) || (email.indexOf("<") >= 0) || (email.indexOf(">") >= 0) 		) return false;	var atPos = email.indexOf('@',0);	if (atPos == -1) {	// email address must contain '@'		return false;	}	if (atPos == 0) {	// email address may not start with '@'		return false;	}	if (email.indexOf('@', atPos + 1) > - 1) {	// only one '@' allowed		return false;	}		// check for period	if (email.indexOf('.', atPos) == -1) {	// must contain a period in the domain name		return false;	}	if (email.indexOf('@.',0) != -1) {	// period must not immediately follow @		return false;	}	if (email.indexOf('.@',0) != -1) {	// period must not immediately precede @		return false;	}	if (email.indexOf('..',0) != -1) {	// two following periods not allowed	   return false;	}		// check for at least 2 chars in primary domain part	var suffix = email.substring(email.lastIndexOf('.')+1);	if (suffix.length < 2) {	   return false;	}		// check for invalid characters. allow foreign characters like umlaut	var invalChars = '\/\'\\ ";:?!()[]\{\}^|';	for (i = 0; i < invalChars.length; i++) {	   if (email.indexOf(invalChars.charAt(i),0) > -1) {		  return false;	   }	}	return true;}var dataflowmove = 15;	    // move x pixels each stepvar dataflowinterval = 1;	// move this fast in msvar hidepos = -10000;var startpos = -100;var stoppos = 250;var nextpos = hidepos;function show_dataflow() {	if (nextpos == hidepos) nextpos = startpos;	nextpos += dataflowmove;	if (nextpos < stoppos) {		document.getElementById("dataflow").style.left = nextpos + "px";		window.setTimeout("show_dataflow()", dataflowinterval);	} else {	// hide it again		nextpos = hidepos;		document.getElementById("dataflow").style.left = hidepos + "px";	}}