var checkAjax;

function trim(str){  //delete blank of string of two terminals
	return str.replace(/(^\s*)|(\s*$)/g, "");   
}

/*---login---*/
function KeyDown(e){
	if(window.event){
		keynum = e.keyCode;
	}else if(e.which){
		keynum = e.keyCode;
	}

	if(keynum==13){
		document.frm1.action = '/en/user/login_do.php';
		document.frm1.submit();
	}
}

function Login_Tina(){
	document.frm1.action = '/en/user/login_do.php';
	document.frm1.submit();
}

function KeyDownNewReg(e){
	if(window.event){
		keynum = e.keyCode;
	}else if(e.which){
		keynum = e.keyCode;
	}

	if(keynum==13){
		document.frm2.action = '/en/user/login_do.php';
		document.frm2.submit();
	}
}

function LoginNewReg(){
	document.frm2.action = '/en/user/login_NEW.php';
	document.frm2.submit();
}

/*---show country---*/
function countryCode(){
	var man = document.getElementById("man").value;
	var countryCode = document.getElementById("dlCountryGuoJi").value;
	var countryName = document.getElementById("dlCountryGuoJi").options[document.getElementById("dlCountryGuoJi").selectedIndex].text;
	//alert(countryName+countryCode);
	if(countryCode!=''){
		document.getElementById("HtxtCountryCode").value = countryCode;	
		document.getElementById("countryName").value = countryName;	
		var code = document.getElementById("HtxtCountryCode").value;
		//if(countryName == 'United States' && man == 'blackberry'){
			//document.getElementById("operators").innerHTML = '<select name="operator"  id="operator" style="FONT-SIZE:12px;COLOR:#666666;FONT-FAMILY:Arial; width:180px;"><option value="0">Please select</option><option value="4">United States – AT&T </option><option value="5">United States – T-Mobile</option><option value="1">United States – Verizon Wireless</option><option value="2">United States – Sprint</option><option value="3">United States – Other </option></select>';
			//document.getElementById("operators").style.display = 'block';	
		//}else if(man == 'blackberry'){			
			//document.getElementById("operators").innerHTML = '<select name="operator"  id="operator" style="FONT-SIZE:12px;COLOR:#666666;FONT-FAMILY:Arial; width:180px;"><option value="0">Please select</option><option value="3">GSM</option><option value="1">CDMA</option></select>';
		//}else{
			//document.getElementById("operators").innerHTML = '';
			//document.getElementById("operators").style.display = 'none';	
		//}
	}else{
		document.getElementById("HtxtCountryCode").value = '';	
	}
	if(countryName=='United Kingdom')
		document.getElementById("txtPhone2").value='7';
	else document.getElementById("txtPhone2").value='';
		numDis();				
}
function numDis(){
	var code = document.getElementById("HtxtCountryCode").value;
	document.getElementById("txtPhone1").value=code;
}

function changeOperator(method){
	document.getElementById("operatorAlertPC").innerHTML = '';
	var operator = document.getElementById("operator_"+method).value;
	var operatorName = document.getElementById("operator_"+method).options[document.getElementById("operator_"+method).selectedIndex].text;
	//alert(operator);
	if(operator == '1' || operator == '2'){
		document.getElementById("CDMAoperators_"+method).style.display = 'block';
	}else{
		document.getElementById("CDMAoperators_"+method).style.display = 'none';
		document.getElementById("pcDownloadLink").style.display = 'none';
		document.getElementById("pcDownloadButton").style.display = 'block';
	}
}

function changeNetwork(method){
	document.getElementById("operatorAlertPC").innerHTML = '';
	/*var dualMode = document.getElementById("dualMode_"+method).value;
	if(method == 'pc' && dualMode =='3'){
		document.getElementById("pcDownloadButton").style.display = 'none';
		document.getElementById("pcDownloadLink").style.display = 'block';
	}else{
		document.getElementById("pcDownloadButton").style.display = 'block';
		document.getElementById("pcDownloadLink").style.display = 'none';
	}*/
}

/*---show flash---*/
function insertFlash(elm, url, w, h) {
    if (!document.getElementById(elm))
       return;

    var str = '';
    str += '<object width="'+ w +'" height="'+ h;
    str += '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
    str += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0">';
    str += '<param name="movie" value="'+ url +'">';
    str += '<param name="wmode" value="transparent">';
    str += '<param name="quality" value="autohigh">';
    str += '<embed width="'+ w +'" height="'+ h +'" src="';
    str += url +'" quality="autohigh" wmode="opaque"';
    str += ' type="application/x-shockwave-flash"';
    str += ' plugspace="http://www.macromedia.com/shockwave/download/';
    str += 'index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>';
    str += '</object>';

    document.getElementById(elm).innerHTML = str;
}

/*---show hide layer---*/
function MM_findObj(n, d) { //v4.01
  var p,i,x;
  if(!d)
     d=document;

  if((p=n.indexOf("?"))>0&&parent.frames.length) {
  	  d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
  }

  if(!(x=d[n])&&d.all)
     x=d.all[n];

  for (i=0;!x&&i<d.forms.length;i++)
     x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++)
     x=MM_findObj(n,d.layers[i].document);

  if(!x && d.getElementById)
     x=d.getElementById(n);

  return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments;

  document.MM_sr=new Array;

  for(i=0;i<(a.length-2);i+=3)
   	if ((x=MM_findObj(a[i]))!=null){
   	   document.MM_sr[j++]=x;
   	   if(!x.oSrc)
   	      x.oSrc=x.src; x.src=a[i+2];
      }
}

function MM_showHideLayers() { //v6.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
	}
function setSelectState(state){
	var objl=document.getElementsByTagName('select');
	for(var i=0;i<objl.length;i++){
		objl[i].style.visibility=state;
	}
}

