

ImageStruct = new Object();
ImageStruct["default"] = "\r\n\t\t\t<div id=\"picture\">\r\n\t\t\t\t<div id=\"mainImageOutline\" style=\"width: 250px; height: 0px;\" onclick=\"javascript:window.open(\'/_largeimage.cfm?image=PSROSE NAVYKFT.jpg\',\'popup\',\'width=600,height=600, scrollbars=yes\');\">\r\n\t\t\t\t\t<a href=\"javascript:void(0);\">\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<img id=\"mainImage\" src=\"/images/product//images/large_PSROSE NAVYKFT.jpg\" class=\"imgBorder\" alt=\"Tints on Kraft\" />\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t</a>\r\n\t\t\t\t\t<br />\r\n\t\t\t\t\t<a href=\"javascript:void(0);\"><img id=\"mainImage\" src=\"/images/retail/zoom.gif\" alt=\"Zoom\" /></a>\r\n\t\t\t\t</div>\r\n\t\t\t\t\r\n\t\t\t</div>\t\t\r\n\t\t\t<div id=\"previews\" style=\"padding-top:270px;\">\r\n\t\t\t\r\n\t\t\t</div>\r\n\t\t\t";


fldValueStruct = new Object();
fldValueStruct["fld1array"] =  new Array();
fldValueStruct["fld1array"][0] = new Object();
fldValueStruct["fld1array"][0]["value"] = 1262;
fldValueStruct["fld1array"][0]["text"] = "5.25 X 3.50 X 8.25";
fldValueStruct["fld1array"][1] = new Object();
fldValueStruct["fld1array"][1]["value"] = 1259;
fldValueStruct["fld1array"][1]["text"] = "8.00 X 4.75 X 10.38";
fldValueStruct["fld1array"][2] = new Object();
fldValueStruct["fld1array"][2]["value"] = 1048;
fldValueStruct["fld1array"][2]["text"] = "10.00 X 5.00 X 13.00";
fldValueStruct["fld1array"][3] = new Object();
fldValueStruct["fld1array"][3]["value"] = 1235;
fldValueStruct["fld1array"][3]["text"] = "13.00 X 6.00 X 15.50";
fldValueStruct["fld1array"][4] = new Object();
fldValueStruct["fld1array"][4]["value"] = 1251;
fldValueStruct["fld1array"][4]["text"] = "14.00 X 9.50 X 16.00";
fldValueStruct["fld1array"][5] = new Object();
fldValueStruct["fld1array"][5]["value"] = 1243;
fldValueStruct["fld1array"][5]["text"] = "16.00 X 6.00 X 19.00";
fldValueStruct["fld1array"][6] = new Object();
fldValueStruct["fld1array"][6]["value"] = 1252;
fldValueStruct["fld1array"][6]["text"] = "16.00 X 6.00 X 12.38";
fldValueStruct["fld1array"][7] = new Object();
fldValueStruct["fld1array"][7]["value"] = 1247;
fldValueStruct["fld1array"][7]["text"] = "18.00 X 7.00 X 18.75";
fldValueStruct["fld2array"] =  new Array();
fldValueStruct["fld2array"][0] = new Object();
fldValueStruct["fld2array"][0]["value"] = 1506;
fldValueStruct["fld2array"][0]["text"] = "BLACK";
fldValueStruct["fld2array"][1] = new Object();
fldValueStruct["fld2array"][1]["value"] = 1649;
fldValueStruct["fld2array"][1]["text"] = "BURNT ORANGE";
fldValueStruct["fld2array"][2] = new Object();
fldValueStruct["fld2array"][2]["value"] = 1652;
fldValueStruct["fld2array"][2]["text"] = "BURNT ORANGE";
fldValueStruct["fld2array"][3] = new Object();
fldValueStruct["fld2array"][3]["value"] = 1361;
fldValueStruct["fld2array"][3]["text"] = "CHOCOLATE";
fldValueStruct["fld2array"][4] = new Object();
fldValueStruct["fld2array"][4]["value"] = 235;
fldValueStruct["fld2array"][4]["text"] = "HUNTER GREEN";
fldValueStruct["fld2array"][5] = new Object();
fldValueStruct["fld2array"][5]["value"] = 1430;
fldValueStruct["fld2array"][5]["text"] = "NAVY";
fldValueStruct["fld2array"][6] = new Object();
fldValueStruct["fld2array"][6]["value"] = 1415;
fldValueStruct["fld2array"][6]["text"] = "OLIVE";
fldValueStruct["fld2array"][7] = new Object();
fldValueStruct["fld2array"][7]["value"] = 1512;
fldValueStruct["fld2array"][7]["text"] = "RED";
fldValueStruct["fld2array"][8] = new Object();
fldValueStruct["fld2array"][8]["value"] = 1651;
fldValueStruct["fld2array"][8]["text"] = "red";


