// JavaScript Document
function check_form(frm,arr1,arr2)
{
	var arr_1;
	var arr_2,st1;
	alert(arr_1.length);	
	arr_1=arr1.split('|');
	arr_2=arr2.split('|');
	st1='Please enter following mandatory fields \n';
	//alert(document.forms[frm].elements[arr_1[6]].checked);
    var flag=true;
	  for(var i=0;i<arr_1.length;i++)
	   {
	     if(document.forms[frm].elements[arr_1[i]].value=='' )
		    {
				st1+=arr_2[i]+'\n';
				flag=false;
			}
	   }
	/* if(document.forms[frm].elements[arr_1[6]].checked==false)
	 {
	     st1+=arr_2[6]+'\n';
		 flag=false;
	 }*/
	if(flag==true)
	 {
		return true;
	 }
	 else
	 {
		  alert(st1);
		  return false;
	 }
	 
}
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 email id")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid email id")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid email id")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid email id")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid email id")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid email id")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid email id")
		    return false
		 }

 		 return true					
	}

function chkEmail(obj){
	
	var emailID=obj
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please enter email id")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }
function getKeyCharCode(event) 
{
	var key = null;
	if (window.event) {
		//ie
		key = window.event.keyCode;
	} else if (event.which) {
		key = event.which;
	}
	return key;
}
function IsNumeric(event)
    {
      /* var key=(evt.which) ? evt.which : event.keyCode
       if ((key >= 48) && (key <58) || (key == 46) || (key==8) || (key==127))
       {
       return true;
       }
       else
       {
       return false;
       }*/
			var isMozilla = false;
			if (!window.event && event.which) 
			{
				isMozilla = true;
			}
			var key = getKeyCharCode(event);
			var isNumeric = false;
			if (key != null) 
			{
				if (key >= 48 && key <= 58)	 
				{
					// key is numeric
					isNumeric = true;
				} 
				else if (key == 46) 
				{
					// key is a decimal point
					isNumeric = true;
				} 
				else if (key == 13) 
				{
					//13 is a return
					isNumeric = true;
				} 
				else if (key == 8 && isMozilla) 
				{
					//8 is a backspace with mozilla
					isNumeric = true;
				}
			} 
			else 
			{
				isNumeric = true;
			}
			return isNumeric;
	   /////
  }
  
  function fade()
{
 document.getElementById('test_1').style.display="";
 //alert("check");
}

function fade_out()
{
	document.getElementById('order').style.display="";
	document.getElementById('test_1').style.display="none";
	//document.getElementById('test_2').style.display="none";
}
 
