		function pop_menu(page_req)
		{
			switch (page_req)
			{
				// these change location:
				case "":
				case "?page=prequal":
					//document.location.href = "index-old.php"+page_req;
					document.location.href = "index-old.php";
					break;
				// this spawns the popup:
				default:
					page_url = page_req;					
					window.open(page_url,"popwin","width=500,height=550,resizable=no,scrollbars=yes,toolbar=no,menubar=no");
					break;
			}
		}



function e(s) {
	rex=true;
	if (window.RegExp) 
	{
		st="a";ex=new RegExp(st);
		if (st.match(ex)) {
		r1=new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
		r2=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)\$");
		b=(!r1.test(s)&&r2.test(s));
		}
		else 
		{
			rex=false;
		}
	} 
	else
	{
		rex=false;
	}

	if(!rex) b=(s.indexOf("@")>0 && s.indexOf(".")>0 && s!="" && s!="enter e-mail");
	return (b);
}

function f(h) 
{
	h.focus();
	h.select();
}
function val(fld) 
{
	s=fld.value;
	if(e(s)) 
	{
		if (checkform()) 
		{
		document.Entry.datatype.value = "Todd";
		}
		else 
		{
		//f(fld);
			return false;
		}

		if (clearform()); 
	} 
	else 
	{
		alert("Please include a proper e-mail address, of the form id\@domain.zzz or id\@domain.xx.zzz.");
		document.Entry.Email.focus();
		//f(fld);
		return false;
	}
}




function ltrim(str) { 
	for(var k = 0; k < str.length && isWhitespace(str.charAt(k)); k++);
	return str.substring(k, str.length);
}
function rtrim(str) {
	for(var j=str.length-1; j>=0 && isWhitespace(str.charAt(j)) ; j--) ;
	return str.substring(0,j+1);
}
function trim(str) {
	return ltrim(rtrim(str));
}
function isWhitespace(charToCheck) {
	var whitespaceChars = " \t\n\r\f";
	return (whitespaceChars.indexOf(charToCheck) != -1);
}





function isDigit(c)
{   return ((c >= "0") && (c <= "9"))
}

function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}

function isInteger (s)
{   
	var i,vval;
	vval="";

    if (isEmpty(s)) 
       if (isInteger.arguments.length == 1) return defaultEmptyOK;
       else return (isInteger.arguments[1] == true);

    // Search through string's characters one by one
    // until we find a non-numeric character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);


        if (isDigit(c)) 
		{
			vval="True";
			break;
		}
		else
			vval="False";
			
    }

    // All characters are numbers.

	if(vval=="True")
		return true;
	else
		return false;
}



function isChars (s)
{   
	var i,vval;
	vval="";

    if (isEmpty(s)) 
       if (isChars.arguments.length == 1) return defaultEmptyOK;
       else return (isChars.arguments[1] == true);

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);


        if (!isDigit(c)) 
		{
			vval="True";
			break;
		}
		else
			vval="False";
			
    }

    // All characters are numbers.

	if(vval=="True")
		return true;
	else
		return false;
}



function LTrim(str)
{
   var whitespace = new String(" \t\n\r");

   var s = new String(str);

   if (whitespace.indexOf(s.charAt(0)) != -1) {

      var j=0, i = s.length;


      while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
         j++;

      s = s.substring(j, i);
   }
   return s;
}


function RTrim(str)
{
   var whitespace = new String(" \t\n\r");

   var s = new String(str);

   if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {

      var i = s.length - 1;      

      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
         i--;

      s = s.substring(0, i+1);
   }

   return s;
}

function trim(str)
{   
   return RTrim(LTrim(str));
}



function mycheck()
{

	if (document.CallBack.name.value == null || document.CallBack.name.value.length == 0 || trim(document.CallBack.name.value) == "") 
	{
		alert("\nPlease Enter your Name.");
		document.CallBack.name.value="";
		document.CallBack.name.focus();
		return false;
	}

	if (isInteger(trim(document.CallBack.name.value)) == true)
	{
			alert("\nNo numbers allowed in your Name.");
			document.CallBack.name.value="";
			document.CallBack.name.focus();
			return false;		
	}

	if (document.CallBack.email.value == null || document.CallBack.email.value.length == 0 || trim(document.CallBack.email.value) == "") 
	{
		alert("\nPlease Enter your Email.");
		document.CallBack.email.focus();
		return false;
	}

	if (!e(document.CallBack.email.value))
	{

		alert("Please include a proper e-mail address, of the form id\@domain.zzz or id\@domain.xx.zzz.");
		document.CallBack.email.focus();
		//f(fld);
		return false;
	}

	if (document.CallBack.phone.value == null || document.CallBack.phone.value.length == 0 || trim(document.CallBack.phone.value) == "") 
	{
		alert("\nPlease Enter your Contact Phone Number.");
		document.CallBack.phone.focus();
		return false;
	}

	if (isChars(document.CallBack.phone.value) == true)
	{
			alert("\nNo Alphabets allowed in Phone number");
			document.CallBack.phone.focus();
			return false;		
	}

	
	if (trim(document.CallBack.product.value) == "") 
	{
		alert("\nPlease select the Product.");
		document.CallBack.product.value="";
		document.CallBack.product.focus();
		return false;
	}
	
	if (document.CallBack.captcha_code.value == null || document.CallBack.captcha_code.value.length == 0 || trim(document.CallBack.captcha_code.value) == "") 
	{
		alert("\nPlease Enter the Security Code.");
		document.CallBack.captcha_code.value="";
		document.CallBack.captcha_code.focus();
		return false;
	}

}






function mycheckcontact()
{

	if (document.Contact.formname.value == null || document.Contact.formname.value.length == 0 || trim(document.Contact.formname.value) == "") 
	{
		alert("\nPlease Enter your Name.");
		document.Contact.formname.value="";
		document.Contact.formname.focus();
		return false;
	}

	if (isInteger(trim(document.Contact.formname.value)) == true)
	{
			alert("\nNo numbers allowed in your Name.");
			document.Contact.formname.value="";
			document.Contact.formname.focus();
			return false;		
	}

	if (document.Contact.formemail.value == null || document.Contact.formemail.value.length == 0 || trim(document.Contact.formemail.value) == "") 
	{
		alert("\nPlease Enter your Email.");
		document.Contact.formemail.focus();
		return false;
	}

	if (!e(document.Contact.formemail.value))
	{

		alert("Please include a proper e-mail address, of the form id\@domain.zzz or id\@domain.xx.zzz.");
		document.Contact.formemail.focus();
		//f(fld);
		return false;
	}

	if (document.Contact.formcomments.value == null || document.Contact.formcomments.value.length == 0 || trim(document.Contact.formcomments.value) == "") 
	{
		alert("\nPlease Enter your Message.");
		document.Contact.formcomments.value="";
		document.Contact.formcomments.focus();
		return false;
	}
	
}
