use( "thing.screen" );



function setTabOn(tabID){

	if(document.all && document.getElementById(tabID) ) document.getElementById(tabID).className = "tabOn";

    }



function winPop(url,width,height) {

        // Use to pop a new window with no browser buttons

        if (url != null) {

                if (width == null) width = 640;

                if (height == null) height = 480;

                var atts = "width=" + (width + 15) + ",height=" + (height + 15) + ",resizable,scrollbar,scrollbars";

                var newwin = window.open(url, "newwin", atts);

                newwin.focus();

                }

        }



function openNewWindow(URLtoOpen, windowName, windowFeatures) { 

        // use to pop a new window with user specified settings

        if (URLtoOpen != null) {

            if (windowName == null) windowName = "newWindow";

            if (windowFeatures == null) windowFeatures = "width=640,height=480,resizable";

            var newWindow = window.open(URLtoOpen, windowName, windowFeatures); 

            }

        }



function clicker(url) {

    // Shareholder.com function used for popping Annual Report

    if (navigator.userAgent.indexOf("MSIE") == -1) {

        var newwindow = window.open(url, 'Report', 'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=yes,width=1025,height=700,top=1,left=1');  

        newwindow.focus();

        }

    else {

        window.open(url, 'Report', 'toolbar=no,width=1006,height=775,directories=no,status=yes,scrollbars=yes,resizable=yes,menubar=no,top=1,left=1');

        }

    }



/*

*************************************************************************

Use this function below to validate form input.

The form tag should use an onSubmit:



<form action="" method="post" onSubmit="validate(this.form)">



Then in the tags you need an additional VALIDATOR parameter:



<input type="" name="" VALIDATOR="notEmptyPat">



It MUST be uppercase and call one of the patterns below.

It helps the user if your input NAME is descriptive enough to 

let them know which field needs input.



Monica Israels

9/16/02

*/



function validate(objForm) {

	var PatternsDict = new Object();

	PatternsDict.zipPat = /\d{5}(-\d{4})?/;  // matches zip codes

	PatternsDict.emailPat = /.*@.*\..*/;  // matches email addresses

	PatternsDict.notEmptyPat = /.{1,}/;  // matches at least one character

	PatternsDict.numberPat = /\d/;  // matches numbers only

	PatternsDict.pwPat = /^\D{1}\S{3,9}$/;  // matches between 4 and 10 characters with non-digit leading

	PatternsDict.currencyPat = /\$\d{1,3}(,\d{3})*\.\d{2}/;  // matches currency with commas

	PatternsDict.timePat = /^([1-9]|1[0-2]):[0-5]\d$/;  // matches times



	var elArr = objForm.elements;

	for(var i=0; i<elArr.length; i++)

	with(elArr[i]) { 

		var v = elArr[i].VALIDATOR; 

		if(!v) continue; 

		

		var thePat = PatternsDict[v]; 

		var gotIt = thePat.exec(value); 

		if(!gotIt) {

			var returnStr;

			returnStr = "The " + name + " field is invalid, this field is required in order to submit this form.  Please try again!";

			alert(returnStr);

			return false;

			}

		} 

	return true;

    }



/*

***************************************************

This function MUST BE USED IN ADDITION to the flash_detection.js script!!!



First call flash_detection.js

Then start a new script block

This detects Macromedia flash versions and returns true or false based on the version tested.

The default version is 4.

Usage:

    detectFlash(4);

This will return true or false to check for version 4.  Use the result accordingly:

    if (detectFlash(4)) { ... }

    else { ... }



Monica Israels

9/18/02

*/

function detectFlash(requiredVersion) {

    if (requiredVersion == null) requiredVersion = 4; 

    

	if (navigator.plugins) {

		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {

			var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";

			var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;

			var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));

			flash2Installed = flashVersion == 2;

			flash3Installed = flashVersion == 3;

			flash4Installed = flashVersion == 4;

			flash5Installed = flashVersion == 5;

			flash6Installed = flashVersion == 6;

    		}

    	}



	for (var i = 2; i <= maxVersion; i++) {

		if (eval("flash" + i + "Installed") == true) actualVersion = i;

	    }



	if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 2;



	if (actualVersion >= requiredVersion) {

		hasRightVersion = true;

		return true;

		}

		

	else {

		return false;

		}

	}