/*---Pop up window---*/
var isIe=(document.all)?true:false;
function showMessage(id,msg,posx,posy,width,height,bordercolor,titlebgcolor,bgcolor) {
	if(isIe){
		setSelectState('hidden');
	}
	//alert(msg);
	var bWidth=parseInt(document.documentElement.clientWidth);
	var bHeight=parseInt(document.documentElement.clientHeight);
	//alert(bHeight+"--"+bWidth);
	var showWidth = (bWidth-width)/2;
	var showHeight = (bHeight-height)/2;
	//var mpx=0,mpy=0;
	var winWidth = document.body.scrollWidth;
	var winHeight = document.body.scrollHeight;
	//alert(winWidth+"=="+winHeight);
	
	$(id).onclick=function () { return; };
	var msgObj=document.createElement("div");
	msgObj.style.cssText  = "position:absolute;font-size:11px;font-family: Tahoma,Arial,Helvetica,Sans-serif,Arab;top:"+showHeight+"px;left:"+showWidth+"px;width:"+width+"px;height:"+height+"px;padding:0px 2px;border:2px solid "+bordercolor+";background-color:"+bgcolor+";padding:1px;line-height:22px;z-index:102;filter:Alpha(Opacity=90);opacity:0.9;";
	document.body.appendChild(msgObj);
	var closeBtn=document.createElement("div");
	msgObj.appendChild(closeBtn)
	closeBtn.style.cssText = "float:right;cursor:pointer; line-height:10px; background-color:" + titlebgcolor;
	closeBtn.innerHTML = "<span style='font-size:10pt; font-weight:bold; color:"+bordercolor+";'>×</span>";
	closeBtn.onclick = function(){ 
		document.body.removeChild(msgObj);
		if(document.getElementById('bgwindow_flash')!=null){
			document.getElementById('bgwindow_flash').parentNode.removeChild(document.getElementById('bgwindow_flash'));
		}
		if(isIe){
			setSelectState('');
		}
//		$(id).onblur=checkwaysphone;
	}
	var msgContent=document.createElement("div");
	msgContent.id='messageObj';
	msgObj.appendChild(msgContent);
	msgContent.className = "ways_style9";
	msgContent.innerHTML = msg;
	
	var okBtn=document.createElement("div");
	msgObj.appendChild(okBtn);
	okBtn.style.cssText = "margin-bottom:10px; cursor:pointer; line-height:30px; background-color:" + titlebgcolor;
	okBtn.innerHTML = '<table border="0" width="400" height="45"><tr><td align="center"><img src="../../images/ways/ok.gif">&nbsp;</td></tr></table>';
	okBtn.onclick = function(){ 
		document.body.removeChild(msgObj);
		if(document.getElementById('bgwindow_flash')!=null){
			document.getElementById('bgwindow_flash').parentNode.removeChild(document.getElementById('bgwindow_flash'));
		}
		if(isIe){
			setSelectState('');
		}
	}
	
	
	var backWidth=parseInt(document.documentElement.scrollWidth);
	var backHeight=parseInt(document.documentElement.scrollHeight);
	var back=document.createElement("div");
	back.id="bgwindow_flash";
	var styleStr="top:0px;left:0px;position:absolute;background:#000;width:"+backWidth+"px;height:"+backHeight+"px;";
	styleStr+=(isIe)?"filter:alpha(opacity=0);":"opacity:0;";
	back.style.cssText=styleStr;
	document.body.appendChild(back);
	showBackground(back,60);
}

function showBackground(obj,endInt){
	if(isIe){
		obj.filters.alpha.opacity+=endInt/10;
		if(obj.filters.alpha.opacity<endInt){
		setTimeout(function(){showBackground(obj,endInt)},5);
	}
	}else{
		var al=parseFloat(obj.style.opacity);al+=endInt/1000;
		obj.style.opacity=al;
		if(al<(endInt/100)){
			setTimeout(function(){showBackground(obj,endInt)},5);
		}
	}
}


function mouseMove(ev){
	ev=ev||window.event;
	var mousePos = mouseCoords(ev); 
	mpx=mousePos.x+6;
	mpy=mousePos.y+6;
}

function mouseCoords(ev){
	if(ev.pageX||ev.pageY){return {x:ev.pageX, y:ev.pageY};}
	return {x:ev.clientX + document.documentElement.scrollLeft,y:ev.clientY + document.documentElement.scrollTop}
}
//document.onmousemove=mouseMove;

function showBackground(obj,endInt){
	if(isIe){
		obj.filters.alpha.opacity+=1;
		if(obj.filters.alpha.opacity<endInt){
		setTimeout(function(){showBackground(obj,endInt)},5);
	}
	}else{
		var al=parseFloat(obj.style.opacity);al+=0.01;
		obj.style.opacity=al;
		if(al<(endInt/100)){
			setTimeout(function(){showBackground(obj,endInt)},5);
		}
	}
}


/*--- show the check result ---*/
function showCheck(objId, type){
	if($('check_'+objId)!=null){
		$(objId).removeChild($('check_'+objId));
	}
	var imgObj = document.createElement('img');
	imgObj.id='check_'+objId;
	var parObj = $(objId).parentNode;
	parObj.style.paddingLeft='5px';
	parObj.style.paddingTop='5px';
	if(type==1){
		imgName =  'alert.gif';
	}else {
		imgName =  'right.gif';
	}
	imgObj.src='../images/ways/'+imgName;
	$(objId).appendChild(imgObj);
}

/*---check firstname---*/
function checkfirstname(){
	var firstName = trim(document.getElementById("txtFirstName").value);
	if(firstName==''){
		MM_showHideLayers('firstname','','show')
		document.getElementById("firstname").innerHTML = 'Please enter your first name.';
		document.getElementById("firstname").style.visibility = 'visible';
		document.getElementById("firstname").style.height = '20px';
		document.getElementById("firstname").style.display = 'block';
		showCheck('firstnameright', 1);
		state = '1';
	}else{
		MM_showHideLayers('firstname','','hide');
		//document.getElementById("firstname").style.height = '5px';
		document.getElementById("firstname").style.display = 'none';
		showCheck('firstnameright', 0);
	}
}



/*---check lasttname---*/
function checklastname(){
	var lastName = trim(document.getElementById("txtLastName").value);
	if(lastName==''){
		MM_showHideLayers('lastname','','show')
		document.getElementById("lastname").innerHTML = 'Please enter your last name.';
		document.getElementById("lastname").style.height = '20px';
		document.getElementById("lastname").style.display = '';
		showCheck('lastnameright', 1);
		state = '2';
	}else{
		MM_showHideLayers('lastname','','hide');
		//document.getElementById("lastname").style.height = '5px';
		document.getElementById("lastname").style.display = 'none';
		showCheck('lastnameright', 0);
	}
}




