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 makeArray(n) 
{
this.length = n
return this
}
monthNames = new makeArray(12)
monthNames[1] = "January"
monthNames[2] = "February"
monthNames[3] = "March"
monthNames[4] = "April"
monthNames[5] = "May"
monthNames[6] = "June"
monthNames[7] = "July"
monthNames[8] = "August"
monthNames[9] = "September"
monthNames[10] = "October"
monthNames[11] = "November"
monthNames[12] = "December"

dayNames=new makeArray(7)
dayNames[1]="Sunday";
dayNames[2]="Monday";
dayNames[3]="Tuesday";
dayNames[4]="Wednesday";
dayNames[5]="Thursday";
dayNames[6]="Friday";
dayNames[7]="Saturday";

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.fname.value)
	{
		txt+="     First Name should not be empty.\n"
	}
	if(!frm.lname.value)
	{
		txt+="     Last Name should not be empty.\n"
	}
	if(!Trim(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!! Following errors has 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!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	 

}
function ValidCat(frm)
{
    var txt="";   
    if(!frm.cat_name.value) 
	{
	   txt+="     Category Name 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 ValidSubcat(frm)
{
    var txt="";   
    if(!frm.sub_cat_name.value) 
	{
	   txt+="     Sub Category Name Name 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 ValidEditor(frm)
{
    var txt="";   
    if(!frm.cont_title.value) 
	{
	   txt+="     Title 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 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 ValidEvent(frm)
{
	var txt="";
   
    if(!frm.eventname.value)
	{   
	   txt+="     Event Name should not be blank.\n";
	}
	if(!frm.eventorg.value)
	{
	   txt+="     Event Organizer should not be blank.\n";
	}
	if(!frm.shortdescription.value) 
	{
	   txt+="     Short Description should not be blank.\n";
	}
	if(!frm.longdescription.value) 
	{
	   txt+="     Long Description should not be blank.\n";
	}
	if(!frm.startdate.value) 
	{
	   txt+="     Start Date 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 ValidBanner(frm)
{
	var txt="";
   
    if(!frm.size.value)
	{   
	   txt+="     Please select any Banner Size.\n";
	}			
	if(txt)
	{
   	  alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	  return false
	}
    return true	
}

function ValidchkName(frm)
{
    var txt="";  
	
	if((!frm.username.value) || (frm.username.value =="Nombre"))
	{   
	   txt+="     Name should not be empty.\n";
	}
    if(!Trim(frm.email.value) || !isEmail(frm.email.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 Validtellfriend(frm)
{
	var txt="";
   
    if(!frm.sender_name.value) 
	{
	   txt+="     Your Name should not be blank.\n";
	}	
	if(!Trim(frm.sender_email.value) || !isEmail(frm.sender_email.value))
	{
	   txt+="     Enter valid email address\n"
       
 	}
	if(!frm.message.value) 
	{
	   txt+="     Message 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 ValidFeedback(frm)
{
    var txt="";
	if(!frm.fd_by.value)
	{
		txt+="     Name should not be empty\n"
	}	
	if(!frm.email.value || !isEmail(frm.email.value))
	{
	    txt+="     Enter valid email address\n";
    }
	if(!frm.fd_desc.value)
	{
	   	txt+="     Description should not be empty\n";	
	}
	
   	if(txt)
	{
   		alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	
}

function ValidContact(frm)
{
    var txt="";
	
	if(!frm.fname.value)
	{
		txt+="     Please put your first name.\n"
	}
	if(!frm.lname.value)
	{
		txt+="     Please put your last name.\n"
	}	
	
	if(!frm.email.value || !isEmail(frm.email.value))
	{
	   txt+="     Please enter valid email address.\n"
       
 	}
	 
	if(!frm.message.value)
	{
		txt+="     You did not put any message.\n"
	} 
   	if(txt)
	{
   		alert("Sorry. The following errors have been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	
}


function isValidNumber(inpString) {
   return /^[-+]?\d+(\.\d+)?$/.test(inpString);
}

function ValidReg1(frm)
{
	var txt="";
	
	   if(!Trim(frm.email.value) || !isEmail(frm.email.value))
	   {
		   txt+="     Enter valid email address.\n";       
 	   }
	   
	   if(!Trim(frm.email.value))
	   {   
		   txt+="     Your retype email field should not be empty .\n";
	   }  
	   
	   if(frm.email.value!=frm.remail.value)
	   {   
		   txt+="     Your retype email is wrong .\n";
	   }
	    
	   if(!Trim(frm.login.value))
	   {   
		   txt+="     You have not entered a user name .\n";
	   }   
	   
	   
 	   if(txt)
	   {
   		  alert("Sorry. The following errors have occurred :\n\n"+ txt +"\n     Please Check");
  	 	  return false
	   }
       return true	
}