AvailableProducts = new Object();
AvailableProducts["1048_1430"] = 34658;
AvailableProducts["1247_1430"] = 34622;
AvailableProducts["1415_1243"] = 34556;
AvailableProducts["1048_1415"] = 34660;
AvailableProducts["1247_1506"] = 34599;
AvailableProducts["1247_1415"] = 34624;
AvailableProducts["1247_235"] = 34610;
AvailableProducts["1512_1259"] = 34810;
AvailableProducts["1048_1361"] = 34646;
AvailableProducts["1259_1649"] = 16256;
AvailableProducts["1430_1262"] = 34865;
AvailableProducts["1252_235"] = 34689;
AvailableProducts["1247_1512"] = 34630;
AvailableProducts["1243_1415"] = 34556;
AvailableProducts["1415_1247"] = 34624;
AvailableProducts["1262_1512"] = 34875;
AvailableProducts["1252_1415"] = 34707;
AvailableProducts["1506_1235"] = 34464;
AvailableProducts["1512_1252"] = 34714;
AvailableProducts["1262_235"] = 34851;
AvailableProducts["1361_1259"] = 34772;
AvailableProducts["1243_1512"] = 34563;
AvailableProducts["1252_1512"] = 34714;
AvailableProducts["1259_1361"] = 34772;
AvailableProducts["235_1243"] = 34538;
AvailableProducts["1649_1259"] = 16256;
AvailableProducts["1259_1430"] = 34799;
AvailableProducts["235_1247"] = 34610;
AvailableProducts["235_1251"] = 34640;
AvailableProducts["1415_1252"] = 34707;
AvailableProducts["1512_1048"] = 34666;
AvailableProducts["1506_1259"] = 34766;
AvailableProducts["1512_1243"] = 34563;
AvailableProducts["1506_1048"] = 34643;
AvailableProducts["1430_1252"] = 34704;
AvailableProducts["1415_1235"] = 34487;
AvailableProducts["1430_1048"] = 34658;
AvailableProducts["1361_1262"] = 34844;
AvailableProducts["1235_1430"] = 34485;
AvailableProducts["1235_1512"] = 34493;
AvailableProducts["1252_1361"] = 34678;
AvailableProducts["235_1252"] = 34689;
AvailableProducts["1243_1506"] = 34520;
AvailableProducts["235_1235"] = 34475;
AvailableProducts["1243_1361"] = 34526;
AvailableProducts["1252_1430"] = 34704;
AvailableProducts["1252_1506"] = 34672;
AvailableProducts["235_1048"] = 34648;
AvailableProducts["1048_235"] = 34648;
AvailableProducts["235_1262"] = 34851;
AvailableProducts["1361_1235"] = 34467;
AvailableProducts["1506_1252"] = 34672;
AvailableProducts["1361_1048"] = 34646;
AvailableProducts["1235_235"] = 34475;
AvailableProducts["1430_1259"] = 34799;
AvailableProducts["1415_1262"] = 34867;
AvailableProducts["1506_1262"] = 34838;
AvailableProducts["1262_1361"] = 34844;
AvailableProducts["1361_1247"] = 34602;
AvailableProducts["1430_1243"] = 34553;
AvailableProducts["1251_235"] = 34640;
AvailableProducts["1259_1512"] = 34810;
AvailableProducts["1262_1430"] = 34865;
AvailableProducts["1512_1262"] = 34875;
AvailableProducts["1512_1247"] = 34630;
AvailableProducts["1048_1506"] = 34643;
AvailableProducts["1415_1259"] = 34802;
AvailableProducts["235_1259"] = 34784;
AvailableProducts["1506_1247"] = 34599;
AvailableProducts["1415_1048"] = 34660;
AvailableProducts["1430_1247"] = 34622;
AvailableProducts["1235_1361"] = 34467;
AvailableProducts["1506_1243"] = 34520;
AvailableProducts["1262_1506"] = 34838;
AvailableProducts["1361_1243"] = 34526;
AvailableProducts["1243_235"] = 34538;
AvailableProducts["1262_1415"] = 34867;
AvailableProducts["1259_1506"] = 34766;
AvailableProducts["1430_1235"] = 34485;
AvailableProducts["1259_1415"] = 34802;
AvailableProducts["1512_1235"] = 34493;
AvailableProducts["1235_1506"] = 34464;
AvailableProducts["1235_1415"] = 34487;
AvailableProducts["1259_235"] = 34784;
AvailableProducts["1048_1512"] = 34666;
AvailableProducts["1361_1252"] = 34678;
AvailableProducts["1247_1361"] = 34602;
AvailableProducts["1243_1430"] = 34553;