/*---check Promotion---*/
function checkmotc(){
	if(document.frm.moTC.checked == false){
			MM_showHideLayers('idMoTC','','show');
			document.getElementById("idMoTC").style.display = '';
			document.getElementById("idMoTC").innerHTML = 'Please read and agree to the Terms and Conditions.';
			document.getElementById("idMoTC").style.textIndent = 0;
			showCheck('moTCright', 1);
			state = '19';
	}else{
		MM_showHideLayers('idMoTC','','hide');
		document.getElementById("idMoTC").style.display = 'none';
		showCheck('moTCright', 0);
	}
}


/*---check username---*/
function checkusername(){
	var re = /^[a-zA-Z]{1}([a-zA-Z0-9]|[._]){5,11}$/;
	if((!re.test(document.getElementById("txtUserName").value)) ||(!document.getElementById("txtUserName").value)){
		MM_showHideLayers('username','','show');
		document.getElementById("username").innerHTML = 'Your username must be between 6 and 12 characters. Your username cannot contain spaces or any special characters. And only begin with characters.';
		document.getElementById("username").style.display = '';
		document.getElementById("username").style.height = '80px';
		showCheck('usernameright', 1);
		state = '4';
	}else{
		ajaxFunction('regusername');
	}
}


/*---check password---*/
function checkpassword(){
	var rd = /^([a-zA-Z0-9]|[._]){5,12}$/;
	if(document.getElementById("txtPwd").value!=''){
		if((!rd.test(document.getElementById('txtPwd').value))){
			MM_showHideLayers('password','','show');
			document.getElementById("password").innerHTML = 'Your password must be between 6 and 12 characters. Your password cannot contain spaces or any special characters.';
			document.getElementById("password").style.display = '';
			document.getElementById("password").style.height = '60px';
			showCheck('passwordright', 1);
			state = '6';
		}else{
			MM_showHideLayers('password','','hide');
			document.getElementById("password").style.display = 'none';
			//document.getElementById("password").style.height = '5px';
			showCheck('passwordright', 0);
		}
	}else{
		//window.document.frm.txtPwd.focus();
		MM_showHideLayers('password','','show');
		document.getElementById("password").style.display = '';
		document.getElementById("password").style.height = '20px';
		document.getElementById("password").innerHTML = 'Please enter your password.';
		showCheck('passwordright', 1);
	}
}


/*---check email---*/
function checkemail(){
	var email = document.getElementById("txtEmail").value;
	if(email != ""){
			if(!/(\S)+[@]{1}(\S)+[.]{1}(\w)+/.test(email)){
				MM_showHideLayers('email','','show');
				document.getElementById("email").style.display = '';
				document.getElementById("email").style.height = '20px';
				document.getElementById("email").innerHTML = 'Please enter a valid e-mail address.';
				showCheck('emailright', 1);
				state = '13';
			}else{
				MM_showHideLayers('email','','hide');
				document.getElementById("email").style.display = 'none';
				//document.getElementById("email").style.height = '5px';
				showCheck('emailright', 0);
			}
		}else{
			//window.document.frm.txtEmail.focus();
			MM_showHideLayers('email','','show');
			document.getElementById("email").style.display = '';
			document.getElementById("email").style.height = '20px';
			document.getElementById("email").innerHTML = 'Please enter your e-mail address.';
			showCheck('emailright', 1);
			state = '14';
	}
}


/*---check regvalidate---*/
function checkvalidate(){
	if(document.frm.txtValidate.value ==""){
		MM_showHideLayers('validate','','show');
		document.getElementById("validate").style.display = '';
		document.getElementById("validate").innerHTML = 'Please enter the 6-digit verification code.';
		document.getElementById("validate").style.height = '20px';
		showCheck('validateright', 1);
	}else{
		var cookie = document.frm.txtValidate.value;
     	var serverPage = 'ajax_verycodecheck.php?value=' + cookie;

     	xmlhttp.open("GET", serverPage);
        xmlhttp.onreadystatechange = function() {

         if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
		 		returnText = xmlhttp.responseText;

		 		if(returnText == 1){
					MM_showHideLayers('validate','','hide');
					document.getElementById("validate").style.display = 'none';
					//document.getElementById("validate").style.height = '5px';
					showCheck('validateright', 0);
				}else{
					var now=new Date();
					var number = now.getSeconds()%43;
					document.getElementById("authimg").innerHTML = '<IMG src="authimg.php?code='+number+'" alt="" name="txtRealName" id="txtRealName">';

					//window.document.frm.txtValidate.focus();
					MM_showHideLayers('validate','','show');
					document.getElementById("validate").style.display = '';
				    document.getElementById("validate").style.height = '40px';
				    document.getElementById("validate").innerHTML = 'The verification code was incorrect. Please try again.';
				    showCheck('validateright', 1);
				}
			}

      }

      xmlhttp.send(null);
	}
}


/*---check handset---*/
function checkhandset(){
	var hid = document.getElementById('H_list').value;
	var mid = document.getElementById('M_list').value;
	
	if(hid==""){
		//window.document.frm.H_list.focus();
		MM_showHideLayers('handset','','show');
		document.getElementById("handset").style.display = '';
		document.getElementById("handset").style.height = '20px';
		document.getElementById("handset").innerHTML = 'Please select your handset.';
		//showMessage('H_list','Please select your handset.',-265,-370,200,60,"#f0afb4","#faeee2","#faeee2");
		state = '5';
	}else{
		MM_showHideLayers('handset','','hide');
		document.getElementById("handset").style.display = 'none';
	}
}


/*---check getMocall---*/
function getMocall(userID){
	var state ='';
	var hid = document.getElementById('H_list').value;
	var mid = document.getElementById('M_list').value;
	//alert(hid+"=="+mid);
	if(hid==""){
		//window.document.frm.H_list.focus();
		MM_showHideLayers('handset','','show');
		document.getElementById("handset").style.display = '';
		document.getElementById("handset").style.height = '20px';
		document.getElementById("handset").innerHTML = 'Please select your handset.';
		//showMessage('H_list','Please select your handset.',-265,-370,200,60,"#f0afb4","#faeee2","#faeee2");
		state = '5';
	}else{
		MM_showHideLayers('handset','','hide');
		document.getElementById("handset").style.display = 'none';
	}
	
	if(state == ''){
		if(userID == ''){
			document.frm.action="../softwaredownload/mobiledetails.php?mn="+mid;
			document.frm.submit();
		}else{
			document.location = '../../softwaredownloads/choosedownload/index.php?hid='+hid+'&mid='+mid;
		}
	}
}



