var effect_1 = null;
function showCap(url,did)
{ 
	divId=did;
	xmlHttpCap=GetXmlHttpObject();
	if (xmlHttpCap==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}	
	xmlHttpCap.onreadystatechange=stateChangedCap ;
	xmlHttpCap.open("GET",url,true);
	xmlHttpCap.send(null);
}
function stateChangedCap()
{ 
	if (xmlHttpCap.readyState==4 || xmlHttpCap.readyState=="complete")
	{ 
		  document.getElementById(divId).innerHTML=xmlHttpCap.responseText ;		
	}
} 

function EmailExistsChanged()
{ 
	if (xmlHttpCap.readyState==4 || xmlHttpCap.readyState=="complete")
	{ 
			if(xmlHttpCap.responseText==0)
			{
				alert("Email Address is already exists !!");
				document.registrationForm_bottom.email.focus();
				return false;
			}
		
	}
} 

function refresh_captha()
	{
		showCap('captcha.php','Image');
	}


var xmlHttp;
var divId="";
var txt='';
var urlpath = '';
var urlpath2 = '';
function checkavailability(url,did)
{
	divId=did;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	
	urlpath = 'checkavailableusername.php?name='+url;
	xmlHttp.onreadystatechange=stateChanged ;
	xmlHttp.open("GET",urlpath,true);
	xmlHttp.send(null);
} 

function stateChanged()
{ 

	if ( xmlHttp.readyState==4 || xmlHttp.readyState=="complete" )
	{ 
		if(xmlHttp.status==200){
			
			if(xmlHttp.responseText=='Yes/<font color="#CC6633" size="+1">No</font>')
			{
			  document.getElementById("name").value='';
			  document.getElementById("name").focus();
			  document.getElementById(divId).innerHTML=xmlHttp.responseText ;
			  return false;
			}
			
			document.getElementById(divId).innerHTML=xmlHttp.responseText ;
		}else{
			alert("error: " + xmlHttp.statusText);
		}		
	}
}



var xmlHttp5
var divId5="";
var txt5='';
var urlpath5 = '';
var urlpath7 = '';
function checkavailability4(url,did)
{
	divId5=did;
	xmlHttp5=GetXmlHttpObject();
	if (xmlHttp5==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	
	urlpath5 = 'checkavailableusername.php?name='+url;
	xmlHttp5.onreadystatechange=stateChanged5 ;
	xmlHttp5.open("GET",urlpath5,true);
	xmlHttp5.send(null);
} 

function stateChanged5()
{ 

	if ( xmlHttp5.readyState==4 || xmlHttp5.readyState=="complete" )
	{ 
		if(xmlHttp5.status==200){
			
			if(xmlHttp5.responseText=='Yes/<font color="#CC6633" size="+1">No</font>')
			{
			  document.getElementById("name2").value='';
			  document.getElementById("name2").focus();
			  document.getElementById(divId5).innerHTML=xmlHttp5.responseText ;
			  return false;
			}
			
			document.getElementById(divId5).innerHTML=xmlHttp5.responseText ;
		}else{
			alert("error: " + xmlHttp5.statusText);
		}		
	}
}






function GetXmlHttpObject()
{ 
	var objXMLHttp=null;
	 if (window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	} 
	objXMLHttp=createXMLHttp();
	return objXMLHttp;
} 

function createXMLHttp() {

    if (typeof XMLHttpRequest != "undefined") {
        return new XMLHttpRequest();
    } else if (window.ActiveXObject) {
      var aVersions = [ "MSXML2.XMLHttp.5.0",
        "MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0",
        "MSXML2.XMLHttp","Microsoft.XMLHttp"
      ];

      for (var i = 0; i < aVersions.length; i++) {
        try {
            var oXmlHttp = new ActiveXObject(aVersions[i]);
            return oXmlHttp;
        } catch (oError) {
            //Do nothing
        }
      }
    }
    throw new Error("XMLHttp object could be created.");
}

function validateRegister(Obj)
{
	
	
if(Obj.name.value=='' || Obj.name.value==null)
{
	alert("Username is Mandatory!");
	Obj.name.focus();
	return false;
}
else
{
    document.registrationForm_bottom.name.value = Obj.name.value;	
}
/*else
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	urlpath2 = 'checkavailableusername.php?name='+Obj.name.value;
	xmlHttp.onreadystatechange=function()
	{
	
	if ( xmlHttp.readyState==4 || xmlHttp.readyState=="complete" )
	{ 
//			alert(xmlHttp.responseText)
			document.getElementById("yesno").innerHTML=xmlHttp.responseText ;
			document.getElementById("bottomyesno").innerHTML=xmlHttp.responseText ;
			if(xmlHttp.responseText=='Yes/<font color="#CC6633" size="+1">No</font>')
			{
			alert("Username is Not Abailable");
			Obj.name.value='';
			Obj.name.focus();
			//Obj.name.select();
			return false;			
			}
			
	}					
	
	}
	xmlHttp.open("GET",urlpath2,true);
	xmlHttp.send(null);
	document.registrationForm_bottom.name.value = Obj.name.value;
	return false;	
}*/


//alert(Obj.name.value);
	if(Obj.email.value=='' || Obj.email.value==null)
	{
		alert("Email Address is Mandatory!");
		Obj.email.focus();		  
		return false;
	}
	else
	{
		document.registrationForm_bottom.email.value = Obj.email.value;
	}
	
	if(Obj.email.value!="")
	{
		if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(Obj.email.value)))
		{
		alert("Please enter a valid email address.");
		Obj.email.focus();
		return false;
		}
    }
	else
	{
		document.registrationForm_bottom.email.value = Obj.email.value;
	}	

