function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

function clearChoices2() {
	var list = document.getElementById("choicesList2");
	var choices = list.getElementsByTagName("li");
	for (var i=0;i<choices.length;i++)
	{
		choices[i].className="";
	}
}

function clearChoices1() {
	var list = document.getElementById("choicesList1");
	var choices = list.getElementsByTagName("li");
	for (var i=0;i<choices.length;i++)
	{
		choices[i].className="";
	}
}

function clearChoices() {
	var list = document.getElementById("choicesList");
	var choices = list.getElementsByTagName("li");
	for (var i=0;i<choices.length;i++)
	{
		choices[i].className="";
	}
}

function highlightChoice2(template2) {
	var satin = document.getElementById("li_satin");
	var semiGloss = document.getElementById("li_semi_gloss");
	var glossy = document.getElementById("li_glossy");
	if (template2 == "li_satin") {
		clearChoices2();
		satin.className = "on";
	}
	else if (template2 == "li_semi_gloss") {
		clearChoices2();
		semiGloss.className = "on";
	}
	else if (template2 == "li_glossy") {
		clearChoices2();
		glossy.className = "on";
	}
}

function highlightChoice1(template1) {
	var lampBlack1 = document.getElementById("li_lamp_black1");
	var tuscanRed1 = document.getElementById("li_tuscan_red1");
	var espresso1 = document.getElementById("li_espresso1");
	if (template1 == "li_lamp_black1") {
		clearChoices1();
		lampBlack1.className = "on";
	}
	else if (template1 == "li_tuscan_red1") {
		clearChoices1();
		tuscanRed1.className = "on";
	}
	else if (template1 == "li_espresso1") {
		clearChoices1();
		espresso1.className = "on";
	}
}

