<!--

var myWarning="The images on this page are the property of Love YourShelf.\nPlease do not copy them.\n";

function rClick(doIt) {
	if (document.all) {
		if (event.button == 2) {
			alert(myWarning); return false;
		}
	}
	if (document.layers) {
		if (doIt.which == 3) {
			alert(myWarning); return false;
		}
	}
}

function preloadImages(images) {
	for(loop = 0; loop < images.length; loop++) {
		var image = new Image();
		image.src = images[loop];
	}
}

function openWindow(fileName,SizeW,SizeH) {
	popupWin = window.open('popups/' + fileName, 'event', 'width=' + SizeW + ',height=' + SizeH)
}

expireDate = new Date;
expireDate.setMonth(expireDate.getMonth()+3);

function writecookie(cookiename,cookievalue) {
     document.cookie = cookiename + "=" + cookievalue + ";expires=" + expireDate.toGMTString()
}

function readcookie(lookfor) {
     if (document.cookie == "") {
          return ""
     }
     else {
          currentcookie = document.cookie.split("; ")
          for (i=0; i<currentcookie.length; i++){
               if (currentcookie[i].split("=")[0]==lookfor) {
                    return currentcookie[i].split("=")[1]
               }
          }
          return ""
     }
}

colors = new Array(8)
colors[0] = "Select a color ";
colors[1] = "Americana Blue";
colors[2] = "Antique White";
colors[3] = "Barn Red";
colors[4] = "Black";
colors[5] = "Butterscotch";
colors[6] = "Hershey Bar";
colors[7] = "Olive Green";



function fillColors(form,Distress) {
	form.os0.options.length = colors.length;
	for (var i = 0; i < colors.length; i++) {
		form.os0.options[i].text = colors[i];
		form.os0.options[i].value = colors[i];
	}
	form.os1.options.length = 3;
	form.os1.options[0].text = "Lightly Distressed ";
	form.os1.options[0].value = "Lightly Distressed";
	form.os1.options[1].text = "Heavily Distressed (+$" + Distress + ")";
	form.os1.options[1].value = "Heavily Distressed (+$" + Distress + ")";
	form.os1.options[2].text = "Not Distressed";
	form.os1.options[2].value = "Not Distressed";
}

function removeColors(form) {
	for (var i = 0; i < form.os0.options.length; i++) {
		form.os0.options[i] = null;
	}
	form.os0.options.length = 1;
	form.os0.options[0].text = "Not Painted ";
	form.os0.options[0].value = "Not Painted";
	form.os1.options.length = 1;
	form.os1.options[0].text = "Not Distressed";
	form.os1.options[0].value = "Not Distressed";
}

function format(expr,decplaces) {
	var str = "" + Math.round(eval(expr)* Math.pow(10,decplaces))
	while (str.length <= decplaces) {
		str = "0" + str
	}
	var decpoint = str.length - decplaces
	return str.substring(0,decpoint) + "." + str.substring(decpoint,str.length);
}

function isValid(inputVal) {
	inputStr = inputVal.toString();
	for (var i = 0; i < inputStr.length; i++) {
		var oneChar = inputStr.charAt(i)
		if (oneChar == ".") {
			continue
		}
		else if (oneChar < "0" || oneChar > "9") {
			return false
		}
	}
	return true
}

function isPosInteger(inputVal) {
	inputStr = inputVal.toString()
	for (var i = 0; i < inputStr.length; i++) {
		var oneChar = inputStr.charAt(i)
		if (oneChar < "0" || oneChar > "9") {
			return false
		}
	}
return true
}

function verifyUnpainted(form,Distress) {
	if (form.amount[1].checked && form.os0.selectedIndex==0) {
		alert("Please select a color.");
		return false;
	}
	else if (form.os1.selectedIndex==1) {
		form.amount[1].value = Distress;
		return true;
	}
	else {
		return true;
	}
}

function verifyPainted(form,Distress) {
	if (form.amount[0].checked && form.os0.selectedIndex==0) {
		alert("Please select a color.");
		return false;
	}
	else if (form.os1.selectedIndex==1) {
		form.amount[0].value = Distress;
		return true;
	}
	else {
		return true;
	}
}

function verify(form) {
	if (form.os0.selectedIndex==0) {
		alert("Please select a color.");
		return false;
	}
	else if (form.shipping.selectedIndex==0) {
		form.os1.value = "Free delivery";
		return true;
	}
	else if (form.shipping.selectedIndex==1) {
		form.os1.value = "Pick-up";
		return true;
	}
	else {
		form.os1.value = "Ship";
		return true;
	}
}


-->
