	var myMsg = "";
	var xmlhttp;
	var xmlhttp2;
		
		//assign a function to execute to an event handler (ie: onunload)
	function dotask(target, functionref, tasktype) { 
			//alert("dotask called for "+target);
			//myMsg += "Creating dotask of type "+ tasktype +" for target : "+ target.id +"<br />";
			if (target) {
				var nTaskType=(target.addEventListener)? tasktype : "on"+tasktype;
				if (target.addEventListener)
					target.addEventListener(nTaskType, functionref, false);
				else if (target.attachEvent)
					target.attachEvent(nTaskType, functionref);
			}
		}
		
	    function getTransport() {
		    if (window.XMLHttpRequest) {
		        return new XMLHttpRequest();
		    } else if (window.ActiveXObject) {
		        try {
		            return new ActiveXObject('Msxml2.XMLHTTP');
		        } catch(e) {
		            return new ActiveXObject('Microsoft.XMLHTTP');
		        }
		    }
		}
		
		function loadAJAX(url, target, functionref,id){
                       
			setContent("Loading data, please wait...", target, null, id);
			
			var cacheBuster = parseInt(Math.random()*99999999);
			if (url.split("?")[1]) url += "&cbuster=" + cacheBuster;
			else url += "?cbuster="+ cacheBuster;
			if (!xmlhttp) {
			    xmlhttp = getTransport();
			    xmlhttp.open("GET", url ,true);
			    xmlhttp.onreadystatechange=function() {
				    if (xmlhttp.readyState==4) {
					    if (document.getElementById(target)) {
						    if ((functionref != undefined) && (functionref != null)) setContent(xmlhttp.responseText, target, functionref,id);
						    else setContent(xmlhttp.responseText, target,null,id,true);
    						
					    }
					    else {
						    if ((functionref != undefined) && (functionref != null)) dotask(window, function(){setContent(xmlhttp.responseText, target, functionref,id,true)}, "load");
						    else dotask(window, function(){setContent(xmlhttp.responseText, target,null,id,true)}, "load");
					    }
				    }
			    }
			    xmlhttp.send(null);
		    } else {
		        xmlhttp2 = getTransport();
			    xmlhttp2.open("GET", url ,true);
			    xmlhttp2.onreadystatechange=function() {
				    if (xmlhttp2.readyState==4) {
					    if (document.getElementById(target)) {
						    if ((functionref != undefined) && (functionref != null)) setContent(xmlhttp2.responseText, target, functionref,id,true);
						    else setContent(xmlhttp2.responseText, target,null,id,true);
    						
					    }
					    else {
						    if ((functionref != undefined) && (functionref != null)) dotask(window, function(){setContent(xmlhttp2.responseText, target, functionref,id,true)}, "load");
						    else dotask(window, function(){setContent(xmlhttp2.responseText, target,null,id,true)}, "load");
					    }
				    }
			    }
			    xmlhttp2.send(null);
		    }
		}
		
		function setContent(content, target, functionref,id,finalText) {
			//alert("parentNode of "+target+" is "+ document.getElementById(target).parentNode);
			myMsg += "setContent for "+target+" ::  target Exists ? "+ (document.getElementById(target)) +"<br />";
			var targetExists = Boolean(document.getElementById(target));
			
			if (targetExists) 
			{
				var thisEle = document.getElementById(target);
				var finalContent = (target=="popupContent") ? "<div id=\"closeBtn\"><a href=\"#\" onclick=\"closeOverlay()\">X CLOSE</a></div>" + content : content;

				thisEle.innerHTML = finalContent;
				//var cGridH = (document.getElementById("colorGrid")) ? document.getElementById("colorGrid").offsetHeight : 0;
				//var sGridH = (document.getElementById("sizeGrid")) ? document.getElementById("sizeGrid").offsetHeight : 0;
				//var pbGridH = (document.getElementById("priceBreakGrid")) ? document.getElementById("priceBreakGrid").offsetHeight : 0;
				var curIE = getVersion();
				//alert("height for "+thisEle.id+" = "+ thisEle.offsetHeight);
				
				//myMsg += "calling getDivHeight for "+thisEle.id+"<br />";
				
				//alert("new Height = "+styleHeight)
				//myMsg += "returned value of getDivHeight for "+thisEle.id+" : "+getDivHeight(thisEle)+"<br />";
				//if (target == "colorGrid")
					//alert(target+" is "+styleHeight+" high");
				//if ((document.getElementById(target).parentNode) && ((curIE == 0) || (curIE != 6)) ) {
					//var msg = "";
				    //var parentEle = document.getElementById(target).parentNode;
					//myMsg += "calling getDivHeight for "+parentEle.id+"<br />";
					//alert("new height is now : "+newHeight);
					//parentEle.style.height = getDivHeight(parentEle);
					//alert(msg+"parentNode of "+ target +" is <"+parentEle.tagName+" id=\""+parentEle.id+"\" class=\""+parentEle.className+"\" style=\"height:"+parentEle.style.height+";\">");
				  
				//}
				if ((functionref != undefined) && (functionref != null)) functionref();
				//alert("setContent :  id = "+id);
				if (id == 3) {
					//alert("toggle tinyMCE");
					//setTimeout(toggleTinymce,100);
					toggleTinymce();
					
				} else if ((id == 4) || (id == 6)) {
					setContentObj();
					if (contentobjmain3)
						generateimagemain(selectobj3.options[selectobj3.options.selectedIndex].value,'','',contentobjmain3,selectobj3);
		
				}
			} else {
				var newObj = document.createElement("div");
				newObj.id = target;
				var myBody = document.getElementsByTagName("body")[0];
				myBody.appendChild(newObj);
				newObj.style.visibility = "visible";
				newObj.innerHTML  = content;	
			}
			
			if (document.getElementById("modalBackground")) {
				var bgEle = document.getElementById("modalBackground");
				var content = document.getElementById("modalContainer");
				//bgEle.style.width = "100%";
				var newBgHeight = content.offsetTop + content.offsetHeight;
				msg = "newBgHeight : "+newBgHeight;
				msg += "\n"+"bgEle.offsetHeight : "+bgEle.offsetHeight;
				if (newBgHeight > bgEle.offsetHeight)
				{
					bgEle.style.height = newBgHeight+"px";	
				}
				//bgEle.style.backgroundColor = "#999999";
				msg += "\n"+"bgEle.style.height after : "+bgEle.style.height;
				msg += "\n"+"overlay width : "+ bgEle.parentNode.style.width;
				msg += "\n"+"bgcolor : "+ bgEle.style.backgroundColor;
				//alert(msg);
			}
			//equalizer.setHeights();
			//var subScriber = equalizer.onEqualDone.subscribers
			//alert('test');
			//if (!inArray(subScriber,"checkHeights"))
			//	equalizer.addEventListener(checkHeights,"checkHeights");
			
			if (finalText) {
				var pText = document.getElementById("pDesctText");
				var pDesc = document.getElementById("productDesc");
				var sGrid = document.getElementById("sizeGrid");
				var sCol = document.getElementById("sizeCol");
				var cGrid = document.getElementById("colorGrid");
				var pGrid = document.getElementById("pricebreakGrid");
				var debugDiv = document.getElementById("debug");
				var sGridExists = Boolean(sGrid);
				var sColExists = Boolean(sCol);
				var cGridExists = Boolean(cGrid);
				var pGridExists = Boolean(pGrid);
				var pTextExists = Boolean(pText);
				var textHeight = 0;
				//alert("setContent for "+target+"\nsizeGrid exists : "+sGridExists+"\nsizeCol exists : "+sColExists+"\ncolorGrid exists : "+cGridExists);
				if (sGridExists && sColExists) {
					//alert("calculate height")
					var styleHeight = 0;
					var colorHeight = 0;
					var priceHeight = 0;
					
					if (pTextExists) textHeight = pText.offsetHeight;
					if (pText == Number.NaN) textHeight = 0;
					else if (typeof(textHeight) == "string") textHeight = textHeight.replace("px","");
					
					if (sColExists) styleHeight = sGrid.offsetHeight;
					if (styleHeight == Number.NaN) styleHeight = 0;
					else if (typeof(styleHeight) == "string") styleHeight = styleHeight.replace("px", "");
					
					if (cGridExists) colorHeight = cGrid.offsetHeight;
					if (colorHeight == Number.NaN) colorHeight = 0;
					else if (typeof(colorHeight) == "string") colorHeight = colorHeight.replace("px","");
					
					if (pGridExists) priceHeight = pGrid.offsetHeight;
					if (priceHeight == Number.NaN) priceHeight = 0;
					else if (typeof(priceHeight) == "string") priceHeight = priceHeight.replace("px", "");
					
					
					var fullheight = parseInt(textHeight) + parseInt(styleHeight) + parseInt(colorHeight) + parseInt(priceHeight) + 20;
					//debugJS(myMsg);
					//debugJS("<br /><br />textheight = "+textHeight+"px <br />styleHeight = "+styleHeight+"px <br />colorHeight = "+colorHeight+"px ||  "+ cGrid.offsetHeight +"px || "+ cGrid.scrollHeight +"px<br />priceHeight = "+priceHeight+"px <br />fullHeight = "+fullheight+"px <br />");
					
					pDesc.style.height = fullheight + "px";
				}				
			}	

			
		}
		
		function inArray(arr, value) {
			for (var i = 0; i < arr.length; i++) {
				if (arr[i].obj == value)
					return true;
			}
			return false;
		}
		
		function checkNode(ele) {
			//alert("checkNode "+ele.id);
			
			if ((ele.id == "sizeCol") || (ele.id == "swatchCol")) {
				myMsg += "checkNode :: good Value " + ele.id+"<br />"; 	
				return true;
			}
			if (ele.childNodes.length > 1) {
				for (var i=0; i < ele.childNodes.length; i++) {
					var curEle = ele.childNodes[i];
					if ((curEle.id == "sizeCol") || (curEle.id == "swatchCol")) {
						myMsg += "checkNode :: good Value " + curEle.id+"<br />"; 
							//alert("inside "+curEle.id);	
						return true;
					}
				}
			}
			myMsg += "checkNode :: no Value found<br />";
			return false;
		}
		
		function getDivHeight(ele, showPX) {
			//alert("getDivHeight called");
			myMsg += "<br />------------------------------------------------------------------------------------<br />getDivHeight for "+ ele.id +" : <br />";
			var newHeight = 0;
			var returnHeight = "auto";
			var msg = "";
			var px = ((showPX == undefined) || (showPX)) ? "px" : 0;
			if (ele.childNodes.length > 0) {
				myMsg += " we have "+ele.childNodes.length+" childNodes<br />";
				for (var i=0; i < ele.childNodes.length; i++) {
					if (checkNode(ele.childNodes[i]))
						newHeight += getDivHeight(ele.childNodes[i],false);
					else if(ele.childNodes[i].scrollHeight)
						newHeight += ele.childNodes[i].scrollHeight;
					if (ele.childNodes[i].style) {
						if(ele.childNodes[i].style.marginTop)
							newHeight += Number(ele.childNodes[i].style.marginTop.replace("px",""))
						if(ele.childNodes[i].style.marginBottom)
							newHeight += Number(ele.childNodes[i].style.marginBottom.replace("px",""))
					}
					//msg += "id : "+curEle.id+",  class : "+curEle.className+", height : "+ curEle.scrollHeight +", tag : "+ curEle.tagName +", nodeName : "+ curEle.nodeName +"\n";
					myMsg += "ele.childNodes["+i+"] :: id ("+ele.childNodes[i].id+")  class("+ele.childNodes[i].className+") .scrollHeight = "+ ele.childNodes[i].scrollHeight +" :: .offsetHeight = "+ ele.childNodes[i].offsetHeight +" :: newHeight = "+ newHeight+", tag : "+ ele.childNodes[i].tagName +", nodeName : "+ ele.childNodes[i].nodeName +"<br /><br />";
				}
				if(ele.style.marginTop)
					newHeight += Number(ele.style.marginTop.replace("px",""))
				if(ele.style.marginBottom)
					newHeight += Number(ele.style.marginBottom.replace("px",""))
				newHeight += px;
				myMsg += "newHeight Final = "+newHeight+" <br /><br />------------------------------------------------------------------------------------<br />";

				return newHeight;
			} else if (ele.scrollHeight) {
				myMsg += " id ("+ele.id+")  class("+ele.className+") .scrollHeight = "+ ele.scrollHeight +" :: newHeight = "+ newHeight+", tag : "+ ele.tagName +", nodeName : "+ ele.nodeName +"<br /><br />";
				myMsg += "newHeight Final = "+ele.id+" scrollHeight  = "+ ele.scrollHeight+"  offsetHeight = "+ ele.offsetHeight +"<br /><br />------------------------------------------------------------------------------------<br />";
				newHeight += ele.scrollHeight;
				if(ele.style.marginTop)
					newHeight += Number(ele.style.marginTop.replace("px",""))
				if(ele.style.marginBottom)
					newHeight += Number(ele.style.marginBottom.replace("px",""))
				return newHeight+px;	
			} else {
				return returnHeight;	
			}
			//returnHeight = newHeight + px;
			//alert(msg+"\n"+ele.id+" returnHeight = "+returnHeight+"\n\n");
			//return returnHeight;
			
		}
		
		function getSwatchHeight(ele) {
			var newHeight = 0;
			var returnHeight = "auto";
			var msg = "";
			if (ele.childNodes.length > 1) {
				for (var i=0; i < ele.childNodes.length; i++) {
					var curEle = ele.childNodes[i];
					if ((curEle.childNodes.length > 1) && (curEle.className == "smallContainerNoBg")) {
						curEle.style.height = Math.round(getDivHeight(curEle,false)/2) + "px";
						newHeight += Math.round(getDivHeight(curEle,false)/2);
					} 
					if (curEle.scrollHeight)
						newHeight += curEle.scrollHeight/2;
					if (curEle.nodeName != "#text") 
						msg += "id : "+curEle.id+",  class : "+curEle.className+", height : "+ curEle.scrollHeight +", tag : "+ curEle.tagName +", nodeName : "+ curEle.nodeName +"\n";
					//} 
				}
				returnHeight = newHeight + "px";
			}
			returnHeight = (ele.scrollHeight > newHeight) ? ele.scrollHeight + "px" : newHeight + "px";
			//alert(msg+"\n"+ele.id+" returnHeight = "+returnHeight+"\n\n");
			return returnHeight;
		}
		
		function debugJS(msg) {
			msg = msg.replace("\n","<br />");
			var ele = document.getElementById("Debug");
			if (ele) {
				ele.innerHTML += msg;	
			} else {
				var newObj = document.createElement("div");
				newObj.id = "Debug";
				var myBody = document.getElementsByTagName("body")[0];
				myBody.appendChild(newObj);
				newObj.style.visibility = "visible";
				newObj.innerHTML  += msg;
			}
		}
		
		function checkHeights() {
			//alert("onEqualDone fired");	
			var cGrid = document.getElementById("colorGrid");
			var sGrid = document.getElementById("sizeGrid");
			var pGrid = document.getElementById("pricebreakGrid");
			var swCol = document.getElementById("swatchCol");
			var prodC = document.getElementById("productDesc");
			var prodI = document.getElementById("productImg");
			var curIE = getVersion();
			
			if (curIE == 0)
				document.getElementById("swatchCol").style.height = setSwatchHeight(document.getElementById("swatchCol"));
			dotask(document.getElementById("swatchCol"),function(){setSwatchHeight(document.getElementById("swatchCol"));},"change");
			dotask(document.getElementById("colorGrid"),function(){setContentHeight(document.getElementById("colorGrid"));},"change");
			dotask(document.getElementById("sizeGrid"),function(){setContentHeight(document.getElementById("sizeGrid"));},"change");
			dotask(document.getElementById("pricebreakGrid"),function(){setContentHeight(document.getElementById("pricebreakGrid"));},"change");
			//document.getElementById("swatchCol").style.height = getDivHeight(document.getElementById("swatchCol"));
			//document.getElementById("colorGrid").style.height = getDivHeight(document.getElementById("colorGrid"));
			//alert("sizeGrid style = "+document.getElementById("sizeGrid").style.toString());
			//document.getElementById("sizeGrid").style.height = getDivHeight(document.getElementById("sizeGrid"));
			//document.getElementById("pricebreakGrid").style.height = getDivHeight(document.getElementById("pricebreakGrid"));
			//document.getElementById("productDesc").style.height = prodC.scrollHeight+"px";
			document.getElementById("productImg").style.height = prodC.scrollHeight+"px";
			///myMsg += "swatchCol height = "+swCol.style.height+" parentNode is "+ swCol.parentNode.id+"<br />";
			//myMsg += "colorGrid height = "+ cGrid.style.height+" parent Node is "+ cGrid.parentNode.id+"<br />";
			//myMsg += "sizeGrid height = "+ sGrid.style.height+" parent Node is "+ sGrid.parentNode.id+"<br />";
			//myMsg += "pricebreakGrid height = "+ pGrid.style.height+" parent Node is "+ pGrid.parentNode.id+"<br /><br />";
			//myMsg += "productImg height = "+prodI.style.height+" :: productDesc height = "+ prodC.style.height+"<br />equalDone subscribers : "+equalizer.onEqualDone.subscribers.toString();
			
			//debugJS(myMsg);
		}
		
		function setContentHeight(target) {
			target.style.height = getDivHeight(target);
			myMsg += "setContentHeight for "+target.id+"<br />";
		}
		function setSwatchHeight(target) {
			target.style.height = getSwatchHeight(target);
			myMsg += "setSwatchHeight for "+target.id+"<br />";
		}
		function setContentOld(content, target, functionref,id) {
			//alert("parentNode of "+target+" is "+ document.getElementById(target).parentNode);
			if (document.getElementById(target)) 
			{
				document.getElementById(target).innerHTML = content;
				var cGridH = (document.getElementById("colorGrid")) ? document.getElementById("colorGrid").offsetHeight : 0;
				var sGridH = (document.getElementById("sizeGrid")) ? document.getElementById("sizeGrid").offsetHeight : 0;
				var pbGridH = (document.getElementById("priceBreakGrid")) ? document.getElementById("priceBreakGrid").offsetHeight : 0;
				var curIE = getVersion();
				if ((document.getElementById(target).parentNode) && ((curIE == 0) || (curIE != 6)) ) {
					var newHeight = cGridH + sGridH + pbGridH;
					//alert("new height is now : "+newHeight);
				   document.getElementById(target).parentNode.style.height = newHeight + "px";
				}
				if ((functionref != undefined) && (functionref != null)) functionref();
				//alert("setContent :  id = "+id);
				if (id == 3) {
					//alert("toggle tinyMCE");
					//setTimeout(toggleTinymce,100);
					toggleTinymce();
					
				} else if ((id == 4) || (id == 6)) {
					setContentObj();
					if (contentobjmain3)
						generateimagemain(selectobj3.options[selectobj3.options.selectedIndex].value,'','',contentobjmain3,selectobj3);
		
				}
			}
		}
	