<!--
function swap_left_navi(el)
{
	if(el.className == "showit")
	{
		el.className = "hideit";	
	}
	else
	{
		el.className = "showit";
	}
}


function softwarepackagesPage()
{
	//window.open("softwarepackages.htm","","toolbar=no,scrollbars=yes,resizable=yes,width=800,height=600");

	scr = "yes";
	w = 631;
	h = 500;
	
	winprops = 'height='+h+',width='+w+',scrollbars='+scr+',resizable';

	window.open("softwarepackages.htm","",winprops);
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
//MM_reloadPage(true);
function validate(ctl, type)
{
	if(type == "email_address")
	{
		if(ctl.value.indexOf("@",0) < 0)
		{
			alert("Please enter a valid email address");
			ctl.value = "";
			ctl.focus();
			return;
		}
	}
	else if(type == "zipcode")
	{
		if(isNaN(ctl.value))
		{	
			alert("Please enter a valid zip code");
			ctl.value = "";
			ctl.focus();
			return;
		}
	}
	else if(type == "phone_number")
	{
		if(0)
		{
			alert("Please enter a valid phone number");
			ctl.value = "";
			ctl.focus();
			return;
		}
	}
	else if(type == "phone_extension")
	{
		if(0)
		{
			alert("Please enter a valid phone extension");
			ctl.value = "";
			ctl.focus();
			return;
		}	
	}
	else if(type == "select")
	{
		// the select cannot have selectedIndex == 0
		if(ctl.selectedIndex == 0)
		{
			alert("Please Select a value");
			ctl.focus();
			return;
		}
	}
	else if(type == "quantity")
	{
		//if(((isNAN(ctl.value)) && (ctl.value.length > 1)) || (ctl.value < 0))
		var t;
		t = ctl.value;
		
		//alert("ctl.name: " + ctl.name + "  ctl.value: " + ctl.value + "   t: " +  t);
		//alert('t.indexOf(".",0)');
		if(t.indexOf(".",0) != -1)
		{
			alert("Please enter a valid quantity.");
			ctl.value = "";
			ctl.focus();
			return;	
		}	
		else if(!((t > -1) && (t < 1000)))
		{
			alert("Please enter a valid quantity.");
			ctl.value = "";
			ctl.focus();
			return;	
		}
		
		
	}
	else	//ctl.value must have a value
	{
		if(0)
		{
			alert("Please enter a value");
			ctl.value = "";
			ctl.focus();
			return;
		}
	}
}
function validate_all(frm)
{
	var i,j,k;
	for(j = 0; j < frm.elements.length; j++)
	{
		if((frm.elements[j].title == 'This Field is Required') && (frm.elements[j].value.length == 0))
		{
			//make em go fix it
			alert("Please enter a value in this required field");
			frm.elements[j].focus();
			return;				
		}
		else if(frm.elements[j].title == 'Required: Please Select a Value')
		{
			 if(frm.elements[j].selectedIndex == 0)
			 {
				//index 0 should always be set to 'Please Select'
				alert("Please select a value for this required field");
				frm.elements[j].focus();
				return;				
			 }
		}
	}
	frm.submit();
}
function validate_summary(frm)
{
	
	//alert("here");
	var oktosubmit
	oktosubmit = 0
	var i,j,k;
	for(j = 0; j < frm.elements.length; j++)
	{
		if((frm.elements[j].title == 'This Field is Required') && (frm.elements[j].value.length == 0))
		{	
			//make em go fix it
			alert("Please enter a value in this required field");
			frm.elements[j].focus();
			return;				
		}
		else if(frm.elements[j].title == 'Required: Please Select a Value')
		{
			 if(frm.elements[j].selectedIndex == 0)
			 {
				//index 0 should always be set to 'Please Select'
				alert("Please select a value for this required field");
				frm.elements[j].focus();
				return;				
			 }
		}
		else if(frm.elements[j].name == "payment_type")
		{
			
			if((frm.elements[j].value == "gc") && (frm.elements[j].checked == true))
			{
				//alert("here");
				oktosubmit = 1;
			}
			else if((frm.elements[j].value == "cc") && (frm.elements[j].checked == true))
			{
				if((frm.cc_type.options[frm.cc_type.selectedIndex].value != "0") && (frm.cc_number.value.length > 14) && (frm.cc_exp_month.options[frm.cc_exp_month.selectedIndex].value != "0") && (frm.cc_exp_year.options[frm.cc_exp_year.selectedIndex].value != "0"))	
				{
					oktosubmit = 1;
				}
				else
				{
					alert("Please enter your credit card information");
					//alert("->" + frm.cc_type.options[frm.cc_type.selectedIndex].value + "  ->" + 
					
					
					
					frm.cc_type.focus();
					return;	
				}
			}
			else if((frm.elements[j].value == "po") && (frm.elements[j].checked == true))
			{
				if((frm.po_number.value.length > 0) && (frm.po_name.value.length > 0) && (frm.po_phone.value.length > 0))
				{
					oktosubmit = 1;					
				}
				else
				{
					alert("Please enter your purchase order information");
					frm.payment_method.focus();
					return;	
				}
			}		
			
			
		}
	
	}
	if(oktosubmit)
	{
		frm.submit();
	}
}
function validate_update(frm)
{
	var oktosubmit
	oktosubmit = 0
	var i,j,k;
	for(j = 0; j < frm.elements.length; j++)
	{
		if((frm.elements[j].title == 'This Field is Required') && (frm.elements[j].value.length == 0))
		{	
			//make em go fix it
			alert("Please enter a value in this required field");
			frm.elements[j].focus();
			return;				
		}
		else if(frm.elements[j].title == 'Required: Please Select a Value')
		{
			 if(frm.elements[j].selectedIndex == 0)
			 {
				//index 0 should always be set to 'Please Select'
				alert("Please select a value for this required field");
				frm.elements[j].focus();
				return;				
			 }
		}
//		else if(frm.elements[j].name == "payment_type")
//		{
//			if((frm.elements[j].value == "cc") && (frm.elements[j].checked == true))
//			{
//				if((frm.cc_type.options[frm.cc_type.selectedIndex].value != "0") && (frm.cc_number.value.length > 15) && (frm.cc_exp_month.options[frm.cc_exp_month.selectedIndex].value != "0") && (frm.cc_exp_year.options[frm.cc_exp_year.selectedIndex].value != "0"))	
//				{
//					oktosubmit = 1;
//				}
//				else
//				{
//					alert("Please enter your credit card information");
//					frm.cc_type.focus();
//					return;	
//				}
//			}
//			else if((frm.elements[j].value == "po") && (frm.elements[j].checked == true))
//			{
//				if((frm.po_number.value.length > 0) && (frm.po_name.value.length > 0) && (frm.po_phone.value.length > 0))
//				{
//					oktosubmit = 1;					
//				}
//				else
//				{
//					alert("Please enter your purchase order information");
//					frm.payment_method.focus();
//					return;	
//				}
//			}		
//			
//			
//		}
	
	}
//	if(oktosubmit)
//	{
		frm.submit();
//	}
}
function P7_autoLayers() { //v1.2 by PVII
 var g,b,k,f,args=P7_autoLayers.arguments;
 var a = parseInt(args[0]);if(isNaN(a))a=0;
 if(!document.p7setc) {p7c=new Array();document.p7setc=true;
  for (var u=0;u<10;u++) {p7c[u] = new Array();}}
 for(k=0; k<p7c[a].length; k++) {
  if((g=MM_findObj(p7c[a][k]))!=null) {
   b=(document.layers)?g:g.style;b.visibility="hidden";}}
 for(k=1; k<args.length; k++) {
  if((g=MM_findObj(args[k])) != null) {
   b=(document.layers)?g:g.style;b.visibility="visible";f=false;
   for(j=0;j<p7c[a].length;j++) {
    if(args[k]==p7c[a][j]) {f=true;}}
  if(!f) {p7c[a][p7c[a].length++]=args[k];}}}
}

var pW = null    			// use this when referring to pop-up window
var wCnt = 0
var wName = "prodHATCH_pW"
var default_distance = 100

///////////////////////////////////////////////////////////////////////////////
//  Function: openPopWin
//  ---------
//
//  Parameters:
//  -----------
//  wURL -- url of document to be loaded into window or "". 
//  wWdth -- width of image in pixels. 
//  wHgt -- height of image in pixels.
//  wFeatures -- a comma separated list of additional features, see below. 
//  wLft -- specifies the distance in pixels the pop-up window is from the left.
//  wTop -- specifies the distance in pixels the pop-up window is from the top.
//  NOTE:: wURL, wWdth, and wHgt are required. wFeatures, wLft, and wTop are optional.
//
//  Additional pop-up window features:
//  ----------------------------------
//  Including the comma separated list for wFeatures is optional. 
//  Listed below is the meaning of each feature.
//  toolbar -- creates the standard browser toolbar. 
//  location -- creates a location entry field. 
//  directories -- creates the standard browser directory buttons. 
//  status -- creates the status bar at the bottom of the window. 
//  menubar -- creates the menu at the top of the window. 
//  scrollbars -- creates scrollbars when the document grows larger than the window. 
//  resizable -- allows the user to resize the window.  
//
//  IMPORTANT NOTE:
//  ---------------
//  If "", which is a zero length string, is used for the wURL,
//  then you must dynamically write the document. The advantage 
//  of dynamically writing the code is that the document is already 
//  loaded and will be displayed much faster.
/////////////////////////////////////////////////////////////////////////////// 
function openPopWin(wURL, wWdth, wHgt, wFeatures, wLft, wTop){
    var default_wLft = default_distance  // default, pixels from screen left to window left
    var default_wTop = default_distance  // default, pixels from screen top to window top
    wName = "prodHATCH_pW" + wCnt++  // unique name for each pop-up window
    closePopWin() // close any previously opened pop-up window
  
    if (openPopWin.arguments.length >= 4) // any additional features? 
        wFeatures = "," + wFeatures
    else 
  	wFeatures = ""
  	 
    if (openPopWin.arguments.length == 6)  // location specified
    	wFeatures += getLocation(wWdth, wHgt, wLft, wTop)
    else
    	wFeatures += getLocation(wWdth, wHgt, default_wLft, default_wTop)
    	
    pW = window.open(wURL, wName, "width=" + wWdth + ",height=" + wHgt + wFeatures)
}

///////////////////////////////////////////////////////////////////////////////
//  Function: closePopWin
//  ---------
//
//  Does exactly as its name implies.  
//  This function is responsible for closing previously created pop-up window.   
///////////////////////////////////////////////////////////////////////////////
function closePopWin(){  // close pop-up window if it is open
    //do not close if early IE
    if (navigator.appName != "Microsoft Internet Explorer" || parseInt(navigator.appVersion) >=4)
        if(pW != null) 
            if(!pW.closed) 
    	        pW.close() 
}

///////////////////////////////////////////////////////////////////////////////
//  Function: getLocation
//  ---------
//
//  Determines the position on the screen 
//  where the pop-up window should be placed
//  by incorporating the user's screen resolution.
//
//  Parameters:
//  -----------
//  wWdth -- width of image in pixels. 
//  wHgt -- height of image in pixels.
//  wLft -- specifies the distance in pixels the pop-up window is from the left.
//  wTop -- specifies the distance in pixels the pop-up window is from the top.
///////////////////////////////////////////////////////////////////////////////
function getLocation(wWdth, wHgt, wLft, wTop){
    var wLoc = ""
    
    if (wLft < 0)
        wLft = screen.width - wWdth + wLft
        
    if (wTop < 0)
        wTop = screen.height - wHgt + wTop
        
    if (wTop == "cen")
        wTop = (screen.height - wHgt)/2 - default_distance
        
    if (wLft == "cen")
        wLft = (screen.width - wWdth)/2
        
    if (wLft > 0 & wTop > 0)
        wLoc =  ",screenX=" + wLft + ",left=" + wLft + ",screenY=" + wTop + ",top=" + wTop
    else
        wLoc = ""
        
    return wLoc
}
function validate_quantity(ctl)
{
	if((isNAN(ctl.value)) && (ctl.value.length > 1))
	{
		alert("Please enter a numeric value");
		ctl.value = "";
		ctl.focus();
		return;	
	}	
}
function validate_product_form(theform)
{
	//Loop through form elements, at least one quantity input must have a value
	var foundit;
	var cnt;
	foundit = 0;
	cnt = 0
	while(cnt < theform.elements.length)
	{
		
		if((theform.elements[cnt].name.length > 8) && (theform.elements[cnt].name.substring(0,8) == "quantity"))
		{
			
			//alert(theform.elements[cnt].name + "  " + theform.elements[cnt].value);
			
			if((theform.elements[cnt].value.length > 0) && !(isNaN(theform.elements[cnt].value)))
			{
				foundit = 1;
				theform.elements[cnt].value = parseInt(theform.elements[cnt].value, 10);
				cnt = theform.elements.length;	
			}
		}  
		cnt = cnt + 1;
	}
	if(foundit == 1)
	{
		theform.action="addToBasket.asp"; 
		//alert("here");
		theform.submit();	
	}
	else
	{
		alert("Please enter a quantity");	
	}
}

 function calcSubTotal()
 {
 //alert("here");
 	var i,j;
 	var lt = 0;
 	var st = 0;
 	alert("elements.length: " + klcorderform.elements.length);
 	for(i = 0; i < klcorderform.elements.length; i++)
 	{
 		var element_name;
 		element_name = klcorderform.elements[i].name.split("_")
 		if(element_name.length > 2)
 		{
 			alert("element_name: " + element_name[0] + "_" + element_name[1]);
 			if(element_name[1] == "quan")
 			{
				
 				if(element_name[0] == "802527K")
 				{
 					//alert("here3");
 					lt = (klcorderform.elements[i].options[klcorderform.elements[i].selectedIndex].value) * 29.95;
 				}
 				else
 				{
 					lt = klcorderform.elements[i].options[klcorderform.elements[i].selectedIndex].value * 15.95;
 					
 				}
 			
 				var el;
 				el = document.getElementByName(element_name[0] + "_total_" + element_name[2]);
 				
 				el.value = lt;
		
 				//eval("klcorderform." + element_name[0] + "_total.value = lt;");
				st = st + lt;
 			}

 		}
	
 	}
 
 	klcorderform.subtotal.value = st;
 
 
 }
 function validate_klc_order(ProductID)
 {
 		if(ProductID == "101KLC")
 		{
 			if(document.getElementById("SP100004").checked == false && document.getElementById("SP100005").checked == false && document.getElementById("SP100006").checked == false && document.getElementById("SP100007").checked == false && document.getElementById("SP100008").checked == false && document.getElementById("SP100009").checked == false && document.getElementById("SP100010").checked == false && document.getElementById("SP100011").checked == false)
			{
					alert("Please select at least one software package");
					getElementById("SP100004").focus();
					return;
			}
			else
			{
				//alert("here: " + ProductID);
 			
				form1.submit();
			}	 	
	 	}
	 	else if(ProductID == "102KLC")
	 	{
	 		if(document.getElementById("SP200004").checked == false && document.getElementById("SP200005").checked == false && document.getElementById("SP200006").checked == false && document.getElementById("SP200007").checked == false && document.getElementById("SP200008").checked == false && document.getElementById("SP200009").checked == false && document.getElementById("SP200010").checked == false && document.getElementById("SP200011").checked == false)
			{
					alert("Please select at least one software package");
					getElementById("SP200004").focus();
					return;
			}
			else
			{
				form1.submit();
			}	 	
	 	}
 	
}
//-->

