
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;
}
cellular.liftPositionTable = [
["none", ""],
["left", "lt_cord&show&color=255,255,255"],
["right", "rt_cord&show&color=255,255,255"]
];
cellular.productTable = [
["Kirsch Cellular Standard", "kstandard"],
["Kirsch Cellular Sheer", "ksheer"],
["Kirsch Cellular Doublecell", "kdoublecell"],
["Kirsch Cellular Blockout", "kblockout"],
["Levolor Cellular Standard", "lstandard"],
["Levolor Cellular Sheer", "lsheer"],
["Levolor Cellular Doublecell", "ldoublecell"],
["Levolor Cellular Blockout", "lblockout"]
];
cellular.productDetailTable = [
["kstandard","Kirsh","Standard/standard","Standard/TDBU","Standard","td/td_standard"],
["ksheer","Kirsh","Sheer/standard","Sheer/TDBU","Sheer","td/td_sheer"],
["kdoublecell","Kirsh","Double_Cell/standard","Double_Cell/TDBU","Double_Cell","td/td_doublecell"],
["kblockout","Kirsh","Block/standard","Block/TDBU","Block","td/td_block"],
["lstandard","Sand","Standard/standard","Standard/TDBU","Standard","td/td_standard"],
["lsheer","Sand","Sheer/standard","Sheer/TDBU","Sheer","td/td_sheer"],
["ldoublecell","Sand","Double_Cell/standard","Double_Cell/standard","Double_Cell","td/td_doublecell"],
["lblockout","Sand","Block/block","Block/TDBU","Block","td/td_block"]
];
cellular.controlOptionTable = [
["Standard", "Standard"],
["Cordless", "Cordless"],
["Motorized", "Cordless"],
["Cordless TDBU", "CordlessTDBU"],
["Continuous Cordloop", "CordlessCordloop"],
["Day/Night", "Day_Night"],
["TDBU", "TD-BU"],
["Top Down", "Top_Down"]
];
cellular.renderingTypeTable = [
["Day", "night"],
["Night", "day"]
];
cellular.colorTable = [
["10001199","218,215,222","0"],
["10001200","232,232,234","0"],
["10001201","212,212,212","0"],
["10001202","211,206,203","0"],
["10001203","213,209,206","0"],
["10001204","210,203,193","0"],
["10001205","240,240,240","0"],
["10001206","237,237,237","0"],
["10001207","240,238,235","0"],
["10001209","222,212,200","0"],
["10001211","241,238,229","0"],
["10001212","230,217,185","0"],
["10001216","178,153,134","0"],
["10001219","185,185,159","0"],
["10001223","236,234,237","0"],
["10001228","109,118,120","0"],
["10001234","135,129,157","0"],
["10001237","138,124,141","0"],
["10001239","227,225,230","0"],
["10001240","181,188,206","0"],
["10001243","164,104,106","0"],
["10001245","132,88,105","0"],
["10001247","231,227,218","0"],
["10001248","217,213,214","0"],
["10001249","115,80,71","0"],
["10001250","210,209,164","0"],
["10001251","198,85,103","0"],
["10001252","115,158,206","0"],
["10001255","224,223,233","0"],
["10001256","235,232,226","0"],
["10001257","120,93,87","0"],
["10001258","207,177,156","0"],
["10001259","165,79,77","0"],
["10001260","136,83,95","0"],
["10001261","78,82,113","0"],
["10001262","138,132,128","0"],
["10001263","221,222,228","0"],
["10001264","228,228,230","0"],
["10001265","208,208,210","0"],
["10001266","205,200,196","0"],
["10001267","212,208,207","0"],
["10001268","200,197,188","0"],
["10001269","236,236,234","0"],
["10001270","238,238,238","0"],
["10001271","238,235,230","0"],
["10001272","230,225,219","0"],
["10001273","218,207,196","0"],
["10001274","168,146,127","0"],
["10001275","228,226,223","0"],
["10001276","250,248,250","0"],
["10001277","234,230,238","0"],
["10001278","240,238,225","0"],
["10001279","228,212,186","0"],
["10001280","184,189,208","0"],
["10001281","180,182,158","0"],
["10001282","110,119,118","0"],
["10001283","120,126,153","0"],
["10001284","159,98,103","0"],
["10001285","195,151,160","0"],
["10001286","143,128,147","0"],
["10001287","223,222,227","0"],
["10001288","209,207,208","0"],
["10001289","208,205,200","0"],
["10001290","206,202,192","0"],
["10001291","238,237,232","0"],
["10001292","232,226,217","0"],
["10001293","215,209,211","0"],
["10001294","224,223,229","0"],
["10001295","242,240,228","0"],
["10001296","185,187,163","0"],
["10001297","127,131,158","0"],
["10001298","137,93,108","0"],
["10001299","10001299","0"],
["10001300","10001300","0"],
["10001301","10001301","0"],
["10001302","10001302","0"],
["10001303","10001303","0"],
["10001304","10001304","0"],
["10001305","10001305","0"],
["10001306","10001306","0"],
["10001307","10001307","0"],
["10001308","10001308","0"],
["10001309","227,227,229","0"],
["10001310","229,225,224","0"],
["10001311","236,226,216","0"],
["10001312","201,169,148","0"],
["10001313","237,222,199","0"],
["10001314","243,241,242","0"],
["10001315","93,100,93","0"],
["10001316","78,127,124","0"],
["10001317","241,232,163","0"],
["10001318","240,202,153","0"],
["10001319","212,81,99","0"],
["10001320","123,115,113","0"],
["10001321","136,141,171","0"],
["10001322","141,100,78","0"],
["10001323","229,230,235","0"],
["10001324","239,239,241","0"],
["10001325","226,226,228","0"],
["10001326","211,207,204","0"],
["10001327","221,220,218","0"],
["10001328","225,222,217","0"],
["10001329","241,240,238","0"],
["10001330","241,239,240","0"],
["10001331","237,232,226","0"],
["10001332","240,237,228","0"],
["10001333","231,223,212","0"],
["10001334","193,161,150","0"],
["10001335","230,227,210","0"],
["10001336","238,223,200","0"],
["10001337","196,205,178","0"],
["10001338","64,122,123","0"],
["10001339","230,228,231","0"],
["10001340","242,240,243","0"],
["10001341","219,114,119","0"],
["10001342","163,80,106","0"],
["10001343","146,124,162","0"],
["10001344","219,220,222","0"],
["10001345","198,208,217","0"],
["10001346","145,171,208","0"],
["10001347","230,229,235","0"],
["10001348","231,225,225","0"],
["10001349","233,231,232","0"],
["10001350","215,211,200","0"],
["10001351","224,222,209","0"],
["10001352","219,209,200","0"],
["10001353","139,145,117","0"],
["10001354","99,89,90","0"],
["10100100","218,217,223","0"],
["10100101","215,215,217","0"],
["10100102","212,212,212","0"],
["10100103","212,207,203","0"],
["10100104","218,216,217","0"],
["10100105","203,199,192","0"],
["10100106","236,235,231","0"],
["10100107","237,237,235","0"],
["10100108","238,235,230","0"],
["10100110","216,207,198","0"],
["10100112","241,239,226","0"],
["10100113","226,213,178","0"],
["10100117","168,151,133","0"],
["10100120","187,190,163","0"],
["10100124","243,241,244","0"],
["10100129","103,117,118","0"],
["10100135","128,132,167","0"],
["10100138","142,130,144","0"],
["10100140","227,226,231","0"],
["10100141","177,182,201","0"],
["10100144","165,105,113","0"],
["10100146","130,88,100","0"],
["10100148","219,215,216","0"],
["10100149","228,224,215","0"],
["10100150","244,235,183","0"],
["10100151","241,200,145","0"],
["10100152","198,86,103","0"],
["10100153","122,121,124","0"],
["10100154","136,141,171","0"],
["10100155","125,87,67","0"],
["60070500","10001287","1"],
["60070502","10001288","1"],
["60070504","10001289","1"],
["60070505","10001290","1"],
["60070508","10001291","1"],
["60070510","10001311","1"],
["60070513","10001313","1"],
["60070517","10001312","1"],
["60070520","10001296","1"],
["60070529","10001316","1"],
["60070532","70532","1"],
["60070535","10001297","1"],
["60070540","10001294","1"],
["60070543","70543","1"],
["60070546","10001298","1"],
["60070547","10001315","1"],
["60070548","10001293","1"],
["60070549","10001292","1"],
["60070600","60070600","0"],
["60070602","60070602","0"],
["60070603","60070603","0"],
["60070604","60070604","0"],
["60070605","60070605","0"],
["60070608","60070608","0"],
["60070610","60070610","0"],
["60070613","60070613","0"],
["60070620","60070620","0"],
["60070635","60070635","0"],
["60070646","60070646","0"],
["60070649","60070649","0"],
["60270700","60270700","0"],
["60270703","60270703","0"],
["60270705","60270705","0"],
["60270708","60270708","0"],
["60270712","60270712","0"],
["60270717","60270717","0"],
["60270720","60270720","0"],
["60270724","60270724","0"],
["60270740","60270740","0"],
["60270747","60270747","0"],
["60270748","60270748","0"],
["60270749","60270749","0"],
["60370700","10001347","1"],
["60370703","10001349","1"],
["60370705","10001350","1"],
["60370708","10001352","1"],
["60370712","70712","1"],
["60370717","70717","1"],
["60370720","10001353","1"],
["60370724","70724","1"],
["60370740","60370740","0"],
["60370747","10001354","1"],
["60370748","10001348","1"],
["60370749","10001351","1"],
["61070500","61070500","0"],
["61070502","61070502","0"],
["61070504","61070504","0"],
["61070505","61070505","0"],
["61070508","61070508","0"],
["61070510","61070510","0"],
["61070513","61070513","0"],
["61070517","61070517","0"],
["61070520","61070520","0"],
["61070529","61070529","0"],
["61070532","61070532","0"],
["61070535","61070535","0"],
["61070540","61070540","0"],
["61070543","61070543","0"],
["61070546","61070546","0"],
["61070547","61070547","0"],
["61070548","61070548","0"],
["61070549","61070549","0"],
["62070300","10001255","1"],
["62070303","62070303","0"],
["62070310","62070310","0"],
["62070313","10001258","1"],
["62070317","10001257","1"],
["62070320","10001262","1"],
["62070325","70325","1"],
["62070335","10001261","1"],
["62070339","70339","1"],
["62070344","10001259","1"],
["62070346","10001260","1"],
["62070349","10001256","1"],
["63070100","10100100","1"],
["63070101","10100101","1"],
["63070102","10100102","1"],
["63070103","10100103","1"],
["63070104","10100104","1"],
["63070105","10100105","1"],
["63070106","10100106","1"],
["63070107","10100107","1"],
["63070108","10100108","1"],
["63070110","10100110","1"],
["63070113","10100113","1"],
["63070114","63070114","0"],
["63070115","10100151","1"],
["63070117","10100117","1"],
["63070120","10100120","1"],
["63070122","63070122","0"],
["63070124","10100124","1"],
["63070125","63070125","0"],
["63070126","63070126","0"],
["63070127","63070127","0"],
["63070129","10100129","1"],
["63070130","63070130","0"],
["63070132","63070132","0"],
["63070134","63070134","0"],
["63070135","10100135","1"],
["63070136","63070136","0"],
["63070138","10100138","1"],
["63070139","63070139","0"],
["63070140","10100140","1"],
["63070142","63070142","0"],
["63070143","63070143","0"],
["63070144","10100144","1"],
["63070146","10100146","1"],
["63070147","10100153","1"],
["63070148","63070148","0"],
["63070149","63070149","0"],
["63070280","63070280","0"],
["63070281","63070281","0"],
["63070282","63070282","0"],
["63070283","63070283","0"],
["63070284","63070284","0"],
["63070285","63070285","0"],
["64070199","10001199","1"],
["64070200","10001200","1"],
["64070201","10001201","1"],
["64070202","10001202","1"],
["64070207","10001207","1"],
["64070211","10001211","1"],
["64070219","10001219","1"],
["64070239","10001239","1"],
["64070243","10001243","1"],
["64070245","10001245","1"],
["64070247","10001247","1"],
["64070270","70270","1"],
["65070100","10001263","1"],
["65070101","10001264","1"],
["65070102","10001265","1"],
["65070103","10001266","1"],
["65070104","10001267","1"],
["65070105","10001268","1"],
["65070106","10001269","1"],
["65070107","10001270","1"],
["65070108","10001271","1"],
["65070110","10001273","1"],
["65070111","70111","1"],
["65070112","10001278","1"],
["65070113","10001279","1"],
["65070114","70114","1"],
["65070115","10001318","1"],
["65070116","70116","1"],
["65070117","10001274","1"],
["65070118","70118","1"],
["65070120","10001281","1"],
["65070121","70121","1"],
["65070122","70122","1"],
["65070124","10001276","1"],
["65070125","70125","1"],
["65070126","70126","1"],
["65070127","70127","1"],
["65070129","10001282","1"],
["65070130","70130","1"],
["65070131","70131","1"],
["65070132","70132","1"],
["65070134","70134","1"],
["65070135","10001283","1"],
["65070136","70136","1"],
["65070137","65070137","0"],
["65070138","10001286","1"],
["65070139","70139","1"],
["65070140","10001277","1"],
["65070141","10001280","1"],
["65070142","70142","1"],
["65070143","70143","1"],
["65070144","10001284","1"],
["65070145","10001319","1"],
["65070146","10001285","1"],
["65070147","10001320","1"],
["65070148","10001275","1"],
["65070149","10001272","1"],
["65070150","10001321","1"],
["65070152","10001322","1"],
["65070153","10001317","1"],
["65070300","10001323","1"],
["65070302","10001325","1"],
["65070303","10001326","1"],
["65070304","10001327","1"],
["65070305","10001328","1"],
["65070308","10001332","1"],
["65070310","10001333","1"],
["65070313","10001336","1"],
["65070320","10001337","1"],
["65070335","10001346","1"],
["65070346","10001342","1"],
["65070349","10001331","1"],
["66070100","66070100","0"],
["66070101","66070101","0"],
["66070102","66070102","0"],
["66070103","66070103","0"],
["66070104","66070104","0"],
["66070105","66070105","0"],
["66070106","66070106","0"],
["66070107","66070107","0"],
["66070108","66070108","0"],
["66070110","66070110","0"],
["66070112","66070112","0"],
["66070113","66070113","0"],
["66070117","66070117","0"],
["66070120","66070120","0"],
["66070124","66070124","0"],
["66070129","66070129","0"],
["66070135","66070135","0"],
["66070138","66070138","0"],
["66070140","66070140","0"],
["66070141","10100141","1"],
["66070144","66070144","0"],
["66070146","66070146","0"],
["66070148","10100148","1"],
["66070149","10100149","1"],
["67070100","67070100","0"],
["67070101","67070101","0"],
["67070102","67070102","0"],
["67070103","67070103","0"],
["67070104","67070104","0"],
["67070105","67070105","0"],
["67070106","67070106","0"],
["67070107","67070107","0"],
["67070108","67070108","0"],
["67070110","67070110","0"],
["67070112","67070112","0"],
["67070113","67070113","0"],
["67070115","67070115","0"],
["67070117","67070117","0"],
["67070120","67070120","0"],
["67070124","67070124","0"],
["67070129","67070129","0"],
["67070135","67070135","0"],
["67070138","67070138","0"],
["67070140","67070140","0"],
["67070141","67070141","0"],
["67070144","67070144","0"],
["67070145","10100152","1"],
["67070146","67070146","0"],
["67070147","67070147","0"],
["67070148","67070148","0"],
["67070149","67070149","0"],
["67070150","10100154","1"],
["67070152","10100155","1"],
["67070153","10100150","1"],
["68070401","70401","1"],
["68070405","70405","1"],
["68070413","70413","1"],
["68070417","10001308","1"],
["68070420","10001307","1"],
["68070429","68070429","0"],
["68070434","70434","1"],
["68070444","10001305","1"],
["68070446","10001306","1"],
["68070449","10001304","1"],
["68170401","68170401","0"],
["68170405","68170405","0"],
["68170413","68170413","0"],
["68170417","68170417","0"],
["68170420","68170420","0"],
["68170429","68170429","0"],
["68170434","68170434","0"],
["68170444","68170444","0"],
["68170446","68170446","0"],
["68170449","68170449","0"],
["69070402","70402","1"],
["69070403","70403","1"],
["69070406","70406","1"],
["69070407","70407","1"],
["69070409","70409","1"],
["69070410","70410","1"],
["69070411","69070411","0"],
["69070412","69070412","0"],
["69170402","69170402","0"],
["69170403","69170403","0"],
["69170406","69170406","0"],
["69170407","69170407","0"],
["69170409","69170409","0"],
["69170410","69170410","0"],
["69170411","69170411","0"],
["69170412","69170412","0"],
["70100","10001263","1"],
["70101","10001264","1"],
["70102","10001265","1"],
["70103","10001266","1"],
["70104","10001267","1"],
["70105","10001268","1"],
["70106","10001269","1"],
["70107","10001270","1"],
["70108","10001271","1"],
["70110","10001273","1"],
["70111","70111","0"],
["70112","10001278","1"],
["70113","10001279","1"],
["70114","70114","0"],
["70115","10001318","1"],
["70116","70116","0"],
["70117","10001274","1"],
["70118","70118","0"],
["70120","10001281","1"],
["70121","70121","0"],
["70122","70122","0"],
["70124","10001276","1"],
["70125","70125","0"],
["70126","70126","0"],
["70127","70127","1"],
["70129","10001282","1"],
["70130","70130","0"],
["70131","70131","0"],
["70132","70132","1"],
["70134","70134","0"],
["70135","10001283","1"],
["70136","70136","0"],
["70139","70139","1"],
["70140","10001277","1"],
["70142","70142","1"],
["70143","70143","1"],
["70144","10001284","1"],
["70145","10001319","1"],
["70146","10001285","1"],
["70147","10001320","1"],
["70148","10001275","1"],
["70149","10001272","1"],
["70150","10001321","1"],
["70152","10001322","1"],
["70199","10001199","1"],
["70200","10001200","1"],
["70201","10001201","1"],
["70202","10001202","1"],
["70203","10001203","1"],
["70204","10001204","1"],
["70205","10001205","1"],
["70206","10001206","1"],
["70207","10001207","1"],
["70209","10001209","1"],
["70212","10001212","1"],
["70216","10001216","1"],
["70219","10001219","1"],
["70228","10001228","1"],
["70234","10001234","1"],
["70237","10001237","1"],
["70239","10001239","1"],
["70240","10001240","1"],
["70243","10001243","1"],
["70245","10001245","1"],
["70247","10001247","1"],
["70270","70270","0"],
["70272","70272","0"],
["70300","10001323","1"],
["70303","10001326","1"],
["70310","10001333","1"],
["70313","10001336","1"],
["70317","10001257","1"],
["70320","10001337","1"],
["70325","70325","0"],
["70335","10001346","1"],
["70339","70339","0"],
["70344","10001259","1"],
["70346","10001342","1"],
["70349","10001331","1"],
["70401","70401","0"],
["70402","70402","0"],
["70403","70403","0"],
["70405","70405","0"],
["70406","70406","0"],
["70407","70407","0"],
["70409","70409","0"],
["70410","70410","0"],
["70413","70413","0"],
["70417","10001308","1"],
["70420","10001307","1"],
["70434","70434","0"],
["70444","10001305","1"],
["70446","10001306","1"],
["70449","10001304","1"],
["70500","10001287","1"],
["70501","10001295","1"],
["70502","10001288","1"],
["70503","10001299","1"],
["70504","10001289","1"],
["70505","10001290","1"],
["70508","10001291","1"],
["70510","10001311","1"],
["70512","10001300","1"],
["70513","10001313","1"],
["70517","10001312","1"],
["70520","10001296","1"],
["70529","10001316","1"],
["70532","70532","0"],
["70535","10001297","1"],
["70540","10001294","1"],
["70543","70543","0"],
["70546","10001298","1"],
["70547","10001315","1"],
["70548","10001293","1"],
["70549","10001292","1"],
["70700","10001347","1"],
["70703","10001349","1"],
["70705","10001350","1"],
["70708","10001352","1"],
["70712","70712","0"],
["70717","70717","0"],
["70720","10001353","1"],
["70724","70724","0"],
["70747","10001354","1"],
["70748","10001348","1"],
["70749","10001351","1"]
];
function cellular(width, height, selectedColor, selectedColor2, selectedRenderingType, selectedControlOption, selectedControlLiftPosition, selectedWall, selectedTrim,selectedProduct) {
selectedProduct = lookupTableValue(cellular.productTable, selectedProduct, 1);
var url = "";
if (selectedControlOption == "Standard")
url = cellularStandard(width, height, selectedColor, selectedControlLiftPosition, selectedWall, selectedTrim, selectedProduct);
else if (selectedControlOption == "TDBU")
url = cellularTDBU(width, height, selectedColor, selectedControlLiftPosition, selectedWall, selectedTrim, selectedProduct);
else if (selectedControlOption == "Cordless TDBU")
url = cellularTDBU(width, height, selectedColor, "cordless", selectedWall, selectedTrim, selectedProduct);
else if (selectedControlOption == "Continuous Cordloop")
url = cellularCordloop(width, height, selectedColor, selectedControlLiftPosition, selectedWall, selectedTrim, selectedProduct);
else if (selectedControlOption == "Cordless" || selectedControlOption == "Motorized")
url = cellularCordless(width, height, selectedColor, selectedWall, selectedTrim, selectedProduct);
else if (selectedControlOption == "Day/Night")
url = cellularDayNight(width, height, selectedColor, selectedColor2, selectedRenderingType, selectedControlLiftPosition, selectedWall, selectedTrim, selectedProduct);
else if (selectedControlOption == "Top Down")
url = cellularTopDown(width, height, selectedColor, selectedControlLiftPosition, selectedWall, selectedTrim, selectedProduct);
url += "&qlt=95&sharpen=1";
return url;
}
function cellularStandard(width, height, selectedColor, selectedControlLiftPosition, selectedWall, selectedTrim, selectedProduct) {
var url = baseUrl;
var productId = lookupTableValue(cellular.productDetailTable, selectedProduct, 1) + "/";
url += "Cellular_2007-400?"
url += "wid=" + width;
url += "&hei=" + height;
url += "&obj=" + productId + lookupTableValue(cellular.productDetailTable, selectedProduct,2);
if(lookupTableValue(cellular.colorTable, selectedColor,2) == "0") {
var the_color = lookupTableValue(cellular.colorTable, selectedColor,1);
if (the_color.indexOf(',') == -1)
url += "&show&src=" + lookupTableValue(cellular.colorTable, selectedColor,1);
else
url += "&show&color=" + lookupTableValue(cellular.colorTable, selectedColor,1);
} else {
var redirect_color = lookupTableValue(cellular.colorTable, selectedColor,1);
var the_color = lookupTableValue(cellular.colorTable, redirect_color,1);
if (the_color.indexOf(',') == -1)
url += "&show&src=" + the_color;
else
url += "&show&color=" + the_color;
}
if (selectedControlLiftPosition != "none")
url += "&obj=" + productId + lookupTableValue(cellular.liftPositionTable, selectedControlLiftPosition,1);
url += "&obj=wall&show&color=" + lookupTableValue(wallColorTable, selectedWall,1);
url += "&obj=trim&show&src=" + lookupTableValue(trimColorTable, selectedTrim,1);
return url;
}
function cellularCordless(width, height, selectedColor, selectedWall, selectedTrim,selectedProduct) {
var url = baseUrl;
var productId = lookupTableValue(cellular.productDetailTable, selectedProduct, 1) + "/";
url += "Cellular_2007-400?"
url += "wid=" + width;
url += "&hei=" + height;
url += "&obj=" + productId + lookupTableValue(cellular.productDetailTable, selectedProduct,2);
if(lookupTableValue(cellular.colorTable, selectedColor,2) == "0") {
var the_color = lookupTableValue(cellular.colorTable, selectedColor,1);
if (the_color.indexOf(',') == -1)
url += "&show&src=" + lookupTableValue(cellular.colorTable, selectedColor,1);
else
url += "&show&color=" + lookupTableValue(cellular.colorTable, selectedColor,1);
} else {
var redirect_color = lookupTableValue(cellular.colorTable, selectedColor,1);
var the_color = lookupTableValue(cellular.colorTable, redirect_color,1);
if (the_color.indexOf(',') == -1)
url += "&show&src=" + the_color;
else
url += "&show&color=" + the_color;
}
url += "&obj=wall&show&color=" + lookupTableValue(wallColorTable, selectedWall,1);
url += "&obj=trim&show&src=" + lookupTableValue(trimColorTable, selectedTrim,1);
return url;
}
function cellularTDBU(width, height, selectedColor, selectedControlLiftPosition, selectedWall, selectedTrim,selectedProduct) {
var url = baseUrl;
var productId = lookupTableValue(cellular.productDetailTable, selectedProduct, 1) + "/";
url += "Cellular_2007-400?"
url += "wid=" + width;
url += "&hei=" + height;
url += "&obj=" + productId + lookupTableValue(cellular.productDetailTable, selectedProduct,3);
if(lookupTableValue(cellular.colorTable, selectedColor,2) == "0") {
var the_color = lookupTableValue(cellular.colorTable, selectedColor,1);
if (the_color.indexOf(',') == -1)
url += "&show&src=" + lookupTableValue(cellular.colorTable, selectedColor,1);
else
url += "&show&color=" + lookupTableValue(cellular.colorTable, selectedColor,1);
} else {
var redirect_color = lookupTableValue(cellular.colorTable, selectedColor,1);
var the_color = lookupTableValue(cellular.colorTable, redirect_color,1);
if (the_color.indexOf(',') == -1)
url += "&show&src=" + the_color;
else
url += "&show&color=" + the_color;
}
if (selectedControlLiftPosition != "cordless") {
url += "&obj=" + productId + "lt_cord";
if(lookupTableValue(cellular.colorTable, selectedColor,2) == "0") {
var the_color = lookupTableValue(cellular.colorTable, selectedColor,1);
if (the_color.indexOf(',') == -1)
url += "&show&src=" + lookupTableValue(cellular.colorTable, selectedColor,1);
else
url += "&show&color=" + lookupTableValue(cellular.colorTable, selectedColor,1);
} else {
var redirect_color = lookupTableValue(cellular.colorTable, selectedColor,1);
var the_color = lookupTableValue(cellular.colorTable, redirect_color,1);
if (the_color.indexOf(',') == -1)
url += "&show&src=" + the_color;
else
url += "&show&color=" + the_color;
}
url += "&obj=" + productId + "rt_cord";
if(lookupTableValue(cellular.colorTable, selectedColor,2) == "0") {
var the_color = lookupTableValue(cellular.colorTable, selectedColor,1);
if (the_color.indexOf(',') == -1)
url += "&show&src=" + lookupTableValue(cellular.colorTable, selectedColor,1);
else
url += "&show&color=" + lookupTableValue(cellular.colorTable, selectedColor,1);
} else {
var redirect_color = lookupTableValue(cellular.colorTable, selectedColor,1);
var the_color = lookupTableValue(cellular.colorTable, redirect_color,1);
if (the_color.indexOf(',') == -1)
url += "&show&src=" + the_color;
else
url += "&show&color=" + the_color;
}
}
url += "&obj=wall&show&color=" + lookupTableValue(wallColorTable, selectedWall,1);
url += "&obj=trim&show&src=" + lookupTableValue(trimColorTable, selectedTrim,1);
return url;
}
function cellularDayNight(width, height, selectedColor, selectedColor2, selectedRenderingType, selectedControlLiftPosition, selectedWall, selectedTrim,selectedProduct) {
var url = baseUrl;
var productId = lookupTableValue(cellular.productDetailTable, selectedProduct, 1) + "/";
url += "Cellular_2007-400?"
url += "wid=" + width;
url += "&hei=" + height;
selectedType = lookupTableValue(cellular.renderingTypeTable, selectedRenderingType,1)
if (selectedColor2 == "" || selectedColor2 == "none") {
selectedColor2 = "10001351";
}
if (selectedRenderingType == "Day") {
url += "&obj=" + productId + lookupTableValue(cellular.productDetailTable, selectedProduct, 4) + "/" + selectedType + "/" + selectedType;
if(lookupTableValue(cellular.colorTable, selectedColor,2) == "0") {
var the_color = lookupTableValue(cellular.colorTable, selectedColor,1);
if (the_color.indexOf(',') == -1)
url += "&show&src=" + lookupTableValue(cellular.colorTable, selectedColor,1);
else
url += "&show&color=" + lookupTableValue(cellular.colorTable, selectedColor,1);
} else {
var redirect_color = lookupTableValue(cellular.colorTable, selectedColor,1);
var the_color = lookupTableValue(cellular.colorTable, redirect_color,1);
if (the_color.indexOf(',') == -1)
url += "&show&src=" + the_color;
else
url += "&show&color=" + the_color;
}
url += "&obj=" + productId + lookupTableValue(cellular.productDetailTable, selectedProduct, 4) + "/" + selectedType + "/" + selectedType + "2";
if(lookupTableValue(cellular.colorTable, selectedColor2,2) == "0") {
var the_color2 = lookupTableValue(cellular.colorTable, selectedColor2,1);
if (the_color.indexOf(',') == -1)
url += "&show&src=" + lookupTableValue(cellular.colorTable, selectedColor2,1);
else
url += "&show&color=" + lookupTableValue(cellular.colorTable, selectedColor2,1);
} else {
var redirect_color2 = lookupTableValue(cellular.colorTable, selectedColor2,1);
var the_color2 = lookupTableValue(cellular.colorTable, redirect_color2,1);
if (the_color.indexOf(',') == -1)
url += "&show&src=" + the_color2;
else
url += "&show&color=" + the_color2;
}
} else {
url += "&obj=" + productId + lookupTableValue(cellular.productDetailTable, selectedProduct, 4) + "/" + selectedType + "/" + selectedType  + "2";
if(lookupTableValue(cellular.colorTable, selectedColor,2) == "0") {
var the_color = lookupTableValue(cellular.colorTable, selectedColor,1);
if (the_color.indexOf(',') == -1)
url += "&show&src=" + lookupTableValue(cellular.colorTable, selectedColor,1);
else
url += "&show&color=" + lookupTableValue(cellular.colorTable, selectedColor,1);
} else {
var redirect_color = lookupTableValue(cellular.colorTable, selectedColor,1);
var the_color = lookupTableValue(cellular.colorTable, redirect_color,1);
if (the_color.indexOf(',') == -1)
url += "&show&src=" + the_color;
else
url += "&show&color=" + the_color;
}
url += "&obj=" + productId + lookupTableValue(cellular.productDetailTable, selectedProduct, 4) + "/" + selectedType + "/" + selectedType;
if(lookupTableValue(cellular.colorTable, selectedColor2,2) == "0") {
var the_color2 = lookupTableValue(cellular.colorTable, selectedColor2,1);
if (the_color.indexOf(',') == -1)
url += "&show&src=" + lookupTableValue(cellular.colorTable, selectedColor2,1);
else
url += "&show&color=" + lookupTableValue(cellular.colorTable, selectedColor2,1);
} else {
var redirect_color2 = lookupTableValue(cellular.colorTable, selectedColor2,1);
var the_color2 = lookupTableValue(cellular.colorTable, redirect_color2,1);
if (the_color.indexOf(',') == -1)
url += "&show&src=" + the_color2;
else
url += "&show&color=" + the_color2;
}
}
url += "&obj=" + productId + "lt_cord&show&color=255,255,255";
url += "&obj=" + productId + "rt_cord&show&color=255,255,255";
url += "&obj=wall&show&color=" + lookupTableValue(wallColorTable, selectedWall,1);
url += "&obj=trim&show&src=" + lookupTableValue(trimColorTable, selectedTrim,1);
return url;
}
function cellularCordloop(width, height, selectedColor, selectedControlLiftPosition, selectedWall, selectedTrim, selectedProduct) {
var url = baseUrl;
var productId = lookupTableValue(cellular.productDetailTable, selectedProduct, 1) + "/";
url += "Cellular_2007-400?"
url += "wid=" + width;
url += "&hei=" + height;
url += "&obj=" + productId + lookupTableValue(cellular.productDetailTable, selectedProduct,2);
if(lookupTableValue(cellular.colorTable, selectedColor,2) == "0") {
var the_color = lookupTableValue(cellular.colorTable, selectedColor,1);
if (the_color.indexOf(',') == -1)
url += "&show&src=" + lookupTableValue(cellular.colorTable, selectedColor,1);
else
url += "&show&color=" + lookupTableValue(cellular.colorTable, selectedColor,1);
} else {
var redirect_color = lookupTableValue(cellular.colorTable, selectedColor,1);
var the_color = lookupTableValue(cellular.colorTable, redirect_color,1);
if (the_color.indexOf(',') == -1)
url += "&show&src=" + the_color;
else
url += "&show&color=" + the_color;
}
if (selectedControlLiftPosition != "none" && selectedControlLiftPosition == "left")
url += "&obj=cordloop/lt_cordloop&show&color=255,255,255";
if (selectedControlLiftPosition != "none" && selectedControlLiftPosition == "right")
url += "&obj=cordloop/rt_cordloop&show&color=255,255,255";
url += "&obj=wall&show&color=" + lookupTableValue(wallColorTable, selectedWall,1);
url += "&obj=trim&show&src=" + lookupTableValue(trimColorTable, selectedTrim,1);
return url;
}
function cellularTopDown(width, height, selectedColor, selectedControlLiftPosition, selectedWall, selectedTrim, selectedProduct) {
var url = baseUrl;
url += "Cellular_2007-400?"
url += "wid=" + width;
url += "&hei=" + height;
url += "&obj=" + lookupTableValue(cellular.productDetailTable, selectedProduct,5);
if(lookupTableValue(cellular.colorTable, selectedColor,2) == "0") {
var the_color = lookupTableValue(cellular.colorTable, selectedColor,1);
if (the_color.indexOf(',') == -1)
url += "&show&src=" + lookupTableValue(cellular.colorTable, selectedColor,1);
else
url += "&show&color=" + lookupTableValue(cellular.colorTable, selectedColor,1);
} else {
var redirect_color = lookupTableValue(cellular.colorTable, selectedColor,1);
var the_color = lookupTableValue(cellular.colorTable, redirect_color,1);
if (the_color.indexOf(',') == -1)
url += "&show&src=" + the_color;
else
url += "&show&color=" + the_color;
}
if (selectedControlLiftPosition != "none")
url += "&obj=td/" + lookupTableValue(cellular.liftPositionTable, selectedControlLiftPosition,1);
url += "&obj=wall&show&color=" + lookupTableValue(wallColorTable, selectedWall,1);
url += "&obj=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();
}
}
}
     