<!--
	//**********************************************************************
	// checkRequired()
	// author:	Paul Jodoin
	// date:	9/04/01, 6/14/02
	// purpose: Checks a form for required values
	// rules:	all spaces denoted with _ 
	//			must use a full description to define the missing field.	
	// mods:	added support for select list
	//**********************************************************************
	
	function checkRequired(form) {
		
		var i;
		var x;
		var validate;
		var element = new String();
		var field = new String();
		var output = new String();
		var spcArr = new Array();
			
		// initialize
		output = '';
			
		for(i = 0; i < form.elements.length; i++) {
			element = form.elements[i].name;
			// check for the existence of the options array
			
			switch(form.elements[i].type) {
				case 'select-one':
					if((element.indexOf('Req') != -1)&&(form.elements[i].options[form.elements[i].selectedIndex].value == '')) {
						if(element.indexOf('selReq') != -1) {
							field = element.substr(6, element.length - 6);
						}
						spcArr = field.split('_');
						if(spcArr.length) {
							for(x = 0; x < spcArr.length; x++) {
								output += spcArr[x] + ' ';
							}//for()
							output = output.slice(0, output.length - 1);
						}
						else {
							output = field;
						}//if()
						alert('Please select ' + output + '.');
						form.elements[i].focus();
						return false;
					}//if()	
					break;
				case 'text':
					if((element.indexOf('Req') != -1)&&(form.elements[i].value == '')) {
						field = element.substr(6, element.length - 6);
						spcArr = field.split('_');
						if(spcArr.length) {
							for(x = 0; x < spcArr.length; x++) {
								output += spcArr[x] + ' ';
							}//for()
							output = output.slice(0, output.length - 1);
						}
						else {
							output = field;
						}//if()
						alert('Please enter ' + output + '.');
						form.elements[i].focus();
						return false;
					}//if()	
					break;
				case 'textarea':
					if((element.indexOf('Req') != -1)&&(form.elements[i].value == '')) {
						field = element.substr(6, element.length - 6);
						spcArr = field.split('_');
						if(spcArr.length) {
							for(x = 0; x < spcArr.length; x++) {
								output += spcArr[x] + ' ';
							}//for()
							output = output.slice(0, output.length - 1);
						}
						else {
							output = field;
						}//if()
						alert('Please enter ' + output + '.');
						form.elements[i].focus();
						return false;
					}//if()	
					break;
				case 'radio':
					if(element.indexOf('Req') != -1) {
						validate = true;
						if(form.elements[element].length > 0) {
							for(x=0;x<form.elements[element].length;x++) {
								if(form.elements[element][x].checked == true) {
									validate = false;
								}//if()
							}//for()
						}
						else {
							if(form.elements[i].checked == true) {
								validate = false;
							}//if()
						}//if()
						if(validate == true) {
							field = element.substr(6, element.length - 6);
							spcArr = field.split('_');
							if(spcArr.length) {
								for(x = 0; x < spcArr.length; x++) {
									output += spcArr[x] + ' ';
								}//for()
								output = output.slice(0, output.length - 1);
							}
							else {
								output = field;
							}//if()
							alert('Please select a ' + output + '.');
							form.elements[i].focus();
							return false;
						}//if()
					}//if()	
					break;
				case 'checkbox':
					if(element.indexOf('Req') != -1) {
						validate = true;
						if(form.elements[element].length > 0) {
							for(x=0;x<form.elements[element].length;x++) {
								if(form.elements[element][x].checked == true) {
									validate = false;
								}//if()
							}//for()
						}
						else {
							if(form.elements[i].checked == true) {
								validate = false;
							}//if()
						}//if()
						if(validate == true) {
							field = element.substr(6, element.length - 6);
							spcArr = field.split('_');
							if(spcArr.length) {
								for(x = 0; x < spcArr.length; x++) {
									output += spcArr[x] + ' ';
								}//for()
								output = output.slice(0, output.length - 1);
							}
							else {
								output = field;
							}//if()
							alert('Please select a ' + output + '.');
							form.elements[i].focus();
							return false;
						}//if()
					}//if()	
					break;
				default:
					break;
			}//switch()
		}//for()
			
	}//checkRequired()

	
	//**********************************************************************
	// selectAll()
	// edited by:	Paul Jodoin
	// date:	02/13/02
	// purpose: selects all of the values in a multiple select box
	// rules:	full object name of select -- 
	//			ex: document.formName.selectName
	//**********************************************************************			
	function selectAll(listObj) {
		
		if(typeof listObj != 'undefined') {
			for (var i=0; i < listObj.length; i++) {  //select all of the items	on submit
				listObj.options[i].selected = true;
			}//next
		}//if()
				
	}//end function  
	
	//**********************************************************************
	// switchBox()
	// edited by:	Paul Jodoin
	// date:	02/13/02
	// purpose: moves values from one select box to another
	// rules:	name of the button pressed, full object name of select
	//			select source, full name of select target -- 
	//			ex: this, document.formName.selectName1, 
	//			document.formName.selectName2
	// dependencies: requires the checkBrowser() function
	//**********************************************************************			
	function switchBox(btn, listObj, targetObj)
		{
		
		var sBrowser = new String();
		var selectedItem;
		
		// grab the browser
		sBrowser = checkBrowser();
		
		// make sure something is selected		
		if(listObj.selectedIndex != -1) {
				
			// loop through once and send the items to the target
			for(var i =0;i < listObj.length;i++){
				if((listObj.options[i].selected) && (listObj.options[i].value != null)){
					selectedItem = listObj.options[i]; 
					targetObj.options[targetObj.length] = new Option(selectedItem.text, selectedItem.value);   //create new items in target select box
				}//end if
			}//next
			
			// clear the selected index	
			listObj.options[listObj.selectedIndex] = null;
				
			// be sure to do this last -- refresh Netscape 4 and less to resize select
			if((sBrowser.indexOf('nav')!=-1)&&(parseFloat(sBrowser)==4)) {
				history.go(0);
			}//end if 
					
		}//end if
						
	}//end function 
	
	//**********************************************************************
	// switchOne()
	// edited by:	Paul Jodoin
	// date:	02/15/02
	// purpose: moves values from one select box to another
	// rules:	name of the button pressed, full object name of select
	//			select source, full name of select target -- 
	//			ex: this, document.formName.selectName1, 
	//			document.formName.selectName2
	// dependencies: requires the checkBrowser() function
	//**********************************************************************			
	function switchOne(btn, listObj, targetObj)
		{
		
		var sBrowser = new String();
		var selectedItem;
		
		// grab the browser
		sBrowser = checkBrowser();
		
		// make sure something is selected		
		if((listObj.selectedIndex != -1)&&(targetObj.length == 0)) {
				
			// loop through once and send the items to the target
			for(var i=0;i < listObj.length;i++){
				if((listObj.options[i].selected) && (listObj.options[i].value != null)){
					selectedItem = listObj.options[i]; 
					targetObj.options[targetObj.length] = new Option(selectedItem.text, selectedItem.value);   //create new items in target select box
					break;
				}//end if
			}//next
			
			// clear the selected index
				
			listObj.options[i] = null;
			
			delSelected(listObj);
				
			// be sure to do this last -- refresh Netscape 4 and less to resize select
			if((sBrowser.indexOf('nav')!=-1)&&(parseFloat(sBrowser)==4)) {
				history.go(0);
			}//end if 
					
		}//end if
						
	}//end function 
				
	// this function will be modified to call the openDialog function
	function openWindow(url) {
		var Nav4 = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 4))
		var IE4 = ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4))
		// One object tracks the current modal dialog opened from this window.
		window.name = 'main';
		var priceWin;
		var left;
		var top;
		var attr = new String();
				
		if(Nav4) {
			attr = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width=600,height=550,screenX=10,screenY=10';
		}
		else { 
			attr = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width=600,height=550,top=10,left=10';
		}//if()
		if((!Nav4)&&(!IE4)) {
			priceWin = window.open(url, 'priceWin', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width=600,height=550');
		}
		else {	
			priceWin = window.open(url, 'priceWin', attr);
		}//if()
	}//end function	
	
	// 
	function orderDetailPopup(url) {
		var Nav4 = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 4))
		var IE4 = ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4))
		// One object tracks the current modal dialog opened from this window.
		window.name = 'main';
		var priceWin;
		var left;
		var top;
		var attr = new String();
				
		if(Nav4) {
			attr = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width=800,height=800,screenX=10,screenY=10';
		}
		else { 
			attr = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width=800,height=800,top=10,left=10';
		}//if()
		if((!Nav4)&&(!IE4)) {
			priceWin = window.open(url, 'priceWin', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width=800,height=800');
		}
		else {	
			priceWin = window.open(url, 'priceWin', attr);
		}//if()
	}//end function	
	
	
	//**********************************************************************
	// delSelected()
	// edited by:	Paul Jodoin
	// date:	02/13/02
	// purpose: deletes selected values from a select box
	// rules:	name of select -- ex: document.formName.selectName
	//**********************************************************************		
	function delSelected(listObj) {
		
		// loop through and delete	
		if(typeof listObj != 'undefined') {
			for( var i = listObj.length - 1; i >= 0; i-- ){
				if (listObj.options[i].selected == true) {
					listObj.options[i] = null;
				}//end if
			}//next
		}//if()
						
	}//end function
	
	//**********************************************************************
	// disableElement()
	// edited by:	Paul Jodoin
	// date:	10/14/03, 10/15/03, 10/29/03
	// purpose: disable a target element
	// rules:
	// edits: added support for the passed in string of named targets
	//**********************************************************************		
	
	function disableElement(element, form, disableList, enableList) {
		
		var y; //counter
		var x; //counter
	
		if(typeof form != 'undefined') {
			
			if(disableList != '') {
				disableList = disableList.split(',');
			}//if()
			
			if(enableList != '') {
				enableList = enableList.split(',');
			}//if()
			
			//disable elements
			for(y=0;y<disableList.length;y++) {
				
				if(form.elements[disableList[y]]) {	
				
					form.elements[disableList[y]].disabled = true;
					if(form.elements[disableList[y]].length > 0) {
						for(x=0;x<form.elements[disableList[y]].length;x++) {
							form.elements[disableList[y]][x].disabled = true;
						}//for()
					}//if()
				
				}//if()
						
			}//for()
			
			//enable elements
			for(y=0;y<enableList.length;y++) {
				
				if(form.elements[enableList[y]]) {
					
					if(form.elements[enableList[y]].length > 0) {
						for(x=0;x<form.elements[enableList[y]].length;x++) {
							form.elements[enableList[y]][x].disabled = false;
						}//for()
					} 
					else {
						form.elements[enableList[y]].disabled = false;
					}//if()
					
				}//if()
						
			}//for()
			
		}//if()

	}//disableElement()
	
	//**********************************************************************
	// getCookie()
	// edited by:	James Kogut
	// date:	08/23/2004
	// purpose: checks for cookies
	//**********************************************************************	
	function getCookie() {
		
		var cookieStr = new String();
		var sOutStr = new String();
			
		// initialize
		sOutStr = '';
		cookieStr = document.cookie;
			
		if(cookieStr.indexOf('on')==-1) {
			sOutStr += '<font color=\"red\"><b>Warning!</b> We have detected that you may not have';
			sOutStr += ' cookies enabled in your browser settings.<br />Cookies are required to access';
			sOutStr += ' the functionality of this site. Please enable cookies in your browser';
			sOutStr += ' settings or upgrade your browser to a version that';
			sOutStr += ' supports cookies.</font>'
		}//if()		
			
		document.write(sOutStr);
			
	}//getCookie()
	
	
	//*******************************
	//*******************************
	function PopUpCenterWindow(sUrl, iWidth, iHeight, sScroll) {
	
		var sWindowString;
		var dNew = new Date();
		var sRandName = dNew.getUTCMilliseconds();
		sRandName = sRandName.toString();

		var Xpos= (screen.availWidth - iWidth)/2;
		var Ypos= (screen.availHeight - iHeight)/2-10;

		if (sScroll == "")
			{
			sScroll = "no";
			}

		sWindowString = "width=" + iWidth + ",height=" + iHeight + ",screenX=" + Xpos + ",screenY="  + Ypos + ",toolbar=0,scrollbars=" + sScroll + ",location=0,directories=0,status=0,menubar=0,resizable=yes";
		newWindow = open(sUrl, sRandName, sWindowString);
		newWindow.moveTo(Xpos, Ypos);
		newWindow.location=sUrl;
	}//PopUpCenterWindow()
	
//-->
