String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}

function sayHi(  ) {
	alert('hi there');
}

function getParameter ( queryString, parameterName ) {
   // Add "=" to the parameter name (i.e. parameterName=value)
   var parameterName = parameterName + "=";
   if ( queryString.length > 0 ) {
      // Find the beginning of the string
      begin = queryString.indexOf ( parameterName );
      // If the parameter name is not found, skip it, otherwise return the value
      if ( begin != -1 ) {
         // Add the length (integer) to the beginning
         begin += parameterName.length;
         // Multiple parameters are separated by the "&" sign
         end = queryString.indexOf ( "&" , begin );
      if ( end == -1 ) {
         end = queryString.length
      }
      // Return the string
      return unescape ( queryString.substring ( begin, end ) );
   }
   // Return "null" if no parameter has been found
   return "null";
   }
}


function getRequestParameter( name ) {
  var retval = "";
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results != null )
	retval = results[1];
  return retval;
}

function makeRadioSelection(radioFormName, radioName, radioValue) {
	radioForm = document.forms[radioFormName];
	var radioEltList = radioForm.elements[radioName];
	for (i=0; i<radioEltList.length; i++) {
		if (radioEltList[i].value == radioValue) {
			radioEltList[i].checked=true;
		} else {
			radioEltList[i].checked=false;				
		}
	}
}

function setElementToColorById(eltId, colorName) {
	var elt = document.getElementById(elementId);
	elt.style.color = colorName;	
}

function displayCC(ccnum) {
	try {
		alert("Credit Card Number:\n"+ccnum);
	}
	catch(e) {
		alert("An error has occurred.  Could not display card.");
	}
}
	
function ensureLocation(locationRoot, locationSuffix) {
	if (document.location.href.indexOf(locationRoot) == -1) {
		document.location.href= locationRoot + locationSuffix;
	} else {
	}	
}

function showHideById(idToShow, idToHide) {
	document.getElementById(idToShow).style.display = "block";
	document.getElementById(idToHide).style.display = "none";
}

function showById(idToShow) {
	document.getElementById(idToShow).style.display = "block";
}

function hideById(idToHide) {
	document.getElementById(idToHide).style.display = "none";
}

function hideByNameShowById(idToShow, nameToHide, tagNameOfHidden, directParentId) {	
	// What's needed for IE (no effect in Firefox)
	var mainDiv = document.getElementById(directParentId);
	var allReportSelectorsForIE = mainDiv.getElementsByTagName(tagNameOfHidden);
	for (i=0; i<allReportSelectorsForIE.length; i++) {
		if (allReportSelectorsForIE[i].name == nameToHide) {
			allReportSelectorsForIE[i].style.display = "none";
		}
	}
	
	// What's needed for Firefox (no effect in ie)
	var allReportSelectorsForFirefox = document.getElementsByName(nameToHide);
	for (i=0; i<allReportSelectorsForFirefox.length; i++) {
		allReportSelectorsForFirefox[i].style.display = "none";
	}

	// Show div to show
	var divToShow = document.getElementById(idToShow);
	if (divToShow) {
		divToShow.style.display = "block";
	}
	return divToShow;
}

function checkAll(field) {
	for (i = 0; i < field.length; i++) {
		field[i].checked = true ;
	}
}
function uncheckAll(field) {
	if (field.length) {
		for (i = 0; i < field.length; i++) {
			field[i].checked = false ;
		}
	}
}

function openQuicklinksInNewWindow(absolutePathPart) {
	var myWindow = window.open(absolutePathPart + "contentTiles/quickLinks.jsp", "quicklinks", "TOP=50,LEFT=50,WIDTH=600,HEIGHT=500");
	myWindow.focus();
}

function openInTallNarrowWindow(href, windowname) {
	var myWindow = window.open(href, windowname, "location=yes,TOP=50,LEFT=50,WIDTH=670,HEIGHT=1000,scrollbars=yes,resizable=yes");
	myWindow.focus();
}

function openInRegularSizeWindow(href, windowname) {
	var myWindow = window.open(href, windowname, "location=yes,TOP=50,LEFT=50,menubar=yes,toolbar=yes,scrollbars=yes,resizable=yes");
	myWindow.focus();
}