function highlightChoice(template) {
	var snowWhite = document.getElementById("li_snow_white");
	var antiqueWhite = document.getElementById("li_antique_white");
	var linen = document.getElementById("li_linen");
	var millstone = document.getElementById("li_millstone");
	var outbackBrown = document.getElementById("li_outback_brown");
	var sageGreen = document.getElementById("li_sage_green");
	var bayberry = document.getElementById("li_bayberry");
	var basil = document.getElementById("li_basil");
	var cypress = document.getElementById("li_cypress");
	var buttermilkYellow = document.getElementById("li_buttermilk_yellow");
	var somersetGold = document.getElementById("li_somerset_gold");
	var littlePink = document.getElementById("li_little_pink");
	var autumnHaze = document.getElementById("li_autumn_haze");
	var redPepper = document.getElementById("li_red_pepper");
	var tuscanRed = document.getElementById("li_tuscan_red");
	var babyBlue = document.getElementById("li_baby_blue");
	var federalBlue = document.getElementById("li_federal_blue");
	var coastalBlue = document.getElementById("li_coastal_blue");
	var lampBlack = document.getElementById("li_lamp_black");
	var naturalStain = document.getElementById("li_natural_stain");
	var countryPine = document.getElementById("li_country_pine");
	var goldenOak = document.getElementById("li_golden_oak");
	var shakerMaple = document.getElementById("li_shaker_maple");
	var pecan = document.getElementById("li_pecan");
	var antiqueOak = document.getElementById("li_antique_oak");
	var earlyAmerican = document.getElementById("li_early_american");
	var antiqueCherry = document.getElementById("li_antique_cherry");
	var blackCherry = document.getElementById("li_black_cherry");
	var walnut = document.getElementById("li_walnut");
	var brownMahogany = document.getElementById("li_brown_mahogany");
	var rosewood = document.getElementById("li_rosewood");
	var espresso = document.getElementById("li_espresso");
	if (template == "li_snow_white") {
		clearChoices();
		snowWhite.className = "on";
	}
	else if (template == "li_antique_white") {
		clearChoices();
		antiqueWhite.className = "on";
	}
	else if (template == "li_linen") {
		clearChoices();
		linen.className = "on";
	}
	else if (template == "li_millstone") {
		clearChoices();
		millstone.className = "on";
	}
	else if (template == "li_outback_brown") {
		clearChoices();
		outbackBrown.className = "on";
	}
	else if (template == "li_sage_green") {
		clearChoices();
		sageGreen.className = "on";
	}
	else if (template == "li_bayberry") {
		clearChoices();
		bayberry.className = "on";
	}
	else if (template == "li_basil") {
		clearChoices();
		basil.className = "on";
	}
	else if (template == "li_cypress") {
		clearChoices();
		cypress.className = "on";
	}
	else if (template == "li_buttermilk_yellow") {
		clearChoices();
		buttermilkYellow.className = "on";
	}
	else if (template == "li_somerset_gold") {
		clearChoices();
		somersetGold.className = "on";
	}
	else if (template == "li_little_pink") {
		clearChoices();
		littlePink.className = "on";
	}
	else if (template == "li_autumn_haze") {
		clearChoices();
		autumnHaze.className = "on";
	}
	else if (template == "li_red_pepper") {
		clearChoices();
		redPepper.className = "on";
	}
	else if (template == "li_tuscan_red") {
		clearChoices();
		tuscanRed.className = "on";
	}
	else if (template == "li_baby_blue") {
		clearChoices();
		babyBlue.className = "on";
	}
	else if (template == "li_federal_blue") {
		clearChoices();
		federalBlue.className = "on";
	}
	else if (template == "li_coastal_blue") {
		clearChoices();
		coastalBlue.className = "on";
	}
	else if (template == "li_lamp_black") {
		clearChoices();
		lampBlack.className = "on";
	}
	else if (template == "li_natural_stain") {
		clearChoices();
		naturalStain.className = "on";
	}
	else if (template == "li_country_pine") {
		clearChoices();
		countryPine.className = "on";
	}
	else if (template == "li_golden_oak") {
		clearChoices();
		goldenOak.className = "on";
	}
	else if (template == "li_shaker_maple") {
		clearChoices();
		shakerMaple.className = "on";
	}
	else if (template == "li_pecan") {
		clearChoices();
		pecan.className = "on";
	}
	else if (template == "li_antique_oak") {
		clearChoices();
		antiqueOak.className = "on";
	}
	else if (template == "li_early_american") {
		clearChoices();
		earlyAmerican.className = "on";
	}
	else if (template == "li_antique_cherry") {
		clearChoices();
		antiqueCherry.className = "on";
	}
	else if (template == "li_black_cherry") {
		clearChoices();
		blackCherry.className = "on";
	}
	else if (template == "li_walnut") {
		clearChoices();
		walnut.className = "on";
	}
	else if (template == "li_brown_mahogany") {
		clearChoices();
		brownMahogany.className = "on";
	}
	else if (template == "li_rosewood") {
		clearChoices();
		rosewood.className = "on";
	}
	else if (template == "li_espresso") {
		clearChoices();
		espresso.className = "on";
	}
}

/* so that if someone clicks on the actual radio and not the image, the effect still happens */

function prepareChoices2() {
	var satin1 = document.getElementById("radio_satin");
	var semiGloss1 = document.getElementById("radio_semi_gloss");
	var glossy1 = document.getElementById("radio_glossy");
	satin1.onclick = function () {
		highlightChoice2("li_satin");
	}
	semiGloss1.onclick = function () {
		highlightChoice2("li_semi_gloss");
	}
	glossy1.onclick = function () {
		highlightChoice2("li_glossy");
	}
}
addLoadEvent(prepareChoices2);

function prepareChoices1() {
	var lampBlack1 = document.getElementById("radio_lamp_black1");
	var tuscanRed1 = document.getElementById("radio_tuscan_red1");
	var espresso1 = document.getElementById("radio_espresso1");
	lampBlack1.onclick = function () {
		highlightChoice1("li_lamp_black1");
	}
	tuscanRed1.onclick = function () {
		highlightChoice1("li_tuscan_red1");
	}
	espresso1.onclick = function () {
		highlightChoice1("li_espresso1");
	}
}
addLoadEvent(prepareChoices1);

