function checkData(){
	frm = document.theForm;
	return  lengthValid(frm.NAME, 4,"full name") && lengthValid(frm.COMPANY, 5,"Company Name") && emailValid(frm.EMAIL, 4,"Email") 
	    &&  lengthValid(frm.PHONE, 10,"ten digits phone number");
	}
	
function windowhref(i) {
    if (i==1) window.location.href=('/granot/home.htm');
    if (i==2) window.location.href=('/pop/is/leads/gateway.htm');
    if (i==3) window.location.href=('/granot/oms.htm');
    if (i==4) window.location.href=('/granot/visual.htm');
    if (i==5) window.location.href=('/wc.dll?mpest~indexwc~DEMOMOVE~w~entry');
    if (i==6) window.open('/granot/onlineest.htm','NewPopWin','channelmode,scrollbars');
    if (i==7) window.location.href=('/wc.dll?isweb~processwc');
    if (i==8) window.location.href=('/granot/catalog.htm');
    if (i==9) window.location.href=('/granot/contactus.htm');
    if (i==10) window.location.href=('https://secure.granot.com/money/admin.htm');
    if (i==11) window.location.href=('https://secure.granot.com/money/admin.htm');
    	}

function SubmitInfo() {
       document.theForm.action="/granot/wc.dll?is~custinfo";
       document.theForm.submit();
    }


function ContactUs() {
		if (checkData()) {
       document.theForm.action="/infosys/wc.dll?isutil~contactusret";
       document.theForm.submit();
      }
   }

//function to validate by length
function lengthValid(field, len, text) {
    // text = Trim(text);
	if (field.value.length < len)
  	{
 	  	alert("Please enter a valid " + text + ".");
		field.focus();
		return false;
	}else{
		return true;
	}
}

//function to validate email
function emailValid(mailfield, len, text) {
   // text = Trim(text);
	if(mailfield.value.length < len || mailfield.value.indexOf("@") < 1 || mailfield.value.indexOf(".") < 2)
	{
	    alert("Please enter a valid " + text + ".");
		mailfield.focus();
		return false;
	}else{
		return true;
	}
}

//function to validate Zip Code fields
function zipValid(field,len, text) {
    //text = Trim(text);
	if (isNaN(field.value) || field.value.length < len)
  	{
 	  	alert("Please enter a valid " + text + ".");
		field.focus();
		return false;
	}else{
		return true;
	}
}
