function swapImage(imgTag, imgName)
{
	document.images[imgTag].src="images/header/"+imgName;
}


	function swapImageArt(imgTag, imgName)
{
	document.images[imgTag].src="images/header/"+imgName;
}

function popUpWindow(URL, width, height, wname) {
	//alert(wname);
	
	//if (!wname) {
		wname = "PopUpWindow";
	//}
	popwin = window.open(URL, wname, "'toolbar=no,location=no,directories=no,status=no,left=500,menubar=no,scrollbars=no,resizable=no,width=" + width +",height=" + height)
	popwin.opener = self
	popwin.focus()
}

function popFullScreen(URL) {
	//alert(wname);
	
	//if (!wname) {
		wname = "PopUpWindow";
	//}
	window.open(URL, "_blank", "fullscreen=yes"); 
	popwin.opener = self
	popwin.focus()
}

function popUpWindowResize(URL, width, height, name) {
	if (!name) {
		name = "PopUpWindow";
	}
	popwin = window.open(URL, name, "'toolbar=no,location=no,directories=no,status=no,left=500,menubar=no,scrollbars=yes,resizable=yes,width=" + width +",height=" + height)
	popwin.opener = self;
	popwin.focus();
}

function printableForm() {
	//  Pop up the printable form
	popUpWindowResize('/printableOrderForm.cfm', 750, 500, 'RHOOrderForm');
}

function clearSearch(formField) {
	//  Only clear the field if it is equal to Site Search
	if (formField.value == "Site Search") {
		document.searchForm.searchString.value = "";
	}	
}

isLess = 1;
function showMore(rootClassID) {
	// provided with a root class for the More/Less pair
	var fullClassName = rootClassID + "More";
	var briefClassName = rootClassID + "Less";
	less = document.getElementById(briefClassName);
	more = document.getElementById(fullClassName);
	//alert(isBrief);
	if (isLess == 1) {
		// Hide the brief and show the full one
		less.style.visibility = "hidden";
		less.style.position = "absolute";
		more.style.visibility = "visible";
		more.style.position = "relative";
		isLess = 0;
	} else {
		// Hide the brief and show the full one
		less.style.visibility = "visible";
		less.style.position = "relative";
		more.style.visibility = "hidden";
		more.style.position = "absolute";
		isLess = 1;
	}
}


preloadFlag = 1;
function changeImages() {
	
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}


function checkAll(formName, fieldName, newState) {
	//alert("Field Name:" + fieldName + "\nForm Name:" + formName + "\nNew Checkbox State: " + newState);
	//alert("number of elements: " + document[formName][fieldName].length)
	for (i = 0; i < document[formName][fieldName].length - 1; i++) {
		document[formName][fieldName][i].checked = true ;
	}
}


function clearAllCheck(formName, allCheckbox) {
	// The purpose of this function is for use in the search forms.
	// If data is entered in the Otherbox or and ID checkbox is checked, the ALL checkbox should be unchecked
	//alert("\nformName: " + formName + "\nallCheckbox: " + allCheckbox + "\nidCheckboxes: " + idCheckboxes + "\notherBox: " + otherBox);
	
	//alert(isAllChecked);
	
	
	
	document[formName][allCheckbox].checked = false;
	
	
}


function clearOther(formName, allCheckbox, idCheckboxes, otherBox) {
	// The purpose of this function is for use in the search forms.
	// If the ALL button is checked then the Otherbox and all ID checkboxes should be unchecked
	// If data is entered in the Otherbox or and ID checkbox is checked, the ALL checkbox should be unchecked
	//alert("\nformName: " + formName + "\nallCheckbox: " + allCheckbox + "\nidCheckboxes: " + idCheckboxes + "\notherBox: " + otherBox);
	
	//  Just clear all the OTHER options if when clicked, it doesn't matter if the state is on or off.
	
	// clear the other field
	document[formName][otherBox].value = "";
	
	// loop through and unckeck all of the ID checkboxes
	for (i = 0; i < document[formName][idCheckboxes].length ; i++) {
		document[formName][idCheckboxes][i].checked = false;
	}

	
}

function findPosX(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent){
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) { 
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function findFieldWidth(obj) {
	return obj.offsetWidth
}

function getScrollPosition() {
      if (document.documentElement && document.documentElement.scrollTop)
          return document.documentElement.scrollTop; // IE6 +4.01
      if (document.body && document.body.scrollTop)
          return document.body.scrollTop; // IE5 or DTD 3.2
      return 0;
  }

    