function KeyDownRegistPhone(e){
	var keynum;
	if(window.event){
		keynum = e.keyCode;
	}else if(e.which){
		keynum = e.keyCode;
	}

	if(keynum==13)
	{
		registPhone(e);
		return false;
	}
}


function registPhone(ev){
	var state ='';
	//check phone
	function phone1(){
		var ukphone1;
		var ukphone2;
		var ukphone;
		ukphone1 = document.getElementById("txtPhone1").value;
		ukphone2 = document.getElementById("txtPhone2").value;
		ukphone = ukphone1 + ukphone2;
		
		if(ukphone2 == ""){
			showMessage('txtPhone2','Please enter your mobile number. To use MO-Call, you must register with a valid mobile number. Please try again.',-525,-400,400,95,"#f0afb4","#faeee2","#faeee2");
			state = '14';
			return 14;
			
		}else if(isNaN(ukphone)){
			showMessage('txtPhone2','Don\'t include any special characters or spaces. To use MO-Call, you must register with a valid mobile number. Please try again. ',-525,-400,400,95,"#f0afb4","#faeee2","#faeee2");
			return 3;
		
		}else if(ukphone1==44 && ukphone2.indexOf('7')!=0){
			showMessage('txtPhone2','Your number should begin with a 7. To use MO-Call, you must register with a valid mobile number. Please try again.',-525,-400,400,95,"#f0afb4","#faeee2","#faeee2");
			state = '19';
			return 19;
		
		}else if(ukphone1==44 && ukphone2.indexOf('70') ==0){
			showMessage('txtPhone2','Unfortunately we can not accept sign-ups from here.',-525,-400,400,95,"#f0afb4","#faeee2","#faeee2");
			state = '19';
			return 19;
		
		}else if(ukphone.length<6){
			showMessage('txtPhone2','The number you entered is too short. To use MO-Call, you must register with a valid mobile number. Please try again.',-525,-400,400,95,"#f0afb4","#faeee2","#faeee2");
			state = '14';
			return 24;
		
		}else if(ukphone.indexOf('852')==0){
			showMessage('txtPhone2',"Unfortunately we can not accept sign-ups for Hong Kong from here. &nbsp;Please visit <a href='http://www.mo-call.hk'>www.mo-call.hk</a>  to register.",-525,-400,400,95,"#f0afb4","#faeee2","#faeee2");
			state = '23';
			return 23;
		
		}else if(ukphone1=='44'){
			var Len2 = ukphone2.length;
			if(Len2>10){
			showMessage('txtPhone2','The number you entered is too long. To use MO-Call, you must register with a valid mobile number. Please try again.',-525,-400,400,95,"#f0afb4","#faeee2","#faeee2");
			state = '15';
			return 15;
		
		}else if(Len2<10){
			showMessage('txtPhone2','The number you entered is too short. To use MO-Call, you must register with a valid mobile number. Please try again.',-525,-400,400,95,"#f0afb4","#faeee2","#faeee2");
			state = '15';
			return 15;
		}
		
		}else{
			MM_showHideLayers('phone','','hide');
			document.getElementById("phone").style.display = 'none';
		}
	}
//	var phone = phone1();
	if(phone1() == undefined) {
		ajaxFunction('checkwaysphone');
		if(document.getElementById("regphone").value=='nophone'){
			state = 'phone';
		}
	}else {
		return false;	
	}
	// update by Evan, On 2009-02-19
	var countiesLeadZero = new Array('225','250');
	var reg_phone1 = document.frm.txtPhone1.value;
	var countryStatus = '';
	for(var z=0; z<countiesLeadZero.length; z++) {
		if (reg_phone1 == countiesLeadZero[z]) {
			countryStatus = '0';
			break;
		}
	}
	//replace zero phone2 start with zero	
	var reg_phone2 = document.getElementById("txtPhone2").value;
	var reguStartWithZero = /^[0]{1,}/;	
    reg_phone2 = reg_phone2.replace(reguStartWithZero,countryStatus);
	document.getElementById("txtPhone2").value = reg_phone2;

	var voiop = document.getElementById("voiop").value;
	if(state == ''){
		//if(window.location.href.toString().indexOf('ways')>-1){
		//	document.frm.action="regist.php?voiop="+voiop;		
		//}else {
			document.frm.action="/en/registration/index.php?voiop="+voiop;
		//}
		document.frm.submit();
	}else{
			return false;
		}
}


function subPhone(){
	document.frm.action="download.php";
	document.frm.submit();
}

