// JavaScript Document

 


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function goto_URL(object) {
window.location.href =  object.options[object.selectedIndex].value;
}


function openDefWin(theURL) { //v2.0
defWin = window.open(theURL,"defWin","scrollbars=yes,width=300,height=250,screenX=30,screenY=70,left=30,top=70");
}

function openSearchWin(theURL) { //v2.0
searchWin = window.open(theURL,"searchWin","scrollbars=yes,width=550,height=475,screenX=0,screenY=0,left=0,top=0");
}

function openCompareWin(theURL) { //v2.0
compareWin = window.open(theURL,"compareWin","scrollbars=yes,resizable=yes,width=780,height=380,screenX=0,screenY=0,left=0,top=0");
}

function feedbackVal()
{
    var error_string = "";
    // check the feedback field
    if (window.document.form1.feedback.value == "")
    {
        error_string += "You forgot to include your feedback!";
    }

    if (error_string == "")
    {
	   return true;
	   
    } else {
        error_string = error_string;
        alert(error_string);
        return false;
    } 
}


function LaunchCompare1()
{


var idlist;
idlist = document.form1.p1.value + ',' + document.form1.p2.value + ',' + document.form1.p3.value+ ',' + document.form1.p4.value+ ',' + document.form1.p5.value;
if (idlist == "0,0,0,0,0") 
	alert("Please select at least one product in order to view expaneded information.");
 else 
		openCompareWin('comparison-table.asp?IDList=' + idlist);
}

function LaunchCompare2()
{
var idlist="";
var comma="";
for (i=0; i < document.form1.chkProduct.length; i++) {
	if (document.form1.chkProduct[i].checked) {
		idlist += comma + document.form1.chkProduct[i].value;
		if (comma == "") comma = ",";
	}
}
if (idlist == "")
	alert ("Please check at least one product in order to view expanded information.")
else
	openCompareWin('comparison-table-rec.asp?IDList=' + idlist);
//idlist = form1.p1.value + ',' + form1.p2.value + ',' + form1.p3.value+ ',' + form1.p4.value+ ',' + form1.p5.value;
//openCompareWin('comparison-table.asp?IDList=' + idlist);
}

function dsVal()
{
    var error_string = "";
    // check the product number field
    if (window.document.form1.productnumber.value == "")
    {
        error_string += "You must type in all or part of a product number\n";
    }

    if (error_string == "")
    {
	   return true;
	   
    } else {
        error_string = error_string;
        alert(error_string);
        return false;
    } 
}


function evalkitVal()
{
    var error_string = "";
    // check the first name field
    if (window.document.theForm.client_name.value == "")
    {
        error_string += "You must enter your name.\n";
    }

 // check the company field
    if (window.document.theForm.client_company.value == "")
    {
        error_string += "You must enter your company name.\n";
    }

// check the phone field
    if (window.document.theForm.client_phone.value == "")
    {
        error_string += "You must enter your phone number.\n";
    }

// check the email field
    if (window.document.theForm.client_email.value == "")
    {
        error_string += "You must enter a valid email address.\n";
    }

// check the product number field
    if (window.document.theForm.product_kit.value == "")
    {
        error_string += "You must enter a product number.\n";
    }

    if (error_string == "")
    {
	   if (confirm("You have entered the following email address as the address \n" + "at which you would like to be contacted: \n\n" + window.document.theForm.client_email.value + "\n\n" + "If the address is correct, please click \"OK\".\n\n" + "If not, click \"cancel\" and make the necessary corrections."))
		{
		return true;
		} else {
		return false;
		}

	   
    } else {
        error_string = "We found the following ommisions in your form submission: \n\n" + error_string;
        alert(error_string);
        return false;
    } 
}

function tellusVal()
{
    var error_string = "";
    // check the first name field
    if (window.document.theForm.client_name.value == "")
    {
        error_string += "You must enter your name.\n";
    }

 // check the company field
    if (window.document.theForm.client_company.value == "")
    {
        error_string += "You must enter your company name.\n";
    }

// check the phone field
    if (window.document.theForm.client_phone.value == "")
    {
        error_string += "You must enter your phone number.\n";
    }

// check the email field
    if (window.document.theForm.client_email.value == "")
    {
        error_string += "You must enter a valid email address.\n";
    }

// check the product description field
    if (window.document.theForm.feedback.value == "")
    {
        error_string += "You forgot to tell us about your application.\n";
    }

    if (error_string == "")
    {
	   if (confirm("You have entered the following email address as the address \n" + "at which you would like to be contacted: \n\n" + window.document.theForm.client_email.value + "\n\n" + "If the address is correct, please click \"OK\".\n\n" + "If not, click \"cancel\" and make the necessary corrections."))
		{
		return true;
		} else {
		return false;
		}
	   
    } else {
        error_string = "We found the following ommisions in your form submission: \n\n" + error_string;
        alert(error_string);
        return false;
    } 
}

function performSearch() {
searchTerm = document.searchForm.searchField.value;
searchTermQuery = "/search-results.asp?searchField=" + searchTerm;

window.location.href = searchTermQuery;
}

function checkEvent(e) {
var unicode=e.keyCode? e.keyCode : e.charCode;
//alert(unicode);
if (unicode == 13) {
	//alert("Test");

searchTerm = document.searchForm.searchField.value;
searchTermQuery = "/search-results.asp?searchField=" + searchTerm;

window.location.href = searchTermQuery;

}

}