/*
<%
'***********************************************************************
' Version:   6.16.$Revision: 2 $
' File:           $Log: /External/eSupport/solutions/Dell.eSupport/Projects/Dell.eSupport.Web/includes/template_javascripts.js $
// 
// 2     1/15/03 3:47p Jay_vilalta
// updated with changes made to 1.25 (added function openSubWinCentered)
// 
// 15    1/14/03 6:20p Jay_vilalta
// added js function for invoice.
// 
// 13    12/19/02 1:30p Jay_vilalta
// put in code to block enter key to submit forms
// 
// 12    12/17/02 9:41a Jay_vilalta
// 
// 11    12/13/02 2:25p Jay_vilalta
// changed printpage function to accommodate legacy pages
// 
// 10    12/13/02 11:59a Jay_vilalta
// added printthispage function
// 
// 9     11/21/02 3:14p David_shelton
// TD#729
// 
// 8     11/14/02 4:29p Jay_vilalta
// added new function to open pop up window with name
// 
// 6     10/31/02 5:13p Lionel_lin
// fixed webmaster javascript errors from dell.com
// 
// 4     10/10/02 5:49p Jay_vilalta
// 
// 1     9/06/02 2:37a Michael_reed
// 
// 1     9/03/02 3:26a Michael_reed
// 
// 1     8/23/02 2:27a Michael_reed
// 
// 1     8/22/02 7:19p Michael_reed
// 
// 2     8/08/02 2:38p David_shelton
// 498
' 
' 1     8/06/02 2:38p Michael_reed
' Admin, Initial placement for version 6.16
'
'
'***********************************************************************
%>
*/

//BEGIN TEMPLATE JAVASCRIPTS
bNS4 = (document.layers);
bIE4 = (document.all);
bV4 = (bNS4 || bIE4);
bMac = (navigator.appVersion.indexOf("Mac") != -1);
bMenu = (bNS4 || (bIE4 && !bMac));
bNS6 = (document.getElementById && !document.all) ? true : false;


function showlayer(lay, flag) {
  
 if (flag == "T"){
           if (bIE4) {document.all[lay].style.visibility = "visible";}
		   if (bNS4) {document.layers[lay].visibility = "show";}
		   if (bNS6) {document.getElementById([lay]).style.display = "block";}
          }
 else {
		if (bIE4) {document.all[lay].style.visibility = "hidden";}
		if (bNS4) {document.layers[lay].visibility = "hide";}
		if (bNS6) {document.getElementById([lay]).style.display = "none";}
	  }
}


function popUp(){return};
function popDown(){return};

if (!bV4) {
	event = null;
}

function openSubWin(strURL, pixW, pixH)
{
	strLocation = strURL;
	strWHandle = "sdcSubWin";
	strProps = "resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,width=" + pixW + ",height=" + pixH + ",top=10,left=10";
	window.open(strLocation, strWHandle, strProps);
}
function openNewWin(strURL, pixW, pixH)
{
	strLocation = strURL;
	strWHandle = "sdcNewWin";
	strProps = "resizable=yes,scrollbars=yes,toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,width=" + pixW + ",height=" + pixH;
	window.open(strLocation, strWHandle, strProps);
}	
function openSubWinWithName(strURL, pixW, pixH, strHandle)
{
	strProps = "resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,width=" + pixW + ",height=" + pixH + ",top=10,left=10";
	window.open(strURL, strHandle, strProps);
}

function updateParent(newURL)
{
	if (window.opener != null)
		{
		window.opener.location = newURL;
		window.opener.focus();
		}
	else 
		{
		window.navigate(newURL);
		}
}
//END TEMPLATE JAVASCRIPTS

//BEGIN DELL CARE JAVASCRIPTS
function chfield(){
	if (this.form1.order_number.value == ""){
		return confirm("The Order Number is invaild! It is a 9-digit number! Continue?")} 
	}

function checkopt(){    
	if (document.form3.pgcat[0].checked == true)
		checkSvc(window.document.form3.pgid.value);
	if (document.form3.pgcat[1].checked == true)
		checkNaN(window.document.form3.pgid.value);
	}

function checkNaN(strVal){		  
	strVal = trim(strVal);
	if (isNaN(strVal))     
		alert("Dell customer numbers and reference numbers are numeric.\n Please verify the data you have entered and click go.");                   
	else
		window.document.form3.submit();
	}  

function checkSvc(strVal){
	strVal = trim(strVal);
	if (strVal.length == 5 || strVal.length == 7) 
		window.document.form3.submit();
	else
		alert("Dell service tags are either 5 or 7 characters long. \nPlease verify the data you entered and click go.");
	}

function trim(strVal){
	while (strVal.charAt(0) == " ")
		strVal = strVal.slice(1);
	while (strVal.charAt(strVal.length-1) == " ")
		strVal = strVal.slice(0, -1);
	return strVal;
	}

function scs_validate(){
	if  (window.document.form3.pgid.value.length > 0)
		window.document.form3.submit();
	else
		{
			alert("Please input a Service Tag or a Dell Customer Number.");
		};
	}

//Customer Care - Contact Us - CustomerServiceForm
function cc2tsform(){
	var selectedOption=document.form.Department.options[document.form.Department.selectedIndex].value
	if (selectedOption == "Technical Support"){
		var answer=confirm("This form is for non-technical issuses only.  Click OK to be taken to the\n Technical Support email form or click CANCEL to email Customer Care.")
		if (answer) {
			window.location=("/us/en/emaildell/")
		}
		else {
			document.form.Department.options[2].selected=true; //stay on this page
		}
	}
}//END DELL CARE JAVASCRIPTS

function printThisPage(intPageType)
{
	var ns4 = (document.layers);
	var ie4 = (document.all && !document.getElementById);
	var ie5 = (document.all && document.getElementById);
	var ns6 = (!document.all && document.getElementById);

	if (ns4)
	{
		window.print();
	}
	else if (ie4)
	{
		window.document.frmPrintPage.printData.value=window.document.all.CONTENT_TABLE.innerHTML;
		window.document.frmPrintPage.submit();
	}
	else
	{
		window.document.frmPrintPage.printData.value=window.document.getElementById("CONTENT_TABLE").innerHTML;
		window.document.frmPrintPage.submit();
	}	
}
//
//if (bNS6)
//{
//	alert("NS6");
//	document.captureEvents(Event.KEYPRESS);
//	document.onkeypress=handleEnterKey
//}
function handleEnterKey(e)
{
	if (bNS6&&e.which==13)
	{
		alert("Pressing the enter key will submit this form as Email My Invoice");
		return false;		
	}
	if (!bNS6&&window.event.keyCode==13)
	{
		window.event.keyCode=0;
	}
}
function openSubWinCentered(strURL, pixW, pixH)
{
	strLocation = strURL;
	strWHandle = "sdcSubWin";
	intScreenHeight=screen.availHeight;
	intScreenWidth=screen.availWidth;
	winX=(intScreenWidth-pixW)/2;
	winY=(intScreenHeight-pixH)/2;
	strProps = "resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,width=" + pixW + ",height=" + pixH;
	strProps += ",top=" + winX + ",left=" + winY;
	window.open(strLocation, strWHandle, strProps);
}