// JavaScript Document
//alert('start');

function validateLogin()
{
	erorx = 0;
	if(document.loger.username)
	{
		if(document.loger.username.value == '' || document.loger.username.value == 'username')
		{
			erorx++;
			alert('please enter username');
			document.loger.username.focus();
			return false;
		}

		if(document.loger.password.value == '' || document.loger.password.value == 'password')
		{
			erorx++;
			alert('please enter password');
			document.loger.password.focus();
			return false;
		}
		if(erorx < 1)
		document.loger.submit();
	}
	
}

function showkey(id)
{
	
	var id1 = document.getElementById(id);
	if(id1.style.display == "none")
	id1.style.display = "block";
	else if(id1.style.display == "block")
	id1.style.display = "none";
	else
	id1.style.display = "block";

}




function show(id)
{
	var id1 = document.getElementById(id);
	if(id1.style.display == "none")
	id1.style.display = "block";
	else if(id1.style.display == "block")
	id1.style.display = "none";
	else
	id1.style.display = "block";

}

function showx(id)
{
	
	var id1 = document.getElementById(id);
	if(id1.style.display == "none")
	{
	
	id1.style.display = "block";
	id1.style.position = "absolute";
	
	
	}
	else if(id1.style.display == "block")
	{
	id1.style.display = "none";
	
	}
	else
	{
	id1.style.display = "block";
	id1.style.position = "absolute";
	}

}


function showxcon(id)
{
	
	
	var id1 = document.getElementById(id);
	var mainid = document.getElementById('main');
	var maincon = document.getElementById('laycon');

	var object = mainid.style; 
	var object2 = id1.style; 
	var object3 = maincon.style; 

	if(id1.style.display == "none")
	{
	
	id1.style.display = "block";
	id1.style.position = "absolute";
	mainid.style.backgroundColor='#000';


		document.body.style.backgroundColor='#000';
		object.backgroundColor='#000';
		object.opacity = '30'; 
		object.MozOpacity = '30'; 
		object.opacity='0.3';
		object.KhtmlOpacity = '30'; 
		object.filter = "alpha(opacity='30')";
		
	object2.opacity = '100'; 
	object2.MozOpacity = '100'; 
	object2.KhtmlOpacity = '100'; 
	object2.filter = "alpha(opacity='100')";
	
	object3.opacity = '100'; 
	object3.MozOpacity = '100'; 
	object3.KhtmlOpacity = '100'; 
	object3.filter = "alpha(opacity='100')";



	
	}
	else if(id1.style.display == "block")
	{
	id1.style.display = "none";
	id1.style.position = "absolute";
	mainid.style.backgroundColor='#fff';
	document.body.style.backgroundColor='';
	object.backgroundColor='#fff';
	
	object.opacity = '100'; 
	object.MozOpacity = '100'; 
	object.KhtmlOpacity = '100'; 
	object.filter = "alpha(opacity='100')";
	
	object2.opacity = '100'; 
	object2.MozOpacity = '100'; 
	object2.KhtmlOpacity = '100'; 
	object2.filter = "alpha(opacity='100')";
	
		object3.opacity = '100'; 
	object3.MozOpacity = '100'; 
	object3.KhtmlOpacity = '100'; 
	object3.filter = "alpha(opacity='100')";
			//document.body.style.backgroundImage = '';
		//object.backgroundImage = '';


	
	}
	else
	{
	id1.style.display = "none";
	id1.style.position = "absolute";
	mainid.style.backgroundColor='#fff';
	
		document.body.style.backgroundColor='';
	object.backgroundColor='#fff';

	object.opacity = '100'; 
	object.MozOpacity = '100'; 
	object.KhtmlOpacity = '100'; 
	object.filter = "alpha(opacity='100')";
		
	object2.opacity = '100'; 
	object2.MozOpacity = '100'; 
	object2.KhtmlOpacity = '100'; 
	object2.filter = "alpha(opacity='100')";
	
	object3.opacity = '100'; 
	object3.MozOpacity = '100'; 
	object3.KhtmlOpacity = '100'; 
	object3.filter = "alpha(opacity='100')";

	}
	
	
	object2.opacity = '100'; 
	object2.MozOpacity = '100'; 
	object2.KhtmlOpacity = '100'; 
	object2.filter = "alpha(opacity='100')";
	
	object3.opacity = '100'; 
	object3.MozOpacity = '100'; 
	object3.KhtmlOpacity = '100'; 
	object3.filter = "alpha(opacity='100')";

}
function validateRegxar()
{
			

	var erorxxx = 0;
	
		if(document.input1.usernamex && document.input1.usernamex.value == '')
		{
			
			alert('  الرجاء إدخال اسم المستخدم ');
			document.input1.usernamex.focus();
			erorxxx++;
			return false;
		}
	

		if(document.input1.passwordx && document.input1.passwordx.value == '' )
		{
			alert('الرجاء إدخال كلمة السر');
			document.input1.passwordx.focus();
			erorxxx++;
			return false;
		}

	
		if(document.input1.name && document.input1.name.value == '' )
		{
			alert('الرجاء إدخال الاسم الأول');
			document.input1.name.focus();
			erorxxx++;
			return false;
		}
		
		if(document.input1.lname && document.input1.lname.value == '' )
		{
			alert('الرجاء إدخال الاسم الاخير');
			document.input1.lname.focus();
			erorxxx++;
			return false;
		}
		if(document.input1.email)
	{
		var eml = document.input1.email.value ;
		if(document.input1.email.value == '')
		{
			alert('الرجاء إدخال البريد الالكتروني');
			document.input1.email.focus();
			erorxxx++;
			return false;
		}
		else
		{
			if (echeckar(eml)==false)
			{
				alert('الرجاء إدخال بريد إلكتروني صالح');
				document.input1.email.focus();
				erorxxx++;
				return false;
			}
		}
		
	}
	if(erorxxx < 1)
	{
	testar();
	return true;
	
	}
		
	
	
	
}
function echeckar(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   //alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    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
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }

 		 return true					
	}



