﻿// JScript File

function CProduct(ProductId, Price, Dynamic, Count,  Status, Serial, ExtraInfo) {
	this.ProductId = ProductId;
	this.Price = Price;
	this.Dynamic = Dynamic;
	this.Count = Count;
	this.Status = Status;
	this.Serial = Serial;
	this.ExtraInfo = ExtraInfo;
}

function initAttr(maxProductId, ConfId) {

	var message = document.productform.elements["message"].value;
	var serial = document.getElementById("serial");
	var price = document.getElementById("price");
	var status = document.getElementById("status");
	var extraInfo = document.getElementById("extraInfo");
	var WaitList = document.getElementById("WaitList");
	var maxQuantityIndex = 0;
	for(i=0;i<products.length; i++) {
		if(maxProductId == products[i].ProductId) {
			maxQuantityIndex = i;
			break;
		}
	}
	serial.innerHTML = "Product Code: " + products[maxQuantityIndex].Serial;
	price.innerHTML = "Price: " + products[maxQuantityIndex].Price;
	var name = document.productform.elements["ProductName"].value;
	name = name.replace("&quote;", "\"");
	name = name.replace("&quote;", "\"");
	var InBasket = document.productform.elements["InBasket"].value;
	extraInfo.innerHTML = name + "&nbsp;&nbsp;" +  products[maxQuantityIndex].ExtraInfo;
	var basket_width = 47;
	if (navigator.appName!="Microsoft Internet Explorer" && navigator.appName!="Opera") {
		var vendor = navigator.vendor;
		if(vendor.indexOf("Apple")>=0)
			basket_width=42;
	}

	var PrevPage = document.productform.elements["PrevPage"].value;
	if (products[maxQuantityIndex].Status == "IN STOCK") {
	    WaitList.innerHTML = "";
		if(InBasket==1)
		    status.innerHTML = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr><td colspan=\"2\" height=\"19\" valign=\"bottom\" align=\"right\"><input type=\"image\" src=\"images/basketbag1.jpg\" name=\"Image3\" id=\"Image3\" onMouseOver=\"MM_swapImage('Image3','','images/basketbag2.jpg',1)\" onMouseOut=\"MM_swapImgRestore()\" onclick=\"try{document.getElementById('Image3').disabled=true;}catch (e){};document.productform.submit();\"></td></tr><tr><td height=\"18\">&nbsp;</td><td height=\"23\" valign=\"middle\" align=\"right\"><a href=\"ViewWishList.aspx?action=1&ProductId=" + ConfId + "\" class=\"subBTNS_2\" style=\"line=height:10px;margin-right:14px;\">ADD TO WISH LIST</a></td></tr><tr><td height=\"20\" colspan=\"2\" align=\"right\"><a href=\"Basket.aspx\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">PROCEED TO CHECKOUT</a></td></tr><tr><td height=\"20\" colspan=\"2\" align=\"right\"><a href=\"javascript:window.location.href='" + PrevPage + "';\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">CONTINUE SHOPPING</a></td></tr></table>";
		else
		    status.innerHTML = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr><td colspan=\"2\" height=\"19\" valign=\"bottom\" align=\"right\"><input type=\"image\" src=\"images/basketbag1.jpg\" name=\"Image3\" id=\"Image3\" onMouseOver=\"MM_swapImage('Image3','','images/basketbag2.jpg',1)\" onMouseOut=\"MM_swapImgRestore()\" onclick=\"try{document.getElementById('Image3').disabled=true;}catch (e){};document.productform.submit();\"></td></tr><tr><td height=\"18\">&nbsp;</td><td height=\"23\"  valign=\"middle\" align=\"right\"><a href=\"ViewWishList.aspx?action=1&ProductId=" + ConfId + "\" class=\"subBTNS_2\" style=\"line=height:10px;margin-right:14px;\">ADD TO WISH LIST</a></td></tr><tr><td height=\"20\" colspan=\"2\" align=\"right\"><a href=\"javascript:window.location.href='" + PrevPage + "';\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">CONTINUE SHOPPING</a></td></tr></table>";
	} else {
		var wait_height = 29;
/*		if(navigator.appName!="Microsoft Internet Explorer") {
			var vendor = navigator.vendor;
			if(vendor.indexOf("Apple")>=0)
				wait_height = 29;
		}*/

		
		WaitList.innerHTML = "THIS ITEM IS SOLD OUT.  YOU MAY ADD IT TO YOUR WAIT LIST TO BE NOTIFIED WHEN IT GETS BACK IN STOCK.";
		if(InBasket==1)
		    status.innerHTML = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr><td height=\"18\">&nbsp;</td><td height=\"" + wait_height + "\" valign=\"middle\" align=\"right\"><a href=\"ViewWishList.aspx?action=1&ProductId=" + ConfId + "&ListId=1\" class=\"subBTNS_2\" style=\"line-height:10px;\">ADD TO WAIT LIST</a> <a href=\"javascript:launchGenericPopUp('WAITLIST', 'ViewShopStaticPage.aspx?ValueId=2501', 840, 540, 1);\" class=\"subBTNS_2\"  style=\"margin-right:3px;color:#FF0000;\">?</a></td></tr><tr><td height=\"18\">&nbsp;</td><td height=\"23\" valign=middle align=\"right\"><a href=\"ViewWishList.aspx?action=1&ProductId=" + ConfId + "\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">ADD TO WISH LIST</a></td></tr><tr><td height=\"28\" colspan=\"2\" align=\"right\"><a href=\"Basket.aspx\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">PROCEED TO CHECKOUT</a></td></tr><tr><td height=\"20\" colspan=\"2\" align=\"right\"><a href=\"javascript:window.location.href='" + PrevPage + "';\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">CONTINUE SHOPPING</a></td></tr></table>";
		else
		    status.innerHTML = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr><td height=\"18\">&nbsp;</td><td height=\"" + wait_height + "\" valign=\"middle\" align=\"right\"><a href=\"ViewWishList.aspx?action=1&ProductId=" + ConfId + "&ListId=1\" class=\"subBTNS_2\" style=\"line-height:10px;\">ADD TO WAIT LIST</a> <a href=\"javascript:launchGenericPopUp('WAITLIST', 'ViewShopStaticPage.aspx?ValueId=2501', 840, 540, 1);\" class=\"subBTNS_2\"  style=\"margin-right:3px;color:#FF0000;\">?</a></td></tr><tr><td height=\"18\">&nbsp;</td><td height=\"23\" valign=middle align=\"right\"><a href=\"ViewWishList.aspx?action=1&ProductId=" + ConfId + "\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">ADD TO WISH LIST</a></td></tr><tr><td height=\"20\" colspan=\"2\" align=\"right\"><a href=\"javascript:window.location.href='" + PrevPage + "';\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">CONTINUE SHOPPING</a></td></tr></table>";
	}
	document.productform.elements["RId"].value = maxProductId;
	var attr = products[maxQuantityIndex].Dynamic.split('@');
	InitChangeAttr(attr[0], maxProductId);
}