/*---check regist---*/
function registWays(){
	checkAjax = 111;
	var state = '';
	var re = /^[a-zA-Z]{1}([a-zA-Z0-9]|[._]){5,11}$/;

	/*---check UserName---*/
	if(document.frm.txtUserName.value == ''){
		//alert("username");
		//if(state=='')
		  // window.document.frm.txtUserName.focus();
		
		MM_showHideLayers('username','','show');
		document.getElementById("username").style.display = '';
		document.getElementById("username").style.height = '20px';
		document.getElementById("username").innerHTML = 'Please enter a username.';
		showCheck('usernameright', 1);
		state = '3';
	}else{
		if(!re.test(document.getElementById("txtUserName").value)){
			//if(state=='')
			 //  window.document.frm.txtUserName.focus();

			MM_showHideLayers('username','','show');
			document.getElementById("username").style.display = '';
			document.getElementById("username").innerHTML = 'Your username must be between 6 and 12 characters. Your username cannot contain spaces or any special characters. And only begin with a characters.';
			document.getElementById("username").style.height = '80px';
			showCheck('usernameright', 1);
			state = '4';
		}else{
			ajaxFunction('regusername');
			if(document.getElementById("regusername").value){
				state = 'regusername';
			}
		}
	}
	
	
	/*---check Password---*/
	if(document.frm.txtPwd.value ==""){
		//if(state=='')
		//   window.document.frm.txtPwd.focus();

		MM_showHideLayers('password','','show');
		document.getElementById("password").style.display = '';
		document.getElementById("password").innerHTML = 'Please select and enter a password.';
		document.getElementById("password").style.height = '20px';
		showCheck('passwordright', 1);
		state = '5';
	}else{
		var rd = /^([a-zA-Z0-9]|[._]){5,11}$/;
		if(!rd.test(document.getElementById('txtPwd').value)){
			//if(state=='')
			 //   window.document.frm.txtPwd.focus();

			MM_showHideLayers('password','','show');
			document.getElementById("password").style.display = '';
			document.getElementById("password").innerHTML = 'Your password must be between 6 and 12 characters. Your password cannot contain spaces or any special characters.';
			document.getElementById("password").style.height = '80px';
			showCheck('passwordright', 1);
			state = '6';
		}else{
			MM_showHideLayers('password','','hide');
			document.getElementById("password").style.display = 'none';
			//document.getElementById("passwordright").style.height = '5px';
			showCheck('passwordright', 0);
		}
	}
	
	
	/*---check FirstName---*/
	var firstName = trim(document.frm.txtFirstName.value);
	if(firstName == ""){
		//if(state=='')
		//	window.document.frm.txtFirstName.focus();
		MM_showHideLayers('firstname','','show')
		document.getElementById("firstname").style.display = '';
		document.getElementById("firstname").innerHTML = 'Please enter your first name.';
		document.getElementById("firstname").style.visibility = 'visible';
		document.getElementById("firstname").style.height = '20px';
		showCheck('firstnameright', 1);
		state = '1';
	}else{
		MM_showHideLayers('firstname','','hide')
		document.getElementById("firstname").style.display = 'none';
		showCheck('firstnameright', 0);
	}
	/*---check LastName---*/
	var lastName = trim(document.frm.txtLastName.value);
	if(lastName==""){
		//if(state=='')
		 //  window.document.frm.txtLastName.focus();
		MM_showHideLayers('lastname','','show')
		document.getElementById("lastname").style.display = '';
		document.getElementById("lastname").innerHTML = 'Please enter your last name.';
		document.getElementById("lastname").style.height = '20px';
		showCheck('lastnameright', 1);
		state = '2';
	}else{
		MM_showHideLayers('lastname','','hide')
		document.getElementById("lastname").style.display = 'none';
		showCheck('lastnameright', 0);
	}
	/*---check Email---*/
	var email = document.getElementById("txtEmail").value;
	if(email != ""){
		if(!/(\S)+[@]{1}(\S)+[.]{1}(\w)+/.test(email)){
			//if(state=='') window.document.frm.txtEmail.focus();
			MM_showHideLayers('email','','show');
			document.getElementById("email").style.display = '';
			document.getElementById("email").style.height = '40px';
			document.getElementById("email").innerHTML = 'Please enter a valid e-mail address.';
			showCheck('emailright', 1);
			state = '13';
			document.frm.txtEmail.value = "";
		}else{
			MM_showHideLayers('email','','hide');
			document.getElementById("email").style.display = 'none';
			//document.getElementById("email").style.height = '5px';
			showCheck('emailright', 0);
		}
	}else{
		//if(state=='') window.document.frm.txtEmail.focus();
		MM_showHideLayers('email','','show');
		document.getElementById("email").style.display = '';
		document.getElementById("email").style.height = '20px';
		document.getElementById("email").innerHTML = 'Please enter your e-mail address.';
		showCheck('emailright', 1);
		state = '14';
	}
	/*---check Validate---*/
	if(document.frm.txtValidate.value ==""){
		//if(state=='') window.document.frm.txtValidate.focus();
		MM_showHideLayers('validate','','show');
		document.getElementById("validate").style.display = '';
		document.getElementById("validate").innerHTML = 'Please enter the 6-digit verification code.';
		document.getElementById("validate").style.height = '20px';
		showCheck('validateright', 1);
		state = '17';
	}else{
		ajaxFunction('verycodecheck');
		if(document.getElementById("vali").value){
			state = 'validate';
		}
	}

	/*---check Promotion---*/
	if(document.frm.moTC.checked == false){
			MM_showHideLayers('idMoTC','','show');
			document.getElementById("idMoTC").style.display = '';
			document.getElementById("idMoTC").innerHTML = 'Please read and agree to the Terms and Conditions.';
			document.getElementById("idMoTC").style.textIndent = 0;
			showCheck('moTCright', 1);
			state = '19';
	}else{
		MM_showHideLayers('idMoTC','','hide');
		document.getElementById("idMoTC").style.display = 'none';
		showCheck('moTCright', 0);
	}
	/*---check the value in the hide form---*/
	if($('txtPhone').value==''||$('dlCountryGuoJi').value==''){
		var msgObj = document.createTextNode('Check  and Try again!');
		$('showMsg').appendChild(msgObj);
		MformWindowTemplate('process');
		state = '20';
	}
	
	if(window.location.href.toString().indexOf('mobile')>-1){
		if($('handset')!=null && $('handset').value==''){
			state = '21';
		}
	}
	
		
	if(state == ''){
		$('pleaseWait').innerHTML='Processing......';
		//alert(checkAjax);
		checkAjax = checkAjax-1;
		registLandingSubmit();
	}else {
		if(state!='validate'){
			//$('pleaseWait').innerHTML='Please check your information.';
		}else {
			$('pleaseWait').innerHTML='Processing ... ';
		}
	}
}

function registLandingSubmit(){
	//alert(checkAjax);
	if(checkAjax==0){
		$('Image1').disabled = 'disabled';
		document.frm.action='../ways/activation.php';
		document.frm.submit();
	}
}