function openInNewWindow(href, windowname) {
	var myWindow = window.open(href, windowname, "location=yes,TOP=50,LEFT=50,WIDTH=670,HEIGHT=600,scrollbars=yes,resizable=yes");
	myWindow.focus();
}

function openTrackingWindow(href) {
	var myWindow = window.open(href, "trackingWindow", "TOP=50,LEFT=50,WIDTH=800,HEIGHT=600,resizable=yes,scrollbars=yes,location=yes");
	myWindow.focus();
}

function openAttachmentWindow(href) {
	var myWindow = window.open(href, "attachments", "TOP=50,LEFT=50,WIDTH=600,HEIGHT=500,resizable=yes,scrollbars=yes");
	myWindow.focus();
}

function openShipMemo(id, profileId) {
	location.replace("editCurrentProfileContactInfo.do?profileId=" + profileId + "&action=load");
	popShipMemo(id);
}

function popShipMemo(id) {
	window.open('loadSupportTransaction.do?itemId=' + id, 
				"shipmemo", 
				"location=yes,TOP=50,LEFT=50,WIDTH=670,HEIGHT=600,scrollbars=yes,resizable=yes");	
}

function editSupportNote(id, profileId) {
	location.replace("processSupportTransaction.do?action=load&profileId=" + profileId + "&id=" + id + "#" + id);
	window.open('loadSupportTransaction.do?itemId=' + id, 
				"editsupportnote", 
							"location=yes,TOP=50,LEFT=50,WIDTH=875,HEIGHT=900,scrollbars=yes,resizable=yes");
}


function confirmProfileIdChange() {
	return confirm("Are you really want to change the profile id for this note?  This function is only for advanced users.");
}


function confirmTicketIdChange() {
	return confirm("Are you really want to change the ticket id for this note?  This function is only for advanced users.");
}

//used for notes in the support center
function initNotes(client) {
	try {
		var note = document.getElementById("noteStatus");
		if (note) {
			if (document.cookie.indexOf(client+"noteIsOpen=yes")!=-1) {
				document.getElementById("noteStatus").innerHTML = "A support note is currently open."
			} else {
				document.getElementById("noteStatus").innerHTML = "&nbsp;"
			}
		}
	}
	catch(err) { }
}

function newTestMessage(client, profileId, absolutePathPart) {
	newSupportNote("entryType=test_email_functionality&profileId=" + profileId, client, absolutePathPart);
}
function newTranscription(contactMethod, client, profileId) {
	newSupportNote("entryType=transcription&contactMethod=" + contactMethod + "&profileId=" + profileId, client);
}
function newNote(client, profileId) {
	newSupportNote("entryType=support_note&profileId=" + profileId, client);
}
function newEmail(client, profileId) {
	newSupportNote("entryType=initial_email&profileId=" + profileId, client);
}
function newShippingMemo(client, profileId) {
	newSupportNote("entryType=shipping_memo&profileId=" + profileId, client);	
}
function newFreightConfirmation(client, profileId) {
	newSupportNote("entryType=freight_confirmation&profileId=" + profileId, client);	
}
function newPurchaseOrder(client, profileId) {
	newSupportNote("entryType=purchase_order&profileId=" + profileId, client);	
}
function newSupportNote(additionalParameters, client, absolutePathPart) {
//	netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
//	alert("enable priviledge");
//	const windowMediatorIID = Components.interfaces.nsIWindowMediator;
//	const windowMediator = Components.classes
//	   ["@mozilla.org/appshell/window-mediator;1"].getService(windowMediatorIID)
//	const topWin = windowMediator.getMostRecentWindow("navigator:browser")
//	topWin.getBrowser().addTab("addSupportTransaction.do?forward=popup&" + additionalParameters)
	
//	netscape.security.PrivilegeManager.disablePrivilege("UniversalXPConnect")

	if (!absolutePathPart) absolutePathPart = "";
	var isOpenCookie = document.cookie.indexOf(client + "noteIsOpen=yes");
	if (isOpenCookie!=-1) {
		alert("You already have a note open!  You will need to save it or close it before you can open a new note.");
	} else {
		var windowName = client + "note";
		var myWindow = 
			window.open(absolutePathPart + "addSupportTransaction.do?" + additionalParameters, 
							windowName, 
							"location=yes,TOP=50,LEFT=50,WIDTH=875,scrollbars=yes,resizable=yes");
		myWindow.focus();
	}
}
//used for notes in the support center
function openNote(isNewProfile, client) {
	var isOpenCookie = client + "noteIsOpen=yes";
	document.cookie=isOpenCookie;
	opener.document.getElementById("noteStatus").innerHTML = "A support note is currently open.";
	if (isNewProfile) {
		opener.document.location.reload();
	}
}
//used for notes in the support center
function closeNote(client) {
	document.cookie=client + "noteIsOpen=no";
	opener.document.getElementById("noteStatus").innerHTML = "&nbsp;";
}