function initRegular(ProductId, Price, Status, Serial, ExtraInfo) {
	var serial = document.getElementById("serial");
	var price = document.getElementById("price");
	var status = document.getElementById("status");
	var extraInfo = document.getElementById("extraInfo");
	var selectedcolor = document.getElementById("selectedcolor");
	var WaitList = document.getElementById("WaitList");
	serial.innerHTML = "Product Code: " + Serial;
	price.innerHTML = "Price: " + Price;
	var name = document.productform.elements["ProductName"].value;
	name = name.replace("&quote;", "\"");
	name = name.replace("&quote;", "\"");
	var InBasket = document.productform.elements["InBasket"].value;
	extraInfo.innerHTML = name + "&nbsp;&nbsp;" + ExtraInfo;
	var basket_width = 47;
	if (navigator.appName!="Microsoft Internet Explorer" && navigator.appName!="Opera") {
		var vendor = navigator.vendor;
		if(vendor.indexOf("Apple")>=0)
			basket_width=42;
	}

	var PrevPage = document.productform.elements["PrevPage"].value;
	if (Status == "IN STOCK") {
	    WaitList.innerHTML = "";
		if (InBasket == 1)
		    status.innerHTML = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr><td colspan=\"2\" height=\"19\" valign=\"bottom\" align=\"right\"><input type=\"image\" src=\"images/basketbag1.jpg\" name=\"Image3\" id=\"Image3\" onMouseOver=\"MM_swapImage('Image3','','images/basketbag2.jpg',1)\" onMouseOut=\"MM_swapImgRestore()\" onclick=\"try{document.getElementById('Image3').disabled=true;}catch (e){};document.productform.submit();\"></td></tr><tr><td height=\"18\">&nbsp;</td><td height=\"23\" valign=\"middle\" align=\"right\"><a href=\"ViewWishList.aspx?action=1&ProductId=" + ProductId + "\" class=\"subBTNS_2\" style=\"line=height:10px;margin-right:14px;\">ADD TO WISH LIST</a></td></tr><tr><td height=\"20\" colspan=\"2\" align=\"right\"><a href=\"Basket.aspx\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">PROCEED TO CHECKOUT</a></td></tr><tr><td height=\"20\" colspan=\"2\" align=\"right\"><a href=\"javascript:window.location.href='" + PrevPage + "';\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">CONTINUE SHOPPING</a></td></tr></table>";
        else
            status.innerHTML = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr><td colspan=\"2\" height=\"19\" valign=\"bottom\" align=\"right\"><input type=\"image\" src=\"images/basketbag1.jpg\" name=\"Image3\" id=\"Image3\" onMouseOver=\"MM_swapImage('Image3','','images/basketbag2.jpg',1)\" onMouseOut=\"MM_swapImgRestore()\" onclick=\"try{document.getElementById('Image3').disabled=true;}catch (e){};document.productform.submit();\"></td></tr><tr><td height=\"18\">&nbsp;</td><td height=\"23\"  valign=\"middle\" align=\"right\"><a href=\"ViewWishList.aspx?action=1&ProductId=" + ProductId + "\" class=\"subBTNS_2\" style=\"line=height:10px;margin-right:14px;\">ADD TO WISH LIST</a></td></tr><tr><td height=\"20\" colspan=\"2\" align=\"right\"><a href=\"javascript:window.location.href='" + PrevPage + "';\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">CONTINUE SHOPPING</a></td></tr></table>";
	} else {
	    WaitList.innerHTML = "THIS ITEM IS SOLD OUT.  YOU MAY ADD IT TO YOUR WAIT LIST TO BE NOTIFIED WHEN IT GETS BACK IN STOCK.";
		var wait_height = 29;
/*		if(navigator.appName!="Microsoft Internet Explorer") {
			var vendor = navigator.vendor;
			if(vendor.indexOf("Apple")>=0)
				wait_height = 29;
		}*/
		if(InBasket==1)
		    status.innerHTML = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr><td height=\"18\">&nbsp;</td><td height=\"" + wait_height + "\" valign=\"middle\" align=\"right\"><a href=\"ViewWishList.aspx?action=1&ProductId=" + ProductId + "&ListId=1\" class=\"subBTNS_2\" style=\"line-height:10px;\">ADD TO WAIT LIST</a>  <a href=\"javascript:launchGenericPopUp('WAITLIST', 'ViewShopStaticPage.aspx?ValueId=2501', 840, 540, 1);\" class=\"subBTNS_2\"  style=\"margin-right:3px;color:#FF0000;\">?</a></td></tr><tr><td height=\"18\">&nbsp;</td><td height=\"23\" valign=middle align=\"right\"><a href=\"ViewWishList.aspx?action=1&ProductId=" + ProductId + "\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">ADD TO WISH LIST</a></td></tr><tr><td height=\"28\" colspan=\"2\" align=\"right\"><a href=\"Basket.aspx\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">PROCEED TO CHECKOUT</a></td></tr><tr><td height=\"20\" colspan=\"2\" align=\"right\"><a href=\"javascript:window.location.href='" + PrevPage + "';\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">CONTINUE SHOPPING</a></td></tr></table>";
		else
		    status.innerHTML = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr><td height=\"18\">&nbsp;</td><td height=\"" + wait_height + "\" valign=\"middle\"  align=\"right\"><a href=\"ViewWishList.aspx?action=1&ProductId=" + ProductId + "&ListId=1\" class=\"subBTNS_2\" style=\"line-height:10px;\">ADD TO WAIT LIST</a>  <a href=\"javascript:launchGenericPopUp('WAITLIST', 'ViewShopStaticPage.aspx?ValueId=2501', 840, 540, 1);\" class=\"subBTNS_2\"  style=\"margin-right:3px;color:#FF0000;\">?</a></td></tr><tr><td height=\"18\">&nbsp;</td><td height=\"23\" valign=middle align=\"right\"><a href=\"ViewWishList.aspx?action=1&ProductId=" + ProductId + "\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">ADD TO WISH LIST</a></td></tr><tr><td height=\"20\" colspan=\"2\" align=\"right\"><a href=\"javascript:window.location.href='" + PrevPage + "';\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">CONTINUE SHOPPING</a></td></tr></table>";
	}
	selectedcolor.innerHTML = "";
}

