//################################################################# GET METHOD
		function setstate() 
			{
				if (xmlHttp.readyState==3 || xmlHttp.readyState==2 || xmlHttp.readyState==1)
				{ 
				//document.getElementById("notification").innerHTML="<div style='padding=5px'>Still working....</div>";
				}

				if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
				{
					if ( xmlHttp.responseText == "c" )
					{
					document.getElementById("notification").innerHTML="<div style='padding:5px'>Your email or password is invalid please check again if you forget your password please fill your email and  <a href=# onclick='forget()' >click here</a></div>"
					}
					if ( xmlHttp.responseText == "b" )
					{
					document.getElementById("notification").innerHTML="<div style='padding:5px'>Kindly check your email you should received a validation email to activate your account</div>"
					}
					if (  xmlHttp.responseText == "a" )
					{
					window.location.reload( true );
					}
					if ( xmlHttp.responseText != "b" && xmlHttp.responseText != "c" && xmlHttp.responseText != "a"  )
					{
					window.location=xmlHttp.responseText;
					}
    			//else { document.getElementById("txtstate").innerHTML=xmlHttp.responseText }
				} 
			}
//#####################################################################################################################################################################
		function setstate1() 
			{
				if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
				{
				document.getElementById("notification").innerHTML=xmlHttp.responseText	
				}
			}
			
//######################################################################################################################################################################		
				function reg() 
			{
				if (xmlHttp.readyState==3 || xmlHttp.readyState==2 || xmlHttp.readyState==1)
				{ 
				//document.getElementById("notification").innerHTML="Problem fetching!";
				}
				if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
				{
				$(document).ready(function(){$('#submitl').slideUp();});
				$(document).ready(function(){$('#submitn').slideDown();});
					if ( xmlHttp.responseText == "a" )
					{
   					document.getElementById("submitn").innerHTML="Your validation answer is not correct! please verify it"
					document.getElementById("validation").value=""
					document.getElementById("validation").focus();
					}
					if ( xmlHttp.responseText == "b" )
					{ 
					document.getElementById("submitn").innerHTML="It seems that your already registered if you need to initialize your account <a href='contact.php?status=account'>send to web admin here</a> | if you forget your password <a href=# onclick='forgetreg()' >click here</a>";
					}
					if ( xmlHttp.responseText == "c" )
					{
					document.getElementById("submitn").innerHTML="You are successfully registered please check your email to activate your account";
					}
					//else { document.getElementById("notification").innerHTML=xmlHttp.responseText; }
				}
			}
			
function setedit() 
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
	$(document).ready(function(){$('#submitl').slideUp();});
	$(document).ready(function(){$('#submitn').slideDown();});
	document.getElementById("submitn").innerHTML=xmlHttp.responseText	
	setTimeout(function(){$("#submitn").slideUp();}, 4500);
	}
}
			
//#####################################################################################################################################################################

		function setstate0()
		{				
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
				{	document.getElementById("notification").innerHTML=""; }
	    }
			
			

//################################################################################################ LOGIN 
function login(str)
{
	if ( str == "verify")
	{
		if ( email('12email') == false ) { return false ; } ;
		if ( input('password') == false ) { return false; } ;
		str1="&email="+i("12email")+"&password="+i("password")+"&remember="+checkbox("remember");
		loading()
		geturlos("verify-login",str1,"validate",setstate);
	}
}

//################################################################################################ FORGET
function forget()
{
		loading()
if ( email('12email') == false ) { return false ; } ;
str1="&email="+va("12email");
geturlos("verify-login",str1,"forgetpass",setstate1);
}

//################################################################################################## FORGET REG SPECIAL for forget password when registering
function forgetreg()
{
$('#box').slideDown(500);
document.getElementById("notification").innerHTML="<div style='padding:4px'>Kindly Fill your email and <a href='#' onclick='forget()'>click here to send your recovery password to your mail</a>";
}