/*---check the active code---*/
function checkActiveWays(){
	document.getElementById('checkCodeResult').innerHTML='<span style="color:#F091B9; font-family:Tahoma; font-size:13px;">Checking activation code...</span>';
	var activeCode=document.getElementById('activationCode').value;
	var voiop = document.getElementById('voiop').value;	
	var operator = document.getElementById('operator').value;	
	//var lang = (document.getElementById('languageAct')!=null)?document.getElementById('languageAct').value:'';
	//var mt = encodeURIComponent(document.getElementById('mt').value);
	//var hid = document.getElementById('hid').value;
	//var mobile = document.getElementById('mobile').value;
	
	
	if(activeCode==''){
		//$('checkCodeResult').innerHTML='Please input your active code.';
		document.getElementById('checkCodeResult').innerHTML='Please enter your activation code.';
	}else {
	     	var serverPage = 'ajax_checkActiveCode.php';
		var directState = window.location.pathname.indexOf('/ways/activate')>-1;
		var directState1 = window.location.pathname.indexOf('/ways/activation_succesful')>-1;
		if(directState){
			serverPage = 'ajax_checkActiveCode.php';
		}
	    
		var xmlhttp = false;
		try { // Firefox, Opera 8.0+, Safari
		 xmlhttp = new XMLHttpRequest();
		}catch (e) {
		 try { // Internet Explorer >=5.0
		   xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		 }catch (e) {
			try { // Internet Explorer <5.0
			  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}catch (e) {// Do not support AJAX
			  alert("Your browser does not support AJAX!");
			}
		 }
		}
		
		xmlhttp.open("POST", serverPage, true);
		xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		//var sendValues='activationCode='+$('activationCode').value;
		var sendValues='activationCode='+document.getElementById('activationCode').value;
		xmlhttp.send(sendValues);
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				var result = xmlhttp.responseText;
				//alert(result);
				var returnText=parseInt(result.split('_')[0]);
				var type = parseInt(result.split('_')[2]);
				var hid = parseInt(result.split('_')[1]);
				
				/*if(returnText==1){
					if(type==2 || type==3){
						directUrl ='activation_succesful.php?type='+result;
					}else{
						if(hid == 813 || hid == 1669){
							//directUrl = 'make-calls/index.php?mobile='+mobile+'&hid='+hid+'&language='+lang;	
							directUrl = 'make-calls/index.php?type='+result;	
						}else{
							//directUrl = 'downloadsms/index.php?mobile='+mobile+'&hid='+hid+'&language='+lang+'&voiop='+voiop;
							directUrl = 'downloadsms/index.php?type='+result+'&voip='+voiop+'&operator='+operator;
						}	
					}
					//document.location = directUrl;
					referCompatible(directUrl);
				}else {
					//$('checkCodeResult').innerHTML=result;
					document.getElementById('checkCodeResult').innerHTML=result;
				}*/
				
				if(returnText==1){
					directUrl ='../registration/continue.php';
					referCompatible(directUrl);
				}else {
					document.getElementById('checkCodeResult').innerHTML=result;
				}
				
			}
		}
	}
}

/*---show active page---*/
function  activewindows(){
	MformWindowTemplate('active');
}

/*---show Pop-up windows---*/
function MformWindowTemplate(formID){
    try{
	  var w, h;
	  if (self.innerHeight) {
		w = self.innerWidth;
		h = self.innerHeight;
	  }else if(document.documentElement && document.documentElement.clientHeight) {
	    w = document.documentElement.clientWidth;
	    h = document.documentElement.clientHeight;
	  }else if (document.body){
	    w = document.body.clientWidth;
	    h = document.body.clientHeight;
	  }
	  sh = document.body.scrollTop;
	  sh = sh ? sh : document.documentElement.scrollTop;
	  mh = document.body.scrollHeight;
	  mh = mh > h ? mh:h;
	  document.getElementById('MformWindow_'+formID).style.display='';
	  
	  var event_w = document.getElementById("div_templage_"+formID).style.width;
	  event_w = event_w.replace('px','');
	  var event_h = document.getElementById("div_templage_"+formID).style.height;
	  event_h = event_h.replace('px','');
	  if(event_h==''){
	  	event_h = 400;
	  }
	  
	  document.getElementById('MformWindow_'+formID).style.left=(w - event_w)/2 +'px';
	  document.getElementById('MformWindow_'+formID).style.top=((h - event_h)/2+sh) +'px';
	  document.getElementById('bgwindow_'+formID).style.display='';
	  document.getElementById('bgwindow_'+formID).style.height= mh + 'px';
	if(isIe){
	  document.getElementById('bgwindow_'+formID).style.width= w+'px';
	}
	  
      }catch(e){
	  return true;
      }
      return false;
}

/*---close the pup-up windows---*/
function MformWindowClose(formID) {
	document.getElementById('MformWindow_'+formID).style.display='none';
	document.getElementById('bgwindow_'+formID).style.display='none';
}

/*---check ajaxFunction---*/

