function ClearInputText(sForm, sField, sValue) {
	var searchValue;
	
	searchValue = document.forms[sForm].elements[sField];

	if (searchValue.value.toLowerCase() == sValue.toLowerCase()) {
		searchValue.value = '';
	}
	else if (searchValue.value == '') {
		searchValue.value = sValue;
	}
}

function wall_prep() {
	OpenPopup('/wallprep_popup.php', 'wallprep', 400, 300, 1, 0);
}

function OpenPopup(sURL, sWindowName, iWidth, iHeight, sScrollYesNo, sResizableYesNo) {
	var fLeftPosition, fTopPosition;
	var sSettings;

	fLeftPosition = (screen.width) ? (screen.width-iWidth)/2 : 0;
	fTopPosition = (screen.height) ? (screen.height-iHeight)/2 : 0;

	sSettings = 'height='+ iHeight +',width='+ iWidth +',top='+ fTopPosition +',left='+ fLeftPosition +',scrollbars='+ sScrollYesNo +',resizable=' + sResizableYesNo
	window.open(sURL, sWindowName, sSettings)
}

function wallprep_close() {
	window.opener.document.location.href='/wallprep.php';
	window.parent.close();
}

function ChangeColor(i, iTotal) {
	//alert(document.getElementById('zen_image').src);
	for (x = 0; x < iTotal; ++x) {
		if (x == i) {
			document.getElementById('zen_image' + i).style.display = 'block';
		}
		else {
			document.getElementById('zen_image' + x).style.display = 'none';
		}
	}
}

function MarkAll(sForm, sField) {
	var is_checked = document.forms[sForm].elements['markall'].checked;
	var iLength = document.forms[sForm].elements[sField].length;
	if(iLength == undefined) {iLength=1;}	//not sure why funct doesn't work when 1 item in cart, but added this kluge to make it work
	
	if(iLength==1) {						//and this stuff (hwm 4/24/09)
        document.forms[sForm].elements[sField].checked = is_checked;
	} else { 
    	for (i = 0; i < iLength; i++) {
    	    document.forms[sForm].elements[sField][i].checked = is_checked;
	    }
	}
}