//################################################################################################ REGISTER
function register()
{
var strs,sell;
strs="1";
		if ( ninput('firstname') =="0" ) { strs="0"; }
		if ( ninput('lastname') =="0" ) { strs="0"; }
		if ( nemail('temail') =="0" ) { strs="0"; }
		if ( ninput('profession') =="0" ) { strs="0"; }
		if ( ninput('country') =="0" ) { strs="0"; }
		if ( npass() =="0" ) { strs="0"; }
		if ( ninput('validation') =="0" ) { strs="0"; }
		//send the data
		if ( strs == "1" ) {
			$('#submitl').slideDown();
			if ( document.getElementById('sell').value == "yes" ){sell="yes"}	
			if ( document.getElementById('sell').value == "no" ||  document.getElementById('sell').value == ""  ){sell="no"}
			str="&sell="+sell+ajaxs('firstname lastname temail profession country password1 validation ivalidation paypal bankwire wu mg cc'); 
		geturlos("verify-login",str,"register",reg);
		}
}
//trigger up down
function regsell()
{
		if ( i('sell') == "no" )
		{
		$('div#sellform').slideUp(500); // time based speed (ms)
		}
		
		if ( i('sell') == "yes" )
		{
		$('div#sellform').slideDown(500); // time based speed (ms)
		document.getElementById("bankwire").style.color="#C3C3C3";
		document.getElementById("bankwire").value="//for example:" +'\n'+ "Accout name: Georges Dean"+'\n'+ "Bank name:Atlantic bank"+'\n'+ "Account number:12345678"+'\n'+ "Accout routing:12345678";

		}
}
		

//################################################################################################ LOGOUT
function logout()
{
a="&logout=logout";
geturlos("verify-login",a,"logout",setstate);	
}


//###################################################################################### GET URL FOR NORMAL REDIRECTION
function geturl()
{

var a;
a="&url="+window.location;
geturlos("verify-login",a,"url",setstate0);
}

//#####################################################################################################################################################################
//DETAILS FOR EDIT CUSTOMER
//#####################################################################################################################################################################
function customeredit()
{
var strs,sell;
strs="1";

		if ( nemail('uemail') =="0" ) { strs="0"; }
		if ( ninput('country') =="0" ) { strs="0"; }
		if ( ninput('profession') =="0" ) { strs="0"; }
		if ( npass() =="0" ) { strs="0"; }
			if ( i('sell') == "yes" )
			{
				if ( ninput('wu') =="0" ) { strs="0"; }	
				if ( ninput('mg') =="0" ) { strs="0"; }		
				if ( ninput('cc') =="0" ) { strs="0"; }	
			}
		if ( i('paypal') == "" || i('bankwire') == "" || i('wu') == "no" || i('mg') == "no" || i('cc') == "no" )
		{
			$(document).ready(function(){$('#submitn').slideDown();});
			document.getElementById("submitn").innerHTML="<b>CHOOSE AT LEAST ONE PAYMENT METHOD</b>" ; 
			setTimeout(function(){$("#submitn").slideUp();}, 8500);
			strs == "0" ; 
		}
		//send the data
		if ( strs == "1" ) {
			$(document).ready(function(){$('#submitl').slideDown();});
			if ( i('sell') == "yes" ){sell="yes"}	
			if ( i('sell') == "no" ){sell="no"}
		str="&sell="+sell+"&bankwire="+va("bankwire")+"&paypal="+va("paypal")+"&wu="+va("wu")+"&mg="+va("mg")+"&cc="+va("cc")+"&email="+va("uemail")+"&country="+va("country")+"&profession="+va("profession")+"&password="+va("password1")+"&cedit="+va("cedit");
		geturlos("verify-login",str,"edit",setedit);
		}
		
		//document.ce.submit();
}

//////shipping edit 
function shippingedit()
{
		loading()
		if ( input('firstname') == false ) { return false; } ;
		if ( input('lastname') == false ) { return false; } ;
		if ( input('company') == false ) { return false; } ;
		if ( input('address') == false ) { return false; } ;
		if ( phonella('slphone') == false ) { return false; } ;
		if ( phonella('smobile') == false ) { return false; } ;
		if ( input('city') == false ) { return false; } ;
		if ( input('state') == false ) { return false; } ;
		if ( input('zip') == false ) { return false; } ;
		if ( input('country') == false ) { return false; } ;
		
		document.editshipping.submit();
}


////EDIT REVIEW
function reviews(s,get)
{
	if ( s == "a")
	{
		if ( input('reviews') == false ) { return false; } ;
				document.getElementById("rereviews").submit();
	}
	if ( s == "b")
	{
	window.location='newmodules/edit.php?reviews='+get+'&url='+window.location;	
	}
}


///SEND EMAIL FRIEND
function toemailfriend()
{
	
if ( input('fullname') == false ) { return false; } ;
if ( email('yemail') == false ) { return false ; } ;
if ( email('femail') == false ) { return false ; } ;
		document.emailfriend.submit();
	
}



//SEND NEWSLETTER
function nl()
{
if ( email('newsletter') == false ) { return false ; } ;	
	
	document.letter.submit();
}