function ajaxFunction(kind){

//	testMessageBox(ev,'The mobile number has already been registered.')
  var xmlHttp;
  try{
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
  }catch (e){
    // Internet Explorer
    try  {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }catch (e)  {
       try{
         xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
       }
       catch (e)  {
         alert("Your browser does not support AJAX!");
         return false;
       }
	 }
  }
    xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4)
        	{//window.alert(xmlHttp.responseText);
				if(kind == 'checkwaysphone'){
					//alert('jin ru ajax');
					//alert(xmlHttp.responseText);
						if(xmlHttp.responseText == 1){
								showMessage('txtPhone2','The mobile number has already been registered.',-525,-400,400,85,"#f0afb4","#faeee2","#faeee2");
						}else if(xmlHttp.responseText == 2){
								showMessage('txtPhone2','Unfortunately we can not accept sign-ups from here.',-525,-400,400,85,"#f0afb4","#faeee2","#faeee2");
						}else if(xmlHttp.responseText == 3){
								document.getElementById("txtPhone2").value = '';
								showMessage('txtPhone2','The number you have entered does not appear to match your SIM Country.',-525,-400,400,85,"#f0afb4","#faeee2","#faeee2");
						}else{
							//closeWindow();
							document.getElementById("regphone").value = '';
							//if(window.location.href.toString().indexOf('ways')>-1){
								//document.frm.action="regist.php?voiop="+voiop;
							//}else {
								//document.frm.action="../../ways/mobile/regist.php?voiop="+voiop;
								if(voiop == 'fromvoiop'){
									document.frm.action="/en/registration/index.php?voiop="+voiop;
								}else{
									document.frm.action="/en/registration/index.php";
								}
						//}
							document.frm.submit();
							//showMessage('txtPhone2',xmlHttp.responseText,-265,-470,200,50,"#487435","#F7FFDD","#F7FFDD");
						}	
						
				}else if(kind == 'regusername'){
					if(xmlHttp.responseText == 1){
						MM_showHideLayers('username','','hide');
						document.getElementById("username").style.display = 'none';
						//document.getElementById("username").style.height = '5px';
						showCheck('usernameright', 0);
						document.getElementById("regusername").value = '';
						checkAjax = checkAjax-100;
						registLandingSubmit();
					}else{
						document.getElementById("regusername").value = 'regusername';
						//window.document.frm.txtUserName.focus();
						MM_showHideLayers('username','','show');
						document.getElementById("username").style.display = '';
						document.getElementById("username").innerHTML = xmlHttp.responseText;
						document.getElementById("username").style.height = '40px';
						showCheck('usernameright', 1);
						return;
					}
				}else if(kind == 'verycodecheck'){
					var returnText = xmlHttp.responseText;
					if(returnText == 1){
						MM_showHideLayers('validate','','hide');
						document.getElementById("validate").style.display = 'none';
						showCheck('validateright', 0);
						document.getElementById("vali").value="";
						checkAjax = checkAjax-10;
						registLandingSubmit();
					}else{
						var now=new Date();
						var number = now.getSeconds()%43;
						document.getElementById("authimg").innerHTML = '<IMG src="authimg.php?code='+number+'" alt="" name="txtRealName" id="txtRealName">';
						//if(state=='')  window.document.frm.txtValidate.focus();
						MM_showHideLayers('validate','','show');
						document.getElementById("validate").style.display = '';
						document.getElementById("validate").style.height = '40px';
						document.getElementById("validate").innerHTML = 'The verification code was incorrect. Please try again.';
						showCheck('validateright', 1);
						document.getElementById("vali").value="validate";
						return false;
					}
				}else if(kind == 'downloadSMS'){
					var returnText = xmlHttp.responseText;
					$('smsresult').innerHTML = returnText;
					//$('sendSMS').disabled = 'disabled';
					if(returnText == 'MO-Call Sent'){
						var now=new Date();
						var sec = now.getHours()*60+now.getMinutes()*60+now.getSeconds();
						$('sendtime').value=sec;
						var disabledButton=setTimeout("$('sendtime').value=''", 40000);
					}else{
						$('sendtime').value='';
						document.getElementById("tryAgain").style.display = 'none';
					}
				}else if(kind == 'downloadSMSForSoftware'){
					var returnText = xmlHttp.responseText;
					$('smsresult').innerHTML = returnText;
					if(returnText == 'MO-Call Sent'){
						
						if(document.getElementById("operator_sms")){
							var operator = $('operator_sms').value;
						}else if(document.getElementById("operator")){
							var operator = $('operator').value;
						}else{
							var operator = '';	
						}
						
						$('sendtime').value='';
						document.getElementById("tryAgain").style.display = 'none';
						document.location = '/en/softwaredownloads/downloadsms/index.php?hid='+$('hid').value+'&mobile='+$('mobile').value+'&voip='+$('voip').value+'&operator='+operator;
					}
				}else{
					//alert(xmlHttp.responseText);
					document.getElementById("txtHint").innerHTML = xmlHttp.responseText;
				}
        	}
      }

	 if(kind == 'checkwaysphone'){
           var re = /\+/g;
		   ukphone1 = document.frm.txtPhone1.value;
		   ukphone2 = document.frm.txtPhone2.value;
		   ukphone = ukphone1 + ukphone2;
		   var voiop = $('voiop').value;
		   var countryNameFromSelect = document.getElementById("dlCountryGuoJi").options[document.getElementById("dlCountryGuoJi").selectedIndex].text;
		   countryNameFromSelect = encodeURIComponent(countryNameFromSelect);
		   xmlHttp.open("GET","../../ways/reg.php?txtPhone="+ukphone+'&cname='+countryNameFromSelect,true);
	  }else if(kind == 'regusername'){
			xmlHttp.open("GET","../ways/reg.php?txtUserName="+document.frm.txtUserName.value,true);
	  }else if(kind == 'verycodecheck'){
		var cookie = document.frm.txtValidate.value;
		var serverPage = 'ajax_verycodecheck.php?value=' + cookie;
		xmlHttp.open("GET", serverPage);
	  }else if(kind == 'downloadSMS'){
		var lang = ($('language')!=null)?$('language').value:'';
		var mt = encodeURIComponent($('mt').value);
		var voiop = $('voiop').value;
		var serverPage = 'softwaredownload_do.php?mobile='+$('mobile').value+'&hid='+$('hid').value+'&language='+lang+'&downType=phone&mt='+mt+'&voiop='+voiop;
	     	xmlHttp.open("GET", serverPage, true);
	  }else if(kind == 'downloadSMSForSoftware'){
		var lang = ($('language')!=null)?$('language').value:'';
		var mt = encodeURIComponent($('mt').value);
		
		if(document.getElementById("operator_sms")){
			var operator = $('operator_sms').value;
		}else if(document.getElementById("operator")){
			var operator = $('operator').value;
		}else{
			var operator = '';	
		}
		
		var serverPage = '/en/softwaredownloads/choosedownload/softwaredownload_do.php?mobile='+$('mobile').value+'&hid='+$('hid').value+'&voip='+$('voip').value+'&language='+lang+'&downType=phone&mt='+mt+'&operator='+operator;
	     	xmlHttp.open("GET", serverPage, true);
	  }
     xmlHttp.send(null);
}

function smsArrive(){
	if(document.getElementById("smsArrive").style.display == 'none'){
		document.getElementById("smsArrive").style.display = 'block';
	}else{
		document.getElementById("smsArrive").style.display = 'none';
	}
}

function resetFields(obj, evt){
	var msg = "";
	if(evt == 'focus'){
		if(obj.value=='Type activation code here') {
			obj.className='active_input_selected';
			obj.value=msg;
		}
	}else {
		if(obj.value=='') {
			obj.className='active_input';
			obj.value='Type activation code here';
		}
	}
}

function downloadSMSSubmit(){
	var re = /^([0]{2}|\+){0,1}([0-9]){4,15}$/;
	var mobile = $('mobile').value;
	var now=new Date();
	var clicksec = $('sendtime').value;
	var sec = now.getHours()*60+now.getMinutes()*60+now.getSeconds();
	if(clicksec!=''){
		document.getElementById("tryAgain").style.display = 'block';
		var remainingTime = 40-(sec-clicksec);
		$('tryAgain').innerHTML = 'You can try again after '+remainingTime+' seconds.';
	//}else if($('mobile').value.length < 9) {
	}else if(!re.test(mobile)){
		window.alert("Please enter a valid mobile number.");
	}else {
		$('sendtime').value=sec;
		$('smsresult').innerHTML = 'Processing ...';
		document.getElementById("tryAgain").style.display = 'none';
		ajaxFunction('downloadSMS');
	}
}