/*******************************************************************

HANDLER FOR DROP-DOWN MENUS



For drop-downs this checks to make sure there is a valid selection

before proceeding.



Monica Israels

2/20/03

*/

function checkEmptySelect(value) {   

    if (value == "-") alert("Please select a valid entry from the drop-down menu to continue.");

    else window.location = value;

    return false;

    }





/*******************************************************************

FUNCTIONS FOR WORKING WITH COOKIES



Three functions for reading, writing and deleting cookies using

Javascript.



Monica Israels

3/12/03

*/

function getCookie(name) {

    var start = document.cookie.indexOf(name + '=');

    var len = start + name.length + 1;

    if ((!start) && (name != document.cookie.substring(0,name.length)))

        return null;

    if (start == -1)

        return null;

    var end = document.cookie.indexOf(';', len);

    if (end == -1) 

        end = document.cookie.length;

    return unescape(document.cookie.substring(len, end));

    }



function setCookie(name,value,expires,path,domain,secure) {

    document.cookie = name + '=' + escape(value) + 

    ((expires) ? ';expires=' + expires.toGMTString() : '') +

    ((path) ? ';path=' + path : '') + 

    ((domain) ? ';domain=' + domain : '') +

    ((secure) ? ';secure' : '');

    }



function deleteCookie(name,path,domain) {

    if (getCookie(name))

        document.cookie = name + '=' +

        ((path) ? ';path=' + path : '') +

        ((domain) ? ';domain=' + domain : '') +

        ';expires=Thu, 01-Jan-1970 00:00:01 GMT';

    }





/*

*************************************************************************

Use this function below to count the number of serial numbers in a form

field.  If more than the maximum have been entered the user gets a

confirm box telling them that the remainder will be ignored if they 

continue.  Serial numbers must be separated by spaces or new lines.



checkSerialNumber(maximum, objForm)



maximum: the maximum number of serial numbers allowed (integer)

objForm: the form name



Ezra Castillo

6/5/03

*/

function countSerialNumbers(maximum, objForm) {

	var serial_numbers = objForm.serial_numbers.value;

	var regexp = /\s/;

	var serialArray = serial_numbers.split(regexp);

	var arrayCount = serialArray.length;

	

	if (arrayCount > maximum) {

		if (confirm("You have entered " + arrayCount + " serial numbers which is more than the " + maximum + " allowed. To \ncontinue \'Click OK\' below to process the first " + maximum + " serial numbers, noting the \nremaining will not be processed ignoring the rest.  Click Cancel below to return \nto the form to edit your list of serial numbers.")) 

			return true;	

		else

			return false;

		}	

	}





/*

*************************************************************************

This function pops up alert boxes based on the key passed to the function.



Ezra Castillo

6/5/03

*/