//init the note...check message type et al
function initMe(isNewProfile, client) {
	openNote(isNewProfile, client);
	checkMessageType();
	checkOk4Public();
}
//checks the type of note (email or internal)
function checkMessageType() {
	if (document.getElementById("messageType") != null) {
		if (document.getElementById("messageType").checked) {
			document.getElementById("messTypeCue").innerHTML = "<img src='images/mail-out.gif' width='48' height='48' alt='Outbound Web Communication'>";
			document.getElementById("thisIsEmail").style.display = "block";
			document.getElementById("ok4public").checked = false;
			document.getElementById("ok4public").disabled = false;
			document.getElementById("submit").disabled = true;
		} else {
			document.getElementById("messTypeCue").innerHTML = "<img src='images/internalNote.gif' width='48' height='48' alt='Internal Note'>";
			document.getElementById("thisIsEmail").style.display = "none";
			document.getElementById("submit").disabled = false;
		}
	}
}
//checks if the agent has marked this note as ok for public
function checkOk4Public() {
	if (document.getElementById("ok4public").checked) {
		document.getElementById("submit").disabled = false;
	} else {
		document.getElementById("submit").disabled = true;
	}
	
//	alert("check ok for public");
/*
	if (document.getElementById("messageType") != null) {
		if (document.getElementById("messageType").checked) {
			if (document.getElementById("ok4public").checked) {
				document.getElementById("submit").disabled = false;
			} else {
				document.getElementById("submit").disabled = true;
			}
		} else {
			document.getElementById("submit").disabled = false;
		}
	} */
//	alert("done check ok for public");
}

/* determine if old/new user, populate username if cookie exists */
/*
function init() {
	getView();
	loadUsername();
}
*/

function loadUsername() {
    if (getCookie("username") != null) {
        document.getElementById("username").value = getCookie("username");
        document.getElementById("password").focus();
    } else {
        document.getElementById("username").focus();
    }
}

function saveUsername(theForm) {
	alert("saving username: " + theForm.username.value);
    var expires = new Date();
    expires.setTime(expires.getTime() + 24 * 30 * 60 * 60 * 1000); // sets it for approx 30 days.
    setCookie("username",theForm.username.value,expires,"/");
}

function showNew() {
	var oldUser = document.getElementById('old');
	var newUser = document.getElementById('new');
	var newRadio = document.getElementById('newRadio');
	var isNewUser = document.getElementById('isNewUser');

	oldUser.style.display='none';
	newUser.style.display='block';
	isNewUser.value = 'true';
	newRadio.checked = true;
	//alert("isNewUser: "+isNewUser.value);
}

function showOld() {
	var oldUser = document.getElementById('old');
	var newUser = document.getElementById('new');
	var isNewUser = document.getElementById('isNewUser');
	var oldRadio = document.getElementById('oldRadio');
	
	oldRadio.checked = true;
	oldUser.style.display='block';
	newUser.style.display='none';
	isNewUser.value = 'false';
	//alert("isNewUser: "+isNewUser.value);
}

function emailPassword() {
	var sendEmail = document.getElementById('sendEmailId');
	var password1 = document.getElementById('password1');
	var password2 = document.getElementById('password2');
	var password = document.getElementById('password');
	sendEmail.value='true';
	password1 = '';
	password2 = '';
	password3 = '';
	document.loginForm.submit()	
}

function checkEnterNew(event){ 	
	NS4 = (document.layers) ? true : false;	var code = 0;
	if (NS4) {
		code = event.which;
	} else {
		code = event.keyCode;
		if (code==13) {
			clonePassword();
			document.loginForm.submit();
		}
	}
}

