function doBlink() {
  var blink = document.all.tags("BLINK")
  for (var i=0; i < blink.length; i++)
    blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "" 
}
function startBlink() {
  if (document.all)
    setInterval("doBlink()",1000)
}
window.onload = startBlink;

function isEmail(Ml)
{
  if(!Ml){return true}
  if(Ml.indexOf("@")<=0 || Ml.indexOf("@")==Ml.length-1 || Ml.indexOf(".")<=0 || Ml.indexOf(".")==Ml.length-1 || Ml.indexOf("..")!=-1 || Ml.indexOf("@@")!=-1 || Ml.indexOf("@.")!=-1 || Ml.indexOf(".@")!=-1)
  {
      return false
  }
  else
  {
      return true
  }
}
function Trim (s){return LTrim(RTrim(' '+s));}
function LTrim (s)
{
    if(!s){return '';}
    while(s.charAt(0)==' ')
        s = s.substring(1,s.length);
    return s;
}
//..............
function RTrim (s)
{
    if(!s || s==' '){return '';}
    if (s.length > 1)
    {
        while(s.charAt(s.length-1)==' ')
            s = s.substring(0,s.length-2);
        return s;
    }
}
function ValidSet(frm)
{
	var txt="";
    if(!frm.city_id.value)
	{   
	   txt+="     Select City Name.\n";
	}
    if(!frm.site_title.value)
	{   
	   txt+="     Site Title should not be blank.\n";
	}
	
	if(!frm.admin_mail.value)
	{
	   txt+="     Admin Email Address should not be blank.\n";
	}
	if(!frm.meta_keys.value) 
	{
	   txt+="     Meta Keys should not be blank.\n";
	}
	if(!frm.meta_desc.value) 
	{
	   txt+="     Meta Description should not be blank.\n";
 	}
	if(txt)
	{
   	  alert("Sorry. The following errors have been occured :\n\n"+ txt +"\n     Please Check");
  	  return false
	}
    return true	
}
function ValidPass(frm)
{
    var txt="";   
    if(!frm.pass.value || frm.pass.value.length<4) 
	{
	   txt+="     Password should not be blank or password less than 4 chars.\n"
	}	
 	if(txt)
	{
   		alert("Sorry. The following errors have been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	 

}



function ValidCon(frm)
{
    var txt="";
	
	if(!frm.fname.value)
	{
		txt+="     First Name should not be empty.\n"
	}
	if(!frm.lname.value)
	{
		txt+="     Last Name should not be empty.\n"
	}
	if(!frm.email.value || !isEmail(frm.email.value))
	{
	   txt+="     Enter valid email address.\n"
       
 	}
	if(!frm.phone.value)
	{
		txt+="     Phone Number should not be empty.\n"
	}
	if(!frm.message.value)
	{
		txt+="     You did not put any Comment.\n"
	}  
   	if(txt)
	{
   		alert("Sorry. The following errors have been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	
}

function ChkLogin(frm)
{
    var txt="";
	
	if(!frm.email.value || !isEmail(frm.email.value))
	{
		txt+="     Invalid Email ID.\n"
	}
	
	if(!frm.password.value)
	{
		txt+="     You did not put Password.\n"
	}  
   	if(txt)
	{
   		alert("Sorry. The following errors have been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	
}

function validulogin(frm)
{
    var txt="";  
	if(!frm.Login.value) 
	{
	   txt+="     Username should not be blank.\n"
	}
    if(!frm.Password.value) 
	{
	   txt+="     Password should not be blank.\n"
	}	
 	if(txt)
	{
   		alert("Sorry. The following errors have been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	 

}

function validnewletter(frm)
{
    var txt="";
	
	if(!frm.email.value || !isEmail(frm.email.value))
	{
		txt+="     Invalid Email ID.\n"
	}
	
	
   	if(txt)
	{
   		alert("Sorry. The following errors have been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	
}