function prepareChoices() {
	var snowWhite = document.getElementById("radio_snow_white");
	var antiqueWhite = document.getElementById("radio_antique_white");
	var linen = document.getElementById("radio_linen");
	var millstone = document.getElementById("radio_millstone");
	var outbackBrown = document.getElementById("radio_outback_brown");
	var sageGreen = document.getElementById("radio_sage_green");
	var bayberry = document.getElementById("radio_bayberry");
	var basil = document.getElementById("radio_basil");
	var cypress = document.getElementById("radio_cypress");
	var buttermilkYellow = document.getElementById("radio_buttermilk_yellow");
	var somersetGold = document.getElementById("radio_somerset_gold");
	var littlePink = document.getElementById("radio_little_pink");
	var autumnHaze = document.getElementById("radio_autumn_haze");
	var redPepper = document.getElementById("radio_red_pepper");
	var tuscanRed = document.getElementById("radio_tuscan_red");
	var babyBlue = document.getElementById("radio_baby_blue");
	var federalBlue = document.getElementById("radio_federal_blue");
	var coastalBlue = document.getElementById("radio_coastal_blue");
	var lampBlack = document.getElementById("radio_lamp_black");
	var naturalStain = document.getElementById("radio_natural_stain");
	var countryPine = document.getElementById("radio_country_pine");
	var goldenOak = document.getElementById("radio_golden_oak");
	var shakerMaple = document.getElementById("radio_shaker_maple");
	var pecan = document.getElementById("radio_pecan");
	var antiqueOak = document.getElementById("radio_antique_oak");
	var earlyAmerican = document.getElementById("radio_early_american");
	var antiqueCherry = document.getElementById("radio_antique_cherry");
	var blackCherry = document.getElementById("radio_black_cherry");
	var walnut = document.getElementById("radio_walnut");
	var brownMahogany = document.getElementById("radio_brown_mahogany");
	var rosewood = document.getElementById("radio_rosewood");
	var espresso = document.getElementById("radio_espresso");
	snowWhite.onclick = function () {
		highlightChoice("li_snow_white");
	}
	antiqueWhite.onclick = function () {
		highlightChoice("li_antique_white");
	}
	linen.onclick = function () {
		highlightChoice("li_linen");
	}
	millstone.onclick = function () {
		highlightChoice("li_millstone");
	}
	outbackBrown.onclick = function () {
		highlightChoice("li_outback_brown");
	}
	sageGreen.onclick = function () {
		highlightChoice("li_sage_green");
	}
	bayberry.onclick = function () {
		highlightChoice("li_bayberry");
	}
	basil.onclick = function () {
		highlightChoice("li_basil");
	}
	cypress.onclick = function () {
		highlightChoice("li_cypress");
	}
	buttermilkYellow.onclick = function () {
		highlightChoice("li_buttermilk_yellow");
	}
	somersetGold.onclick = function () {
		highlightChoice("li_somerset_gold");
	}
	littlePink.onclick = function () {
		highlightChoice("li_little_pink");
	}
	autumnHaze.onclick = function () {
		highlightChoice("li_autumn_haze");
	}
	redPepper.onclick = function () {
		highlightChoice("li_red_pepper");
	}
	tuscanRed.onclick = function () {
		highlightChoice("li_tuscan_red");
	}
	babyBlue.onclick = function () {
		highlightChoice("li_baby_blue");
	}
	federalBlue.onclick = function () {
		highlightChoice("li_federal_blue");
	}
	coastalBlue.onclick = function () {
		highlightChoice("li_coastal_blue");
	}
	lampBlack.onclick = function () {
		highlightChoice("li_lamp_black");
	}
	naturalStain.onclick = function () {
		highlightChoice("li_natural_stain");
	}
	countryPine.onclick = function () {
		highlightChoice("li_country_pine");
	}
	goldenOak.onclick = function () {
		highlightChoice("li_golden_oak");
	}
	shakerMaple.onclick = function () {
		highlightChoice("li_shaker_maple");
	}
	pecan.onclick = function () {
		highlightChoice("li_pecan");
	}
	antiqueOak.onclick = function () {
		highlightChoice("li_antique_oak");
	}
	earlyAmerican.onclick = function () {
		highlightChoice("li_early_american");
	}
	antiqueCherry.onclick = function () {
		highlightChoice("li_antique_cherry");
	}
	blackCherry.onclick = function () {
		highlightChoice("li_black_cherry");
	}
	walnut.onclick = function () {
		highlightChoice("li_walnut");
	}
	brownMahogany.onclick = function () {
		highlightChoice("li_brown_mahogany");
	}
	rosewood.onclick = function () {
		highlightChoice("li_rosewood");
	}
	espresso.onclick = function () {
		highlightChoice("li_espresso");
	}
}
addLoadEvent(prepareChoices);

function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=400,height=235,scrollbars=yes');
return false;
}
