// JavaScript Document

<!--               Right Click Disable Script                 -->
var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")
-->


///////////////////       email validaion ///////
function EmailValidation(Element)
	{
		Flag  = 1;
		count = 0;
	
		var alp = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_@.-";
		
		if(Element.value.length > 0)
		{
			for (var i=0; i<Element.value.length; i++)
			{
				temp = Element.value.substring(i, i+1);
	
				if (alp.indexOf(temp) == -1)
				{
					Flag = 0;
				}
			} // closing the for loop
		}
		else
		{
			Flag = 0;
		}
	
		for(var i=0; i <= Element.value.length; i++)
		{
			if(Element.value.charAt(0)=='@')
			{
				Flag = 0;
				break;
			}

			if(Element.value.charAt(Element.value.length-1)=='@')
			{
				Flag = 0;
				break;
			}

			if(Element.value.charAt(i)=='@') 
			{
				count = count + 1;

				if(count>1)
				{
					Flag = 0;
					break;
				}
			  
				if((Element.value.charAt(i-1)=='.') || (Element.value.charAt(i+1)=='.'))
				{
					Flag = 0;
					break;
				}
			}
			if(Element.value.indexOf('@')==-1)
			{
				Flag = 0;		    	
				break;
			}
			if(Element.value.charAt(0)=='.')
			{
				Flag = 0;
				break;
			}
			if(Element.value.indexOf('.')==-1)
			{
				Flag = 0;		    	
				break;
			}
		  } //closing the for loop
		///// added  
		if (Element.value.indexOf('..') > 0){
			Flag=0;
		}
		//////
		if(Element.value.charAt(Element.value.length-1) == '.')
			Flag = 0;
			
		if(Flag != 1)
		{
			alert("Invalid Email Address.\nValid Characters are [a-z][A-Z][0-9][ _ @ . - ].");
			Element.focus();
			return 0;
		}	
		else
			return 1;
	}
//        end email validation/////
///////////////////////////////Login validation//////////////////////////
function login()
{
	
	var username = document.formx1.username.value;
	var password = document.formx1.password.value;
		if(username == "")
		{
			alert("Please enter User Name.");
			document.formx1.username.focus();
			return false;
		
		}	
		if(password == "")
		{
			alert("Please enter Password.");
			document.formx1.password.focus();
			return false;
		
		}	
	else
	{
		document.formx1.action='login.php';
		document.formx1.submit();
	}

}
////////////////////////////////End //////////////////////////////////////////////////

//////////////////////////////Logout ////////////////////////////////////////////////
function logout()
{       
		document.formx1.action='logout.php';
		document.formx1.submit();
}
/////////////////////////////////////End ///////////////////////////////////////





function Valid_Publisher() {
	
		var username = document.publisher_register.username.value;
		if(username == "")
		{
			alert("Please Enter UserID.");
			document.publisher_register.username.focus();
			return false;
		
		}
		
		var passwd = document.publisher_register.passwd.value;
		if(passwd == "")
		{
			alert("Please Enter Password.");
			document.publisher_register.passwd.focus();
			return false;
		
		}	
		
		var passwd1 = document.publisher_register.passwd1.value;
		if(passwd1 == "")
		{
			alert("Please Enter Confirm Password.");
			document.publisher_register.passwd1.focus();
			return false;
		
		}
		
		if(passwd != passwd1) {
			alert("Your Password and confirm Password are Not Matching.");
			document.publisher_register.passwd1.value="";
			document.publisher_register.passwd1.focus();
			return false;	
			
		}
		
		var first_name = document.publisher_register.first_name.value;
		if(first_name == "")
		{
			alert("Please Enter First Name.");
			document.publisher_register.first_name.focus();
			return false;
		
		}		
		
		var last_name = document.publisher_register.last_name.value;
		if(last_name == "")
		{
			alert("Please Enter Last Name.");
			document.publisher_register.last_name.focus();
			return false;
		
		}
		
		var phone = document.publisher_register.phone.value;
		if(phone == "")
		{
			alert("Please Enter Phone.");
			document.publisher_register.phone.focus();
			return false;
		
		}
		
		email=document.publisher_register.email.value;
		if(!EmailValidation(document.publisher_register.email,'Email','','')) {
		return false;
		}

		var address1 = document.publisher_register.address1.value;
		if(address1 == "")
		{
			alert("Please Enter Address.");
			document.publisher_register.address1.focus();
			return false;
		
		}

		var city = document.publisher_register.city.value;
		if(city == "")
		{
			alert("Please Enter City.");
			document.publisher_register.city.focus();
			return false;
		
		}
		
		var state = document.publisher_register.state.value;
		if(state == "")
		{
			alert("Please Enter State.");
			document.publisher_register.state.focus();
			return false;
		
		}

		var zip = document.publisher_register.zip.value;
		if(zip == "")
		{
			alert("Please Enter ZipCode.");
			document.publisher_register.zip.focus();
			return false;
		
		}
		
		var site_url = document.publisher_register.site_url.value;
		if(site_url == "")
		{
			alert("Please Enter Website URL.");
			document.publisher_register.site_url.focus();
			return false;
		
		}
		
		var cnt = -1;
	    for (var i=document.publisher_register.site_type.length-1; i > -1; i--) {
        if (document.publisher_register.site_type[i].checked) {cnt = i; i = -1;}
    	}
    	if (cnt > -1) {
			
			if(document.publisher_register.site_type[cnt].value==5 && document.publisher_register.site_type_value.value=="") {
				alert("Please Enter Site type.");
				document.publisher_register.site_type_value.focus();
				return false;				
			}
			
		} else {	
		alert("Please Select Site Type.");	
			return false;
		} 
		
		var ssn = document.publisher_register.ssn.value;
		if(ssn == "")
		{
			alert("Please Enter Social Security Number.");
			document.publisher_register.ssn.focus();
			return false;
		
		}	
		
		if (document.publisher_register.agree_yes.checked == false) {
			alert("Please Check Terms & Conditions.");
			document.publisher_register.agree_yes.focus();
			return false;
			
		}
		
		var security_code = document.publisher_register.security_code.value;
		if(security_code == "")
		{
			alert("Please Enter SecurityCode.");
			document.publisher_register.security_code.focus();
			return false;
		
		}

		
	
}
/////////////////////////////////////////////////
function Pub_Login() {
		var username = document.publisher_login.username.value;
		if(username == "")
		{
			alert("Please Enter UserID.");
			document.publisher_login.username.focus();
			return false;
		
		}
		
		var passwd = document.publisher_login.passwd.value;
		if(passwd == "")
		{
			alert("Please Enter Password.");
			document.publisher_login.passwd.focus();
			return false;
		
		}	


}

////////////////////// for got password///////////////////////////
function Forgot_Publisher() {
		var email = document.publisher_forgot.email.value;
		if(email == "")
		{
			alert("Please Enter Email.");
			document.publisher_forgot.email.focus();
			return false;
		
		}
		
		


}
////////////////////// Myaccount  ///////////////////////////

function Valid_Myaccount() {
	
	
		var passwd1 = document.publisher_account.passwd1.value;
		if(passwd1!="") {
			var passwd2 = document.publisher_account.passwd2.value;
			if(passwd2 == "")
			{
				alert("Please Enter Confirm Password.");
				document.publisher_account.passwd2.focus();
				return false;
			
			}
			if(passwd1 != passwd2) {
			alert("Your Password and confirm Password are Not Matching.");
			document.publisher_account.passwd1.value="";
			document.publisher_account.passwd2.focus();
			return false;	
			}
		
		}
}