function ChangeAttr(Value, Id, AttrId, ConfId, AttrNo) {
	var attrId = document.getElementById(AttrId).value;
	var attribute = attrId + '~' + Value;
	var newProducts = new Array();
	var counter = 0;
	var imgg = '';
	var desc = '';
	var ChangedTypeId = 'Type'+AttrNo;
	var ChangedType = document.getElementById(ChangedTypeId).value;
	if(ChangedType==1) {
		document.productform.elements['GlobalDynamic'+AttrNo].value = Value; 
	}
	
	for(i=0;i<products.length; i++) {
		var word = products[i].Dynamic.split('@');
		for(j=0;j<word.length;j++) {
			if(word[j] == attribute)  {
				newProducts[counter] = products[i];
				counter++;
				break;
			}
			
		}
	}
	var ProductDynamic = '';
	var cmb = new Array(products[0].Count);
	var type = new Array(products[0].Count);
	for(i=1;i<=products[0].Count;i++) {
		var cmbid = 'GlobalDynamic'+i;
		var cmbAttr = 'Attr'+i;
		var cmbAttrId = document.getElementById(cmbAttr).value;
		cmb[i] = document.getElementById(cmbid);
		var typeId = 'Type'+i;
		type[i] = document.getElementById(typeId).value;
		
		
		//combo box
		if(type[i]==0){
			if(i>1)
				ProductDynamic = ProductDynamic +'@';
			ProductDynamic = ProductDynamic + cmbAttrId+'~'+cmb[i].options[cmb[i].selectedIndex].value;
			if(cmbid!=Id ) {
				for(j=1;j<cmb[i].options.length;j++) {
					var option = cmbAttrId + '~'+cmb[i].options[j].value;
					for(k=0;k<newProducts.length;k++) {
						var word = newProducts[k].Dynamic.split('@');
						var flag=0;
						for(l=0;l<word.length;l++) {
							if(word[l]==option) {
								flag=1;
								break;
							}
						}
						if(flag==1)
							break;
					}
					if(flag==0) {
					    if (navigator.appName=="Microsoft Internet Explorer" || navigator.appName=="Opera") {
							emulateEnabled(cmb[i].options[j], false);
						} else {
							cmb[i].options[j].disabled = true;
						}
					}
					else {
					    if (navigator.appName=="Microsoft Internet Explorer" || navigator.appName=="Opera") {
							emulateEnabled(cmb[i].options[j], true);
						} else {
							cmb[i].options[j].disabled = false;
						}
					}
				}
			}
		} else { //image
			if(i>1) {
				ProductDynamic = ProductDynamic +'@';
			}
			ProductDynamic = ProductDynamic + cmbAttrId+'~'+document.productform.elements[cmbid].value;
			if(cmbid!=Id ) {
				var totalImagesId = 'Total'+i;
				var totalImages = document.getElementById(totalImagesId).value;
				for(j=0;j<totalImages;j++) {
					var optionId = 'Option'+i+'@'+j;
					var link = 'image'+i+'@'+j;
					//document.getElementById(link).setAttribute("class", "plaisio");
					document.getElementById(link).className='plaisio';
					var descId = 'Desc'+i+'@'+j;
					var option = cmbAttrId + '~'+document.getElementById(optionId).value;
					for(k=0;k<newProducts.length;k++) {
						var word = newProducts[k].Dynamic.split('@');
						var flag=0;
						for(l=0;l<word.length;l++) {
							if(word[l]==option) {
								flag=1;
								if(newProducts[k].Dynamic==ProductDynamic) {
									imgg = document.getElementById(link).src;
									desc = document.getElementById(descId).value;
								}
							//	break;
							}
						}
						if(flag==1)
							break;
					}
					if(flag==0) {
						enableLink(link,false);//apenergopoiisi eikonas
					}
					else {
						enableLink(link,true);//energopoiisi eikonas
					}
				}
			} else {
				var totalImagesId = 'Total'+i;
				var totalImages = document.getElementById(totalImagesId).value;
				for(j=0;j<totalImages;j++) {
					var optionId = 'Option'+i+'@'+j;
					var link = 'image'+i+'@'+j;
					document.getElementById(link).className='plaisio';
					//document.getElementById(link).setAttribute("class", "plaisio");
					var descId = 'Desc'+i+'@'+j;
					var option = cmbAttrId + '~'+document.getElementById(optionId).value;
					var word = option.split('~');
					if(word[1]==Value) {
						imgg = document.getElementById(link).src;
						desc = document.getElementById(descId).value;
						document.getElementById(link).className='plaisio2';
						//document.getElementById(link).setAttribute("class", "plaisio2");
						//break;
					}
				}
			}
		}
	}
	
	
	var message = document.productform.elements["message"].value;

	var serial = document.getElementById("serial");
	var price = document.getElementById("price");
	var status = document.getElementById("status");
	var extraInfo = document.getElementById("extraInfo");
	var WaitList = document.getElementById("WaitList");
	var selectedcolor = document.getElementById("selectedcolor");
	var InBasket = document.productform.elements["InBasket"].value;
	var PrevPage = document.productform.elements["PrevPage"].value;
	for(i=0;i<newProducts.length;i++) {
		if(newProducts[i].Dynamic==ProductDynamic) {
			serial.innerHTML = "Product Code: " + newProducts[i].Serial;
			price.innerHTML = "Price: " + newProducts[i].Price;
			var name = document.productform.elements["ProductName"].value;
			name = name.replace("&quote;", "\"");
			name = name.replace("&quote;", "\"");
			extraInfo.innerHTML = name + "&nbsp;&nbsp;" + newProducts[i].ExtraInfo;
			document.productform.elements["RId"].value = newProducts[i].ProductId; 
			var basket_width = 47;
			if (navigator.appName!="Microsoft Internet Explorer" && navigator.appName!="Opera") {
				var vendor = navigator.vendor;
				if(vendor.indexOf("Apple")>=0)
					basket_width=42;
			}
			if (newProducts[i].Status == "IN STOCK") {
			    WaitList.innerHTML = "";		
				if(InBasket==1)
				    status.innerHTML = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr><td colspan=\"2\" height=\"19\" valign=\"bottom\" align=\"right\"><input type=\"image\" src=\"images/basketbag1.jpg\" name=\"Image3\" id=\"Image3\" onMouseOver=\"MM_swapImage('Image3','','images/basketbag2.jpg',1)\" onMouseOut=\"MM_swapImgRestore()\" onclick=\"try{document.getElementById('Image3').disabled=true;}catch (e){};document.productform.submit();\"></td></tr><tr><td height=\"18\">&nbsp;</td><td height=\"23\" valign=\"middle\" align=\"right\"><a href=\"ViewWishList.aspx?action=1&ProductId=" + ConfId + "\" class=\"subBTNS_2\" style=\"line=height:10px;margin-right:14px;\">ADD TO WISH LIST</a</td></tr><tr><td height=\"20\" colspan=\"2\" align=\"right\"><a href=\"Basket.aspx\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">PROCEED TO CHECKOUT</a></td></tr><tr><td height=\"20\" colspan=\"2\" align=\"right\"><a href=\"javascript:window.location.href='" + PrevPage + "';\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">CONTINUE SHOPPING</a></td></tr></table>";
				else
				    status.innerHTML = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr><td colspan=\"2\" height=\"19\" valign=\"bottom\" align=\"right\"><input type=\"image\" src=\"images/basketbag1.jpg\" name=\"Image3\" id=\"Image3\" onMouseOver=\"MM_swapImage('Image3','','images/basketbag2.jpg',1)\" onMouseOut=\"MM_swapImgRestore()\" onclick=\"try{document.getElementById('Image3').disabled=true;}catch (e){};document.productform.submit();\"></td></tr><tr><td height=\"18\">&nbsp;</td><td height=\"23\" valign=\"middle\" align=\"right\"><a href=\"ViewWishList.aspx?action=1&ProductId=" + ConfId + "\" class=\"subBTNS_2\" style=\"line=height:10px;margin-right:14px;\">ADD TO WISH LIST</a></td></tr><tr><td height=\"20\" colspan=\"2\" align=\"right\"><a href=\"javascript:window.location.href='" + PrevPage + "';\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">CONTINUE SHOPPING</a></td></tr></table>";
            } else {
            WaitList.innerHTML = "THIS ITEM IS SOLD OUT.  YOU MAY ADD IT TO YOUR WAIT LIST TO BE NOTIFIED WHEN IT GETS BACK IN STOCK.";
				var wait_height = 29;
			/*	if(navigator.appName!="Microsoft Internet Explorer") {
					var vendor = navigator.vendor;
					if(vendor.indexOf("Apple")>=0)
						wait_height = 29;
				}*/
				if(InBasket==1)
				    status.innerHTML = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr><td height=\"18\">&nbsp;</td><td height=\"" + wait_height + "\" valign=\"middle\" align=\"right\"><a href=\"ViewWishList.aspx?action=1&ProductId=" + ConfId + "&ListId=1\" class=\"subBTNS_2\">ADD TO WAIT LIST</a>  <a href=\"javascript:launchGenericPopUp('WAITLIST', 'ViewShopStaticPage.aspx?ValueId=2501', 840, 540, 1);\" class=\"subBTNS_2\"  style=\"margin-right:3px;color:#FF0000;\">?</a></td></tr><tr><td height=\"18\">&nbsp;</td><td height=\"20\" align=\"right\"><a href=\"ViewWishList.aspx?action=1&ProductId=" + ConfId + "\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">ADD TO WISH LIST</a></td></tr><tr><td height=\"28\" colspan=\"2\" align=\"right\"><a href=\"Basket.aspx\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">PROCEED TO CHECKOUT</a></td></tr><tr><td height=\"20\" colspan=\"2\" align=\"right\"><a href=\"javascript:window.location.href='" + PrevPage + "';\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">CONTINUE SHOPPING</a></td></tr></table>";
				else
				    status.innerHTML = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr><td height=\"18\">&nbsp;</td><td height=\"" + wait_height + "\" valign=\"middle\" align=\"right\"><a href=\"ViewWishList.aspx?action=1&ProductId=" + ConfId + "&ListId=1\" class=\"subBTNS_2\">ADD TO WAIT LIST</a>  <a href=\"javascript:launchGenericPopUp('WAITLIST', 'ViewShopStaticPage.aspx?ValueId=2501', 840, 540, 1);\" class=\"subBTNS_2\"  style=\"margin-right:3px;color:#FF0000;\">?</a></td></tr><tr><td height=\"18\">&nbsp;</td><td height=\"20\" align=\"right\"><a href=\"ViewWishList.aspx?action=1&ProductId=" + ConfId + "\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">ADD TO WISH LIST</a></td></tr><tr><td height=\"20\" colspan=\"2\" align=\"right\"><a href=\"javascript:window.location.href='" + PrevPage + "';\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">CONTINUE SHOPPING</a></td></tr></table>";
			}

//			selectedcolor.innerHTML = "<img src=\""+imgg+"\" width=\"114\" height=\"55\"  border=\"0\" class=\"plaisio\">";
			break;
		}
	}

	if(i==newProducts.length) {
		serial.innerHTML = " ";
		price.innerHTML = " ";
		extraInfo.innerHTML = "";
		var basket_width = 47;
		if (navigator.appName!="Microsoft Internet Explorer" && navigator.appName!="Opera") {
			var vendor = navigator.vendor;
			if(vendor.indexOf("Apple")>=0)
				basket_width=42;
		}
			if(InBasket==1)
			    status.innerHTML = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr><td colspan=\"2\" height=\"19\" valign=\"bottom\" align=\"right\"><img src=\"images/basketbag1.jpg\" name=\"Image3\" id=\"Image3\" onMouseOver=\"MM_swapImage('Image3','','images/basketbag2.jpg',1)\" onMouseOut=\"MM_swapImgRestore()\" onclick=\"alert(\'" + message + "\');\" style=\"cursor:pointer;\"></td></tr><tr><td height=\"18\">&nbsp;</td><td height=\"23\" valign=\"middle\" align=\"right\"><a href=\"ViewWishList.aspx?action=1&ProductId=" + ConfId + "\" class=\"subBTNS_2\" style=\"line=height:10px;margin-right:14px;\">ADD TO WISH LIST</a></td></tr><tr><td height=\"20\" colspan=\"2\" align=\"right\"><a href=\"Basket.aspx\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">PROCEED TO CHECKOUT</a></td></tr><tr><td height=\"20\" colspan=\"2\" align=\"right\"><a href=\"javascript:window.location.href='" + PrevPage + "';\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">CONTINUE SHOPPING</a></td></tr></table>";
				else
				    status.innerHTML = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr><td colspan=\"2\" height=\"19\" valign=\"bottom\" align=\"right\"><img src=\"images/basketbag1.jpg\" name=\"Image3\" id=\"Image3\" onMouseOver=\"MM_swapImage('Image3','','images/basketbag2.jpg',1)\" onMouseOut=\"MM_swapImgRestore()\"  onclick=\"alert(\'" + message + "\');\" style=\"cursor:pointer;\"></td></tr><tr><td height=\"18\">&nbsp;</td><td height=\"23\" valign=\"middle\" align=\"right\"><a href=\"ViewWishList.aspx?action=1&ProductId=" + ConfId + "\" class=\"subBTNS_2\" style=\"line=height:10px;margin-right:14px;\">ADD TO WISH LIST</a></td></tr><tr><td height=\"20\" colspan=\"2\" align=\"right\"><a href=\"javascript:window.location.href='" + PrevPage + "';\" class=\"subBTNS_2\" style=\"line-height:10px; margin-right:14px;\">CONTINUE SHOPPING</a></td></tr></table>";
		document.productform.elements["RId"].value = -1;
	}

	if(imgg!="")
		selectedcolor.innerHTML = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td><img src=\""+imgg+"\" width=\"114\" height=\"55\"  border=\"0\" class=\"plaisiobig\"></td></tr><tr><td align=\"center\"><span class=\"MAINTEXTBLACK\" style=\"text-align:justify;\">"+desc+"</span></td></tr></table>";
}