function alertBoxPop(key) {

	// add new definitions here as needed

	// please list in alphabetical order

	

	if (key.toUpperCase() == "ADVANCE_RMA") alert('Help: Advance Replacement \n\nCreate an Advance Return Material Authorization (RMA) for a defective product.  A replacement product will be shipped to you first.  A credit card is required.');

	

	else if (key.toUpperCase() == "EXPIRATION_DATE") alert('Help: Expiration Date \n\nThe warranty on this hard drive expires at midnight at the beginning of the date listed.');



	else if (key.toUpperCase() == "REPLACEMENT_PROCESS") alert('Help: Replacement Process \n\nFollow Steps 3 through 8.');

	

	else if (key.toUpperCase() == "STANDARD_RMA") alert('Help: Standard Replacement \n\nCreate a Standard Return Material Authorization (RMA) for a defective product.  The replacement product will be shipped after the defective product has been received.  A credit card is not required.');



	else if (key.toUpperCase() == "TLA") alert('Help: TLA Number \n\nThe Top Level Assembly (TLA) number contains the hard drive\'s \nmodel number. TLA numbers are used in our warranty database \nto help identify a hard drvies\'s product family and capacity point. \nThe TLA number can be found on the label located on the top of \nthe hard drive. The TLA number may also be referred to as the \n\"material number\" by our customer service department.');	



	else if (key.toUpperCase() == "CHECK_STATUS") alert('Help: Status \n\nThis column will display the current processing status of your \nRMA. RMA status can be obtained for all RMA\'s created on our web \nsite or through our Customer Support Center. You will also be notified by e-mail \nwhen your replacement drive has been shipped from Maxtor.');



	else if (key.toUpperCase() == "CHECK_MESSAGE") alert('Help: Tracking Number \n\nIf your replacement drive has been shipped from Maxtor, the shipper\'s \ntracking number will be displayed in this column. If a tracking \nnumber is displayed, please click on it to obtain current shipping status.');

	

	}





/*

************************************************************************

Confirm pop-up box for RMA back button

Ezra Castillo

6/30/03

*/

function checkDriveConfirm(){

	if (confirm("Click OK below to return to the main page of this application \nto add another serial number. Note that the current Warranty \nStatus Results will be lost. Click Cancel below to remain on \nthis page.")) 

		return true;	

	else

		return false;

	}



	

/*

*************************************************************************

This function pops up a confirm box for the High Volume Warranty Lookup

application when the user clicks a link to start the process over.  If OK 

is pressed they are sent to the beginning of the application.  Otherwise no 

action is taken.



Ezra Castillo

6/5/03

*/

function hvwlStartOver() {

	if (confirm("Click OK below to return to the main page of this application to \nadd more serial numbers.  Note that the current Warranty Status \nResults will be lost. \n\nClick Cancel below to remain on this page.")) 

		window.location.href = "index.cfm";

	}

	

/*

Ezra Castillo

7/20/2003

*/

function createRMAConfirm(){

	var value = document.shippack.ship_and_pack.checked;



	if (value == false){

		if (confirm("You must agree to follow these Procedures to continue this RMA \nprocess. Click OK below to return to this page to check the checkbox \nstating you agree to the Procedure detailed here. Click Cancel \nbelow to end this RMA process (your information will not be saved).")) 

			return false;

	}

}

/*

Ezra Castillo

7/24/2003

*/

function purchaseLoc(){

	var country = document.troubleshoot.shipping_country.value;

	

	window.location.href = "03_troubleshooting.cfm?country="+country;

}







/* 

Ezra Castillo

12/11/03

*/

function createRMAConfirm2(submitTypImage) {

   submitTypImage.disabled = true;

   var objForm = document.shippack;

   

   if (objForm.ship_and_pack.checked == false){

    submitTypImage.disabled = false;

    if (confirm("You must agree to follow these Procedures to continue this RMA \nprocess. Click OK below to return to this page to check the checkbox \nstating you agree to the Procedure detailed here. Click Cancel \nbelow to end this RMA process (your information will not be saved).")) 

     return false;

   } 

   

   submitTypImage.form.method = 'post';

   submitTypImage.form.action = '07_ship_and_pack.cfm';

   submitTypImage.form.submit();

 

  }







/*

*************************************************************************

The following functions are used in the world map polygon rollovers to preload

and swapout images for the onMouseover function. To keep the swapping simplified, 

each rollover is an entire world map and not simple geometric slice images because

the polygons are the shape of the continents and multiple slice rollovers would 

otherwise be required.



Steven Reiser

7/31/03

*/



function findObj(n, d) { 

  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=findObj(n,d.layers[i].document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}

function swapImage() { 

  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)

   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

function preloadImages() { 

 var d=document; if(d.images){ if(!d.p) d.p=new Array();

   var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)

   if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}

}