function checkEnterOld(event){ 	
	NS4 = (document.layers) ? true : false;	var code = 0;
	if (NS4) {
		code = event.which;
	} else {
		code = event.keyCode;
		if (code==13)
			document.loginForm.submit();
	}
}

function getView() {
	var password1 = document.getElementById('password1');
	var password2 = document.getElementById('password2');
	var password = document.getElementById('password');
	if ( password1.value.length > 0 ) {
		password.value = '';
		showNew();
	} else if ( password2.value.lenth > 0 ) {
		password.value = '';
		showNew();
	} else {
		showOld();
	}
}

function resetNewUserPasswords() {
	var password1 = document.getElementById('password1');
	var password2 = document.getElementById('password2');
	password1.value = '';
	password2.value = '';
}	

function resetOldUserPassword() {
	var password = document.getElementById('password');
	password.value = '';
}	

function clonePassword() {
	var password1 = document.getElementById('password1');
	var password = document.getElementById('password');
	password.value = password1.value;
}	

function syncCCNumber() {
	var ccNumber = document.getElementById('ccNumber');
	alert("ccnumber:" + ccNumber);
	var maskedCcNumber = document.getElementById('maskedCcNumber');
	alert("maskedCcNumber:" + maskedCcNumber);
	ccNumber.value = maskedCcNumber.value;
}

function checkoutCopyBillingToShipping(theForm) {
	theForm.elements['sfname'].value = theForm.elements['fname'].value;
	theForm.elements['slname'].value = theForm.elements['lname'].value;
	theForm.elements['scompanyName'].value = theForm.elements['companyName'].value;
	theForm.elements['saddr1'].value = theForm.elements['addr1'].value;
	theForm.elements['saddr2'].value = theForm.elements['addr2'].value;
	theForm.elements['scity'].value = theForm.elements['city'].value;
	theForm.elements['szip'].value = theForm.elements['zip'].value;
	theForm.elements['sstate'].value = theForm.elements['state'].value;
	theForm.elements['sstate'].selectedIndex = theForm.elements['state'].selectedIndex;
	theForm.elements['scountry'].value = theForm.elements['country'].value;
	theForm.elements['scountry'].selectedIndex = theForm.elements['country'].selectedIndex;
}
function copyBillingToShipping(theForm) {
//	alert("copying billing to shipping");

	theForm.elements['shippingAddress.firstName'].value = theForm.elements['billingAddress.firstName'].value;
	theForm.elements['shippingAddress.role'].value = theForm.elements['billingAddress.role'].value;
	theForm.elements['shippingAddress.lastName'].value = theForm.elements['billingAddress.lastName'].value;
	theForm.elements['shippingAddress.companyName'].value = theForm.elements['billingAddress.companyName'].value;
	theForm.elements['shippingAddress.address1'].value = theForm.elements['billingAddress.address1'].value;
	theForm.elements['shippingAddress.address2'].value = theForm.elements['billingAddress.address2'].value;
	theForm.elements['shippingAddress.city'].value = theForm.elements['billingAddress.city'].value;
	theForm.elements['shippingAddress.state'].value = theForm.elements['billingAddress.state'].value;
	theForm.elements['shippingAddress.zip'].value = theForm.elements['billingAddress.zip'].value;
	theForm.elements['shippingAddress.country'].value = theForm.elements['billingAddress.country'].value;
	theForm.elements['shippingAddress.country'].selectedIndex = theForm.elements['billingAddress.country'].selectedIndex;
//	alert("done");
}
function copyBillTo(theForm) {
	var shipAddress1 = document.getElementById('shipAddress1');
	var billAddress1 = document.getElementById('billAddress1');
	shipAddress1.value = billAddress1.value;

	var shipAddress2 = document.getElementById('shipAddress2');
	var billAddress2 = document.getElementById('billAddress2');
	shipAddress2.value = billAddress2.value;

	var shipCity = document.getElementById('shipCity');
	var billCity = document.getElementById('billCity');
	shipCity.value = billCity.value;

	var shipState = document.getElementById('shipState');
	var billState = document.getElementById('billState');
	shipState.value = billState.value;

	var shipZip = document.getElementById('shipZip');
	var billZip = document.getElementById('billZip');
	shipZip.value = billZip.value;

	var shipCountry = document.getElementById('shipCountry');
	var billCountry = document.getElementById('billCountry');
	shipCountry.value = billCountry.value;
	
	var isShipAddressChanged = document.getElementById('isShipAddressChanged');
	isShipAddressChanged.value = 'true';

}