if(Obj.password.value=='' || Obj.password.value==null)
	{
		alert("Password is Mandatory!");
		Obj.password.focus();
		return false;
	}
	else
	{
		document.registrationForm_bottom.password.value = Obj.password.value;
		document.registrationForm_bottom.re_password.focus();

	}	
	if(Obj.re_password.value=='' || Obj.re_password.value==null)
	{
		alert("Retype Password is Mandatory!");
		document.registrationForm_bottom.re_password.focus();
		return false;
	}
	else
	{
		document.registrationForm_bottom.re_password.value = Obj.re_password.value;
	}	
	if(Obj.re_password.value!=Obj.password.value)
	{
		alert("Paswords are not same!");
		document.registrationForm_bottom.re_password.value='';
		Obj.re_password.value='';
		document.registrationForm_bottom.re_password.focus();
		return false;
	}
	else
	{
		document.registrationForm_bottom.verification.focus();
		alert("Please Type the words are in Image!");
		return false;
	}	

		return false;	
	
}
function checkavailability2(url,yesno)
{
  
  if(url=='' || url==null)
  {
		alert("Username is Mandatory!");
		document.getElementById("name").focus();
		//return false;
  }
  else
  {
        
		
		if(document.getElementById("name").value.length < 6 || document.getElementById("name").value.length > 12) 
		{
			alert("Username must be between 6 to 12 characters long.");
			document.getElementById("name").focus();
			//return false;
		}
		else
		{ 	
		    var out = checkavailability(url,yesno);
		}
  }
  
}

function checkavailability3(url,yesno)
{
  
  if(url=='' || url==null)
  {
		alert("Username is Mandatory!");
		document.getElementById("name2").focus();
		//return false;
  }
  else
  {
        
		
		if(document.getElementById("name2").value.length < 6 || document.getElementById("name2").value.length > 12) 
		{
			alert("Username must be between 6 to 12 characters long.");
			document.getElementById("nam2e").focus();
			//return false;
		}
		else
		{ 	
		   document.registrationForm.name.value = document.registrationForm_bottom.name.value;
		   var out = checkavailability4(url,yesno);
		}
  }
  
}


