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 imgWin(image,width,height) {
self.name = "main"; // names current window as "main"

  	window.open("includes/imgWin.php?image=" + image, "popupwindow", 
  				"width=" + width + ",height=" + height + ",resizable,scrollbars");
	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 sort(x,y)
{
 var frm=document.forms['search'];
 frm.sort.value=x;
 frm.type.value=y;
 frm.search.value=1;
 frm.submit();
}
function dateString(oneDate) 
{
	var theDay = dayNames[oneDate.getDay() + 1]
	var theMonth = monthNames[oneDate.getMonth() + 1]
	var theYear = oneDate.getFullYear()
	return theDay +" "+ theMonth + " " + oneDate.getDate() + ", " + theYear
}
function ValidSet(frm)
{
	var txt="";
   
    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!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	  return false
	}
    return true	
}


function ValidCon(frm)
{
    var txt="";
	
	if(!frm.subject.value)
	{
		txt+="     Subject should not be empty.\n"
	}
	if(!frm.from.value)
	{
		txt+="     From should not be empty.\n"
	}
	if(!frm.email.value || !isEmail(frm.email.value))
	{
	   txt+="     Enter valid email address.\n"
       
 	}
	if(!frm.explain.value)
	{
		txt+="     You did not put any message.\n"
	}  
   	if(txt)
	{
   		alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	
}

function ValidConsp(frm)
{
    var txt="";
	
	if(!frm.subject.value)
	{
		txt+="     El tema no debe ser vacío.\n"
	}
	if(!frm.from.value)
	{
		txt+="     De no debe ser vacío.\n"
	}
	if(!frm.email.value || !isEmail(frm.email.value))
	{
	   txt+="     Incorpore el email address válido.\n"
       
 	}
	if(!frm.explain.value)
	{
		txt+="     You did not put any message.\n"
	}  
   	if(txt)
	{
   		alert("Apesadumbrado!! Se ha ocurrido lo que sigue errores :\n\n"+ txt +"\n     Por favor Cheque");
  	 	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!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	 

}

function ValidFpass(frm)
{
    var txt="";   
	
    if(!Trim(frm.admin_mail.value) || !isEmail(frm.admin_mail.value))
	{
	   txt+="     Enter valid email address\n"
       
 	}
 	if(txt)
	{
   		alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	 

}
function ValidAlogin(frm)
{
    var txt="";   
	
    if(!Trim(frm.pass.value))
	{
	   txt+="     Password should not be blank.\n"
       
 	}
 	if(txt)
	{
   		alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	 

}
function Validbook(frm)
{
    var txt="";   
	
    if(!frm.first_name.value)
	{
	   txt+="     First Name should not be blank.\n"
       
 	}
	if(!frm.last_name.value)
	{
	   txt+="     Last Name should not be blank.\n"
       
 	}
	if(!frm.email.value || !isEmail(frm.email.value))
	{
	   txt+="     Invalid Email ID.\n"
       
 	}
 	if(txt)
	{
   		alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	 

}