function emailChanged() {
	var isEmailChanged = document.getElementById('isEmailChanged');
	isEmailChanged.value = 'true';
}

function billAddressChanged() {
	var isBillAddressChanged = document.getElementById('isBillAddressChanged');
	isBillAddressChanged.value = 'true';
}

function shipAddressChanged() {
	var isShipAddressChanged = document.getElementById('isShipAddressChanged');
	isShipAddressChanged.value = 'true';
}

function paymentChanged() {
	var isPaymentChanged = document.getElementById('isPaymentChanged');
	isPaymentChanged.value = 'true';
}

function toggleBox(box) {
	if (box.checked == true) {
		box.checked = false;
	} else {
		box.checked = true;
	}
}

function showEdit1Rows() {
	var rows = null;
	rows = document.getElementsByTagName("tr");
	for (var i = 0; i < rows.length; i++) {
		if	(!rows[i].className) {
			continue;
		} else {
 			if (rows[i].className == 'edit1'){
	 			rows[i].style.display = "block";
	 		}
 			if (rows[i].className == 'view1') {
	 			rows[i].style.display = "none";
	 		}
 		}
	}
	var saveButton = document.getElementById('saveButton1');
	if (saveButton != null) 
		saveButton.style.display = "inline";	
	var cancelButton = document.getElementById('cancelButton1');
	if (cancelButton != null) 
		cancelButton.style.display = "inline";	
	var editButton = document.getElementById('editButton1');
	if (editButton != null) 
		editButton.style.display = "none";	
}

