function loadReg() {
	top.window.name="Tiscali";
	var url = "http://www.tiscali.co.uk/products/";
	var win = window.open(url,"regkiosk","width=740,height=600,toolbar=1,status=0,scrollbars=1,resizable=1,top=25,left=25")
}

function checkAutoLogin()
{
 var currL1U=getCookie("L1U");
 var currL1P=getCookie("L1P");

 if(currL1U!="0" && currL1P!="0")
 {
   document.forms[0].save.checked = true;
 }
}

function LoginCheckForm(){
  var l1u=document.forms[0].elements[0].value;
  var l1p=document.forms[0].elements[1].value;
  if(l1u=="" || l1p==""){
    alert("Please fill in both your username and password");
    return false;
  }
  return true;
}  

// Get value from query string passed to this html page.
// eg. for index.html?querytext=hello return hello when called
// with querytext.
function getValueFromUrl(key) {
	var url = "" + document.location;
	var index = url.lastIndexOf("?");
	var res = "";
	var escres = "";
	var i = 0;

	if(index != -1) {
		var qs = url.substring(index+1);
		var lookFor = key+"=";
		index = qs.indexOf(lookFor);
		if(index != -1) {
			index += lookFor.length;
			var index2 = qs.indexOf("&",index);
			if(index2 != -1) {
				res = qs.substring(index,index2);
			} else {
				res = qs.substring(index);
			}
		}
	}	

	// Pluses need to be spaces
	for(i = 0;i < res.length;i++) {
		escres += (res.charAt(i) == '+') ? ' ' : res.charAt(i);
	}
	escres = unescape(escres);

	return escres;
}

function checkForm() {
	var fm = document.loginform;
	var email = ""+fm.email.value;
	if(!email.match(/\@/)) {
                if(email.match(/\*/)) {
                  alert('You cannot use * anymore in your email address, you should change this to an @ sign.');
                } else {
		  alert('Please enter your full email address.');
                }
		return false;
	}
	var url = getValueFromUrl("url");
	//if(email.match(/tiscali\.co\.uk|worldonline\.co\.uk$/) && url.match("/commscentre/email")) {
	//	var win = window.open("/commscentre/email/login_wol.html","_self");
	//	return false;
	//}
	var url = getValueFromUrl("url");
	if(url != "") {
		fm.url.value = url;
	}
	return true;
}

var htmlmsg = "";
function checkaddress(fm) {
  // Allow Homechoice users to log in.
  if(fm.email.value.match(/^(.*)@homechoice\.co\.uk/)) {
    var username = RegExp.$1;
    var hc = document.getElementById('homechoicewebmail');
    if(hc) {
      hc.user.value = username;
      hc.pass.value = fm.password.value;
      hc.submit();
      return false;
    }
  }

  var deftext = "verifying...";

  if(document.all) {
  document.all['message'].innerHTML = deftext;
  } else if (document.getElementById('message')) {
      document.getElementById('message').innerHTML = deftext;
  }
  var email = fm.email.value;
  // Remove spaces.
  email = email.replace(/\s*/g,"");
  //email = email.replace(/(tisclai|ticsali|tisacli|tiscila|tiscalk)\.co\.uk$/i,"tiscali.co.uk");

  if(email != "") {
    if(!email.match(/\@(tiscali\.co\.uk|tiscalitest\.co\.uk|lineone\.net|tinyworld\.co\.uk|tinyonline\.co\.uk|worldonline\.co\.uk|screaming\.net|ukgateway\.net|handbag\.com)$/)) {
      email = email.replace(/\@t.*/i, "@tiscali.co.uk");
      email = email.replace(/\@l.*/i, "@lineone.net");
    }
  }
  fm.email.value = email;

  var msg = '';
  if (fm.password.value == "") {
  msg = 'Please enter your password';
  } else if(email.match(/^[^\@]+\@[^\.]+\.worldonline\.co\.uk$/i)) {
    // World online address.
    msg = 'If the format of your email address used to be <FONT color=red><B>user@username.worldonline.co.uk</B></FONT> then you must now use the format <FONT color=green><B>username@worldonline.co.uk</B></FONT> to access your emails. Don\'t worry, you will still automatically receive emails sent to the old format address.<P> If you need more help, customer support staff are available on <B>0906 300 6633</B> <P>* calls charged at 50p per minute';
  } else if(email.match(/^[^\@]+\@[^\.]+\.screaming\.net$/)) {
    msg = 'If the format of your email address used to be <FONT color=red><B>user@username.screaming.net</B></FONT> then you must now use the format <FONT color=green><B>username@screaming.net</B></FONT> to access your emails. Don\'t worry, you will still automatically receive emails sent to the old format address.<P> If you need more help, customer support staff are available on <B>0906 300 6633</B> <P>* calls charged at 50p per minute';
  } else if(email.match(/\*(tinyonline\.co\.uk)$/)) {
  msg = 'If the format of your email address used to be <FONT color=red><B>yourname*tinyonline.co.uk</B></FONT> then you must now use the format <FONT color=green><B>yourname@tinyonline.co.uk</B></FONT> to access your emails. Don\'t worry, you will still automatically receive emails sent to the old format address.<P> If you need more help, customer support staff are available on <B>0906 300 6633</B> <P>* calls charged at 50p per minute.';
  } else if(!email.match(/\@(lineone\.net|worldonline\.co\.uk|tiscali\.co\.uk|tiscalitest\.co\.uk|tinyworld\.co\.uk|tinyonline\.co\.uk|screaming\.net|ukgateway\.net|handbag\.com)$/i)) {
    msg = '<div style="background:#FF9706; width:312px; height:60px; padding:4px"><span style="color: #fff;"><b>Remember that your email address has to be in the correct format e.g. username@tiscali.co.uk .</b></span></div>';
  }
  htmlmsg = '<font color="red">'+msg+'</font>';
  if(msg) {
    if(document.all) {
      setTimeout("ZG5_showmsg()",500);
    } else if(document.getElementById) {
      setTimeout("ZG5_showmsg()",500);
    } else {
      alert(msg);
    }
    return false;
  } else {
    return true;
  }
}

function ZG5_showmsg(msg) {
  if(document.all) {
    document.all['message'].innerHTML = htmlmsg;
  } else if(document.getElementById) {
    document.getElementById('message').innerHTML = htmlmsg;
  }
}

function inputbox_size(the_size) {
        document.write('<input type="text" name="query_text" size='+the_size+' />');}

function user(num) {
document.write('<input name="User" size=' + num + ' value="" /><br />');
}
function pass(num) {
document.write('<input name="Password" type="password" size=' + num + ' value=""><br />');
}
var nav = navigator.appName == "Netscape";