
var xmlDoc;
function ajaxrequest(dest) {
var url, querystring;
var xmlhttp = false;
if (window.XMLHttpRequest) { 
xmlhttp = new XMLHttpRequest();
if (xmlhttp.overrideMimeType) {
xmlhttp.overrideMimeType('text/xml');
}
} else if (window.ActiveXObject) { 
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!xmlhttp) {
alert("Your browser cannot handle this script.");
return false;
}
url = null;
querystring = null;
var aPart = dest.split("?");
if (aPart && aPart.length>1) {
url = aPart[0];
querystring = aPart[1];
} else {
url = dest;
}
url = url + ((url.indexOf("?")>=0) ? "&" : "?") + "_ct=" + new Date().getTime();
xmlhttp.onreadystatechange = function() { httptriggered(xmlhttp); };
xmlhttp.open("POST", url, true);
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
xmlhttp.send(querystring);
}
function httptriggered(xmlhttp) {
var o;
if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
    xmlDoc = xmlhttp.responseXML;
handleResponse();
}
}
function loadXML(xml) {
if (window.ActiveXObject) {
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = false;
xmlDoc.loadXML(xml);
handleResponse();
} else if (document.implementation && document.implementation.createDocument) {
var vParser = new DOMParser();
xmlDoc = vParser.parseFromString(xml, "text/xml");
handleResponse();
} else {
alert('Your browser cannot handle this script.');
}
}
function getInnerText(node) {
if (typeof node.textContent != 'undefined') {
return node.textContent;
} else if (typeof node.innerText != 'undefined') {
return node.innerText;
} else if (typeof node.text != 'undefined') {
return node.text;
} else {
switch (node.nodeType) {
case 3:
case 4:
return node.nodeValue;
break;
case 1:
case 11:
var innerText = '';
for (var i = 0; i < node.childNodes.length; i++) {
innerText += getInnerText(node.childNodes[i]);
}
return innerText;
break;
default:
return '';
}
}
}
function getObj(targetName) {
if (document.all) {
return document.all[targetName];
} else if (document.getElementById) {
return document.getElementById(targetName);
}
}
function replace(string,text,by) {
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;
    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;
    var newstr = string.substring(0,i) + by;
    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);
    return newstr;
}
function checkdate(strDate) {
var reDateSplit = /\/|-/;
var i;
var r = false;
var nDateThreshold = 83;
var nDateHighyear = 2000;
var nDateLowyear = 1900;
var nDateMinyear = 1900;
var nDateMaxyear = 3000;
var aDatePieces = strDate.split(reDateSplit);
if (aDatePieces.length == 3) {
if (aDatePieces[0].length < 3 && aDatePieces[1].length < 3) {
for (i=0; i<3; i++) {
aDatePieces[i] = parseInt(aDatePieces[i], 10);
}
if (aDatePieces[0] && aDatePieces[1]) {
if (aDatePieces[0] <= 12 && ((aDatePieces[2] < 100) || (aDatePieces[2] > nDateMinyear && aDatePieces[2] < nDateMaxyear))) {
switch (aDatePieces[0]) {
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
r = (aDatePieces[1] < 32);
break;
case 4:
case 6:
case 9:
case 11:
r = (aDatePieces[1] < 31);
break;
default:
if (aDatePieces[2] < 100) {
if (aDatePieces[2] < nDateThreshold) {
aDatePieces[2] += nDateHighyear;
} else {
aDatePieces[2] += nDateLowyear;
}
}
if (((aDatePieces[2] % 4 == 0) && (aDatePieces[2] % 100 != 0)) || (aDatePieces[2] % 400 == 0)) {
r = (aDatePieces[1] < 30);
} else {
r = (aDatePieces[1] < 29);
}
break;
}
}
}
}
}
return r;
}
function decimalFormat(val) {
var v;
val = parseFloat(val);
if (isNaN(val)) return "0.00";
val = parseInt(Math.round(val*100))/100.0;
v = parseInt(Math.round(val*100));
if (v%100==0) return val + ".00";
if (v%10==0) return val + "0";
return val;
}
function getNum(english) {
switch(english.toLowerCase()) {
case "one":
return 1;
break;
case "two":
return 2;
break;
case "three":
return 3;
break;
case "four":
return 4;
break;
case "five":
return 5;
break;
case "six":
return 6;
break;
case "seven":
return 7;
break;
case "eight":
return 8;
break;
case "nine":
return 9;
break;
case "ten":
return 10;
break;
default:
return 0;
break;
}
}
function getSize(suffix) {
var o, v;
v = 0;
o = getObj("sizea"+suffix);
if (o) {
if (o.type) {
if (o.type=="select-one") {
if (!isNaN(parseInt(o.options[o.selectedIndex].value))) {
v = parseInt(o.options[o.selectedIndex].value);
}
} else {
v = 0;
if (!isNaN(parseInt(o.value))) {
v += parseInt(o.value);
o.value = v;
} else {
o.value = "";
}
}
}
}
o = getObj("sizeb"+suffix);
if (o) {
if (o.type) {
if (o.type=="select-one") {
if (o && !isNaN(parseFloat(o.options[o.selectedIndex].value))) {
v += parseFloat(o.options[o.selectedIndex].value);
}
} else {
if (!isNaN(parseInt(o.value))) {
v += parseInt(o.value);
}
}
}
}
return v;
}
function setSize(suffix, size) {
var i, o, a, b;
a = parseInt(size);
if (!isNaN(a)) {
b = parseFloat(size-a);
if (isNaN(b)) b = 0;
o = getObj("sizea"+suffix);
if (o && o.type) {
if (o.type=="select-one") {
for (i=0; i<o.options.length; i++) {
o.options[i].selected = (parseInt(o.options[i].value)==a);
}
} else {
o.value = a;
}
}
o = getObj("sizeb"+suffix);
if (o) {
for (i=0; i<o.options.length; i++) {
o.options[i].selected = (o.options[i].value==b);
}
}
}
}
function eighthFormat(val) {
var num, part;
num = parseInt(val);
val = parseFloat(val)
if (!isNaN(num) && !isNaN(val)) {
part = val - parseFloat(num);
part = eighth(part*8.0);
return "" + num + (part=="" ? "" : "-") + part;
} else {
return "0";
}
}
function eighth(numerator) {
numerator = parseInt(numerator);
if (!isNaN(numerator)) {
switch (numerator) {
case 1:
return "1/8";
break;
case 2:
return "1/4";
break;
case 3:
return "3/8";
break;
case 4:
return "1/2";
break;
case 5:
return "5/8";
break;
case 6:
return "3/4";
break;
case 7:
return "7/8";
break;
default:
return "";
break;
}
} else {
return "";
}
}
function sizeField(suffix, val, onchange) {
var val1, val2, r, v;
r = "";
val1 = parseInt(val);
if (isNaN(val1)) val1 = 0;
val2 = val-val1;
r += "<input type=\"text\" name=\"sizea"+suffix+"\" id=\"sizea"+suffix+"\" value=\"" + (val1>0 ? val1 : "") + "\" size=\"3\"" + (onchange!="" ? " onchange=\""+onchange+"\"" : "") + " /> ";
r += "<select name=\"sizeb"+suffix+"\" id=\"sizeb"+suffix+"\"" + (onchange!="" ? " onchange=\"" + onchange + "\"" : "") + ">";
for (var i=0; i<8; i++) {
v = parseFloat(i/8.0);
r += "<option value=\"" + v + "\"" + (val2==v ? " selected=\"selected\"" : "") + ">" + eighth(i) + "</option>";
}
r += "</select>";
return (r);
}
function dynamicToEnglish(val) {
switch(val) {
case "configwidth":
return "[Width of the Config]";
break;
case "minmodelwidth":
return "[Minimum Width of the Model]";
break;
case "maxmodelwidth":
return "[Maximum Width of the Model]";
break;
default:
return val;
break;
}
}
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;
var USE_IMAGE_LOADER = false;
var BrowserDetect = {
init: function () {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(navigator.userAgent)
|| this.searchVersion(navigator.appVersion)
|| "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
if (this.version == 6 && this.browser == "Explorer")
USE_IMAGE_LOADER = true;
},
searchString: function (data) {
for (var i=0;i<data.length;i++){
var dataString = data[i].string;
var dataProp = data[i].prop;
this.versionSearchString = data[i].versionSearch || data[i].identity;
if (dataString) {
if (dataString.indexOf(data[i].subString) != -1)
return data[i].identity;
}
else if (dataProp)
return data[i].identity;
}
},
searchVersion: function (dataString) {
var index = dataString.indexOf(this.versionSearchString);
if (index == -1) return;
return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
},
dataBrowser: [
{ string: navigator.userAgent,
subString: "OmniWeb",
versionSearch: "OmniWeb/",
identity: "OmniWeb"
},
{
string: navigator.vendor,
subString: "Apple",
identity: "Safari"
},
{
prop: window.opera,
identity: "Opera"
},
{
string: navigator.vendor,
subString: "iCab",
identity: "iCab"
},
{
string: navigator.vendor,
subString: "KDE",
identity: "Konqueror"
},
{
string: navigator.userAgent,
subString: "Firefox",
identity: "Firefox"
},
{
string: navigator.vendor,
subString: "Camino",
identity: "Camino"
},
{
string: navigator.userAgent,
subString: "Netscape",
identity: "Netscape"
},
{
string: navigator.userAgent,
subString: "MSIE",
identity: "Explorer",
versionSearch: "MSIE"
},
{
string: navigator.userAgent,
subString: "Gecko",
identity: "Mozilla",
versionSearch: "rv"
},
{ 
string: navigator.userAgent,
subString: "Mozilla",
identity: "Netscape",
versionSearch: "Mozilla"
}
],
dataOS : [
{
string: navigator.platform,
subString: "Win",
identity: "Windows"
},
{
string: navigator.platform,
subString: "Mac",
identity: "Mac"
},
{
string: navigator.platform,
subString: "Linux",
identity: "Linux"
}
]
};
BrowserDetect.init();
function stripeHelpTables(attributeid) {
$("#learnpanel"+attributeid+" table tbody tr:odd").each(function() {
$(this).attr("class","odd");
});
$("#learnpanel"+attributeid+" table tr th:first").each(function() {
$(this).attr("class","first"); 
});
}
function learnMoreLink(attributeid) {
return '<p><img id="learnMoreArrow'+attributeid+'" width="7" height="7" border="0" alt="#" src="'+IMAGES_URL+'/icons/7px_tri_right.gif"/> <a href="Javascript:;" onclick="toggleLearnMoreDiv(\''+attributeid+'\', false);">' + (attributeid=="dimensionshelp" ? "important measuring tips" : "learn more") + '</a> <span id="learnspinner'+attributeid+'" style="display:none;"><img src="/images/configurator/indicator_onwhite.gif" border="0" /> Loading...</span><img src="'+IMAGES_URL+'/icons/spacer.gif" height="16" width="1" />';
}
function learnMoreDiv(attributeid) {
return '<div class="message_panel learn-colors" id="learnpanel'+attributeid+'" name="learnpanel'+attributeid+'" style="display:none"></div>';
}
function toggleLearnMoreDiv(attributeid, forceget) {
var layerid = "learnMoreArrow"+attributeid;
var p,o = getObj("learnpanel"+attributeid);
if (o) {
if (o.style.display == "none" || o.innerHTML == "" || forceget) {
var downImageUrl = IMAGES_URL+'/icons/7px_tri_down.gif';
$("span[@id=learnspinner"+attributeid+"]").show(); 
if (USE_IMAGE_LOADER) {
addImageToQueue(downImageUrl, layerid);
sendNextImagePreloaderRequest();
} else {
$("img[@id="+layerid+"]").attr({src:downImageUrl});
}
getAttributeDescription(attributeid); 
} else {
var rightImageUrl = IMAGES_URL+'/icons/7px_tri_right.gif';
$("span[@id=learnspinner"+attributeid+"]").hide(); 
$("div[@id=learnpanel"+attributeid+"]").slideUp("normal");
if (USE_IMAGE_LOADER) {
addImageToQueue(rightImageUrl, layerid);
sendNextImagePreloaderRequest();
} else {
$("img[@id="+layerid+"]").attr({src:rightImageUrl});
}
}
}
}
function populateLearnMoreDiv(attributeid, attributedesc) {
var content = '<span class="close-panel"><a onclick="toggleLearnMoreDiv(\''+attributeid+'\',false);" href="Javascript:;"><img width="11" height="11" border="0" alt="close" src="'+IMAGES_URL+'/icons/close_x.gif"/>&nbsp;close</a></span><p>'+attributedesc+'</p><div class="clearer">&nbsp;</div>';
$("div[@id=learnpanel"+attributeid+"]").html(content);
$("div[@id=learnpanel"+attributeid+"]").slideDown("normal", function() {
stripeHelpTables(attributeid);
$("span[@id=learnspinner"+attributeid+"]").hide(); 
}); 
}
function errorDiv(attributeid) {
return '<div name="attributeerrorbox' + attributeid + '" id="attributeerrorbox' + attributeid + '" style="width:400px;"></div>'
}
function errorDivCategoryAttributes(attributeid) {
return '<div name="attributeerrorbox' + attributeid + '" id="attributeerrorbox' + attributeid + '" class="swatch_content" style="display:none;"></div>';
}
function getRandomNumber(range) {
return Math.floor(Math.random() * range);
}
function getRandomChar() {
var chars = "0123456789abcdefghijklmnopqurstuvwxyzABCDEFGHIJKLMNOPQURSTUVWXYZ";
return chars.substr( getRandomNumber(62), 1 );
}
function randomID(size) {
var str = "";
var i=0;
for (i=0; i<size; i++) {
str += getRandomChar();
}
return str;
}
/*
function onPreloadSwatchImages(aImages) {
var i=0;
var o;
for (i=0; i<aImages.length; i++) {
if (aImages[i].bLoaded) {
o = getObj("swatchimage"+aImages[i].swatchid);
if (o) {
o.src = aImages[i].source;
}
}
}
}
function onPreloadScene7Image(aImages) {
var i, o;
for (i=0; i<aImages.length; i++) {
if (aImages[i].bLoaded) {
o = getObj("scene7image");
if (o) {
o.src = aImages[i].source;
}
}
}
}
function onPreloadGenericImage(aImages) {
var i, o;
for (i=0; i<aImages.length; i++) {
if (aImages[i].bLoaded) {
o = getObj(aImages[i].layerid); 
if (o) {
o.src = aImages[i].source;
}
}
}
}
*/
var imagePreloaderQueue = new Array();
function typedef_preloadImage(source, layerid) {
this.source = source;
this.layerid = layerid;
}
function typedef_ImagePreloaderQueueItem(images) {
this.images = images;
this.sent = false;
this.requestid= randomID(10);
}
function sendNextImagePreloaderRequest() {
var i;
var ip_request = new Array();
for (i=0; i<imagePreloaderQueue.length; i++) {
if (imagePreloaderQueue[i].sent == false) {
ip_request[ip_request.length] = new ImagePreloader(imagePreloaderQueue[i].images, imagePreloaderQueue[i].requestid);
imagePreloaderQueue[i].sent = true;
}
}
for (i=imagePreloaderQueue.length-1; i>=0; i--) {
if (imagePreloaderQueue[i].sent == true) {
imagePreloaderQueue.splice(i, 1); 
}
}
}
function ImagePreloader(images,requestid) {
this.nLoaded = 0;
this.nProcessed = 0;
this.nRequestId = requestid; 
this.aImages = new Array;
this.nImages = images.length;
for ( var i = 0; i < images.length; i++ ) {
this.preload(images[i]);
}
}
ImagePreloader.prototype.preload = function(image) {
var oImage = new Image;
this.aImages.push(oImage);
oImage.onload = ImagePreloader.prototype.onload;
oImage.onerror = ImagePreloader.prototype.onerror;
oImage.onabort = ImagePreloader.prototype.onabort;
oImage.oImagePreloader = this;
oImage.bLoaded = false;
oImage.source = image.source;
oImage.layerid= image.layerid;
oImage.src = image.source;
}
ImagePreloader.prototype.onComplete = function() {
this.nProcessed++;
if ( this.nProcessed == this.nImages ) {
var i, o;
for (i=0; i<this.aImages.length; i++) {
if (this.aImages[i].bLoaded) {
o = getObj(this.aImages[i].layerid); 
if (o) {
o.src = this.aImages[i].source;
if (this.aImages[i].layerid == "scene7image") {
setTimeout("toggleScene7Cover('hide');", 500);
}
}
}
}
}
}
ImagePreloader.prototype.onload = function() {
this.bLoaded = true;
this.oImagePreloader.nLoaded++;
this.oImagePreloader.onComplete();
}
ImagePreloader.prototype.onerror = function() {
this.bError = true;
this.oImagePreloader.onComplete();
}
ImagePreloader.prototype.onabort = function() {
this.bAbort = true;
this.oImagePreloader.onComplete();
}
function validateParentalDependency(attributeid) {
var parent=new Array;
var and_results=new Array;
var oktoshow=false; 
var i, newindex;
for (i=0; i<parentobjects_all[attributeid].length; i++) {
thisparent = parentobjects_all[attributeid][i];
newindex = parent.length;
parent[newindex] = thisparent;
if (thisparent.type == "attributevalue") {
parent[newindex].selected = isAttributeValueSelected(attributeids[thisparent.value], thisparent.value);
} 
else if (thisparent.type == "swatch") {
parent[newindex].selected = isSwatchStuffSelected(thisparent.categoryid, thisparent.collectionid, thisparent.swatchid, thisparent.attributeid);
}
}
if (parent.length == 0) {
oktoshow = true; 
} else if (parent.length > 0) {
var holdpos = 0;
for (curpos=0; curpos<parent.length; curpos++) {
if (parent[curpos].isor == 1) {
if (curpos > 0)
and_results[and_results.length] = evaluateConditions_AND(parent, holdpos, curpos-1);  
if (curpos == parent.length-1) {
and_results[and_results.length] = parent[curpos].selected ^ parent[curpos].isnot;
}
holdpos = curpos; 
}
else if (curpos == parent.length-1) { 
and_results[and_results.length] = evaluateConditions_AND(parent, holdpos, curpos); 
}
}
oktoshow = evaluateConditions_OR(and_results, 0, and_results.length-1);
}
return oktoshow;
}
function evaluateConditions_AND(andarray, thispos, endpos) {
if (thispos==endpos) {  
return andarray[thispos].selected ^ andarray[thispos].isnot;
} else 
return ((andarray[thispos].selected ^ andarray[thispos].isnot) && evaluateConditions_AND(andarray, thispos+1, endpos));
}
function evaluateConditions_OR(orarray, thispos, endpos) {
if (thispos==endpos)   
return orarray[thispos];
else  
return (orarray[thispos] || evaluateConditions_OR(orarray, thispos+1, endpos));
}
function LZ(x) {return(x<0||x>9?"":"0")+x}
function formatDate(date,format) {
var MONTH_NAMES=new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
var DAY_NAMES=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat');
format=format+"";
var result="";
var i_format=0;
var c="";
var token="";
var y=date.getYear()+"";
var M=date.getMonth()+1;
var d=date.getDate();
var E=date.getDay();
var H=date.getHours();
var m=date.getMinutes();
var s=date.getSeconds();
var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;
var value=new Object();
if (y.length < 4) {y=""+(y-0+1900);}
value["y"]=""+y;
value["yyyy"]=y;
value["yy"]=y.substring(2,4);
value["M"]=M;
value["MM"]=LZ(M);
value["MMM"]=MONTH_NAMES[M-1];
value["NNN"]=MONTH_NAMES[M+11];
value["d"]=d;
value["dd"]=LZ(d);
value["E"]=DAY_NAMES[E+7];
value["EE"]=DAY_NAMES[E];
value["H"]=H;
value["HH"]=LZ(H);
if (H==0){value["h"]=12;}
else if (H>12){value["h"]=H-12;}
else {value["h"]=H;}
value["hh"]=LZ(value["h"]);
if (H>11){value["K"]=H-12;} else {value["K"]=H;}
value["k"]=H+1;
value["KK"]=LZ(value["K"]);
value["kk"]=LZ(value["k"]);
if (H > 11) { value["a"]="PM"; }
else { value["a"]="AM"; }
value["m"]=m;
value["mm"]=LZ(m);
value["s"]=s;
value["ss"]=LZ(s);
while (i_format < format.length) {
c=format.charAt(i_format);
token="";
while ((format.charAt(i_format)==c) && (i_format < format.length)) {
token += format.charAt(i_format++);
}
if (value[token] != null) { result=result + value[token]; }
else { result=result + token; }
}
return result;
}
function stripLeadingZeroes(str) {
while(str.length > 1 && str.substring(0,1) == '0'){
str = str.substring(1,str.length);
}
return str;
}
consolidated.productTable = [
['Levolor 1-inch Premium Real Wood'],
['Levolor 2-inch Premium Real Wood'],
['Levolor 2 1/2-inch Premium Real Wood'],
['Levolor 2-inch NuWood Composite'],
['Levolor 2-inch Visions Faux Wood'],
['Levolor 2 1/2-inch Visions Faux Wood'],
['Levolor Cornice'],
['Kirsch 1-inch Select Hardwood'],
['Kirsch 2-inch Select Hardwood'],
['Kirsch 2 1/2-inch Select Hardwood'],
['Kirsch 2-inch Variance Composite'],
['Kirsch 2-inch Resemblace Faux Wood'],
['Kirsch 2-inch Modernesque Faux Wood'],
['Kirsch 2 1/2-inch Modernesque Faux Wood'],
['Kirsch Cornice']
];
consolidated.renderingTable = [
["closed", "/blinds/"],
["opened", "/blinds_open/"]
];
consolidated.controlLiftPositionTable = [
["Tilt Left/Lift Right","left","right"],
["Tilt Right/Lift Left","right","left"],
["Tilt Right/Lift Right","right","right"],
["Tilt Left/Lift Left","left","left"],
["Center Tilt/No Lift","center","none"],
["No Tilt/No Lift","none","none"]
];
consolidated.valanceTable = [
["none"],
["Traditional"],
["Modern"]
];
consolidated.lightmasterTable = [
["No","/blinds_lightmaster/"],
["Yes","/blinds_lightmaster_open/"]
];
consolidated.tapesizeTable = [
['3/4-inch','34tapes'],
['1-1/2-inch','tapes']
];
consolidated.controlTable = [
["cord","Cord"],
["wand","Wand"],
["motorized","Motorized"]
];
consolidated.profileTable = [
["none"],
["Rope"],
["Dentil"]
];
consolidated.headrailTable = [
["none", "cordless_headrail&show&src="],
["Standard", "cordless_headrail&show&src="],
["Cordless", "cordless_headrail&show&src="]
];
consolidated.colorTable = [
["10098","10098"],
["1002771","12002771"],
["1002777","12002777"],
["1002798","12002798"],
["1002908","12002908"],
["1002910","12081019"],
["1078097","12078097"],
["11002321","11002321"],
["11002771","11002771"],
["11002772","11002772"],
["11002777","11002777"],
["11002798","11002798"],
["11002885","11002885"],
["11002908","11002908"],
["11002930","11002930"],
["11078027","11078027"],
["11078082","11078082"],
["11078097","11078097"],
["11081019","11081019"],
["11081041","11081041"],
["11081329","11081329"],
["12002321","12002321"],
["12002352","12002352"],
["12002366","12002366"],
["12002771","12002771"],
["12002772","12002772"],
["12002777","12002777"],
["12002798","12002798"],
["12002804","12002804"],
["12002884","12002884"],
["12002885","12002885"],
["12002888","12002888"],
["12002890","12002890"],
["12002894","12002894"],
["12002895","12002895"],
["12002896","12002896"],
["12002897","12002897"],
["12002908","12002908"],
["12002909","12002909"],
["12002930","12002930"],
["12067100","12067100"],
["12067101","12067101"],
["12067102","12067102"],
["12067104","12067104"],
["12067105","12067105"],
["12067106","12067106"],
["12067107","12067107"],
["12067108","12067108"],
["12067109","12067109"],
["12067110","12067110"],
["12067130","12067130"],
["12067160","12067160"],
["12067200","12067200"],
["12067217","12067217"],
["12067265","12067265"],
["12067371","12067371"],
["12067403","12067403"],
["12067404","12067404"],
["12067405","12067405"],
["12067406","12067406"],
["12067407","12067407"],
["12067410","12067410"],
["12067500","12067500"],
["12067501","12067501"],
["12067502","12067502"],
["12067503","12067503"],
["12067504","12067504"],
["12067505","12067505"],
["12078027","12078027"],
["12078082","12078082"],
["12078097","12078097"],
["12081019","12081019"],
["12081023","12081023"],
["12081041","12081041"],
["12081042","12081042"],
["12081089","12081089"],
["12081329","12081329"],
["12081337","12081337"],
["12081338","12081338"],
["12081339","12081339"],
["12081340","12081340"],
["12081341","12081341"],
["12081342","12081342"],
["12502321","12502321"],
["12502771","12502771"],
["12502777","12502777"],
["12502798","12502798"],
["12502888","12502888"],
["12502890","12502890"],
["12502894","12502894"],
["12502895","12502895"],
["12502896","12502896"],
["12502897","12502897"],
["12502908","12502908"],
["12567101","12567101"],
["12567102","12567102"],
["12567107","12567107"],
["12567110","12567110"],
["12567403","12567403"],
["12578082","12578082"],
["12578097","12578097"],
["12581019","12581019"],
["12581041","12581041"],
["12581329","12581329"],
["12002886","12002886"],
["12002899","52002899"],
["12081100","52081100"],
["12081101","52081101"],
["12081102","52081102"],
["12081103","52081103"],
["12081104","52081104"],
["12081105","52081105"],
["12502886","52502886"],
["12502899","52502899"],
["50000098","10098"],
["50002771","12002771"],
["50002777","12002777"],
["50002798","12002798"],
["50002908","12002908"],
["50078097","12081019"],
["50081019","12078097"],
["51002321","11002321"],
["51002771","11002771"],
["51002772","11002772"],
["51002777","11002777"],
["51002798","11002798"],
["51002885","11002885"],
["51002908","11002908"],
["51002930","11002930"],
["51078027","11078027"],
["51078082","11078082"],
["51078097","11078097"],
["51081019","11081019"],
["51081041","11081041"],
["51081329","11081329"],
["52002321","12002321"],
["52002352","12002352"],
["52002366","12002366"],
["52002771","12002771"],
["52002772","12002772"],
["52002777","12002777"],
["52002798","12002798"],
["52002804","12002804"],
["52002884","12002884"],
["52002885","12002885"],
["52002886","12002886"],
["52002888","12002888"],
["52002890","12002890"],
["52002894","12002894"],
["52002895","12002895"],
["52002896","12002896"],
["52002897","12002897"],
["52002898","52002898"],
["52002899","52002899"],
["52002908","12002908"],
["52002909","12002909"],
["52002930","12002930"],
["52067100","12067100"],
["52067101","12067101"],
["52067102","12067102"],
["52067104","12067104"],
["52067105","12067105"],
["52067106","12067106"],
["52067107","12067107"],
["52067108","12067108"],
["52067109","12067109"],
["52067110","12067110"],
["52067130","12067130"],
["52067160","12067160"],
["52067200","12067200"],
["52067217","12067217"],
["52067265","12067265"],
["52067371","12067371"],
["52067403","12067403"],
["52067404","12067404"],
["52067405","12067405"],
["52067406","12067406"],
["52067407","12067407"],
["52067410","12067410"],
["52067500","12067500"],
["52067501","12067501"],
["52067502","12067502"],
["52067503","12067503"],
["52067504","12067504"],
["52067505","12067505"],
["52078027","12078027"],
["52078082","12078082"],
["52078097","12078097"],
["52081019","12081019"],
["52081023","12081023"],
["52081041","12081041"],
["52081042","12081042"],
["52081089","12081089"],
["52081100","52081100"],
["52081101","52081101"],
["52081102","52081102"],
["52081103","52081103"],
["52081104","52081104"],
["52081105","52081105"],
["52081329","12081329"],
["52081337","12081337"],
["52081338","12081338"],
["52081339","12081339"],
["52081340","12081340"],
["52081341","12081341"],
["52081342","12081342"],
["52502321","12502321"],
["52502771","12502771"],
["52502777","12502777"],
["52502798","12502798"],
["52502886","52502886"],
["52502888","12502888"],
["52502890","12502890"],
["52502894","12502894"],
["52502895","12502895"],
["52502896","12502896"],
["52502897","12502897"],
["52502898","52502898"],
["52502899","52502899"],
["52502908","12502908"],
["52567101","12567101"],
["52567102","12567102"],
["52567107","12567107"],
["52567110","12567110"],
["52567403","12567403"],
["52578082","12578082"],
["52578097","12578097"],
["52581019","12581019"],
["52581041","12581041"],
["52581329","12581329"]
];
premiumHardwood1Blind.controlPositionTable = [
["none", ""],
["left", "&obj=Premium_Hardwood_1/cords/lf_wand&show&src="],
["right", "&obj=Premium_Hardwood_1/cords/rt_wand&show&src="],
["center", "&obj=Premium_Hardwood_1/cords/ctr_wand&show&src="]
];
premiumHardwood1Blind.liftPositionTable = [
["none", ""],
["left", "&obj=Premium_Hardwood_1/cords/lf_cord&show&src="],
["right", "&obj=Premium_Hardwood_1/cords/rt_cord&show&src="]
];
premiumHardwood1Blind.controlTypeTable = [
["none", ""],
["wand", ""]
];
premiumHardwood2Blind.controlPositionTable = [
["none", ""],
["left", "/cords/lf_wand&show&src="],
["right", "/cords/rt_wand&show&src="],
["center", "/cords/ctr_wand&show&src="]
];
premiumHardwood2Blind.cordControlPositionTable = [
["none", ""],
["left", "/cords/lf_cord_tilter&show&src="],
["right", "/cords/rt_cord_tilter&show&src="],
["center", "/cords/ctr_cord_tilter&show&src="]
];
premiumHardwood2Blind.liftPositionTable = [
["none", "/cords&hide&src="],
["left", "/cords/lf_cord_lifter&show&src="],
["right", "/cords/rt_cord_lifter&show&src="]
];
premiumHardwood2Blind.renderingLightmasterTable = [
["closed", '/blinds_lightmaster/'],
["opened", '/blinds_lightmaster_open/']
];
premiumHardwood2Blind.renderingTable = [
["closed", '/blinds/blinds/'],
["opened", '/blinds_open/blinds/']
];
premiumHardwood25Blind.controlPositionTable = [
["none", ""],
["left", "/cords/lf_cord_tilter&show&src="],
["right", "/cords/rt_cord_tilter&show&src="],
["center", "/cords/ctr_cord_tilter&show&src="]
];
premiumHardwood25Blind.liftPositionTable = [
["none", ""],
["left", "/cords/lf_cord_lifter&show&src="],
["right", "/cords/rt_cord_lifter&show&src="]
];
nuWoodBlind.controlPositionTable = [
["none", ""],
["left", "/cords/lf_wand&show&src="],
["right", "/cords/rt_wand&show&src="],
["center", "/cords/ctr_wand&show&src="]
];
nuWoodBlind.cordControlPositionTable = [
["none", ""],
["left", "/cords/lf_cord_tilter&show&src="],
["right", "/cords/rt_cord_tilter&show&src="],
["center", "/cords/ctr_cord_tilter&show&src="]
];
nuWoodBlind.liftPositionTable = [
["none", "/cords&hide&src="],
["left", "/cords/lf_cord_lifter&show&src="],
["right", "/cords/rt_cord_lifter&show&src="]
];
fauxWood2Blind.liftPositionTable = [
["none", ""],
["left", "/cords/lf_cord_lifter&show&src="],
["right", "/cords/rt_cord_lifter&show&src="]
];
fauxWood2Blind.cordTiltTable = [
["none", ""],
["left", "/cords/lf_cord_tilter&show&src="],
["right", "/cords/rt_cord_tilter&show&src="],
["center", "/cords/ctr_cord_tilter&show&src="]
];
fauxWood2Blind.wandTable = [
["none", "/cords&hide"],
["left", "/cords/lf_wand&show&src="],
["right", "/cords/rt_wand&show&src="],
["center", "/cords/ctr_wand&show&src="]
];
fauxWood2Blind.controlPositionTable = [
["none", ""],
["left", "/lt_"],
["right", "/rt_"]
];
fauxWood25Blind.controlPositionTable = [
["none", ""],
["left", "/cords/lf_cord_tilter&show&src="],
["right", "/cords/rt_cord_tilter&show&src="],
["center", "/cords/ctr_cord_tilter&show&src="]
];
fauxWood25Blind.liftPositionTable = [
["none", ""],
["left", "/cords/lf_cord_lifter&show&src="],
["right", "/cords/rt_cord_lifter&show&src="]
];
function consolidated(width, height, selectedProduct, selectedColor, selectedRendering, selectedControlLiftPosition, selectedControlType, selectedControlOption, selectedValance, selectedLightmaster, selectedProfile, selectedTape, selectedTapeSize, selectedWall, selectedTrim) {
if(selectedProduct == 'Levolor 1-inch Premium Real Wood' || selectedProduct == 'Kirsch 1-inch Select Hardwood')
url = premiumHardwood1Blind(width, height, selectedRendering, selectedColor, selectedControlType, selectedControlLiftPosition, selectedTape, selectedTapeSize, selectedWall, selectedTrim);
if(selectedProduct == 'Levolor 2-inch Premium Real Wood' || selectedProduct == 'Kirsch 2-inch Select Hardwood')
url = premiumHardwood2Blind(width, height, selectedRendering, selectedColor, selectedControlType, selectedControlLiftPosition, selectedTape, selectedTapeSize, selectedControlOption, selectedLightmaster, selectedWall, selectedTrim);
if(selectedProduct == 'Levolor 2 1/2-inch Premium Real Wood' || selectedProduct == 'Kirsch 2 1/2-inch Select Hardwood')
url = premiumHardwood25Blind(width, height, selectedRendering, selectedColor, selectedControlType, selectedControlLiftPosition, selectedControlOption, selectedWall, selectedTrim);
if(selectedProduct == 'Levolor 2-inch NuWood Composite' || selectedProduct == 'Kirsch 2-inch Variance Composite')
url = nuWoodBlind(width, height, selectedRendering, selectedColor, selectedControlType, selectedControlLiftPosition, selectedTape, selectedWall, selectedTrim, selectedTapeSize);
if(selectedProduct == 'Levolor 2-inch Visions Faux Wood' || selectedProduct == 'Kirsch 2-inch Resemblace Faux Wood' || selectedProduct == 'Kirsch 2-inch Modernesque Faux Wood')
url = fauxWood2Blind(width, height, selectedRendering, selectedColor, selectedControlType, selectedControlLiftPosition, selectedTape, selectedWall, selectedTrim, selectedTapeSize);
if(selectedProduct == 'Levolor 2 1/2-inch Visions Faux Wood' || selectedProduct == 'Kirsch 2 1/2-inch Modernesque Faux Wood')
url = fauxWood25Blind(width, height, selectedRendering, selectedColor, selectedControlType, selectedControlLiftPosition, selectedWall, selectedTrim)
return url;
}
function premiumHardwood1Blind(width, height, selectedRendering, selectedColor, selectedControlType, selectedControlLiftPosition, selectedTape, selectedTapeSize, selectedWall, selectedTrim) {
var url = baseUrl;
var selectedLiftPosition = lookupTableValue(consolidated.controlLiftPositionTable, selectedControlLiftPosition,2);
var selectedControlPosition = lookupTableValue(consolidated.controlLiftPositionTable, selectedControlLiftPosition,1);
url += "Premium_Hardwood_1_2005-400?"
url += "wid=" + width;
url += "&hei=" + height;
url += '&obj=Premium_Hardwood_1' + lookupTableValue(consolidated.renderingTable, selectedRendering,1) + 'blinds&show&src=';
url += lookupTableValue(consolidated.colorTable, selectedColor,1);
url += '&obj=Premium_Hardwood_1' + lookupTableValue(consolidated.renderingTable, selectedRendering,1) + 'valance&show&src=';
url += lookupTableValue(consolidated.colorTable, selectedColor,1);
if (selectedTapeSize != "none") {
url += '&obj=Premium_Hardwood_1' + lookupTableValue(consolidated.renderingTable, selectedRendering,1);
url += lookupTableValue(consolidated.tapesizeTable,selectedTapeSize,1) + '&' + lookupTableValue(tapeColorTable, selectedTape,1);
}
if (selectedControlPosition != "none") {
url += lookupTableValue(premiumHardwood1Blind.controlPositionTable, selectedControlPosition,1)  + lookupTableValue(consolidated.colorTable, selectedColor,1);
} 
if (selectedLiftPosition != "none") {
url += lookupTableValue(premiumHardwood1Blind.liftPositionTable, selectedLiftPosition,1) + lookupTableValue(consolidated.colorTable, selectedColor,1);
}
url += "&obj=wall/wall&show&color=" + lookupTableValue(wallColorTable, selectedWall,1);
url += "&obj=trim/trim&show&src=" + lookupTableValue(trimColorTable, selectedTrim,1);
return url;
}
function premiumHardwood2Blind(width, height, selectedRendering, selectedColor, selectedControlType, selectedControlLiftPosition, selectedTape, selectedTapeSize, selectedControlOption, selectedLightmaster, selectedWall, selectedTrim) {
var url = baseUrl;
var productID = "&obj=Premium_Hardwood_2";
var selectedLiftPosition = lookupTableValue(consolidated.controlLiftPositionTable, selectedControlLiftPosition,2);
var selectedControlPosition = lookupTableValue(consolidated.controlLiftPositionTable, selectedControlLiftPosition,1);
url += "Premium_Hardwood_2_2005-400?"
url += "wid=" + width;
url += "&hei=" + height;
if (selectedLightmaster == "Yes") {
url += productID + lookupTableValue(premiumHardwood2Blind.renderingLightmasterTable, selectedRendering,1);
url += "blinds&show&src=" + lookupTableValue(consolidated.colorTable, selectedColor,1);
} else {
url += productID + lookupTableValue(premiumHardwood2Blind.renderingTable, selectedRendering,1);
url += "blinds&show&src=" + lookupTableValue(consolidated.colorTable, selectedColor,1);
if (selectedTape != "none") {
url += productID + lookupTableValue(consolidated.renderingTable, selectedRendering,1);
url += lookupTableValue(consolidated.tapesizeTable, selectedTapeSize,1) + '&' + lookupTableValue(tapeColorTable, selectedTape,1);
}
}
url += productID + lookupTableValue(premiumHardwood2Blind.renderingTable, selectedRendering,1) + lookupTableValue(consolidated.headrailTable, selectedControlOption, 1) + lookupTableValue(consolidated.colorTable, selectedColor,1);
if (selectedControlType == "cord" && selectedControlPosition != "none") {
url += productID + lookupTableValue(premiumHardwood2Blind.cordControlPositionTable, selectedControlPosition,1)  + lookupTableValue(consolidated.colorTable, selectedColor,1);
}
if (selectedControlType == "wand" && selectedControlPosition != "none") {
url += productID +lookupTableValue(premiumHardwood2Blind.controlPositionTable, selectedControlPosition,1)  + lookupTableValue(consolidated.colorTable, selectedColor,1);
}
if (selectedControlType == "motorized" && selectedControlOption != "Cordless") {
url += productID + "/cords/rt_cord_tilter&show&src=" + lookupTableValue(consolidated.colorTable, selectedColor,1);
}
if (selectedLiftPosition != "none" && selectedControlOption != "Cordless" && selectedControlType != "motorized") {
url += productID + lookupTableValue(premiumHardwood2Blind.liftPositionTable, selectedLiftPosition,1) + lookupTableValue(consolidated.colorTable, selectedColor,1);
}
url += "&obj=wall/wall&show&color=" + lookupTableValue(wallColorTable, selectedWall,1);
url += "&obj=trim/trim&show&src=" + lookupTableValue(trimColorTable, selectedTrim,1);
return url;
}
function premiumHardwood25Blind(width, height, selectedRendering, selectedColor, selectedControlType, selectedControlLiftPosition, selectedControlOption, selectedWall, selectedTrim) {
var url = baseUrl;
var productID = "&obj=Premium_Hardwood_2.5%22";
var selectedLiftPosition = lookupTableValue(consolidated.controlLiftPositionTable, selectedControlLiftPosition,2);
var selectedControlPosition = lookupTableValue(consolidated.controlLiftPositionTable, selectedControlLiftPosition,1);
url += "Premium_Hardwood_2-5_2005-400?"
url += "wid=" + width;
url += "&hei=" + height;
url += productID +lookupTableValue(consolidated.renderingTable, selectedRendering,1);
url += "blinds&show&src=" + lookupTableValue(consolidated.colorTable, selectedColor,1);
if (selectedControlType == "motorized") {
url += productID + "/cords/rt_cord_lifter&show&src=" + lookupTableValue(consolidated.colorTable, selectedColor,1);
} else {
if (selectedControlType != "none" && selectedControlPosition != "none") 
url += productID + lookupTableValue(premiumHardwood25Blind.controlPositionTable, selectedControlPosition,1) + lookupTableValue(consolidated.colorTable, selectedColor,1);
if (selectedLiftPosition != "none")
url += productID + lookupTableValue(premiumHardwood25Blind.liftPositionTable, selectedLiftPosition,1) + lookupTableValue(consolidated.colorTable, selectedColor,1);
}
url += "&obj=wall/wall&show&color=" + lookupTableValue(wallColorTable, selectedWall,1);
url += "&obj=trim/trim&show&src=" + lookupTableValue(trimColorTable, selectedTrim,1);
return url;
}
function nuWoodBlind(width, height, selectedRendering, selectedColor, selectedControlType, selectedControlLiftPosition, selectedTape, selectedWall, selectedTrim, selectedTapeSize) {
var url = baseUrl;
var productID = "&obj=NuWood";
var selectedLiftPosition = lookupTableValue(consolidated.controlLiftPositionTable, selectedControlLiftPosition,2);
var selectedControlPosition = lookupTableValue(consolidated.controlLiftPositionTable, selectedControlLiftPosition,1);
url += "NuWood_2005-400?";
url += "wid=" + width;
url += "&hei=" + height;
url += productID +lookupTableValue(consolidated.renderingTable, selectedRendering,1);
url += "blinds&show&src=" + lookupTableValue(consolidated.colorTable, selectedColor,1);
if (selectedTape != "none") {
url += productID +lookupTableValue(consolidated.renderingTable, selectedRendering,1);
url += lookupTableValue(consolidated.tapesizeTable,selectedTapeSize,1) + '&' + lookupTableValue(tapeColorTable,selectedTape,1);
}
if (selectedControlType == "wand" && selectedControlPosition != "none") {
url += productID +lookupTableValue(nuWoodBlind.controlPositionTable, selectedControlPosition,1)+ lookupTableValue(consolidated.colorTable, selectedColor,1);
} 
if (selectedControlType == "cord" && selectedControlPosition != "none") {
url += productID +lookupTableValue(nuWoodBlind.cordControlPositionTable, selectedControlPosition,1)+ lookupTableValue(consolidated.colorTable, selectedColor,1);
} 
if (selectedLiftPosition != "none") {
url += productID + lookupTableValue(nuWoodBlind.liftPositionTable, selectedLiftPosition,1) + lookupTableValue(consolidated.colorTable, selectedColor,1);
}
url += "&obj=wall/wall&show&color=" + lookupTableValue(wallColorTable, selectedWall,1);
url += "&obj=trim/trim&show&src=" + lookupTableValue(trimColorTable, selectedTrim,1);
return url;
}
function fauxWood2Blind(width, height, selectedRendering, selectedColor, selectedControlType, selectedControlLiftPosition, selectedTape, selectedWall, selectedTrim, selectedTapeSize) {
var url = baseUrl;
var productID = "&obj=Faux_Wood_2";
var selectedLiftPosition = lookupTableValue(consolidated.controlLiftPositionTable, selectedControlLiftPosition,2);
var selectedControlPosition = lookupTableValue(consolidated.controlLiftPositionTable, selectedControlLiftPosition,1);
url += "Faux_Wood_2_2005-400?"
url += "wid=" + width;
url += "&hei=" + height;
url += productID +lookupTableValue(consolidated.renderingTable, selectedRendering,1);
url += "blinds&show&src=" + lookupTableValue(consolidated.colorTable, selectedColor,1);
if (selectedTape != "none") {
url += productID +lookupTableValue(consolidated.renderingTable, selectedRendering,1);
url += lookupTableValue(consolidated.tapesizeTable, selectedTapeSize,1) + '&' + lookupTableValue(tapeColorTable, selectedTape,1);
}
if (selectedLiftPosition != "none")
url += productID + lookupTableValue(fauxWood2Blind.liftPositionTable, selectedLiftPosition,1) + lookupTableValue(consolidated.colorTable, selectedColor,1);
if (selectedControlType == "wand" && selectedControlPosition != "none") {
url += productID +lookupTableValue(fauxWood2Blind.wandTable, selectedControlPosition,1) + lookupTableValue(consolidated.colorTable, selectedColor,1);
} else if (selectedControlType == "cord" && selectedControlPosition != "none") {
url += productID + lookupTableValue(fauxWood2Blind.cordTiltTable, selectedControlPosition,1) + lookupTableValue(consolidated.colorTable, selectedColor,1);
}
url += "&obj=wall/wall&show&color=" + lookupTableValue(wallColorTable, selectedWall,1);
url += "&obj=trim/trim&show&src=" + lookupTableValue(trimColorTable, selectedTrim,1);
return url;
}
function fauxWood25Blind(width, height, selectedRendering, selectedColor, selectedControlType, selectedControlLiftPosition, selectedWall, selectedTrim) {
var url = baseUrl;
var productID = "&obj=Faux%20Wood_2.5%22";
var selectedLiftPosition = lookupTableValue(consolidated.controlLiftPositionTable, selectedControlLiftPosition,2);
var selectedControlPosition = lookupTableValue(consolidated.controlLiftPositionTable, selectedControlLiftPosition,1);
url += "Faux_Wood_2-5_2005-400?"
url += "wid=" + width;
url += "&hei=" + height;
url += productID +lookupTableValue(consolidated.renderingTable, selectedRendering,1);
url += "&show&src=" + lookupTableValue(consolidated.colorTable, selectedColor,1);
if (selectedLiftPosition != "none")
url += productID + lookupTableValue(fauxWood25Blind.liftPositionTable, selectedLiftPosition,1) + lookupTableValue(consolidated.colorTable, selectedColor,1);
if (selectedControlType == "cord" && selectedControlPosition != "none")
url += productID + lookupTableValue(fauxWood25Blind.controlPositionTable, selectedControlPosition,1) + lookupTableValue(consolidated.colorTable, selectedColor,1);
url += "&obj=wall/wall&show&color=" + lookupTableValue(wallColorTable, selectedWall,1);
url += "&obj=trim/trim&show&src=" + lookupTableValue(trimColorTable, selectedTrim,1);
return url;
}
var tapeColorTable = [
["none", "hide"],
["00110", "show&src=00110_TP"],
["00138", "show&src=00138_TP"],
["00140", "show&src=00140_TP"],
["00162", "show&src=00162_TP"],
["00301", "show&src=00301_TP"],
["00302", "show&src=00302_TP"],
["00352", "show&src=00352_TP"],
["00378", "show&src=00378_TP"],
["00386", "show&src=00386_TP"],
["00401", "show&src=00401_TP"],
["00402", "show&src=00402_TP"],
["00503", "show&src=00503_TP"],
["00504", "show&src=00504_TP"],
["00584", "show&src=00584_TP"],
["00662", "show&src=00662_TP"],
["00755", "show&src=00755_TP"],
["00890", "show&src=00890_TP"],
["01201", "show&src=01201_TP"],
["01216", "show&src=01216_TP"],
["01222", "show&src=01222_TP"],
["01223", "show&src=01223_TP"],
["01227", "show&src=01227_TP"],
["01228", "show&src=01228_TP"],
["01229", "show&src=01229_TP"],
["01230", "show&src=01230_TP"],
["01231", "show&src=01231_TP"],
["01233", "show&src=01233_TP"],
["01234", "show&src=01234_TP"],
["01235", "show&src=01235_TP"],
["01236", "show&src=01236_TP"],
["01237", "show&src=01237_TP"],
["01238", "show&src=01238_TP"],
["01239", "show&src=01239_TP"],
["01237", "show&src=01237_TP"]
];
wallColorTable = [
["3C3E3F","60,62,63"],
["303131","48,49,49"],
["443936","68,57,54"],
["483930","72,57,48"],
["57452E","87,69,46"],
["6C4936","108,73,54"],
["6F3830","111,56,48"],
["70392E","112,57,46"],
["913337","145,51,55"],
["653331","101,51,49"],
["653146","101,49,70"],
["3A3239","58,50,57"],
["293560","41,53,96"],
["1F3B5C","31,59,92"],
["114450","17,68,80"],
["2E3D3C","46,61,60"],
["005947","0,89,71"],
["0F593B","15,89,59"],
["146837","20,104,55"],
["35A020","53,160,32"],
["B5C900","181,201,0"],
["FFB300","255,179,0"],
["F77809","247,120,9"],
["E04D22","224,77,34"],
["D23B24","210,59,36"],
["7E412E","126,65,46"],
["AB572B","171,87,43"],
["CD572D","205,87,45"],
["A6783D","166,120,61"],
["B1823B","177,130,59"],
["D98D13","217,141,19"],
["9C8C3D","156,140,61"],
["6E7138","110,113,56"],
["4A4A3E","74,74,62"],
["343938","52,57,56"],
["515458","81,84,88"],
["38393B","56,57,59"],
["484040","72,64,64"],
["594745","89,71,69"],
["594742","89,71,66"],
["724E3C","114,78,60"],
["743D35","116,61,53"],
["88433F","136,67,63"],
["A54041","165,64,65"],
["7E393F","126,57,63"],
["7E395E","126,57,94"],
["443B4F","68,59,79"],
["124B85","18,75,133"],
["005380","0,83,128"],
["005F6E","0,95,110"],
["325554","50,85,84"],
["007C60","0,124,96"],
["0A6447","10,100,71"],
["227341","34,115,65"],
["49AA2A","73,170,42"],
["C3CE00","195,206,0"],
["FFB900","255,185,0"],
["FB831E","251,131,30"],
["E85830","232,88,48"],
["DD4738","221,71,56"],
["8C493A","140,73,58"],
["B15D31","177,93,49"],
["D56237","213,98,55"],
["AE7F44","174,127,68"],
["BA8A42","186,138,66"],
["DF941C","223,148,28"],
["A59444","165,148,68"],
["8B8A4F","139,138,79"],
["525246","82,82,70"],
["404C4F","64,76,79"],
["6D7277","109,114,119"],
["44484D","68,72,77"],
["4E4C50","78,76,80"],
["705C5B","112,92,91"],
["866C58","134,108,88"],
["7A5645","122,86,69"],
["895D56","137,93,86"],
["A64D5D","166,77,93"],
["AC475A","172,71,90"],
["9E4755","158,71,85"],
["9E477C","158,71,124"],
["534C6D","83,76,109"],
["0062A5","0,98,165"],
["006EA1","0,110,161"],
["007B8D","0,123,141"],
["3D7371","61,115,113"],
["009C7C","0,156,124"],
["16765B","22,118,91"],
["348353","52,131,83"],
["63B73D","99,183,61"],
["D3D50F","211,213,15"],
["FFC616","255,198,22"],
["FF9237","255,146,55"],
["F16A47","241,106,71"],
["E95854","233,88,84"],
["9F564D","159,86,77"],
["BB673B","187,103,59"],
["DF734A","223,115,74"],
["BA8C51","186,140,81"],
["C99950","201,153,80"],
["EDA92E","237,169,46"],
["B8A050","184,160,80"],
["A6A36B","166,163,107"],
["616153","97,97,83"],
["50646B","80,100,107"],
["A2A8AC","162,168,172"],
["757B81","117,123,129"],
["727A84","114,122,132"],
["A39194","163,145,148"],
["B39F93","179,159,147"],
["A17F70","161,127,112"],
["AB807B","171,128,123"],
["CB7E95","203,126,149"],
["CF7890","207,120,144"],
["C47C8D","196,124,141"],
["C47CAE","196,124,174"],
["8681A5","134,129,165"],
["1C94CF","28,148,207"],
["189ECB","24,158,203"],
["13ABBD","19,171,189"],
["6EA9A6","110,169,166"],
["27C5AE","39,197,174"],
["5CA491","92,164,145"],
["72AD87","114,173,135"],
["98D376","152,211,118"],
["E1E364","225,227,100"],
["FFD866","255,216,102"],
["FFB874","255,184,116"],
["FF9680","255,150,128"],
["FB878E","251,135,142"],
["CA8583","202,133,131"],
["D89069","216,144,105"],
["F0A17F","240,161,127"],
["D8B381","216,179,129"],
["E1BA80","225,186,128"],
["F7C46A","247,196,106"],
["D1C182","209,193,130"],
["CDCAA3","205,202,163"],
["909183","144,145,131"],
["7D99A1","125,153,161"],
["C6CBCF","198,203,207"],
["A2A8AE","162,168,174"],
["9BA5B1","155,165,177"],
["C5BABE","197,186,190"],
["D1C4BC","209,196,188"],
["C4A99E","196,169,158"],
["C8A7A3","200,167,163"],
["E4ACBF","228,172,191"],
["E5A6BB","229,166,187"],
["DEA9B8","222,169,184"],
["DEA9D0","222,169,208"],
["AFAECA","175,174,202"],
["6DB8E6","109,184,230"],
["73C1E3","115,193,227"],
["78CBD9","120,203,217"],
["9ECCCB","158,204,203"],
["7FDDCE","127,221,206"],
["92C5BA","146,197,186"],
["A3CDB4","163,205,180"],
["C0E7A9","192,231,169"],
["F0EF9F","240,239,159"],
["FFE89C","255,232,156"],
["FFD4A7","255,212,167"],
["FFBCAF","255,188,175"],
["FFB0B9","255,176,185"],
["E3B0B1","227,176,177"],
["ECB79B","236,183,155"],
["F8C4AE","248,196,174"],
["ECD2AE","236,210,174"],
["F1D6AE","241,214,174"],
["FDDB9D","253,219,157"],
["E6DBAF","230,219,175"],
["E3E2C9","227,226,201"],
["B8B9B0","184,185,176"],
["A9C2C9","169,194,201"],
["DFE2E3","223,226,227"],
["C5CACD","197,202,205"],
["C1C8D0","193,200,208"],
["DFD7D9","223,215,217"],
["E7DDD8","231,221,216"],
["DEC9C0","222,201,192"],
["DBC4C0","219,196,192"],
["EFCCD8","239,204,216"],
["F2C8D6","242,200,214"],
["ECCAD4","236,202,212"],
["ECCAE3","236,202,227"],
["CFCEE0","207,206,224"],
["A2D4F1","162,212,241"],
["A9DAEE","169,218,238"],
["ADE1E9","173,225,233"],
["C5E3E1","197,227,225"],
["B4EDE2","180,237,226"],
["BFDFD6","191,223,214"],
["C8E3D1","200,227,209"],
["DBF2CA","219,242,202"],
["F8F5C2","248,245,194"],
["FFF1C2","255,241,194"],
["FFE7CA","255,231,202"],
["FFD8CF","255,216,207"],
["FFCFD5","255,207,213"],
["F2CECF","242,206,207"],
["F7D3BE","247,211,190"],
["FBDCCD","251,220,205"],
["F5E4CC","245,228,204"],
["F9E8CD","249,232,205"],
["FEEBC2","254,235,194"],
["F2EBCE","242,235,206"],
["F0EFDF","240,239,223"],
["D5D6CE","213,214,206"],
["CCDCDF","204,220,223"],
["FFFFFF","255,255,255"],
["DFE1E3","223,225,227"],
["DCDFE3","220,223,227"],
["EDE9E8","237,233,232"],
["F2ECE8","242,236,232"],
["EDE0D9","237,224,217"],
["EAD8D6","234,216,214"],
["F8E3E7","248,227,231"],
["FAE1E6","250,225,230"],
["F5E2E4","245,226,228"],
["F5E2ED","245,226,237"],
["E4E4EC","228,228,236"],
["C7E5F2","199,229,242"],
["CEEAF2","206,234,242"],
["D1EEF0","209,238,240"],
["DEF0EC","222,240,236"],
["D5F4ED","213,244,237"],
["D9ECE6","217,236,230"],
["E1EFE3","225,239,227"],
["ECF7DF","236,247,223"],
["F9F9DC","249,249,220"],
["FCF6DC","252,246,220"],
["FDF1E0","253,241,224"],
["FFE9E2","255,233,226"],
["FFE4E6","255,228,230"],
["F9E4E3","249,228,227"],
["FBE6D8","251,230,216"],
["FAEBE1","250,235,225"],
["F8EEE0","248,238,224"],
["FAF2E2","250,242,226"],
["FCF2D9","252,242,217"],
["F8F3E3","248,243,227"],
["F6F5EB","246,245,235"],
["E8E8E2","232,232,226"],
["E3EBEB","227,235,235"]
];
trimColorTable = [
["12002884","12002884"],
["12002885","12002885"],
["12002930","12002930"],
["12002366","12002366"],
["12081171","12081171"],
["12078628","12078628"],
["12002777","12002777"],
["12002772","12002772"],
["12002888","12002888"],
["12002302","12002302"],
["12002352","12002352"],
["12002351","12002351"],
["12002798","12002798"],
["12002303","12002303"],
["12002300","12002300"],
["12002887","12002887"],
["12002886","12002886"],
["12081094","12081094"],
["12002913","12002913"],
["12081023","12081023"],
["12081042","12081042"],
["12078027","12078027"],
["12002909","12002909"],
["12081019","12081019"],
["12002321","12002321"],
["WHITE","WHITE"]
];
corniceTopTreatmentTable = [
["None","None"],
["pleatedSwagCasual","pleatedSwagCasual"],
["pleatedContemporary","pleatedContemporary"],
["pleatedTraditional","pleatedTraditional"],
["corniceStepped","corniceStepped"],
["corniceStraight","corniceStraight"]
];
var baseUrl = "http:\/\/s7d4.scene7.com/ir/render/LevolorRender/",
replaceUrl = "http:\/\/s7d4.scene7.com/ir/render/",
imageUrl = "http:\/\/s7d4.scene7.com/is/image/Levolor";
function searchTable(value, table, index) {
for (i = 0; i < table.length; i++)
if (table[i][index] == value)
return true;
return false;
}
function lookupTableValue(table, key, index) {
for (i = 0; i < table.length; i++)
if (table[i][0] == key)
return table[i][index];
return "";
}
function populateOptions(selector, colorTable) {
for (var i = 0; i < colorTable.length; i++) {
selector.options[i] = new Option(colorTable[i][0]);
}
}
function sortit(a, b)
{
    return a.replace(/\D.*/, "") - b.replace(/\D.*/, "");
}
function populateOptionsSortedByNumber(selector, optionTable)
{
    var options = new Array(optionTable.length);
    
    for (var i = 0; i < optionTable.length; i++)
            options[i] = optionTable[i][0];
            
    options.sort(sortit);
    
    var optionIndex = 0;
    for (var j = 0; j < options.length; j++)
           selector.options[optionIndex++] = new Option(options[j]);
}
function URLEncode (clearString) {
  var output = '';
  var x = 0;
  clearString = clearString.toString();
  var regex = /(^[a-zA-Z0-9_.]*)/;
  while (x < clearString.length) {
    var match = regex.exec(clearString.substr(x));
    if (match != null && match.length > 1 && match[1] != '') {
    output += match[1];
      x += match[1].length;
    } else {
      if (clearString[x] == ' ')
        output += '+';
      else {
        var charCode = clearString.charCodeAt(x);
        var hexVal = charCode.toString(16);
        output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
      }
      x++;
    }
  }
  return output;
}
function URLDecode (encodedString) {
  var output = encodedString;
  var binVal, thisString;
  var myregexp = /(%[^%]{2})/;
  while ((match = myregexp.exec(output)) != null
             && match.length > 1
             && match[1] != '') {
    binVal = parseInt(match[1].substr(1),16);
    thisString = String.fromCharCode(binVal);
    output = output.replace(match[1], thisString);
  }
  return output;
}
function crop (width,height,url) {
  url = url.replace(replaceUrl, "");
  url = url.replace("-400?wid="+width+"&hei="+height, "?wid=1701&hei=2330");
  url = URLEncode(url);
  var output = imageUrl+"?size=1006,1378&layer=1&pos=10,190&src=ir%7B" + url + "%7D&crop=338,285,1006,1378&wid="+width+"&hei="+height;
  return output;
}
function crop2 (width,height,url) {
  url = url.replace(replaceUrl, "");
  url = url.replace("-400?wid="+width+"&hei="+height, "?wid=1409&hei=2042");
  url = URLEncode(url);
  var output = imageUrl+"?size=1006,1378&layer=1&pos=11,140&src=ir%7B" + url + "%7D&qlt=95&crop=191,135,1006,1378&wid="+width+"&hei="+height;
  return output;
}
function uncrop (width,height,url) {
  url = URLDecode(url);
  url = url.replace(imageUrl+"?size=1006,1378&layer=1&pos=10,190&src=ir%7D",replaceUrl);
  url = url.replace("?wid=1701&hei=2330","-400?wid="+width+"&hei="+height);
  url = url.replace("%7D&crop=338,285,1006,1378&wid="+width+"&hei="+height,"");
  return url;
}
function goDrapery()
{
var url = uncrop(document.productForm.imgProduct.src);
var selectedWall = document.productForm.selectWall.selectedIndex;
var selectedTrim = document.productForm.selectTrim.selectedIndex;
var wall = getSelectedItem(document.productForm.selectWall);
var trim = getSelectedItem(document.productForm.selectTrim);
wallString = "&obj=wall/wall&show&color=" + lookupTableValue(wallColorTable,wall,1);
trimString = "&obj=trim/trim&show&src=" + lookupTableValue(trimColorTable,trim,1);
url = url.replace(wallString, "&obj=wall/wall&show&color=$wall$");
url = url.replace(trimString, "&obj=trim/trim&show&src=$trim$");
url = url.replace(replaceUrl, "");
    location.href = 'drapery.html?blinds='  + URLEncode(url) + '&selectedWall=' + selectedWall + '&selectedTrim=' + selectedTrim;
}
function goHardware()
{
var blinds = getQueryVariable("blinds");
var url = document.productForm.imgProduct.src + "&obj=Main&req=object";
var draw = getSelectedItem(document.productForm.selectdraw);
var selectedWall = document.productForm.selectWall.selectedIndex;
var selectedTrim = document.productForm.selectTrim.selectedIndex;
var wall = getSelectedItem(document.productForm.selectWall);
var trim = getSelectedItem(document.productForm.selectTrim);
wallString = "&obj=room/wall&show&color=" + lookupTableValue(wallColorTable,wall,1);
trimString = "&obj=room/trim&show&src=" + lookupTableValue(trimColorTable,trim,1);
url = url.replace(wallString, "");
url = url.replace(trimString, "");
url = url.replace(replaceUrl, "");
    location.href = 'hardware.html?blinds=' + blinds + '&drapery=' + URLEncode(url) + '&draw=' + draw + '&selectedWall=' + selectedWall + '&selectedTrim=' + selectedTrim;
}
function goFinal()
{
    var blinds = getQueryVariable("blinds");
var drapery = getQueryVariable("drapery");
var url = document.productForm.imgProduct.src + "&obj=Main&req=object";
var wall = getSelectedItem(document.productForm.selectWall);
var trim = getSelectedItem(document.productForm.selectTrim);
var wall = getSelectedItem(document.productForm.selectWall);
var trim = getSelectedItem(document.productForm.selectTrim);
wallString = "&obj=room/wall&show&color=" + lookupTableValue(wallColorTable,wall,1);
trimString = "&obj=room/trim&show&src=" + lookupTableValue(trimColorTable,trim,1);
url = url.replace(wallString, "");
url = url.replace(trimString, "");
url = url.replace(replaceUrl, "");
    location.href = 'final.html?hardware=' + URLEncode(url) + '&drapery=' + drapery + '&blinds=' + blinds + '&selectedWall=' + wall + '&selectedTrim=' + trim;
}
function deebughtml(msg) {
if (config_df && 1==0)
document.frmDebug.debughtml.value += "\n" + msg + "\n";
}
function deebugurl(msg) {
if (config_df==1) 
document.frmDebug.debugurl.value += msg + "\n";
}
function deebug2(msg) {
if (config_df==2) {
if (document.frmDebug) {
if (document.frmDebug.debug2) 
document.frmDebug.debug2.value += msg + "\n";
}
}
}
function deebug3(msg) {
if (config_df==3) {
if (document.frmDebug) {
if (document.frmDebug.debug2) 
document.frmDebug.debug2.value += msg + "\n";
}
}
}
function deebug_dirxml(xmlnode) {
}
function deebug_dir(obj) {
}
var
L_fb=0,
L_xs,
L_ys,
L_sticky=0,
L_sticky_x=0,
L_sticky_y=0,
L_top=0,
L_sH=screen.height,
L_d=document,
L_w=window,
L_ua=navigator.userAgent.toLowerCase(),
L_uav=0,
L_pxc,
L_pyc,
L_ofx=L_d.all?-34:-365+(L_ua.indexOf('safari')>-1?31:15),
L_ofy=5; 
L_w.onresize+=L_Resize,
L_ofy_default=0,
L_ofy_threshold=0; 
function L_Resize(){
L_Move(1); 
};
function _PgetObj(id){
return L_d.getElementById ? L_d.getElementById(id) :
(L_d.all ? L_d.all[id] : 
  (L_d.layers ? L_d.layers[id] : 
   null
  )
 )
};
if(L_d.all){
L_b=L_d.body;
strict=false;
var L_td=document.doctype;
strict=(document.compatMode=='CSS1Compat');
strict=(L_td&&_td.systemId?(L_td.systemId.indexOf('strict')>-1?true:(L_td.publicId.indexOf('transitional')>-1?true:false)):(L_td&&L_td.publicId.indexOf('transitional')==-1?true:strict));
strict=(L_td&&_td.name.indexOf('.dtd')>-1)?true:strict;
if(strict)L_b=L_d.documentElement;
};
function _Position(id,y) {
var g=_PgetObj(id);
if(g) {
L_d.getElementById ? 
(g.style.top=y+'px') : 
(L_d.all ? 
 (g.style.top=y) : 
(L_d.layers ?
 (g.top=y) : 
null
)
)
}
};
function L_PosW(O_offset,O_ly) { 
L_ly_w=0;
if (!L_d.all){
return (L_sticky&&L_sticky_x!=-1?L_sticky_x:(L_w.innerWidth+self.pageXOffset))+O_offset-L_ly_w;
} else {
return (L_sticky&&L_sticky_x!=-1?L_sticky_x:(L_b.clientWidth+L_b.scrollLeft))+O_offset;
}
};
function L_PosH(O_offset,O_ly) {
if(!L_d.all) { 
return (L_sticky&&L_sticky_y!=-1?L_sticky_y:(self.pageYOffset))+O_offset;
} else { 
return (L_sticky&&L_sticky_y!=-1?L_sticky_y:L_b.scrollTop)+O_offset; 
}
};
function L_Moved() {
var L_rc;
if(L_d.all){
L_rc=((L_b.scrollLeft!=L_pxc) || (L_b.scrollTop!=L_pyc));
L_pxc=L_b.scrollLeft;
L_pyc=L_b.scrollTop;
return L_rc;
} else {
L_rc=((self.pageXOffset!=L_pxc) || (self.pageYOffset!=L_pyc));
L_pxc=self.pageXOffset;
L_pyc=self.pageYOffset;
return L_rc;
}
};
function L_Move(O_force){
if (L_Moved()||O_force) {
var yy = L_PosH(L_ofy, L_d.scene7window);
if (yy > L_ofy_threshold) { 
_Position('scene7window', L_ofy_default + (yy-L_ofy_threshold)); 
} else {
_Position('scene7window', L_ofy_default); 
}
}
otimerID=setTimeout('L_Move(0)',100)
};
function L_init(_p){
if (L_ua.indexOf('gecko')) {
L_uav=parseFloat(L_ua.substr(L_ua.indexOf('; rv:')+5,L_ua.indexOf(') gecko/')-L_ua.indexOf('; rv:')+5))
};
if ((navigator.userAgent.indexOf('Opera 6')!=-1) || 
(navigator.userAgent.indexOf('Opera/6')!=-1) || 
(navigator.appVersion.indexOf('MSIE 4.')!=-1) || 
(L_ua.indexOf("mac_powerpc")>-1 && L_ua.indexOf("msie")>-1) ||
document.layers 
) {
return;
}
L_xs=L_top?91:(L_fb?91:119);
L_ys=L_top?0:39;
if(!L_d.layers) { 
L_d.write(_p);
L_Move(1);
}
};
L_top=0;
L_fb=1;
/*
L_init('<div id="scene7window"><span id="shipdate"></span><div id="configuredprice">$0.00</div><img id="scene7image" name="scene7image" src="/images/blank.gif" width="268" height="366" alt="Blind Preview" /></div>');
*/
var ATTRIBUTE_TYPE_FIXED= 1;
var ATTRIBUTE_TYPE_DYNAMIC = 2;
var ATTRIBUTE_TYPE_CATEGORY= 3;
var aCategory = new Array;
var aCollection = new Array; 
var aSwatch = new Array;
var collectionsincategory = new Array;
var selectedcollection = new Array;
var activeswatchid= 0;
var aSwatchLookup= new Array;
var attributeidbyxmlindex= new Array;
var selectedvalueid= new Array;
var selectedvalueid_previous = new Array;
var valueids= new Array; 
var attributedata = new Array();
var valuedata = new Array();
var attributeids = new Array();
var childatts = new Array();
var childattributes = new Array();
var attributeids_displayed = new Array();
var parentobjects = new Array();
var parentswatchobjects = new Array();
var parentobjects_all = new Array();
var scene7default = new Array();
var selectedswatch = new Array();
var attributeinconfig = new Array();
var attributeImagePathCtr = 0;
var attributesforcategory = new Array();
var loadswatches_xmlDoc = "";
var xmlDoc = "";
var aSwatchImg = new Array();
var requestPath = ""; 
var closed_balloon = {'room_tab':0, 'first_swatch':0};
var scene7group = scene7group_previous = new Array();
for (modelid in SCENE_7_FILENAME) {
scene7group[modelid] = new typedef_scene7group();
scene7group_previous[modelid] = new typedef_scene7group(); 
scene7group[modelid]["selectedProduct"] = SCENE_7_MODEL[modelid]; 
prePopulateScene7Options(modelid);
}
var isIC = (EXTERNAL_CART);
function prePopulateScene7Options(modelid) {
for (var prop in s7prophold[modelid]) {
scene7group[modelid][prop] = s7prophold[modelid][prop];
}
}
function configure_order() {
document.location.href = CONFIGURATOR_URL + '?mid='+MODEL_ID;
}
function getQuote() {
var params = new Object;
params['width'] = $("select[@id=qq_width]").val();
params['height'] = params['length'] = $("select[@id=qq_height]").val();
params['mcid'] = MODEL_CATEGORY_ID;
if (params['width'] > 0 && params['length'] > 0) {
$("div[@id=configuredprice]").html('<img src="/images/configurator/indicator_FFFFFF.gif" vspace="8" />');
$.ajax({
url: '/request.php?method=savequickquotedimensions',
data: params,
type: 'POST',
dataType: 'xml',
timeout: 30000,
error: function(robj, etype, eobj) {
getQuote_callback(params); 
},
success: function(xml) {
getQuote_callback(params); 
}
});
}
}
function getQuote_callback(params) {
params['usedefaults'] = 1;
params['extra'] = params['mid'] = MODEL_ID;
params['vendorid'] = VENDOR_ID;
params['accountid'] = ACCOUNT_ID;
params['storeid'] = STORE_ID;
delete params['mcid'];
var aid = aSwatch[aSwatchLookup[activeswatchid]].attributeid+'';
params['co'+aid.replace('000'+MODEL_ID, '')] = activeswatchid; 
params['overridedefaults'] = 1;
$.ajax({
url: '/request.php?method=getprice',
data: params,
type: 'POST',
dataType: 'xml',
timeout: 10000,
error: function(robj, etype, eobj) {
var msg = "An error occurred while attempting to retrieve the price quote.<br />";
for (x in eobj) msg+= x + ': ' + eobj[x]+'<br>';
$('span[@id=qq_price'+MODEL_ID+']').html(msg);
$('div[@id=configuredprice]').html('Error');
},
success: function(xml) {
var error_code = $('errorcode', xml).text();
var model_id = $('extra', xml).text();
var content = '$0.00';
var returnprice = '';
if (error_code <= 0) {
returnprice = $('price', xml).text();
if (returnprice.length && returnprice != "0.00") {
content = '$'+returnprice;
}
}
$('div[@id=configuredprice]').html(content);
}
});
}
function loadStep(stepnum) {
STEP_NUM = stepnum;
processLoadSwatches("successive");
}
function loadSwatches() {
$.ajax({
url: '/request.php?method=loadswatchesandattributes',
data: {mcid:MODEL_CATEGORY_ID},
type: 'POST',
dataType: 'xml',
timeout: 15000,
error: function(robj, etype, eobj) {
showTimeoutError();
},
success: function(xml) {
var error_code = $('errorcode', xml).text();
var model_id = $('extra', xml).text();
xmlDoc = xml;
processLoadSwatches("initial");
}
});
}
function addToCart_Result(xml,swatchid,carttype) {
var errorcode = $("errorcode",xml).text();
var msg = $("msg",xml).text();
var cartid = (carttype=='NORMAL'?'cart':'list');
if (errorcode > 0) {
$("#add2"+cartid+swatchid).text("+ "+cartid); 
alert(msg.replace(/{break}/g, "\n\n"));
} else {
if (!isIC) {
var new_cart_items = parseInt($("itemsincart",xml).text());
var overlimit = parseInt($("overlimit",xml).text());
var is_new_cart= parseInt($("newcart",xml).text());
var updateFlag = true;
var cart_title_text = "&nbsp;("+new_cart_items+" item"+(new_cart_items!=1?'s':'')+")"; 
var cart_title_text_topnav = (new_cart_items==0?"":cart_title_text); 
}
if (carttype == "NORMAL") {
if (!isIC && overlimit) {
for (i=0; i<aSwatch.length;i++) {
if (aSwatch[i].swatchid == swatchid) {
if (aSwatch[i].inlist == 1) {
alert('Only '+CART_SWATCH_LIMIT+' swatches can be added to your cart and ordered at one time.\n\n'+
 'This swatch ('+aSwatch[i].text+') already exists in your wishlist.');
updateFlag = false;
} else {
if (confirm('Only '+CART_SWATCH_LIMIT+' swatches can be added to your cart and ordered at one time.\n\n'+
 'Would you like to add it to your wishlist instead?\n'+
 '(your wishlist can hold more than '+CART_SWATCH_LIMIT+' swatches)')) {
toggleInCart(swatchid,'WISHLIST');
}
updateFlag = false;
}
}
}
} else {
o = getObj("add2cart"+swatchid); 
if (o) { 
o.innerHTML = (isIC ? "added" : "remove from cart");
o.className = "cart-btn selected"; 
}
if (!isIC) {
o = getObj("cart_items_count"); 
if (o) o.innerHTML = cart_title_text_topnav;
o = getObj("swatch_hint_cart_count"); 
if (o) o.innerHTML = new_cart_items;
}
var idx = aSwatchLookup[swatchid];
if (s_gi) {
var s=s_gi(s_account);
s.linkTrackVars = 'events,products';
s.linkTrackEvents = (is_new_cart==1?'scOpen,scAdd':'scAdd'); 
s.events = (is_new_cart==1?'scOpen,scAdd':'scAdd');
s.products = ';[Swatch] - '+aSwatch[idx].oekey+' - '+aSwatch[idx].text+' - '+MODEL_CATEGORY_NAME + ';1;0;;evar2=';
s.tl(this,'o');
}
}
}
else if (carttype == "WISHLIST") {
o = getObj("add2list"+swatchid); 
if (o) { o.innerHTML = "- list"; o.className = "list-btn selected"; }
var idx = aSwatchLookup[swatchid];
if (s_gi) {
var s=s_gi(s_account);
s.linkTrackVars = 'events,products';
s.linkTrackEvents = (is_new_cart==1?'event4,event1':'event1'); 
s.events = (is_new_cart==1?'event4,event1':'event1');
s.products = ';[Swatch] - '+aSwatch[idx].oekey+' - '+aSwatch[idx].text+' - '+MODEL_CATEGORY_NAME + ';1;0;;evar2=';
s.tl(this,'o');
}
o = getObj("list_items_count"); 
if (o) o.innerHTML = cart_title_text_topnav;
o = getObj("swatch_hint_list_count"); 
if (o) o.innerHTML = new_cart_items;
}
if (updateFlag && !isIC) {
for (i=0; i<aSwatch.length;i++) {
if (aSwatch[i].swatchid == swatchid) {
if (carttype == "WISHLIST")
aSwatch[i].inlist = 1;
else if (carttype == "NORMAL")
aSwatch[i].incart = 1;
}
}
}
}
}
function addToCart(swatchid,carttype) {
var cartid = (carttype=='NORMAL'?'cart':'list');
if (isIC) {
$("#add2"+cartid+swatchid).text("wait...");
$.ajax({
url: '/products/cart.php',
data:{swatch:swatchid},
type:'GET',dataType:'xml',timeout:15000,
error: function(robj, etype, eobj) { $("#add2"+cartid+swatchid).text("error"); },
success: function(xml) { addToCart_Result(xml,swatchid,carttype); }
});
} else {
$("#add2"+cartid+swatchid).text("wait...");
$.ajax({
url: '/request.php?method=addswatchtocart',
data:{swatchid:swatchid, carttype:carttype},
type:'POST',dataType:'xml',timeout:15000,
error: function(robj, etype, eobj) {},
success: function(xml) { addToCart_Result(xml,swatchid,carttype); }
});
}
}
function removeFromCart(swatchid,carttype) {
$.ajax({
url: '/request.php?method=removeswatchfromcart',
data: {swatchid:swatchid, modelcategoryid:MODEL_CATEGORY_ID, carttype:carttype},
type: 'POST',
dataType: 'xml',
timeout: 15000,
error: function(robj, etype, eobj) {
showTimeoutError();
},
success: function(xml) {
var new_cart_items = parseInt($("itemsincart",xml).text());
var swatchid = parseInt($("swatchid",xml).text());
var carttype = $("carttype",xml).text();
var cart_title_text = "&nbsp;("+new_cart_items+" item"+(new_cart_items!=1?'s':'')+")"; 
var cart_title_text_topnav = (new_cart_items==0?"":cart_title_text); 
if (carttype == "NORMAL") {
o = getObj("add2cart"+swatchid); 
if (o) { o.innerHTML = "add to cart"; o.className = "cart-btn"; }
o = getObj("cart_items_count"); 
if (o) o.innerHTML = cart_title_text_topnav;
o = getObj("swatch_hint_cart_count"); 
if (o) o.innerHTML = new_cart_items;
} else if (carttype == "WISHLIST") {
o = getObj("add2list"+swatchid); 
/* DISABLE WISHLIST
if (o) { o.innerHTML = "+ list"; o.className = "list-btn"; }
o = getObj("list_items_count"); 
*/
if (o) o.innerHTML = cart_title_text_topnav;
o = getObj("swatch_hint_list_count"); 
if (o) o.innerHTML = new_cart_items;
}
var idx = aSwatchLookup[swatchid];
if (s_gi) {
var s=s_gi(s_account);
s.linkTrackVars = 'events,products';
s.linkTrackEvents = (carttype=="NORMAL"?'scRemove':'event11');
s.events = (carttype=="NORMAL"?'scRemove':'event11');
s.products = ';[Swatch] - '+aSwatch[idx].oekey+' - '+aSwatch[idx].text+' - '+MODEL_CATEGORY_NAME + ';1;0;;evar2=';
s.tl(this,'o');
}
for (i=0; i<aSwatch.length;i++) {
if (aSwatch[i].swatchid == swatchid) {
if (carttype == "WISHLIST") {
if (aSwatch[i].inlist != 0) {
aSwatch[i].inlist = 0;
}
} else if (carttype == "NORMAL") {
aSwatch[i].incart = 0;
}
}
}
}
});
}
function toggleInCart(swatchid,type) {
if (isIC) { 
addToCart(swatchid,type);
} else {
if (type == 'NORMAL' && aSwatch[aSwatchLookup[swatchid]].incart || type == 'WISHLIST' && aSwatch[aSwatchLookup[swatchid]].inlist) {
removeFromCart(swatchid,type); 
} else {
addToCart(swatchid,type);
}
}
}
function setVar(name, value) {
}
function updateRoomTabSelection(scene7groupname, scene7code) {
var o = getObj(scene7groupname + scene7code);
if (o) o.className = "selected";
o = getObj(scene7groupname + scene7group_previous[scene7groupname]);
if (o) o.className = "";
}
function showTimeoutError() {
$("#configcontent").html("Sorry, an error occurred loading the configuration details.<a href=\"Javascript:;\" onclick=\"loadConfig();return(false);\">Click here</a> to try again.");
}
function arrayFind(ary, element){
    for(var i=0; i<ary.length; i++){
        if(ary[i] == element){
            return i;
        }
    }
    return -1;
}
function _getElementsByTagName(xmlDoc, name) {
var ret = xmlDoc.getElementsByTagName(name);
if (!ret) {
ret = "";
}
return ret;
}
function _getElementsTextByTagName(xmlDoc, name) {
var ret = xmlDoc.getElementsByTagName(name).item(0);
if (!ret) {
ret = "";
}
return ret;
}
function saveAttributeInfo(xmlindex) {
var j, p, q, indexexists, parent_type, parent_isor, parent_isnot;
var thisattribute= attributes[xmlindex];
var attributeid= parseInt(getInnerText(_getElementsTextByTagName(thisattribute, "id")));
var attributename= getInnerText(_getElementsTextByTagName(thisattribute, "name"));
var attributetype= parseInt(getInnerText(_getElementsTextByTagName(thisattribute, "attributetype"))); 
var attributestep= parseInt(getInnerText(_getElementsTextByTagName(thisattribute, "step")));
var hasdescriptiontext= parseInt(getInnerText(_getElementsTextByTagName(thisattribute, "hasdescriptiontext")));
var attributeoverview= getInnerText(_getElementsTextByTagName(thisattribute, "overview"));
var attributerequired= parseInt(getInnerText(_getElementsTextByTagName(thisattribute, "required")));
var attributeformat= parseInt(getInnerText(_getElementsTextByTagName(thisattribute, "outputformat")));
var attributefilename= getInnerText(_getElementsTextByTagName(thisattribute, "filename"));
var attributedefaultvalue= getInnerText(_getElementsTextByTagName(thisattribute, "defaultvalue")); 
var attributescene7code= getInnerText(_getElementsTextByTagName(thisattribute, "scene7code"));
var values= _getElementsByTagName(thisattribute, "value"); 
attributeidbyxmlindex[xmlindex] = attributeid;
if (attributetype == ATTRIBUTE_TYPE_FIXED) {
var loopstart = 0;
var loopend = 0;
var loopinterval = -1; 
var hasvalues = false;
var nextindex= ""; 
if (values.length > 0) {
loopstart = 0;
loopend = values.length;
loopinterval = 1;
hasvalues = true;
} 
attributedata[attributeid] = new typedef_attributedata(xmlindex, attributeid, attributetype, attributename, attributestep, hasdescriptiontext, attributeoverview,
attributerequired, attributeformat, attributefilename, loopstart, loopend, loopinterval, 
attributedefaultvalue, attributescene7code, values, hasvalues);
if (attributedefaultvalue != "") {
setAsSelected(attributeid, attributedefaultvalue);
}
valueids[attributeid] = new Array();
var valueid, valuename, valueisdefault, scene7codedefault, valuefilename;
for (j=loopstart; j<loopend; j+=loopinterval) {
valueid = parseInt(getInnerText(_getElementsTextByTagName(values[j], "id")));
valuename = getInnerText(_getElementsTextByTagName(values[j], "name"));
valueisdefault= parseInt(getInnerText(_getElementsTextByTagName(values[j], "isdefault")));
scene7codedefault = getInnerText(_getElementsTextByTagName(values[j], "scene7code"));
valuefilename= getInnerText(_getElementsTextByTagName(values[j], "filename"));
valueids[attributeid][valueids[attributeid].length] = valueid; 
attributeids[valueid] = attributeid; 
valuedata[valueid] = new typedef_valueid(valueid, valuename, valueisdefault, scene7codedefault, valuefilename); 
}
}
else if (attributetype == ATTRIBUTE_TYPE_CATEGORY) {
var categories = _getElementsByTagName(thisattribute, "category");
saveSwatchInfo(attributeid, categories);
for (var j=0; j<categories.length; j++) { 
var categoryid = parseInt(getInnerText(_getElementsTextByTagName(categories[j], "categoryid")));
attributedata[attributeid] = new typedef_attributecategorydata(xmlindex, attributeid, attributetype, categoryid, attributestep, hasdescriptiontext);
}
}
/*
<attribute>
<id>46</id>
<name>1st Panel Width</name>
<parents>
<parent>
<type>attributevalue</type>
<isor>0</isor>
<attributevalueid>22</attributevalueid>
</parent>
<parent>
<type>attributevalue</type>
<isor>1</isor>
<attributevalueid>23</attributevalueid>
</parent>
</parents>
</attribute>
*/
parentobjects[attributeid] = new Array;
parentswatchobjects[attributeid] = new Array;
parentobjects_all[attributeid] = new Array;
parentsxml = _getElementsByTagName(attributes[xmlindex], "parent");
for (var p=0; p<parentsxml.length; p++) {
parent_type = getInnerText(_getElementsTextByTagName(parentsxml[p], "type"));
parent_isor = getInnerText(_getElementsTextByTagName(parentsxml[p], "isor"));
parent_isnot = getInnerText(_getElementsTextByTagName(parentsxml[p], "isnot"));
if (parent_type == "attributevalue") {
parent_attributevalueid = parseInt(getInnerText(_getElementsTextByTagName(parentsxml[p], "attributevalueid")));
parent_attributeid = parseInt(getInnerText(_getElementsTextByTagName(parentsxml[p], "attributeid")));
if (parent_attributevalueid > 0) {
addParentToChildArray(parent_attributevalueid, xmlindex, parent_attributeid);
nextindex = parentobjects[attributeid].length;
parentobjects[attributeid][nextindex] = new typedef_attributeparent(parent_type, attributeid, parent_attributevalueid, parent_isor, parent_isnot, -1); 
parentobjects_all[attributeid][parentobjects_all[attributeid].length] = parentobjects[attributeid][nextindex];
}
} 
else if (parent_type == "swatch") {
parent_categoryid= parseInt(getInnerText(_getElementsTextByTagName(parentsxml[p], "categoryid")));if (isNaN(parent_categoryid)) parent_categoryid = 0;
parent_categoryname = getInnerText(_getElementsTextByTagName(parentsxml[p], "categoryname"));
parent_collectionid = parseInt(getInnerText(_getElementsTextByTagName(parentsxml[p], "collectionid")));if (isNaN(parent_collectionid)) parent_collectionid = 0;
parent_collectionname= getInnerText(_getElementsTextByTagName(parentsxml[p], "collectionname"));
parent_swatchid = parseInt(getInnerText(_getElementsTextByTagName(parentsxml[p], "swatchid")));if (isNaN(parent_swatchid)) parent_swatchid = 0;
parent_swatchname= getInnerText(_getElementsTextByTagName(parentsxml[p], "swatchname"));
parent_attributeid= parseInt(getInnerText(_getElementsTextByTagName(parentsxml[p], "attributeid_category")));if (isNaN(parent_attributeid)) parent_attributeid = 0;
var swatchkey = parent_categoryid + "_" + parent_collectionid + "_" + parent_swatchid;
if (parent_categoryid > 0 || parent_collectionid > 0 || parent_swatchid > 0) {
addParentToChildArray(swatchkey, xmlindex, parent_attributeid);
nextindex = parentswatchobjects[attributeid].length;
parentswatchobjects[attributeid][nextindex] = new typedef_swatchparent(parent_type, parent_categoryid, parent_collectionid, parent_swatchid, parent_isor, parent_isnot, -1); 
parentobjects_all[attributeid][parentobjects_all[attributeid].length] = parentswatchobjects[attributeid][nextindex];
if (!attributesforcategory[parent_categoryid]) {
attributesforcategory[parent_categoryid] = new Array;
attributesforcategory[parent_categoryid][0] = attributeid;
} else {
attributesforcategory[parent_categoryid][attributesforcategory[parent_categoryid].length] = attributeid;
}
}
}
}
attributeinconfig[attributeid] = false;
}
function addParentToChildArray(parentkey, xmlindex, parent_attributeid) {
var q, indexexists;
if (childatts[parentkey] == null) {
childatts[parentkey] = new Array;
childatts[parentkey][0] = xmlindex;
} else {
indexexists = false;
for (q=0; q<childatts[parentkey].length; q++) {
if (childatts[parentkey][q] == xmlindex) {
indexexists = true;
break;
}
}
if (!indexexists) {
childatts[parentkey][childatts[parentkey].length] = xmlindex;
}
}
if (childattributes[parent_attributeid] == null) {
childattributes[parent_attributeid] = new Array;
childattributes[parent_attributeid][0] = xmlindex;
} else {
indexexists = false;
for (q=0; q<childattributes[parent_attributeid].length; q++) {
if (childattributes[parent_attributeid][q] == xmlindex) {
indexexists = true;
break;
}
}
if (!indexexists) {
childattributes[parent_attributeid][childattributes[parent_attributeid].length] = xmlindex;
}
}
}
function setAsSelected(attributeid, attributevalueid) {
if (selectedvalueid[attributeid] != undefined) {
selectedvalueid_previous[attributeid] = selectedvalueid[attributeid];
}
if (attributevalueid != undefined) {
selectedvalueid[attributeid] = attributevalueid;
if (attributedata[attributeid]) {
attributedata[attributeid].attributedefaultvalue = attributevalueid;
}
}
}
function processLoadSwatches(whichTime) {
var z;
if (whichTime != "initial") {
xmlDoc = loadswatches_xmlDoc;
}
for (MODEL_ID in SCENE_7_MODEL) {
break;
}
if (whichTime == "initial") {
attributes = _getElementsByTagName(xmlDoc, "attribute");
childattributes = new Array(); 
for (var i=0; i<attributes.length; i++) {
saveAttributeInfo(i);
}
var selectedWall = getInnerText(_getElementsTextByTagName(xmlDoc, "scene7wallcolor"));
var selectedTrim = getInnerText(_getElementsTextByTagName(xmlDoc, "scene7trimcolor"));
if (selectedWall!='') { setScene7Property("selectedWall", selectedWall);}
if (selectedTrim!='') { setScene7Property("selectedTrim", selectedTrim);}
}
$("#configcontent").html('');
var content = '';
var qq_content = $("#qq_content").val();
if (qq_content!='')
content += '<div id="quickquote"><div id="arrow">quick quote price</div><div id="settings">'+$("#qq_content").val()+'</div></div>';
show_room_tab = true;
for (mid in SCENE_7_OVERRIDE_SIDEBAR) {
if (SCENE_7_OVERRIDE_SIDEBAR[mid] != '') {
show_room_tab = false;
}
}
if (CAN_ORDER_SWATCHES) {
content += '<h2 class="swatch-step1-'+(MODEL_CATEGORY_ID==33?'fabric':'style')+'">choose your '+(MODEL_CATEGORY_ID==33?'fabric':'color')+'</h2>'+
'<div class="dotted-rule" style="margin: 5px 0;"><hr /></div>'+
'<div class="swatch-lesson">'+
'<div class="text">'+
'<h2>order up to '+CART_SWATCH_LIMIT+' free swatches!</h2>'+
'Click the buttons below each individual swatch to add it to '+(isIC?'your cart':'either your cart or your wishlist')+'. '+
'Swatches will be delivered to your mailbox in 3-5 days.'+
'</div>'+
'</div>';
}
if (show_room_tab) {
content += drawRoomOptions();
}
var firstColor = true;
for (z=0; z<attributeidbyxmlindex.length; z++) {  
var attributeid = attributeidbyxmlindex[z];
if (attributedata[attributeid].attributetype == ATTRIBUTE_TYPE_FIXED) {
content += '<div id="attributecontent'+attributeid+'">';
content += renderAttribute(z, 0, 0, "loadconfig",true); 
content += '</div>';
} else if (attributedata[attributeid].attributetype == ATTRIBUTE_TYPE_CATEGORY) {
var showDisclaimer = (firstColor ? true : false); 
if (firstColor) { 
content += '<div class="config-wrap">';
firstColor = false;
}
content += '<div id="attributecontent'+attributeid+'">';
content += renderAttribute(z, 0, 0, "loadconfig", showDisclaimer); 
content += '</div>';
if (z < attributeidbyxmlindex.length-1 && attributedata[attributeidbyxmlindex[z+1]].attributetype != ATTRIBUTE_TYPE_CATEGORY) {
content += '</div>';
firstColor = true;
}
}
}
$("#configcontent").html(content); 
if (SCENE_7_FILENAME[MODEL_ID] == "" && USE_IMAGE_LOADER) {
sendNextImagePreloaderRequest();
} else {
buildScene7Blind_Configurator();
}
getQuote();
}
function renderAttribute(xmlindex, isChild, parentalCheckOK, invocationSource, showDisclaimer) {
var content = "";
var attributeid = attributeIdFromIndex(xmlindex);
var attributetype= attributedata[attributeid].attributetype;
if (attributetype == ATTRIBUTE_TYPE_CATEGORY) {
var categoryid = attributedata[attributeid].categoryid;
var parentsOK = parentalCheckOK;
if (!parentalCheckOK) 
parentsOK = validateParentalDependency(attributeid);
if (isChild || parentobjects_all[attributeid].length == 0 || (parentobjects_all[attributeid].length > 0 && parentsOK)) {
content += renderSwatchesForCollection(categoryid, 'taball'+categoryid, true, showDisclaimer)
attributeinconfig[attributeid] = true;
}
} 
else if (attributetype == ATTRIBUTE_TYPE_FIXED) {
var attributename= attributedata[attributeid].attributename;
var hasdescriptiontext= attributedata[attributeid].hasdescriptiontext;
var attributeoverview= attributedata[attributeid].attributeoverview;
var attributerequired= attributedata[attributeid].attributerequired;
var attributeformat = attributedata[attributeid].attributeformat;
var attributefilename = attributedata[attributeid].attributefilename;
var attributefixed= attributedata[attributeid].attributefixed;
var attributedefaultvalue= attributedata[attributeid].attributedefaultvalue;
var attributedefaultvalueraw= attributedata[attributeid].attributedefaultvalueraw;
var attributescene7code = attributedata[attributeid].attributescene7code;
var values= attributedata[attributeid].attributevalues;
var hasvalues= attributedata[attributeid].hasvalues;
var loopstart= attributedata[attributeid].loopstart;
var loopend= attributedata[attributeid].loopend;
var loopinterval= attributedata[attributeid].loopinterval;
var j, content = '';
var parentsOK = parentalCheckOK;
if (!parentalCheckOK) 
parentsOK = validateParentalDependency(attributeid);
 
if (isChild || parentobjects_all[attributeid].length == 0 || (parentobjects_all[attributeid].length > 0 && parentsOK)) {
attributeinconfig[attributeid] = true;
content += "<div class=\"config-wrap\" id=\"config_wrap_"+attributeid+"\">";
content += "<div class=\"head\">";
content += "<h2>" + attributename + (config_df ? "(a" + attributeid + ")" : "") + "&nbsp;</h2>";
content += "</div>"; 
content += "<div class=\"content\">"; 
if (attributeoverview != null && attributeoverview != "") {
content += "<p>"+attributeoverview+"</p>"
}
if (hasdescriptiontext == 1) {
content += learnMoreLink(attributeid);
content += learnMoreDiv(attributeid); 
}
content += '<table cellspacing="0" cellpadding="0" border="0">'; 
if (hasvalues) {
switch (attributeformat) {
case 1:
content += '<tr valign="top">';
for (j=loopstart; j<loopend; j=j+loopinterval) {
var v = getAttributeValueLoopData(j, attributedata[attributeid]);
content += '<td width="219">';
if (v.attributevaluefilename != "") {
if (USE_IMAGE_LOADER)
imagePreloaderQueue[imagePreloaderQueue.length] = new typedef_ImagePreloaderQueueItem([new typedef_preloadImage(getAttributeImagePath()+v.attributevaluefilename, "attributevalueimage"+v.valueid)]);
content += '<img id="attributevalueimage'+v.valueid+'" src="'+(USE_IMAGE_LOADER?"":getAttributeImagePath()+v.attributevaluefilename)+'" class="diagramthumb" alt="" onclick="clickValueOption(\'attribute'+attributeid+'_value'+v.valueid+'\')" />';
}
content += '<div class="radiolabel">';
content += '<input type="radio" name="attribute' + attributeid + '" id="attribute' + attributeid + '_value' + v.valueid + '" value="' + v.valueid + '"'+ (v.valueisdefault==1 ? ' checked' : '') + ' onclick="' + generateOnClickCodeForAttributeValue(attributeid, v.valueid, attributescene7code, v.scene7valuecode, attributeformat) + '" />'; 
content += v.valuename + (config_df ? '((='+v.valueid+'))' : '<!--(('+v.valueid+'))-->') + '<br/>';
content += '</div>';
content += '</td>';
setAttributeValueDefaults(attributedata[attributeid], v);
} 
content += '</tr>';
break;
case 4:
for (j=loopstart; j<loopend; j=j+loopinterval) {
var v = getAttributeValueLoopData(j, attributedata[attributeid]);
content += '<tr valign="top"><td width="219"><br />';
if (v.attributevaluefilename != "") {
if (USE_IMAGE_LOADER)
imagePreloaderQueue[imagePreloaderQueue.length] = new typedef_ImagePreloaderQueueItem([new typedef_preloadImage(getAttributeImagePath()+v.attributevaluefilename, "attributevalueimage"+v.valueid)]);
content += '<img id="attributevalueimage'+v.valueid+'" src="'+(USE_IMAGE_LOADER?"":getAttributeImagePath()+v.attributevaluefilename)+'" class="diagramthumb" alt="" onclick="clickValueOption(\'attribute'+attributeid+'_value'+v.valueid+'\')" />';
}
content += '</td><td width="219" valign="bottom">';
content += '<div class="radiolabel">';
content += '<input type="radio" name="attribute' + attributeid + '" id="attribute' + attributeid + '_value'+v.valueid+'" value="' + v.valueid + '"'+ (v.valueisdefault==1 ? ' checked' : '') + ' onclick="' + generateOnClickCodeForAttributeValue(attributeid, v.valueid, attributescene7code, v.scene7valuecode, attributeformat) + '" />'; 
content += v.valuename + (config_df ? ' {{='+v.valueid+'}}' : '<!--{{'+v.valueid+'}}-->') + '<br/>';
content += '</div></td></tr>';
setAttributeValueDefaults(attributedata[attributeid], v);
}
break;
case 5:
var valcounter = 1;
for (j=loopstart; j<loopend; j=j+loopinterval) {
if (valcounter % 2 == 1) {
content += '<tr valign="top">';
}
var v = getAttributeValueLoopData(j, attributedata[attributeid]);
content += '<td>';
if (v.attributevaluefilename != "") {
if (USE_IMAGE_LOADER)
imagePreloaderQueue[imagePreloaderQueue.length] = new typedef_ImagePreloaderQueueItem([new typedef_preloadImage(getAttributeImagePath()+v.attributevaluefilename, "attributevalueimage"+v.valueid)]);
content += '<img id="attributevalueimage'+v.valueid+'" src="'+(USE_IMAGE_LOADER?"":getAttributeImagePath()+v.attributevaluefilename)+'" class="diagramthumb" alt="" onclick="clickValueOption(\'attribute'+attributeid+'_value'+v.valueid+'\')" />';
}
content += '<div class="radiolabel">';
content += '<input type="radio" name="attribute' + attributeid + '" id="attribute' + attributeid + '_value' + v.valueid + '" value="' + v.valueid + '"'+ (v.valueisdefault==1 ? ' checked' : '') + ' onclick="' + generateOnClickCodeForAttributeValue(attributeid, v.valueid, attributescene7code, v.scene7valuecode, attributeformat) + '" />'; 
content += v.valuename + (config_df ? '((='+v.valueid+'))' : '<!--(('+v.valueid+'))-->') + '<br/>';
content += '</div><br />';
content += '</td><td width="10">&nbsp;</td>';
setAttributeValueDefaults(attributedata[attributeid], v);
if (valcounter++ % 2 == 0) {
content += '</tr>'; 
}
}
if (valcounter-1 % 2 == 1) {
content += '<td width="219">&nbsp;</td><td width="10">&nbsp;</td></td></tr>';
}
break;
case 6:
atts_per_row = 3;
var valcounter = 1;
for (j=loopstart; j<loopend; j=j+loopinterval) {
if (valcounter % atts_per_row == 1) {
content += '<tr valign="top">';
}
var v = getAttributeValueLoopData(j, attributedata[attributeid]);
content += '<td>';
if (v.attributevaluefilename != "") {
imagePreloaderQueue[imagePreloaderQueue.length] = new typedef_ImagePreloaderQueueItem([new typedef_preloadImage(getAttributeImagePath()+v.attributevaluefilename, "attributevalueimage"+v.valueid)]);
content += '<img id="attributevalueimage'+v.valueid+'" src="'+(USE_IMAGE_LOADER?"":getAttributeImagePath()+v.attributevaluefilename)+'" class="diagramthumb" alt="" onclick="clickValueOption(\'attribute'+attributeid+'_value'+v.valueid+'\')" />';
}
content += '<div class="radiolabel">';
content += '<input type="radio" name="attribute' + attributeid + '" id="attribute' + attributeid + '_value' + v.valueid + '" value="' + v.valueid + '"'+ (v.valueisdefault==1 ? ' checked' : '') + ' onclick="' + generateOnClickCodeForAttributeValue(attributeid, v.valueid, attributescene7code, v.scene7valuecode, attributeformat) + '" />'; 
content += v.valuename + (config_df ? '((='+v.valueid+'))' : '<!--(('+v.valueid+'))-->') + '<br/>';
content += '<span id="surchargeattributevalue'+v.valueid+'"></span>'; 
content += '</div><br />';
content += '</td><td width="10">&nbsp;</td>';
setAttributeValueDefaults(attributedata[attributeid], v);
if (valcounter++ % atts_per_row == 0) content += '</tr>'; 
}
if (valcounter-1 % atts_per_row == 1) {
content += '<td width="219">&nbsp;</td><td width="10">&nbsp;</td></td></tr>';
}
break;
case 3:
for (j=loopstart; j<loopend; j=j+loopinterval) {
var v = getAttributeValueLoopData(j, attributedata[attributeid]);
content += '<tr valign="top"><td width="219">';
if (attributefilename != "") {
if (USE_IMAGE_LOADER)
imagePreloaderQueue[imagePreloaderQueue.length] = new typedef_ImagePreloaderQueueItem([new typedef_preloadImage(getAttributeImagePath()+attributefilename, "attributeimage"+attributeid)]);
content += '<img id="attributeimage'+attributeid+'" src="'+(USE_IMAGE_LOADER?"":getAttributeImagePath()+attributefilename)+'" class="diagramthumb" alt="diagram" onclick="clickValueOption(\'attribute'+attributeid+'_value'+v.valueid+'\')" />';
}
content += '</td><td width="219" valign="bottom">';
content += '<input type="checkbox" name="attribute' + attributeid + '" id="attribute'+attributeid+'_value'+v.valueid+'" value="'+v.valueid+'"' + (v.valueisdefault==1 ? ' checked' : '') + ' onclick="' + generateOnClickCodeForAttributeValue(attributeid, v.valueid, attributescene7code, v.scene7valuecode, attributeformat) + '" />'; 
content += ' Add this option ' + (config_df ? '[[='+v.valueid+']]' : '<!--[['+v.valueid+']]-->') + '<br/>';
setAttributeValueDefaults(attributedata[attributeid], v);
}
content += '</td></tr>';
break;
case 2:
content += '<tr valign="top"><td width="219">';
if (attributefilename != "") {
if (USE_IMAGE_LOADER)
imagePreloaderQueue[imagePreloaderQueue.length] = new typedef_ImagePreloaderQueueItem([new typedef_preloadImage(getAttributeImagePath()+attributefilename, "attributeimage"+attributeid)]);
content += '<img id="attributeimage'+attributeid+'" src="'+(USE_IMAGE_LOADER?"":getAttributeImagePath()+attributefilename)+'" class="diagramthumb" alt="" />';
}
content += '</td><td width="219" valign="bottom">';
content += drawRequiredAsterisk(attributeid);
if (attributetype == ATTRIBUTE_TYPE_DYNAMIC) {
content += sizeFieldDynamic(attributeid, "attribute"+attributeid, attributedefaultvalueraw, loopstart, loopend-1, loopinterval);
} else {
content += attributeDropDownFixed(attributeid, loopstart, loopend, loopinterval);
}
content += "</td></tr>";
break;
} 
} 
content += '</table>';
content += '</div>'; 
content += '<span class="complete-msg" id="completeAtt_'+attributeid+'" style="display:none;"><img alt="!" src="/images/icons/error_icon.gif"/> please complete this option</span>';
content += '<p class="req-key"><span id="requiredAtt_'+attributeid+'" style="display:none;"><img class="m-r_5" alt="!" src="/images/icons/req_star.gif"/>required</span></p>';
content += '</div>'; 
} else {
attributeinconfig[attributeid] = false;
}
} 
return content;
}
function toggleChild(attributevalueid, attributeid, returnhtml, isParentASwatch, invocationSource) {
var o, i, j, k, p, r, finalHTML="", thisvalueid, previous_valueid, previous_attributeid;
var childrenArray = new Array();
var examinedArray = new Array();
childrenArray = getChildrenAttributes(attributeid, 0, childrenArray, examinedArray);
if (childrenArray.length > 0) {
}
hideChildrenAttributes(attributeid, childrenArray);
if (childattributes[attributeid] != undefined && childattributes[attributeid].length > 0) {
if (config_df==2) {
var c_atts = "";
for (i=0; i<childattributes[attributeid].length; i++) 
c_atts += attributeIdFromIndex(childattributes[attributeid][i]) + ",";
}
for (i=0; i<childattributes[attributeid].length; i++) {
var baseattributeid = attributeIdFromIndex(childattributes[attributeid][i]);
if (validateParentalDependency(baseattributeid)) { 
var newtext = renderAttribute(childattributes[attributeid][i], 1, 1, invocationSource, true);
if (newtext != "") {
$("#attributecontent"+baseattributeid).html(newtext).show();
} 
attributeinconfig[baseattributeid] = true;
if (USE_IMAGE_LOADER && attributedata[baseattributeid].attributetype == ATTRIBUTE_TYPE_CATEGORY && invocationSource == "userinvoked") {
sendNextImagePreloaderRequest();
}
} else {
$("#attributecontent"+baseattributeid).html('').hide();
attributeinconfig[baseattributeid] = false;
}
}
} 
}
function getChildrenAttributes(attributeid, recursive, finalarray, examinedarray) {
var spacing = repeatString(" ", recursive*3);
var child_attributeid;
if (childattributes[attributeid]) { 
if (!examinedarray[attributeid]) {
examinedarray[attributeid] = 1; 
recursive++;
for (var i=0; i<childattributes[attributeid].length; i++) {
child_attributeid = attributeIdFromIndex(childattributes[attributeid][i]); 
finalarray[child_attributeid] = child_attributeid; 
finalarray = getChildrenAttributes(child_attributeid, recursive, finalarray, examinedarray);
}
}
}
return finalarray;
}
function hideChildrenAttributes(attributeid, attributestohide) {
var oktodisplay_scene7values = new Array(); 
if (attributestohide.length > 0) { 
for (examine_attributeid in attributestohide) {
if (!validateParentalDependency(examine_attributeid)) { 
if (attributedata[examine_attributeid].containertypeid > 0) {
sink = eval("containerRenderer_"+attributedata[examine_attributeid].containertypeid+"_AttributeOff("+examine_attributeid+")");
} else {
var c = getObj("attributecontent"+examine_attributeid);
if (c) {
c.innerHTML = "";
c.style.display = "none"; 
}
}
if (attributedata[examine_attributeid].attributetype == ATTRIBUTE_TYPE_CATEGORY) {
} else {
}
attributeids_displayed[examine_attributeid] = false;
setAsSelected(examine_attributeid, "");
attributedata[examine_attributeid].attributedefaultvalue = "";
attributeinconfig[examine_attributeid] = false;
} else {
if (!attributeinconfig[examine_attributeid]) {
oktodisplay_scene7values[attributedata[examine_attributeid].attributescene7code] = scene7default[examine_attributeid]; 
}
}
}
for (s7code in oktodisplay_scene7values) {
if (oktodisplay_scene7values[s7code] != scene7group[MODEL_ID][s7code]) {
}
}
} else {
}
}
function getAttributeValueLoopData(idx, attdata) {
var scene7valuecode = "";
var attributevaluefilename = "";
if (attdata.attributetype == ATTRIBUTE_TYPE_FIXED) {
var thisvalue = valuedata[valueids[attdata.attributeid][idx]]; 
var valueid = thisvalue.valueid; 
var valuename = thisvalue.name; 
var isdefault= thisvalue.isdefault;
var valueisdefault = false;
if (attdata.attributedefaultvalue == valueid || attdata.attributedefaultvalue == "" && isdefault)
valueisdefault = true;
scene7valuecode = thisvalue.scene7code; 
attributevaluefilename = thisvalue.filename;
}
return {
valueid:valueid,
valuename:valuename,
valueisdefault:valueisdefault,
scene7valuecode:scene7valuecode,
attributevaluefilename:attributevaluefilename
}
}
function generateOnClickCodeForAttributeValue(attributeid, valueid, attributescene7code, scene7valuecode, attributeformat) {
var content = '';
if (attributeformat == 2) { 
content += ' var useValue=this.options[this.selectedIndex].value;' +
' setAsSelected('+attributeid+',useValue);' + 
' toggleChild(useValue,'+attributeid+',false,false,\'userinvoked\');';
' trackAction({attributeid:'+attributeid+', valueid:useValue});' +
'';
content += ' buildScene7Blind_Configurator();'; 
} else {
if (attributeformat == 3) { 
content += ' if (!this.checked) {' + 
'setAsSelected('+attributeid+',0);' +
'   toggleChild(\''+valueid+'\','+attributeid+',false,false,\'userinvoked\');'+
'setScene7Property(\''+attributescene7code+'\',\'\');';
content += ' } else { ' + 
'   setAsSelected('+attributeid+',\''+valueid+'\');' +
'   toggleChild(\''+valueid+'\','+attributeid+',false,false,\'userinvoked\');'+
'   setScene7Property(\''+attributescene7code+'\',\''+scene7valuecode+'\');';
content +=  ' } ';
} else {
content += ' setAsSelected('+attributeid+',\''+valueid+'\');'
content += ' toggleChild(\''+valueid+'\','+attributeid+',false,false,\'userinvoked\');';
content += ' setScene7Property(\''+attributescene7code+'\',\''+scene7valuecode+'\');';
}
content += ' buildScene7Blind_Configurator();'; 
}
return content;
}
function setAttributeValueDefaults(adata, v) {
if (v.valueisdefault == 1) {
setAsSelected(adata.attributeid, v.valueid);
if (adata.attributescene7code != "") {
setScene7Property(adata.attributescene7code, v.scene7valuecode);
scene7default[adata.attributeid] = v.scene7valuecode; 
}
}
}
var isRoomOpen = false;
function toggleRoom() {
if (isRoomOpen) {
$("#room_settings_bar").attr("style", "config-wrap closed");
$("#roomarrow").attr("src", "/images/config_head_arrow_closed.gif");
} else {
$("#room_settings_bar").attr("style", "config-wrap");
$("#roomarrow").attr("src", "/images/config_head_arrow_open.gif");
}
$("#roomtitle").text((isRoomOpen ? 'show' : 'hide')+' room settings');
$("#room_tab").toggle();
isRoomOpen = !isRoomOpen;
}
function drawRoomOptions() {
var content = "", i;
var isThisSelected = false;
content += '<div class="config-wrap closed" id="room_settings_bar">'+
'<a href="#" onclick="toggleRoom();return false;" style="text-decoration: none;"><div class="head">'+
'<img src="/images/config_head_arrow_closed.gif" border="0" class="spinner" id="roomarrow" alt="open panel" />'+
'<h2 id="roomtitle">show room settings</h2>'+
'</div></a>'+
'<div class="content" id="room_tab" style="display:none;">';
content += "<div class=\"clearer\">&nbsp;</div>"+
"<div class=\"dotted_header\"><h4>choose a wall color</h4></div>"+
"<div class=\"wall_colors\">";
for (i=0; i<wallColorTable.length; i++)
content += '<a id="selectedWall' + wallColorTable[i][0] + '" href="Javascript:;" style="background: #' + wallColorTable[i][0] + ';" ' + (scene7group[MODEL_ID]["selectedWall"] == wallColorTable[i][0] ? 'class="selected"' : '') + ' onclick="setScene7Property(\'selectedWall\', \'' + wallColorTable[i][0] + '\');updateRoomTabSelection(\'selectedWall\',\''+wallColorTable[i][0]+'\');buildScene7Blind_Configurator();"></a>';
content += "<div class=\"clearer\">&nbsp;</div>"+
"</div>"+
"<div class=\"dotted_header\"><h4>choose a trim color</h4></div>"+
"<div class=\"trim_colors\">";
for (i=0; i<trimColorTable.length; i++)
content += '<a href="Javascript:;"><img id="selectedTrim'+trimColorTable[i][0]+'" src="' + getImageURLPrefix(i) + '/trim_swatches/trim_swatch_'+trimColorTable[i][0]+'.jpg" width="42" height="24" border="0" alt="#" ' + ((scene7group[MODEL_ID]["selectedTrim"]==trimColorTable[i][0]) || (scene7group["selectedTrim"]=="none" && i==0) ? 'class="selected"' : '') + ' onclick="setScene7Property(\'selectedTrim\', \'' + trimColorTable[i][0] + '\');updateRoomTabSelection(\'selectedTrim\',\''+trimColorTable[i][0]+'\');buildScene7Blind_Configurator();"/></a>';
content += "<div class=\"clearer\">&nbsp;</div>"+
"</div>";
if (SCENE_7_CAN_OPEN_CLOSE[MODEL_ID]) {
content +="<div class=\"dotted_header\"><h4>slat options</h4></div>"+
"<div>"+
"<p>slats open/closed: "+
"<select name=\"slat options\" onChange=\"setScene7Property('selectedRendering', this.options[this.selectedIndex].value);buildScene7Blind_Configurator();\">"+
"<option value=\"closed\"" + (scene7group[MODEL_ID]["selectedRendering"] == "closed" ? "selected=\"selected\"" : "") + ">closed</option>"+
"<option value=\"opened\"" + (scene7group[MODEL_ID]["selectedRendering"] == "opened" ? "selected=\"selected\"" : "") + ">opened</option>"+
"</select>"+
"</p>"+
"</div>";
}
content += '</div>';
content += '</div>';
return content;
}
function saveSwatchInfo(attributeid, categories) {
var i, j, p, q;
for (var j=0; j<categories.length; j++) {
var categoryswatchcount = 0;
var thiscategory = categories[j];
var categoryid = parseInt(getInnerText(_getElementsTextByTagName(thiscategory, "categoryid")));
var categoryname = getInnerText(_getElementsTextByTagName(thiscategory, "categoryname"));
var categorydirectoryname = getInnerText(_getElementsTextByTagName(thiscategory, "categorydirectoryname"));
var modelid = parseInt(getInnerText(_getElementsTextByTagName(thiscategory, "modelid")));
var categoryscene7code = "selectedColor";
aCategory[categoryid] = new typedef_category(categoryid, categoryname, categoryscene7code, -1, categorydirectoryname, modelid); 
if (collectionsincategory[categoryid] == null) collectionsincategory[categoryid] = new Array;
if (attributesforcategory[categoryid] == null) attributesforcategory[categoryid] = new Array;
var collections = _getElementsByTagName(thiscategory, "collection");
for (var k=0; k<collections.length; k++) {
var thiscollection = collections[k];
var collectionid = parseInt(getInnerText(_getElementsTextByTagName(thiscollection, "collectionid")));
var collectionname = getInnerText(_getElementsTextByTagName(thiscollection, "collectionname"));
var feature1 = getInnerText(_getElementsTextByTagName(thiscollection, "feature1"));
var feature2 = getInnerText(_getElementsTextByTagName(thiscollection, "feature2"));
if (aCollection[collectionid] == null) aCollection[collectionid] = new Array;
aCollection[collectionid] = new typedef_collection(collectionid, categoryid, collectionname.toLowerCase(), feature1, feature2);
collectionsincategory[categoryid][collectionsincategory[categoryid].length] = collectionid;
var swatches = _getElementsByTagName(thiscollection, "swatch");
for (var m=0; m<swatches.length; m++) {
var thisswatch = swatches[m];
var swatchid = parseInt(getInnerText(_getElementsTextByTagName(thisswatch, "swatchid")));
var swatchname = getInnerText(_getElementsTextByTagName(thisswatch, "swatchname"));
var oekey = getInnerText(_getElementsTextByTagName(thisswatch, "oekey"));
var isdefault = parseInt(getInnerText(_getElementsTextByTagName(thisswatch, "isdefault")));
var stockoutdate = getInnerText(_getElementsTextByTagName(thisswatch, "stockoutdate"));
var canorder = parseInt(getInnerText(_getElementsTextByTagName(thisswatch, "canorder")));
var incart = (isIC ? 0 : parseInt(getInnerText(_getElementsTextByTagName(thisswatch, "incart"))));
var inlist = (isIC ? 0 : parseInt(getInnerText(_getElementsTextByTagName(thisswatch, "inlist"))));
var paththumb = "";
var pathfull = "";
if (categorydirectoryname != "") {
var paththumb = getImageURLPrefix(m) + "/swatches/" + categorydirectoryname+"/thumbs/"+oekey+".jpg";
var pathfull = getImageURLPrefix(m) + "/swatches/" + categorydirectoryname+"/"+oekey+".jpg";
}
aSwatch[aSwatch.length] = new typedef_swatch(attributeid, swatchid, categoryid, collectionid, swatchname, paththumb, pathfull, 0, categoryscene7code, oekey, stockoutdate, canorder, incart, inlist);
aSwatchLookup[swatchid] = aSwatch.length-1; 
categoryswatchcount++;
if (isdefault == 1) {
selectedcollection[categoryid] = collectionid;
selectedswatch[categoryid] = new typedef_selectedswatch(categoryid, collectionid, swatchid, null);
if (activeswatchid == 0) {
setActiveSwatch(swatchid); 
}
}
} 
} 
aCategory[categoryid].swatchcount = categoryswatchcount;
} 
}
function setActiveSwatch(swatchid) {
activeswatchid = swatchid;
}
function renderSwatchesForCollection(categoryid, collectionid, returnhtml, showdisclaimer) {
var SWATCHES_PER_ROW = 5;
var content = "";
var rendercount=1,collectionsdrawn=0;
var o, i;
var alltab = (collectionid.toString().indexOf("taball") >= 0 ? true : false);
var curcollectionid = 0;
var disclaimerdisplayed = false;
aSwatchImg[categoryid] = new Array();
for (i=0; i<aSwatch.length; i++) {
if (aSwatch[i].categoryid == categoryid) {
if (aSwatch[i].collectionid == collectionid || alltab) {
if (aSwatch[i].collectionid != curcollectionid) {
if (curcollectionid > 0) {
content += '</div>'; 
content += '<div class="clearer">&nbsp;</div>'
}
content += "<div class=\"content\">";
if (showdisclaimer) {
content += '<div class="message_panel note-colors"><p>';
content += 'Due to variations in computer monitors, we cannot guarantee the accuracy of colors presented on-screen with actual products.';
if (CAN_ORDER_SWATCHES) {
content += ' Please order free swatches to ensure color accuracy.';
} else {
content += ' Please visit a <a href="/dealer-locator">local retailer</a> to view actual samples.';
} 
content += '</p></div>';
showdisclaimer = false;
}
curcollectionid = aSwatch[i].collectionid;
content += "<h3>"+MODEL_NAMES[aCategory[aCollection[curcollectionid].categoryid].modelid]+" ("+aCollection[curcollectionid].collectionname+")</h3>";
if (aCollection[curcollectionid].feature1 != "") {
content += "<ul><li>" + aCollection[curcollectionid].feature1 + "</li>";
if (aCollection[curcollectionid].feature2 != "") 
content += "<li>" + aCollection[curcollectionid].feature2 + "</li>";
content += "</ul>";
}
content += "</div>";
content += '<div class="swatch-area">'; 
if (rendercount==1 && collectionsdrawn==0 && !closed_balloon['first_swatch'] && H_BALLOONS['first_swatch'] && CAN_ORDER_SWATCHES) {
content += FIRST_SWATCH_BALLOON;
closed_balloon['first_swatch'] = 1; 
}
collectionsdrawn++;
}
if (USE_IMAGE_LOADER)
aSwatchImg[categoryid][aSwatchImg[categoryid].length] = new typedef_preloadImage(aSwatch[i].src, "swatchimage"+aSwatch[i].swatchid);
var swatchclass = "swatch-wrap";
var clickcontent = "";
var checkedtext = "";
clickcontent = "changeSwatch("+aSwatch[i].categoryid+","+aSwatch[i].collectionid+","+aSwatch[i].swatchid+",'"+aSwatch[i].scene7groupname+"','"+aSwatch[i].oekey+"',"+i+");";
if (selectedswatch[categoryid].swatchid == aSwatch[i].swatchid || aSwatch[i].swatchid == activeswatchid) {
checkedtext = ' checked="checked" ';
swatchclass = "swatch-wrap selected";
setScene7Property(aSwatch[i].scene7groupname, aSwatch[i].oekey);
updateSwatchHint(i);
if (selectedswatch[categoryid].swatchid == aSwatch[i].swatchid) {
MODEL_ID = aCategory[categoryid].modelid;
} else if (aSwatch[i].swatchid == activeswatchid) {
MODEL_ID = aCategory[aSwatch[i].categoryid].modelid;
}
activeswatchid = aSwatch[i].swatchid;
getQuote();
}
content += '<div class="swatch-space">'+
'<div class="'+swatchclass+'" id="swatchwrap'+aSwatch[i].swatchid+'">'+
'<div class="swatch-border" onclick="'+clickcontent+'">'+
'<a class="magnify" href="'+aSwatch[i].full+'" target="_blank">Magnify</a>'+
'<img src="'+(USE_IMAGE_LOADER?'':aSwatch[i].src)+'" id="swatchimage'+aSwatch[i].swatchid+'" alt="'+aSwatch[i].text+'" />'+
'<span class="number">'+aSwatch[i].oekey+'</span>'+
'</div>'+
'<p>'+aSwatch[i].text+'</p>';
if (CAN_ORDER_SWATCHES && aSwatch[i].canorder) {
content += '<a class="cart-btn'+(aSwatch[i].incart?' selected':'')+'" href="#" onclick="toggleInCart('+aSwatch[i].swatchid+',\'NORMAL\');return false;" id="add2cart'+aSwatch[i].swatchid+'">'+(aSwatch[i].incart?'remove from':'add to')+' cart</a> ';
}
content += '</div>'+
'</div>';
rendercount++;
}
}
}
if (content != '') {
content += '</div>'; 
content += '<div class="clearer">&nbsp;</div>'
}
if (USE_IMAGE_LOADER) 
imagePreloaderQueue[imagePreloaderQueue.length] = new typedef_ImagePreloaderQueueItem(aSwatchImg[categoryid]);
return content;
}
function closeballoon(suffix) {
$("#help_balloon_"+suffix).toggle();
closed_balloon[suffix] = true;
}
function neveragain(suffix) {
$.ajax({
url: '/request.php?method=updatehelpballoons', data:{key:suffix, value:0}, type:'POST', dataType:'xml', timeout:10000,
error: function(robj, etype, eobj) {
},
success: function(xml) {
closeballoon(suffix);
}
});
}
function updateSwatchHint(idx) {
$("#current_swatch").html(aSwatch[idx].text + ' - ' + aSwatch[idx].oekey);
}
function changeSwatch(categoryid, collectionid, swatchid, scene7groupname, oekey, swatchindex) {
var o,p;
p = getObj("swatchwrap"+swatchid);
if (p) {
if (swatchid != activeswatchid) { 
p.className = "swatch-wrap selected";
}
}
p = getObj("swatchwrap"+activeswatchid);
if (p) {
if (swatchid != activeswatchid) {
p.className = "swatch-wrap";
}
}
setActiveSwatch(swatchid); 
MODEL_ID = aCategory[categoryid].modelid;
selectedswatch[categoryid] = new typedef_selectedswatch(categoryid, collectionid, swatchid, null);
if (SCENE_7_FILENAME[MODEL_ID] != "") { 
scene7group[MODEL_ID][scene7groupname] = oekey;
}
buildScene7Blind_Configurator();
updateSwatchHint(swatchindex);
if (CAN_ORDER_SWATCHES) { 
getQuote();
}
}
function attributeIdFromIndex(xmlindex) {
var ret = -1;
if (attributeidbyxmlindex[xmlindex]) {
ret = attributeidbyxmlindex[xmlindex];
}
return ret;
}
function isAttributeValueSelected(attributeid, attributevalueid) {
var ret = false;
if (selectedvalueid[attributeid] == attributevalueid)
ret = true;
return ret;
}
function getAttributeImagePath() {
var url = getImageURLPrefix(attributeImagePathCtr++);
return url + "/attributes/";
}
function getImageURLPrefix(ctr) {
return PRODUCT_IMAGES_URL_ARRAY[( parseInt((ctr%2)+(ctr/2)) ) % PRODUCT_IMAGES_URL_ARRAY.length];
}
function getAttributeDescription(attributeid) {
var params = new Object;
params['mid'] = MODEL_ID;
params['aid'] = attributeid;
$.ajax({
url: '/request.php?method=getattributedescription', data:params, type:'POST', dataType:'xml', timeout:10000,
error: function(robj, etype, eobj) {
populateLearnMoreDiv(attributeid, "Timeout error retrieving help.  <a href=\"Javascript:;\" onclick=\"toggleLearnMoreDiv("+attributeid+",true)\">Click here to try again</a>.");
},
success: function(xml) {
populateLearnMoreDiv(attributeid, $('description',xml).text());
}
});
}
function repeatString(str, ct) {
var a = new Array(ct+1);
return a.join(str);
}
function clickValueOption(elementid) {
var o = getObj(elementid);
if (o) {
if (!o.checked) {
o.click();
}
}
}