function showEdit2Rows() {
	var rows = null;
	rows = document.getElementsByTagName("tr");
	for (var i = 0; i < rows.length; i++) {
		if	(!rows[i].className) {
			continue;
		} else {
 			if (rows[i].className == 'edit2'){
	 			rows[i].style.display = "block";
	 		}
 			if (rows[i].className == 'view2') {
	 			rows[i].style.display = "none";
	 		}
 		}
	}
	var saveButton = document.getElementById('saveButton2');
	if (saveButton != null) 
		saveButton.style.display = "inline";	
	var cancelButton = document.getElementById('cancelButton2');
	if (cancelButton != null) 
		cancelButton.style.display = "inline";	
	var editButton = document.getElementById('editButton2');
	if (editButton != null) 
		editButton.style.display = "none";	
}
function showEdit3Rows() {
	var rows = null;
	rows = document.getElementsByTagName("tr");
	for (var i = 0; i < rows.length; i++) {
		if	(!rows[i].className) {
			continue;
		} else {
 			if (rows[i].className == 'edit3'){
	 			rows[i].style.display = "block";
	 		}
 			if (rows[i].className == 'view3') {
	 			rows[i].style.display = "none";
	 		}
 		}
	}
	var saveButton = document.getElementById('saveButton3');
	if (saveButton != null) 
		saveButton.style.display = "inline";	
	var cancelButton = document.getElementById('cancelButton3');
	if (cancelButton != null) 
		cancelButton.style.display = "inline";	
	var editButton = document.getElementById('editButton3');
	if (editButton != null) 
		editButton.style.display = "none";	
}
function showEdit4Rows() {
	var rows = null;
	rows = document.getElementsByTagName("tr");
	for (var i = 0; i < rows.length; i++) {
		if	(!rows[i].className) {
			continue;
		} else {
 			if (rows[i].className == 'edit4'){
	 			rows[i].style.display = "block";
	 		}
 			if (rows[i].className == 'view4') {
	 			rows[i].style.display = "none";
	 		}
 		}
	}
	var saveButton = document.getElementById('saveButton4');
	if (saveButton != null) 
		saveButton.style.display = "inline";	
	var cancelButton = document.getElementById('cancelButton4');
	if (cancelButton != null) 
		cancelButton.style.display = "inline";	
	var editButton = document.getElementById('editButton4');
	if (editButton != null) 
		editButton.style.display = "none";	
}
function showEdit5Rows() {
	var rows = null;
	rows = document.getElementsByTagName("tr");
	for (var i = 0; i < rows.length; i++) {
		if	(!rows[i].className) {
			continue;
		} else {
 			if (rows[i].className == 'edit5'){
	 			rows[i].style.display = "block";
	 		}
 			if (rows[i].className == 'view5') {
	 			rows[i].style.display = "none";
	 		}
 		}
	}
	var saveButton = document.getElementById('saveButton5');
	if (saveButton != null) 
		saveButton.style.display = "inline";	
	var cancelButton = document.getElementById('cancelButton5');
	if (cancelButton != null) 
		cancelButton.style.display = "inline";	
	var editButton = document.getElementById('editButton5');
	if (editButton != null) 
		editButton.style.display = "none";	
}
function showEdit6Rows() {
	var rows = null;
	rows = document.getElementsByTagName("tr");
	for (var i = 0; i < rows.length; i++) {
		if	(!rows[i].className) {
			continue;
		} else {
 			if (rows[i].className == 'edit6'){
	 			rows[i].style.display = "block";
	 		}
 			if (rows[i].className == 'view6') {
	 			rows[i].style.display = "none";
	 		}
 		}
	}
	var saveButton = document.getElementById('saveButton6');
	if (saveButton != null) 
		saveButton.style.display = "inline";	
	var cancelButton = document.getElementById('cancelButton6');
	if (cancelButton != null) 
		cancelButton.style.display = "inline";	
	var editButton = document.getElementById('editButton6');
	if (editButton != null) 
		editButton.style.display = "none";	
}
function showEdit7Rows() {
	var rows = null;
	rows = document.getElementsByTagName("tr");
	for (var i = 0; i < rows.length; i++) {
		if	(!rows[i].className) {
			continue;
		} else {
 			if (rows[i].className == 'edit7'){
	 			rows[i].style.display = "block";
	 		}
 			if (rows[i].className == 'view7') {
	 			rows[i].style.display = "none";
	 		}
 		}
	}
	var saveButton = document.getElementById('saveButton7');
	if (saveButton != null) 
		saveButton.style.display = "inline";	
	var cancelButton = document.getElementById('cancelButton7');
	if (cancelButton != null) 
		cancelButton.style.display = "inline";	
	var editButton = document.getElementById('editButton7');
	if (editButton != null) 
		editButton.style.display = "none";	
}
function hideEdit1Rows() {
	var rows = null;
	rows = document.getElementsByTagName("tr");
	for (var i = 0; i < rows.length; i++) {
		if	(!rows[i].className) {
			continue;
		} else {
 			if (rows[i].className == 'edit1'){
	 			rows[i].style.display = "none";
	 		}
 			if (rows[i].className == 'view1') {
	 			rows[i].style.display = "block";
	 		}
 		}
	}
	var saveButton = document.getElementById('saveButton1');
	if (saveButton != null) 
		saveButton.style.display = "none";	
	var cancelButton = document.getElementById('cancelButton1');
	if (cancelButton != null) 
		cancelButton.style.display = "none";	
	var editButton = document.getElementById('editButton1');
	if (editButton != null) 
		editButton.style.display = "block";	
}

function hideEdit2Rows() {
	var rows = null;
	rows = document.getElementsByTagName("tr");
	for (var i = 0; i < rows.length; i++) {
		if	(!rows[i].className) {
			continue;
		} else {
 			if (rows[i].className == 'edit2'){
	 			rows[i].style.display = "none";
	 		}
 			if (rows[i].className == 'view2') {
	 			rows[i].style.display = "block";
	 		}
 		}
	}
	var saveButton = document.getElementById('saveButton2');
	if (saveButton != null) 
		saveButton.style.display = "none";	
	var cancelButton = document.getElementById('cancelButton2');
	if (cancelButton != null) 
		cancelButton.style.display = "none";	
	var editButton = document.getElementById('editButton2');
	if (editButton != null) 
		editButton.style.display = "block";	
}