AttributeArray = new Object();
AttributeArray["1251"] = new Object();
AttributeArray["1251"]["value"] = 1251;
AttributeArray["1251"]["text"] = "14.00 X 9.50 X 16.00";
AttributeArray["1251"]["prod_id"] = "34640";
AttributeArray["1251"]["allowed"] = "235";
AttributeArray["1430"] = new Object();
AttributeArray["1430"]["value"] = 1430;
AttributeArray["1430"]["text"] = "NAVY";
AttributeArray["1430"]["prod_id"] = "34658,34485,34553,34622,34704,34799,34865";
AttributeArray["1430"]["allowed"] = "1048,1235,1243,1247,1252,1259,1262";
AttributeArray["1048"] = new Object();
AttributeArray["1048"]["value"] = 1048;
AttributeArray["1048"]["text"] = "10.00 X 5.00 X 13.00";
AttributeArray["1048"]["prod_id"] = "34648,34646,34660,34658,34643,34666";
AttributeArray["1048"]["allowed"] = "235,1361,1415,1430,1506,1512";
AttributeArray["1361"] = new Object();
AttributeArray["1361"]["value"] = 1361;
AttributeArray["1361"]["text"] = "CHOCOLATE";
AttributeArray["1361"]["prod_id"] = "34646,34467,34526,34602,34678,34772,34844";
AttributeArray["1361"]["allowed"] = "1048,1235,1243,1247,1252,1259,1262";
AttributeArray["1243"] = new Object();
AttributeArray["1243"]["value"] = 1243;
AttributeArray["1243"]["text"] = "16.00 X 6.00 X 19.00";
AttributeArray["1243"]["prod_id"] = "34538,34526,34556,34553,34520,34563";
AttributeArray["1243"]["allowed"] = "235,1361,1415,1430,1506,1512";
AttributeArray["1649"] = new Object();
AttributeArray["1649"]["value"] = 1649;
AttributeArray["1649"]["text"] = "BURNT ORANGE";
AttributeArray["1649"]["prod_id"] = "16256";
AttributeArray["1649"]["allowed"] = "1259";
AttributeArray["1651"] = new Object();
AttributeArray["1651"]["value"] = 1651;
AttributeArray["1651"]["text"] = "red";
AttributeArray["1262"] = new Object();
AttributeArray["1262"]["value"] = 1262;
AttributeArray["1262"]["text"] = "5.25 X 3.50 X 8.25";
AttributeArray["1262"]["prod_id"] = "34851,34844,34867,34865,34838,34875";
AttributeArray["1262"]["allowed"] = "235,1361,1415,1430,1506,1512";
AttributeArray["1247"] = new Object();
AttributeArray["1247"]["value"] = 1247;
AttributeArray["1247"]["text"] = "18.00 X 7.00 X 18.75";
AttributeArray["1247"]["prod_id"] = "34610,34602,34624,34622,34599,34630";
AttributeArray["1247"]["allowed"] = "235,1361,1415,1430,1506,1512";
AttributeArray["1506"] = new Object();
AttributeArray["1506"]["value"] = 1506;
AttributeArray["1506"]["text"] = "BLACK";
AttributeArray["1506"]["prod_id"] = "34643,34464,34520,34599,34672,34766,34838";
AttributeArray["1506"]["allowed"] = "1048,1235,1243,1247,1252,1259,1262";
AttributeArray["1652"] = new Object();
AttributeArray["1652"]["value"] = 1652;
AttributeArray["1652"]["text"] = "BURNT ORANGE";
AttributeArray["1512"] = new Object();
AttributeArray["1512"]["value"] = 1512;
AttributeArray["1512"]["text"] = "RED";
AttributeArray["1512"]["prod_id"] = "34666,34493,34563,34630,34714,34810,34875";
AttributeArray["1512"]["allowed"] = "1048,1235,1243,1247,1252,1259,1262";
AttributeArray["235"] = new Object();
AttributeArray["235"]["value"] = 235;
AttributeArray["235"]["text"] = "HUNTER GREEN";
AttributeArray["235"]["prod_id"] = "34648,34475,34538,34610,34640,34689,34784,34851";
AttributeArray["235"]["allowed"] = "1048,1235,1243,1247,1251,1252,1259,1262";
AttributeArray["1415"] = new Object();
AttributeArray["1415"]["value"] = 1415;
AttributeArray["1415"]["text"] = "OLIVE";
AttributeArray["1415"]["prod_id"] = "34660,34487,34556,34624,34707,34802,34867";
AttributeArray["1415"]["allowed"] = "1048,1235,1243,1247,1252,1259,1262";
AttributeArray["1259"] = new Object();
AttributeArray["1259"]["value"] = 1259;
AttributeArray["1259"]["text"] = "8.00 X 4.75 X 10.38";
AttributeArray["1259"]["prod_id"] = "34784,34772,34802,34799,34766,34810,16256";
AttributeArray["1259"]["allowed"] = "235,1361,1415,1430,1506,1512,1649";
AttributeArray["1252"] = new Object();
AttributeArray["1252"]["value"] = 1252;
AttributeArray["1252"]["text"] = "16.00 X 6.00 X 12.38";
AttributeArray["1252"]["prod_id"] = "34689,34678,34707,34704,34672,34714";
AttributeArray["1252"]["allowed"] = "235,1361,1415,1430,1506,1512";
AttributeArray["1235"] = new Object();
AttributeArray["1235"]["value"] = 1235;
AttributeArray["1235"]["text"] = "13.00 X 6.00 X 15.50";
AttributeArray["1235"]["prod_id"] = "34475,34467,34487,34485,34464,34493";
AttributeArray["1235"]["allowed"] = "235,1361,1415,1430,1506,1512";