function emulateEnabled(option, enable) {
	if(enable)
		 option.style.color = "menutext";
	else 
		option.style.color = "graytext";
}

function enableLink(linkid,enable) {
	var link=document.getElementById(linkid);
	if(enable) {
		link.style.cursor="pointer";
	} else {
		link.style.cursor="not-allowed";
	}
}


function InitChangeAttr(attribute, maxProductId) {
	var newProducts = new Array();
	var counter = 0;
	var imgg = "";
	var newProducts = new Array();
	var counter = 0;
	/*//if(products[0].Count>1) {
		for(i=0;i<products.length; i++) {
			var word = products[i].Dynamic.split('@');
			for(j=0;j<word.length;j++) {
				if(word[j] == attribute)  {
					newProducts[counter] = products[i];
					counter++;
					break;
				}
				
			}
		}
/*	} else {*/
		for(i=0;i<products.length; i++) {
			newProducts[i] = products[i];
		}
	//}
	
	var ProductDynamic = '';
	var cmb = new Array(products[0].Count);
	var type = new Array(products[0].Count);
	
	
	var SizeNo = 0;
try {
	SizeNo = document.getElementById("SizeNo").value;
} catch(e) {
}
if(SizeNo!=0 && products[0].Count==1) {
	for(i=0;i<products.length;i++) {
		if(products[i].Status!="IN STOCK") {
			var cmbid = 'GlobalDynamic'+SizeNo;
			var cmbAttr = 'Attr'+SizeNo;
			var cmbAttrId = document.getElementById(cmbAttr).value;
			cmb[0] = document.getElementById(cmbid);
			for(j=1;j<cmb[0].options.length;j++) {
				var option = cmbAttrId + '~'+cmb[0].options[j].value;
				var word = products[i].Dynamic.split('@');
				var flag=0;
				for(l=0;l<word.length;l++) {
					if(word[l]==option) {
						flag=1;
						var optiontxt = cmb[0].options[j].text;
						if (optiontxt.indexOf("Out of Stock") <= 0)
						    cmb[0].options[j].text = optiontxt + " - Out of Stock";
						break;
					}
				}
				if(flag==1)
					break;
			}
			
		}
	}
}
	
	
	
	
	for(i=1;i<=products[0].Count;i++) {
		var cmbid = 'GlobalDynamic'+i;
		var cmbAttr = 'Attr'+i;
		var cmbAttrId = document.getElementById(cmbAttr).value;
		cmb[i] = document.getElementById(cmbid);
		var typeId = 'Type'+i;
		type[i] = document.getElementById(typeId).value;
		
		
		//combo box
		if(type[i]==0){
			if(i>1)
				ProductDynamic = ProductDynamic +'@';
			ProductDynamic = ProductDynamic + cmbAttrId+'~'+cmb[i].options[cmb[i].selectedIndex].value;
			for(j=1;j<cmb[i].options.length;j++) {
				var option = cmbAttrId + '~'+cmb[i].options[j].value;
				for(k=0;k<newProducts.length;k++) {
					var word = newProducts[k].Dynamic.split('@');
					var flag=0;
					for(l=0;l<word.length;l++) {
						if(word[l]==option) {
							flag=1;
							break;
						}
					}
					if(flag==1)
						break;
				}
				if(flag==0 && products[0].Count>1) {
				    if (navigator.appName=="Microsoft Internet Explorer" || navigator.appName=="Opera") {
						emulateEnabled(cmb[i].options[j], false);
					} else {
						cmb[i].options[j].disabled = true;
					}
				}
				else {
				    if (navigator.appName=="Microsoft Internet Explorer" || navigator.appName=="Opera") {
						emulateEnabled(cmb[i].options[j], true);
					} else {
						cmb[i].options[j].disabled = false;
					}
				}
			}
		} else { //image
			if(i>1) {
				ProductDynamic = ProductDynamic +'@';
			}
			ProductDynamic = ProductDynamic + cmbAttrId+'~'+document.productform.elements[cmbid].value;
			var totalImagesId = 'Total'+i;
			var totalImages = document.getElementById(totalImagesId).value;
			for(j=0;j<totalImages;j++) {
				var optionId = 'Option'+i+'@'+j;
				var link = 'image'+i+'@'+j;
				var descId = 'Desc'+i+'@'+j;
				var option = cmbAttrId + '~'+document.getElementById(optionId).value;
				for(k=0;k<newProducts.length;k++) {
					var word = newProducts[k].Dynamic.split('@');
					var flag=0;
					for(l=0;l<word.length;l++) {
						if(word[l]==option) {
							
							
							//document.getElementById(link).setAttribute("class", "plaisio2");
							if(newProducts[k].ProductId == maxProductId) {
								document.getElementById(link).className='plaisio2';
								imgg = document.getElementById(link).src;
								document.getElementById(link).setAttribute("class", "plaisio2");
								var desc = document.getElementById(descId).value;
							}
							flag=1;
							break;
						}
					}
					if(flag==1)
						break;
				}
				if(flag==0 && products[0].Count>1) {
					enableLink(link,false);//apenergopoiisi eikonas
				}
				else {
					enableLink(link,true);//energopoiisi eikonas
				}
			}
		}
		var selectedcolor = document.getElementById("selectedcolor");
		if(imgg!="")
			selectedcolor.innerHTML = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td><img src=\""+imgg+"\" width=\"114\" height=\"55\"  border=\"0\" class=\"plaisiobig\"></td></tr><tr><td align=\"center\"><span class=\"MAINTEXTBLACK\" style=\"text-align:justify;\">"+desc+"</span></td></tr></table>";
	}

}
