// JavaScript Document

function validate_form(thisform)
	{

	
	
	with(thisform)
		{
	  
		////////////////////Null Check 
		
    if (validate_Size(fromhight,"From height should not be greater than to height...Example - Height between 20 - 100 inches OR 20 - 100 cm ...!!!")==false)
		 { fromhight.focus(); return false; }
		 
	if (validate_width(fromwidth,"From width should not be greater than to width...Example - Width between 20 - 100 OR 20 - 100 cm...!!!")==false)
		 { fromwidth.focus(); return false; }
			 
			 
	if (validate_price(fromprice,"From Price should not be greater than to Price...Example - Price between  5000 - 20000 Rs. OR  500 - 1000 $...!!!")==false)
		 { fromprice.focus(); return false; }
		 
		if (validate_Doll_price(fromprice,"Please Enter dollar price greater than 500$...Example - Price between 500 - 1000 $...!!!")==false)
		 { fromprice.focus(); return false; }	 
			 
		
		if (Validate_Integer(fromhight,"Please enter valide from height") == false)
 			 { fromhight.focus(); return false; }
		if (Validate_Integer(tohight,"Please enter valide To height") == false)
 			 { tohight.focus(); return false; }
		if (Validate_Integer(fromwidth,"Please enter valide From width") == false)
 			 { fromwidth.focus(); return false; }
	    if (Validate_Integer(towidth,"Please enter valide To width") == false)
 			 { towidth.focus(); return false; }
	    if (Validate_Integer(fromprice,"Please enter valide from price") == false)
 			 { fromprice.focus(); return false; }
		if (Validate_Integer(toprice,"Please enter valide To price") == false)
 			 { toprice.focus(); return false; }	 
		
		  			  
		} 
		

	
	
	  }
	  
	  
/////////////////////////////////////////
	  
function Validate_Integer(field,alerttxt){
	with (field)
	{
	var i;
    for (i = 0; i < value.length; i++){   
        // Check that current character is number.
        var c = value.charAt(i);
        if (((c < "0") || (c > "9"))) 
		{
		alert(alerttxt)
		return false;}
    }
    // All characters are numbers.
    return true;
	}
}	  
	  
	  
/////////////////////////////////////////

function validate_Doll_price(field,alerttxt)
	{
	with (field)
	{
		if (document.frm.pricein.value == "$")
		{
		if (parseFloat(document.frm.fromprice.value) < 500 )
		  {alert(alerttxt);return false;}
		else {return true}
		}
	}
	}	  
	  
/////////////////////////////////////////

function validate_price(field,alerttxt)
	{
	with (field)
	{
		if (parseFloat(document.frm.fromprice.value) > parseFloat(document.frm.toprice.value))
		  {alert(alerttxt);return false;}
		else {return true}
	}
	}
	  
	  
	  
	  
	  /////////////////////////////////////////	
function validate_width(field,alerttxt)
	{
	with (field)
	{
		if (parseFloat(document.frm.fromwidth.value) > parseFloat(document.frm.towidth.value))
		  {alert(alerttxt);return false;}
		else {return true}
	}
	}
	  

/////////////////////////////////////////	
function validate_Size(field,alerttxt)
	{
	with (field)
	{
		if (parseFloat(document.frm.fromhight.value) > parseFloat(document.frm.tohight.value))
		  {alert(alerttxt);return false;}
		else {return true}
	}
	}
	  
	  
///////////////////////////////////////////////////////////////////////
function validate_accountno(field,alerttxt)
	{
	with (field)
	{
		if (value.length != 10)
		  {alert(alerttxt);return false;}
		else {return true}
	}
	}
////////////////// Validation For find ' in text area	
	
	function validate_text(field,alerttxt)
	{
	with (field)
	{
	 	 var patt2=new RegExp("'");
         var ans;
          ans = (patt2.test(value));
           if (ans == true)
               {alert(alerttxt);return false;}
		     else {return true}
	}
	}
	


//////////////////////////////////////////////////////////////////////
function validate_required(field,alerttxt)
	{
	with (field)
	{
		if (value==null||value=="")
		  {alert(alerttxt);return false;}
		else {return true}
	}
	}
	

/////////////////////////////////////////////////////////////////////	
	function noNumbers(e)
	{
		var keynum;
		var keychar;
		var numcheck;if(window.event) // IE
		{
		  keynum = e.keyCode;
	     }
		else if(e.which) // Netscape/Firefox/Opera
	    {
		  keynum = e.which;
		}
		keychar = String.fromCharCode(keynum);
		numcheck = /\d/;
		return !numcheck.test(keychar);
	}
	
	function Numbers(e)
	{
			var keynum;
			var keychar;
			var numcheck;
			
			if(window.event) // IE
				{
				keynum = e.keyCode;
				}
			else if(e.which) // Netscape/Firefox/Opera
				{
				keynum = e.which;
				}
			keychar = String.fromCharCode(keynum);
			numcheck = /\d/;
			return numcheck.test(keychar);
		}
		//////////////////////////////////////////////////////////////


var ctrlFlag=false;function noKeyPaste(e){ if((e.keyCode?e.keyCode:e.which)==17) {  ctrlFlag=true;  return false; } else if(ctrlFlag) {  return false; } else  return true;}function resetCtrl(e){ if((e.keyCode?e.keyCode:e.which)==17)  ctrlFlag=false;} 