/*--------download via SMS in software section ---------*/
function downloadSMSSubmitForSoftware(){
	var re = /^([0]{2}|\+){0,1}([0-9]){4,15}$/;
	var mobile = $('mobile').value;
	var hid = $('hid').value;
	var now=new Date();
	var clicksec = $('sendtime').value;
	var sec = now.getHours()*60+now.getMinutes()*60+now.getSeconds();
	/*if(clicksec!=''){
		document.getElementById("tryAgain").style.display = 'block';
		var remainingTime = 40-(sec-clicksec);
		$('tryAgain').innerHTML = 'You can try again after '+remainingTime+' seconds.';
	}else*/ 
	if(!re.test(mobile)){
		window.alert("Please enter a valid mobile number.");
	}else {
		//$('sendtime').value=sec;
		//$('smsresult').innerHTML = 'Processing ...';
		//document.getElementById("tryAgain").style.display = 'none';
		//ajaxFunction('downloadSMSForSoftware');
		
		/*if(document.getElementById("operator_sms")){
			if(operator = document.getElementById("operator_sms").value == 0){
				document.getElementById("operatorAlertSMS").innerHTML = 'There are two versions of MO-Call for Blackberry. If your phone has a SIM card, you will need the GSM version.';
			}else{
				$('sendtime').value=sec;
				$('smsresult').innerHTML = 'Processing ...';
				document.getElementById("tryAgain").style.display = 'none';
				ajaxFunction('downloadSMSForSoftware');
			}
		}else{*/
			$('sendtime').value=sec;
			$('smsresult').innerHTML = 'Processing ...';
			document.getElementById("tryAgain").style.display = 'none';
			ajaxFunction('downloadSMSForSoftware');
		//}
	}
}

function mobiDownloadForSoftware(){	
	/*if(document.getElementById("operator_mobi")){
		if(operator = document.getElementById("operator_mobi").value == 0){
			document.getElementById("operatorAlertMobi").innerHTML = 'There are two versions of MO-Call for Blackberry. If your phone has a SIM card, you will need the GSM version.';
		}else{
			document.mobiDownload.action='/en/softwaredownloads/downloadmobi/index.php';
			document.mobiDownload.submit();
		}
	}else{*/
		document.mobiDownload.action='/en/softwaredownloads/downloadmobi/index.php';
		document.mobiDownload.submit();
	//}
}

function pcDownloadForSoftwareSubmit(obj){
	document.getElementById("operatorAlertPC").innerHTML = '';
	document.frm.action='/en/softwaredownloads/downloadpc/index.php?network='+obj;
	document.frm.submit();
}

function pcDownloadForSoftware(obj){
	var operator_pc = document.getElementById("operator_pc");
	var operatorAlertPC = document.getElementById("operatorAlertPC");
	//alert(operator_pc.value);
	if(operator_pc){
		if(operator_pc.value == 0){
			operatorAlertPC.innerHTML = 'Please select your Mobile Network from the drop down list.';
		}else{
			var dualMode_pc = document.getElementById("dualMode_pc");
			if(dualMode_pc){
				if(operator_pc.value == 1 || operator_pc.value == 2){
					if(dualMode_pc.value == 0){
						operatorAlertPC.innerHTML = 'Please select your phone type from the drop down list.';
					}else{
						pcDownloadForSoftwareSubmit(obj);
					}
				}else{
					pcDownloadForSoftwareSubmit(obj);
				}
			}else{
				pcDownloadForSoftwareSubmit(obj);	
			}
		}
	}else{
		document.frm.action='/en/softwaredownloads/downloadpc/index.php';
		document.frm.submit();
	}
}

function MouseOverColor(obj,method) {
//	alert(obj);
	obj.className='playvideoOver';
	if(method==1){
		document.getElementById("videoName").className ='playvideo1';
		document.getElementById("videoPlay").className ='play1';
	}else if(method==2){
		document.getElementById("videoNameM").className ='playvideo1M';
		document.getElementById("videoPlayM").className ='play1M';
	}else if(method==3){
		obj.className='nextOver';
		document.getElementById("nextName").className ='next1';
	}else{
		obj.className='playvideoOver';
		document.getElementById("morevideo").className ='morevideoN1';
	}
}
function MouseOutColor(obj, method) {
//	alert(obj);
	obj.className='playvideoOut';
	if(method==1){
		document.getElementById("videoName").className ='playvideo';
		document.getElementById("videoPlay").className ='play';
	}else if(method==2){
		document.getElementById("videoNameM").className ='playvideoM';
		document.getElementById("videoPlayM").className ='playM';
	}else if(method==3){
		obj.className='nextOut';
		document.getElementById("nextName").className ='next';
	}else{
		obj.className='playvideoOut';
		document.getElementById("morevideo").className ='morevideoN';
	}
}

function activateStatus(serverPage, sendValues, voiop, handset, ways, operator){
	var xmlhttp = false;
	try { // Firefox, Opera 8.0+, Safari
	 xmlhttp = new XMLHttpRequest();
	}catch (e) {
	 try { // Internet Explorer >=5.0
	   xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	 }catch (e) {
		try { // Internet Explorer <5.0
		  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}catch (e) {// Do not support AJAX
		  alert("Your browser does not support AJAX!");
		}
	 }
	}
		
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			returnText = xmlhttp.responseText;
			if(returnText == 1){
				document.location = 'enterActivation.php?voiop='+voiop+'&handset='+handset+'&ways='+ways+'&operator='+operator;
			}else{
				document.getElementById("contentFailure").style.display = 'block';
				document.getElementById("contentLoading").style.display = 'none';
			}
		}
	}
	xmlhttp.open("POST", serverPage, true);
	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttp.send(sendValues);
}


function referCompatible(url){
	var isIe=(document.all)?true:false;
	if(isIe) {
		var linka = document.createElement('a');
		linka.href=url;
		document.body.appendChild(linka);
		linka.click();
	}else {
		window.location = url;
	}
}

/*---login---*/
function KeyDown_AU(e){
	if(window.event){
		keynum = e.keyCode;
	}else if(e.which){
		keynum = e.keyCode;
	}

	if(keynum==13){
		document.frm1.action = HOST_DIR+'/user/login_do.php';
		document.frm1.submit();
	}
}

function Login_Tina_AU(){
	document.frm1.action = HOST_DIR+'/user/login_do.php';
	document.frm1.submit();
}
