// JavaScript Document
function validate_Browser()
	{
		var val = navigator.userAgent.toLowerCase();
		   if(val.indexOf("firefox") > -1)
      {          
       document.getElementById("pwd").style.width = '202px';
	  }
     else if(val.indexOf("opera") > -1)
     {
  document.getElementById("pwd").style.width = '200px';
     }
     else if(val.indexOf("msie") > -1)
     {
  document.getElementById("pwd").style.width = '400px';
     } 
    else if(val.indexOf("safari") > -1)
     {
   document.getElementById("pwd").style.width = '200px';
     }
	}
function Reg_validation()
{
	
	    var frm = document.Registration;     
	   
	   if (frm.FirstName.value == "")
		{
			alert("Please enter your first name.");
			frm.FirstName.focus();
			return false;
		}
		if (frm.LastName.value == "")
		{
			alert("Please enter your last name.");
			frm.LastName.focus();
			return false;
		}
		
		if((frm.EmailId.value==null)||(frm.EmailId.value==""))
		{
			alert("Please Enter Email ID");
			frm.EmailId.focus();
			return false;
		}
		if (echeck(frm.EmailId.value)==false){
			frm.EmailId.value="";
			frm.EmailId.focus();
			return false;
		}
		if (frm.City.value == "")
		{
			alert("Please enter your city.");
			frm.City.focus();
			return false;
		}
		if (frm.UserName.value == "")
		{
			alert("Please enter User Name.");
			frm.UserName.focus();
			return false;
		}
		if (frm.Password.value == "")
		{
			alert("Please enter password.");
			frm.Password.focus();
			return false;
		}
		if (frm.Cpassword.value == "") 
		{
			alert("Please enter Confirm password.");
			frm.Cpassword.focus();
			return false;
		}
		if (frm.Cpassword.value!=frm.Password.value )
		{
			alert("Please enter correct Confirm password.");
			frm.Cpassword.value = "";
			frm.Cpassword.focus();
			return false;
		}
      return true;
}

function Login_va()
{
	
	    var frm = document.Login;     
	   
	  
		if (frm.UserName.value == "")
		{
			alert("Please enter User Name.");
			frm.UserName.focus();
			return false;
		}
		if (frm.Password.value == "")
		{
			alert("Please enter password.");
			frm.Password.focus();
			return false;
		}
	      return true;
}
	function Contact_Validate()
	{
		
			var frm = document.contact;     
		   
		  
			if (frm.fname.value == "")
			{
				alert("Please enter First Name.");
				frm.fname.focus();
				return false;
			}
			if (frm.lname.value == "")
			{
				alert("Please enter Last Name.");
				frm.lname.focus();
				return false;
			}
			if (frm.email.value == "")
			{
				alert("Please enter Email Id.");
				frm.email.focus();
				return false;
			}
			if (frm.rcontact.value == "")
			{
				alert("Please enter Reason for Contact.");
				frm.rcontact.focus();
				return false;
			}
			if (frm.comment.value == "")
			{
				alert("Please enter Comment.");
				frm.comment.focus();
				return false;
			}
			  return true;
	}
function echeck(str)
	{
		var at="@";
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID");
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID");
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID");
		    return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID");
		    return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID");
		    return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID");
		    return false;
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID");
		    return false;
		 }

 		 return true;					
	}
	function Comment() 
	{
		var frm = document.comment;     
		   
		  
			if (frm.comment.value == "")
			{
				alert("Please enter Comment.");
				frm.comment.focus();
				return false;
			}

 		 return true;					
	}
	function Validate_upImages() 
	{
		var frm = document.upload;     
			if (frm.type_G.value == "")
			{
				alert("Please select type.");
				frm.type_G.focus();
				return false;
			}
			if (frm.Title.value == "")
			{
				alert("Please enter title for Image.");
				frm.Title.focus();
				return false;
			}
			if (frm.Pic.value == "")
			{
				alert("Please select Image.");
				frm.Pic.focus();
				return false;
			}
 		 return true;					
	}