function contactfields()
{
	var obj = document.contact_form;
	if(obj.name.value=="")
	{
		alert("Sorry! we cannot complete your request, please enter your name");
		obj.name.focus();
		return false;
	}
	if(obj.email.value=="")
	{
		alert("Sorry! we cannot complete your request, please enter your email id");
		obj.email.focus();
		return false;
	}
	if(!is_email(obj.email.value))
	{
		alert("Sorry! we cannot complete your request, please enter valid email");
		obj.email.focus();
		return false;
	}
	if(obj.subject.value=="")
	{
		alert("Sorry! we cannot complete your request, please select subject ? ");
		obj.subject.focus();
		return false;
	}
	if(obj.message.value=="")
	{
		alert("Sorry! we cannot complete your request, please enter the message");
		obj.message.focus();
		return false;
	}
	if(obj.captcha_code.value=="")
	{
		alert("Sorry! we cannot complete your request, please enter the security code as given below");
		obj.captcha_code.focus();
		return false;
	}
}
function replyfields()
{
	var obj = document.reply_form;
	if(obj.title.value=="")
	{
		alert("Sorry! we cannot complete your request, please enter mail title");
		obj.title.focus();
		return false;
	}
	if(obj.from.value=="")
	{
		alert("Sorry! we cannot complete your request, please enter mail from text");
		obj.from.focus();
		return false;
	}
	
} 
function showhide(id)
{
	if (document.getElementById)
	{
		obj = document.getElementById(id);
		if (obj.style.display == "none")
		{
		obj.style.display = "";
		} 
		else 
		{
		obj.style.display = "none";
		}
	}
}

function CheckAll(chk)
{
	
	if(document.contact_form.checkboxall.checked == false)
	{
		if(document.contact_form.chkcount.value==1)
		{
		 document.contact_form.checkbox.checked = false
		}
		else
		{
			for (i = 0; i < chk.length; i++)
			chk[i].checked = false ;
		}
	}
	else
	{

		if(document.contact_form.chkcount.value==1)
		{
		 document.contact_form.checkbox.checked = true
		}
		else
		{
			for (i = 0; i < chk.length; i++)
			chk[i].checked = true ;
		}

	}
}

function validationjs11()
{

var j="F";
if(document.contact_form.chkcount.value==1)
{
  if(document.contact_form.checkbox.checked == true)
  {
 	 j="T";
  }
}
else
{
	
	
  for(var i=0; i < document.contact_form.chkcount.value; i++)
  {
	 
  	if(document.contact_form.checkbox[i].checked == true)
	{
		//alert('vikas');
  	j="T";
  	}
  }
}

if(j=="F"){
alert("Error: Select atleast one record!");
return false;
}else{
	if(document.contact_form.action.value==""){
	alert("Select Any Action!");
	return false;
}
return confirm("Are you sure ?");
}
}


function selectAll(field)
{

for (i = 0; i < field.length; i++)
	field[i].selected = true ;
}
function unselectAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].selected = false ;
}

function is_email(str) 
{

	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   
	   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;
	}
	else
	 return true;					
}
function IsNumeric(sText)

{

   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;
   for (i = 0; i < sText.length && IsNumber == true; i++) 
   { 
   		 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
      {
		 
         IsNumber = false;
      }
   }
   return IsNumber;
   
}

