function password_validate(p1, p2)
{
	if(p1.value.trim()=="" || p2.value.trim()=="")
	{
		document.getElementById("pwd").src="pics/smiley_frown.gif";
		document.getElementById("pwd").alt="Password Not Matches";		
		return true;
	}
	
																		
	 
	if(p1.value.trim() != p2.value.trim() )
	{

		 
		//alert("incorrect");		 
	}
	else
	{
		//alert("corect");
		document.getElementById("pwd").src="pics/smiley_laugh.gif";
		document.getElementById("pwd").alt="Password Not Matches";
		 
	}
	 
}

function validate_form_register(p0,p1, p2,email)
{
	 var ans=false;
	 if(p1.value.trim() != p2.value.trim() )
	 {
		 document.getElementById("pwd").src="pics/smiley_frown.gif";
		 document.getElementById("pwd").alt="Password Not Matches";
		 ans= false; 
	 }
	 else
	 {
		if(p1.value.trim() =="")
		{
			document.getElementById("pwd").src="pics/smiley_frown.gif";
			document.getElementById("pwd").alt="Password Not Matches";
			ans= false; 
		}
		else
		{
			document.getElementById("pwd").src="pics/smiley_laugh.gif";
			document.getElementById("pwd").alt="Oh Yeah";
			ans= true; 			
		}
	 }
	 if(p0.value.trim()=="")
	 {
		 document.getElementById("usrname").innerHTML="User Name Cannot be Empty";
		 ans= false; 
	 }
	ans= ValidateEmail(email);
	 return ans;
	 
}

function prompt_delete()
{
	var res =	confirm("Are You Sure You Want to Delete?");
	if(res==true)
	{
		return true;
	}
	else
	{
		return false;
	}
}
///////////////////////////////////////////////////////////////////////////
var xmlhttp = false;
//Check if we are using IE.
try 
{
	//If the Javascript version is greater than 5.
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	//alert ("You are using Microsoft Internet Explorer.");
} 
catch (e) 
{
	//If not, then use the older active x object.
	try 
	{
		//If we are using Internet Explorer.
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		//alert ("You are using Microsoft Internet Explorer");
	} 
	catch (E) 
	{
		//Else we must be using a non-IE browser.
		xmlhttp = false;
	}
}
//If we are using a non-IE browser, create a javascript instance of the object.
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') 
{
	xmlhttp = new XMLHttpRequest();
	//alert ("You are not using Microsoft Internet Explorer");
}

function makerequest(serverPage, objID,ldimg) 
{ 
	
	document.getElementById(ldimg).style.display="block";
	var obj = document.getElementById(objID);
	xmlhttp.open("POST", serverPage);
	xmlhttp.onreadystatechange = function() 
	{
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) 
		{
			obj.innerHTML = xmlhttp.responseText;
		}
	}
	xmlhttp.send(null);
	document.getElementById(ldimg).style.display="none";
}



function ajaxExecute(serverPage, objID,ldimg) 
{ 
	
	document.getElementById(ldimg).style.display="block";
	var obj = document.getElementById(objID);
	xmlhttp.open("POST", serverPage);
	xmlhttp.onreadystatechange = function() 
	{
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) 
		{
			obj.innerHTML = xmlhttp.responseText;
		}
	}
	xmlhttp.send(null);
	document.getElementById(ldimg).style.display="none";
}

 
function echeck(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){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function ValidateEmail(obj){
	var emailID=obj;
	
	if ((emailID.value==null)||(emailID.value=="")){
		emailID.focus()
		return false;
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus();
		return false;
	}
	return true;
 }
 

function RegisterUnregister(val,v2)
{
	if(val=="Registered")
	{
		v2.style.visibility="visible";
	}
	else
	{
		v2.style.visibility="hidden";
 
	}	
}

function notify_help_show(notify_id)
{ 
	notify_id.style.display="block";	
}
function notify_help_hide(notify_id)
{ 	
	notify_id.style.display="none";	
}


var elementEmpty=false;
function check_empty(id)
{ 
	
	if(id.value=="")
	{ 
		id.style.background='#FFAAAA';
		elementEmpty=true;
	}
	else
	{ 
		id.style.background='#FFFFFF';
		elementEmpty=false;
	}
}