function hideEdit3Rows() {
	var rows = null;
	rows = document.getElementsByTagName("tr");
	for (var i = 0; i < rows.length; i++) {
		if	(!rows[i].className) {
			continue;
		} else {
 			if (rows[i].className == 'edit3'){
	 			rows[i].style.display = "none";
	 		}
 			if (rows[i].className == 'view3') {
	 			rows[i].style.display = "block";
	 		}
 		}
	}
	var saveButton = document.getElementById('saveButton3');
	if (saveButton != null) 
		saveButton.style.display = "none";	
	var cancelButton = document.getElementById('cancelButton3');
	if (cancelButton != null) 
		cancelButton.style.display = "none";	
	var editButton = document.getElementById('editButton3');
	if (editButton != null) 
		editButton.style.display = "block";	
}

function hideEdit4Rows() {
	var rows = null;
	rows = document.getElementsByTagName("tr");
	for (var i = 0; i < rows.length; i++) {
		if	(!rows[i].className) {
			continue;
		} else {
 			if (rows[i].className == 'edit4'){
	 			rows[i].style.display = "none";
	 		}
 			if (rows[i].className == 'view4') {
	 			rows[i].style.display = "block";
	 		}
 		}
	}
	var saveButton = document.getElementById('saveButton4');
	if (saveButton != null) 
		saveButton.style.display = "none";	
	var cancelButton = document.getElementById('cancelButton4');
	if (cancelButton != null) 
		cancelButton.style.display = "none";	
	var editButton = document.getElementById('editButton4');
	if (editButton != null) 
		editButton.style.display = "block";	
}

function hideEdit5Rows() {
	var rows = null;
	rows = document.getElementsByTagName("tr");
	for (var i = 0; i < rows.length; i++) {
		if	(!rows[i].className) {
			continue;
		} else {
 			if (rows[i].className == 'edit5'){
	 			rows[i].style.display = "none";
	 		}
 			if (rows[i].className == 'view5') {
	 			rows[i].style.display = "block";
	 		}
 		}
	}
	var saveButton = document.getElementById('saveButton5');
	if (saveButton != null) 
		saveButton.style.display = "none";	
	var cancelButton = document.getElementById('cancelButton5');
	if (cancelButton != null) 
		cancelButton.style.display = "none";	
	var editButton = document.getElementById('editButton5');
	if (editButton != null) 
		editButton.style.display = "block";	
}

function hideEdit6Rows() {
	var rows = null;
	rows = document.getElementsByTagName("tr");
	for (var i = 0; i < rows.length; i++) {
		if	(!rows[i].className) {
			continue;
		} else {
 			if (rows[i].className == 'edit6'){
	 			rows[i].style.display = "none";
	 		}
 			if (rows[i].className == 'view6') {
	 			rows[i].style.display = "block";
	 		}
 		}
	}
	var saveButton = document.getElementById('saveButton6');
	if (saveButton != null) 
		saveButton.style.display = "none";	
	var cancelButton = document.getElementById('cancelButton6');
	if (cancelButton != null) 
		cancelButton.style.display = "none";	
	var editButton = document.getElementById('editButton6');
	if (editButton != null) 
		editButton.style.display = "block";	
}
function hideEdit7Rows() {
	var rows = null;
	rows = document.getElementsByTagName("tr");
	for (var i = 0; i < rows.length; i++) {
		if	(!rows[i].className) {
			continue;
		} else {
 			if (rows[i].className == 'edit7'){
	 			rows[i].style.display = "none";
	 		}
 			if (rows[i].className == 'view7') {
	 			rows[i].style.display = "block";
	 		}
 		}
	}
	var saveButton = document.getElementById('saveButton7');
	if (saveButton != null) 
		saveButton.style.display = "none";	
	var cancelButton = document.getElementById('cancelButton7');
	if (cancelButton != null) 
		cancelButton.style.display = "none";	
	var editButton = document.getElementById('editButton7');
	if (editButton != null) 
		editButton.style.display = "block";	
}

function checkForErrors() {

	var errorDiv = document.getElementById('hasErrors');
	if (errorDiv != null) {
		showEdit1Rows();
		showEdit2Rows();
	}
}

/* Product Gallery Reviews Pages */
function getFullReview(revID) {
	try {
		theURL = document.getElementById(revID+"Link").href;
		window.location=theURL;
	}
	catch(err) {
		return false;
	}
}