function filterAttribute(attrID,fldID,srcFld){
	var fld = document.getElementById('attributeID_'+fldID);
	attrID = srcFld.options[srcFld.selectedIndex].value;
	var valueCount = 1;
	var noValueCount = 0;
	if (attrID > 0) {
		var allowedValueList = AttributeArray[attrID]['allowed'];
		var prod_id = AttributeArray[attrID]['prod_id'];
		var allowedValueArray = allowedValueList.split(',');
		var notAllowedValueArray = new Array();
		//alert(attrID);
		//alert(allowedValueList);
	
		//alert(fld.selectedIndex)
		
		var selectedValue = '';
		var removed = false;
		if (fld.selectedIndex > 0){
			selectedValue = fld.options[fld.selectedIndex].value;
		}
		if (fld.options.length > 1) {
			removed = true;
			for(var i=fld.options.length-1;i>=1;i--){
				fld.remove(i);
			}
			
			//fldArray = eval('fld'+fldID+'Array');
			fldArray = fldValueStruct['fld'+fldID+'array']
			for(var i=0; i< fldArray.length; i++){
		
				var  currentValue = fldArray[i]['value'];
			
				for (var j = 0; j < allowedValueArray.length; j++){
					var allowedValue = allowedValueArray[j];
					//alert(currentValue+ ' - ' + allowedValue)
					if (currentValue == allowedValue || attrID == 0){
						fld.options[valueCount] = new Option(fldArray[i]['text'], fldArray[i]['value'], false, false);
						if (selectedValue == currentValue)
							fld.options[valueCount].selected = true;
							
						valueCount = valueCount + 1;
					}
					else {
						
						notAllowedValueArray[noValueCount] = currentValue;
						noValueCount = noValueCount + 1;
					}
		
				}
			}
		}
		
		for(var i=0; i< notAllowedValueArray.length; i++){
			var divID = document.getElementById('img'+notAllowedValueArray[i])
			if (divID!= null) { 
				divID.innerHTML = '<img src="/images/retail/inActive.png">';
			}
		}
		
		for(var i=0; i< allowedValueArray.length; i++){
			var divID = document.getElementById('img'+allowedValueArray[i])
			if (divID!= null) { 
				divID.innerHTML = '';
			}
		}
	}
	else {
		var selectedValue = '';
		var removed = false;
		if (fld.selectedIndex > 0){
			selectedValue = fld.options[fld.selectedIndex].value;
		}
		
		if (fld.options.length > 1) {
			removed = true;
			for(var i=fld.options.length-1;i>=1;i--){
				fld.remove(i);
			}
					
			fldArray = fldValueStruct['fld'+fldID+'array']
			//alert(fldArray.length);
			for(var i=0; i< fldArray.length; i++){
				fld.options[i+1] = new Option(fldArray[i]['text'], fldArray[i]['value'], false, false);
				if (selectedValue == currentValue)
					fld.options[i+1].selected = true;
					
				var divID = document.getElementById('img'+fldArray[i]['value']);
				if (divID!= null) { 
					divID.innerHTML = '';
				}
				
			}
		}
	}
	
	if (!removed || (fld.selectedIndex > 0 && srcFld.selectedIndex > 0 )){
		value = fld.options[fld.selectedIndex].value;
		attrID = srcFld.options[srcFld.selectedIndex].value;
		key = value+'_'+attrID;
		//alert(key);
		//alert(AvailableProducts[key]);
		getProductPrice('/index.cfm?event=shop.dspProductPrice&prod_id='+AvailableProducts[key]);
	}
	else {
		if (fld.selectedIndex == 0 && srcFld.selectedIndex == 0 )
			Spry.Utils.setInnerHTML('imageText',ImageStruct['default']);

		Spry.Utils.setInnerHTML('productPrice', '');
	}
	//alert(fldArray)
	//alert('fld'+fldID+'Array');

	//fld.options[boxLength] = new Option(Text, Value, false, false);
	
	/*for (var j = 0; j < fld.length; j++) {
		if (fld.options[j].value == attrID){
			
		}
	}
	alert(AttributeArray[attrID]['allowed']);*/
}
function selectColor(id,imgText,imgBorder){
	//alert(id);
	var imgTagText = document.getElementById(imgText).innerHTML;
	var imgBorderDiv = document.getElementById(imgBorder);
	
	if (imgTagText.indexOf('<img') >=0 )
		alert('Not available');
	else {
		//alert(imgBorderDiv.style.border);
		//imgBorderDiv.style.border = '5px'
		var fld = document.getElementById('attributeID_2');
		for(i=fld.options.length-1;i>=1;i--){
		if (fld.options[i].value == id)
			fld.options[i].selected = true;
		}
	
		filterAttribute(id,1,fld);
	}
}

	function doAdd(){
		Spry.Utils.setInnerHTML('updateResponseDiv', 'Processing.....');
		return Spry.Utils.submitForm(document.forms['frmProductDetail'], updateResponseDiv);
	}

	function doCheckStatus(sc_que_id){
		document.forms['frmCartStatus'].sc_que_id.value = sc_que_id;
		return Spry.Utils.submitForm(document.forms['frmCartStatus'], updateResponseDiv);
	}
	function updateResponseDivTest(req){
		Spry.Utils.setInnerHTML('updateResponseDiv', req.xhRequest.responseText);
	}
	
	function updateResponseDiv(req){

		var responseXML = Spry.XML.documentToObject(req.xhRequest.responseXML);
		if (responseXML.ShopCart) {
			var sc_que_id = responseXML.ShopCart['sc_que_id']._value();
			var sc_que_status_id = responseXML.ShopCart['sc_que_status_id']._value();
			var sc_que_message = responseXML.ShopCart['sc_que_message']._value();
		}
		if (sc_que_status_id == 3) { // Product added to shopping cart
			
			sc_que_message = '<h3>'+sc_que_message + '</h3>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/index.cfm?event=cart.dspView"><img src="/images/retail/cart.gif" />&nbsp;View Cart</a>';
			
			var sc_sub_total = responseXML.ShopCart['sc_sub_total']._value();

			if (document.getElementById('cartTotal') != null)
				Spry.Utils.setInnerHTML('cartTotal', '$'+sc_sub_total);

			Spry.Utils.setInnerHTML('updateResponseDiv', sc_que_message);
		}
		else if (sc_que_status_id == 1) // In Que
			doCheckStatus(sc_que_id);
		else if (sc_que_status_id == 5 ) {// Unable to add to shopping cart
			sc_que_message = '<h3> out of stock </h3>';
			Spry.Utils.setInnerHTML('updateResponseDiv', sc_que_message);
		}
	}
	
	function getProductPrice(url){
		Spry.Utils.setInnerHTML('productPrice', 'Loading...');
		Spry.Utils.setInnerHTML('updateResponseDiv', '');
		var req = Spry.Utils.loadURL("GET", url, true, processDispPriceResult);
	}
	
	function processDispPriceResult(req){
		var responseXML = Spry.XML.documentToObject(req.xhRequest.responseXML);
		
		var priceText = responseXML.product['price']._value();
		var imageText = responseXML.product['image']._value();
		//alert(responseXML);
		Spry.Utils.setInnerHTML('productPrice', priceText);
		Spry.Utils.setInnerHTML('imageText', imageText);
	}

	
	function fadeIt(ele,url){
		Spry.Utils.setInnerHTML(ele, 'Loading...');
		Spry.Utils.setInnerHTML('productPrice', '');
		Spry.Utils.setInnerHTML('updateResponseDiv', '');
		//FilterData();
		Spry.Utils.updateContent(ele,url);
	}
	
	var keyArray = new Array();
	
	
	//var fld1 = document.getElementById('attributeID_1');
	var attrFld1 = eval(document.forms['frmProductDetail'].attributeID_1);
	if (attrFld1.options.length == 2){
		attrFld1.options[0]= null;
		attrFld1.options[0].selected = true;
		
		keyArray[0] = attrFld1.options[attrFld1.selectedIndex].value;
	}
	
	else
		attrFld1.options[0].selected = true;
	
	//var fld2 = document.getElementById('attributeID_2');
	var attrFld2 = eval(document.forms['frmProductDetail'].attributeID_2);
	if (attrFld2.options.length == 2){
		attrFld2.options[0]= null;
		attrFld2.options[0].selected = true;
		
		keyArray[1] = attrFld2.options[attrFld2.selectedIndex].value;
	}
	
	else
		attrFld2.options[0].selected = true;
	
	
	//alert(keyArray.length);
	var key = '';
	for(var i=0; i < keyArray.length;i++){
		if (keyArray[i] != undefined){
			if (key.length ==0)
				key = keyArray[i];
			else
				key = key + '_' + keyArray[i];
		}
	}
	if (keyArray.length > 0 && key.indexOf('_') >0){
		getProductPrice('/index.cfm?event=shop.dspProductPrice&prod_id='+AvailableProducts[key]);
	}
	else {
		
	}
	

