// JavaScript Document
function echeck(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		var lengt = str.length;
		var the_substring = str.substring(lat+1);
        var exp1="entheosweb.com";
        if(the_substring==exp1)
        {
         return false;
        }
		if(lengt == (ldot+1))
		{
			return false;	
		}
		if (str.indexOf(at)==-1){
		   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					
	}
	function checknumber(name,str)
	{
	   var errmsg = '';
	   var ValidChars = "0123456789.";
	   var IsNumber=true;
	   var Char;
	   var numflag = 0;
	for (i = 0; i < str.length && IsNumber == true; i++) 
	   { 
		  Char = str.charAt(i); 
		  if (ValidChars.indexOf(Char) == -1) 
		  {
			 IsNumber = false;
			 numflag = 1;
		  }
	   }
		if(numflag==1)
		{
			return false;
		}
		return true;
	}

	function spider_cont()
	{
		var msg='';
		
		if(document.getElementById('cont_name').value == '')
		{
			msg += "Name Required \n";
		}
		if(echeck(document.getElementById('cont_email').value) == false && document.getElementById('cont_email').value != '')
		{
			msg += "Invalid Email \n";	
		}
		else if(document.getElementById('cont_email').value == '')
		{
			msg += "Email Required \n";	
		}
		if(document.getElementById('phone_ext').value == '')
		{
			msg += "Ext. Required \n";	
		}
		else if(checknumber("Ext.",document.getElementById('phone_ext').value) == false)
		{
			msg += "Ext. Should Have Numeric Value Only \n";		
		}
		else if((document.getElementById('phone_ext').value).length >  4)
		{
			msg += "Only Four Digit Ext Required \n";	
		}
		if(document.getElementById('phone_ext1').value == '')
		{
			msg += "Phone Required \n";	
		}
		else if(checknumber("Phone",document.getElementById('phone_ext1').value) == false)
		{
			msg += "Phone Should Have Numeric Value Only \n";		
		}
		else if((document.getElementById('phone_ext1').value).length >  10)
		{
			msg += "Only 10 Digit Number Required \n";	
		}
		
		if(document.getElementById('shk1').checked == false && document.getElementById('shk2').checked == false && document.getElementById('shk3').checked == false && document.getElementById('shk4').checked == false && document.getElementById('shk5').checked == false && document.getElementById('shk6').checked == false)
		{
			msg += "At Least One Service Required \n";	
		}
		if(validatewebsiteurl(document.getElementById('website').value)== false && document.getElementById('website').value != '')
		{
			msg += "Invalid Website Url \n";	
		}
		if(document.getElementById('sec').value == '')
		{
			msg += "Security Code Required \n";	
		}
		if(msg != '')
		{
			alert(msg);
			return false;
		}
		else
		{
			return true;
		}
	}
	
	function OpenPopUpWindow(theURL,winName,features, myWidth, myHeight, isCenter) {
	//alert(myWidth); //v3.0
	  if(window.screen)if(isCenter)if(isCenter=="true"){
		var myLeft = (screen.width-myWidth)/2;
		var myTop = (screen.height-myHeight)/2;
		features+=(features!='')?',':'';
		features+=',left='+myLeft+',top='+myTop;
	  }
	  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight		);
	}
	
	function change_color(a)
	{
		if(a == 1)
		{
		document.getElementById("left_over").bgColor = "#A3100D";
		document.getElementById("head").style.color = "#A3100D";
		}
		else
		{
		document.getElementById("left_over").bgColor = "#DDDDDD";
		document.getElementById("head").style.color = "#555555";
		}
	}
	function change_color1(a)
	{
		if(a == 1)
		{
		document.getElementById("left_over1").bgColor = "#A3100D";
		document.getElementById("head1").style.color = "#A3100D";
		}
		else
		{
		document.getElementById("left_over1").bgColor = "#DDDDDD";
		document.getElementById("head1").style.color = "#555555";
		}
	}
	function change_color2(a)
	{
		if(a == 1)
		{
		document.getElementById("left_over2").bgColor = "#A3100D";
		document.getElementById("head2").style.color = "#A3100D";
		}
		else
		{
		document.getElementById("left_over2").bgColor = "#DDDDDD";
		document.getElementById("head2").style.color = "#555555";
		}
	}
	function text_color_change(a)
	{
		if(a == 1)
		{
			document.getElementById("pd").style.color = "#A3100D";
		}
		else if(a==2)
		{
			document.getElementById("ecm").style.color = "#A3100D";
		}
		else if(a==3)
		{
			document.getElementById("cms").style.color = "#A3100D";
		}
		else if(a==8)
		{
			document.getElementById("onpop").style.color = "#A3100D";
		}
		else if(a==9)
		{
			document.getElementById("lbng").style.color = "#A3100D";
		}
		else if(a==10)
		{
			document.getElementById("dirsub").style.color = "#A3100D";
		}
		else if(a==11)
		{
			document.getElementById("contwr").style.color = "#A3100D";
		}
		else if(a==12)
		{
			document.getElementById("artsub").style.color = "#A3100D";
		}
		else if(a==13)
		{
			document.getElementById("blogp").style.color = "#A3100D";
		}
		else
		{
			
			document.getElementById("contwr").style.color = "#555555";
			document.getElementById("blogp").style.color = "#555555";
			document.getElementById("artsub").style.color = "#555555";
			document.getElementById("dirsub").style.color = "#555555";
			document.getElementById("lbng").style.color = "#555555";
			document.getElementById("onpop").style.color = "#555555";
			document.getElementById("cms").style.color = "#555555";
			document.getElementById("ecm").style.color = "#555555";
			document.getElementById("pd").style.color = "#555555";
		}
	}
	
function validatewebsiteurl(nField){
var msg ='';
		var URL = nField;
		if (!/^http:\/\/.+/.test(URL) || (!/\.com$|\.gov$|\.org$|\.net$|\.in$|\.mil$/.test(URL)))
			{
				return false;
			}
			else
			{
				return true;	
				}
	}