function validateRegister_bottom(BObj)
{

	if(BObj.name.value=='' || BObj.name.value==null)
	{
		alert("Username is Mandatory!");
		BObj.name.focus();
		return false;
	}
	else
	{
		
		if(document.getElementById("name").value.length < 6 || document.getElementById("name").value.length > 12) 
		{
			alert("Username must be between 6 to 12 characters long.");
			document.getElementById("name").focus();
			//return false;
		}
		else
		{
			document.registrationForm.name.value = BObj.name.value;
		}
		
	}
	if(BObj.email.value=='' || BObj.email.value==null)
	{
		alert("Email Address is Mandatory!");
		BObj.email.focus();
		return false;
	}
	else
	{
		document.registrationForm.email.value = BObj.email.value;
	}
	
	if(BObj.email.value!="")
	{
		if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(BObj.email.value)))
		{
		alert("Please enter a valid email address.");
		BObj.email.focus();
		return false;
		}
    }
	else
	{
		document.registrationForm.email.value = BObj.email.value;
	}
	
	
	
	if(BObj.password.value=='' || BObj.password.value==null)
	{
		alert("Password is Mandatory!");
		BObj.password.focus();
		return false;
	}
	else
	{
		document.registrationForm.password.value = BObj.password.value;
	}	
	if(BObj.re_password.value=='' || BObj.re_password.value==null)
	{
		alert("Confirmation Password is Mandatory!");
		BObj.re_password.focus();
		return false;
	}
	if(BObj.password.value!=BObj.re_password.value)
	{
		alert("Passwords are not same!");
		BObj.re_password.focus();
		return false;
	}
	if(BObj.verification.value=='' || BObj.verification.value==null)
	{
		alert("Please Type the words are in Image!");
		BObj.verification.focus();
		return false;
	}
	else
	{
	var v1 = BObj.verification.value.toLowerCase();
	var v2 = BObj.ver_code.value.toLowerCase();
		if(v1!=v2)
		{
		alert("Please Type the Correct words are in Image!");
		BObj.verification.value='';
		refresh_captha();
		BObj.verification.focus();
		return false;
		}
	}

}

function show_ratesystem(vv)
{
	if(vv=='basic')
	{
		var info = document.getElementById("basicrate");
		info.style.display="block";
		var info2 = document.getElementById("premiumrate");
		info2.style.display="none";
		document.registrationForm_bottom.membershiptype.value="basic";
		 if (document.registrationForm_bottom.bratepar[0].checked)
		 {
			document.registrationForm_bottom.ratesystem.value=document.registrationForm_bottom.bratepar[0].value;
			document.registrationForm_bottom.monthyear.value='month';
		}			
		else
		{
			document.registrationForm_bottom.ratesystem.value=document.registrationForm_bottom.bratepar[1].value;
			document.registrationForm_bottom.monthyear.value='year';
		}
	}
	if(vv=='premium')
	{
		var info3 = document.getElementById("basicrate");
		info3.style.display="none";
		var info4 = document.getElementById("premiumrate");
		info4.style.display="block";
		document.registrationForm_bottom.membershiptype.value="premium";
		 if (document.registrationForm_bottom.pratepar[0].checked)
		 {
			document.registrationForm_bottom.ratesystem.value=document.registrationForm_bottom.pratepar[0].value;
			document.registrationForm_bottom.monthyear.value='month';
		}
		else
		{
			document.registrationForm_bottom.ratesystem.value=document.registrationForm_bottom.pratepar[1].value;
			document.registrationForm_bottom.monthyear.value='year';
		}
	}
	if(vv=='free')
	{
		var info3 = document.getElementById("basicrate");
		info3.style.display="none";
		var info4 = document.getElementById("premiumrate");
		info4.style.display="none";
		document.registrationForm_bottom.membershiptype.value="free";
		document.registrationForm_bottom.ratesystem.value='';
	}

}
function show_ratesystem2(rs)
{
	if(rs=='basic')
	{
		 if (document.registrationForm_bottom.bratepar[0].checked)
		 {
			document.registrationForm_bottom.ratesystem.value=document.registrationForm_bottom.bratepar[0].value;
			document.registrationForm_bottom.monthyear.value='month';
		}			
		else
		{
			document.registrationForm_bottom.ratesystem.value=document.registrationForm_bottom.bratepar[1].value;
			document.registrationForm_bottom.monthyear.value='year';
		}
			
	}
	if(rs=='premium')
	{
		 if (document.registrationForm_bottom.pratepar[0].checked)
		 {
			document.registrationForm_bottom.ratesystem.value=document.registrationForm_bottom.pratepar[0].value;
			document.registrationForm_bottom.monthyear.value='month';
		}
		else
		{
			document.registrationForm_bottom.ratesystem.value=document.registrationForm_bottom.pratepar[1].value;
			document.registrationForm_bottom.monthyear.value='year';
		}
	}

}


