function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
} // getStyleObject

function changeObjectVisibility(objectId, newVisibility) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.visibility = newVisibility;
	return true;
    } else {
	// we couldn't find the object, so we can't change its visibility
	return false; 
    }
} // changeObjectVisibility

function moveObject(objectId, newXCoordinate, newYCoordinate) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.left = newXCoordinate;
	styleObject.top = newYCoordinate;
	return true;
    } else {
	// we couldn't find the object, so we can't very well move it
	return false;
    }
} // moveObject

// store variables to control where the popup will appear relative to the cursor position
// positive numbers are below and to the right of the cursor, negative numbers are above and to the left
var xOffset = 80;
var yOffset = -200;

function showPopup (targetObjectId, eventObj) {
    if(eventObj) {
	// hide any currently-visible popups
	hideCurrentPopup();
	// stop event from bubbling up any farther
	eventObj.cancelBubble = true;

	// move popup div to current cursor position 
	// (add scrollTop to account for scrolling for IE)
	//var newXCoordinate = (eventObj.pageX)?eventObj.pageX + xOffset:eventObj.x + xOffset + ((document.body.scrollLeft)?document.body.scrollLeft :0);
	//var newYCoordinate = (eventObj.pageY)?eventObj.pageY + yOffset:eventObj.y + yOffset + ((document.body.scrollTop)?document.body.scrollTop:0);
	viewport.getAll();
	var tip=null
	var offX = 50
    var offY = 30
	tip=document.getElementById(targetObjectId);
	if(tip&&tip.style)
		{
			
			var x=eventObj.pageX?eventObj.pageX:eventObj.clientX+viewport.scrollX;
			var y=eventObj.pageY?eventObj.pageY:eventObj.clientY+viewport.scrollY;
			
			if(x+tip.offsetWidth+offX>viewport.width+viewport.scrollX)
			{
				x=x- tip.offsetWidth- offX;if(x<0)x=0;
			}
			else
				x=x+offX;
			if(y+tip.offsetHeight+offY>viewport.height+viewport.scrollY)
				{
				y=y-tip.offsetHeight-offY;
				if(y<viewport.scrollY)y=viewport.height+viewport.scrollY-tip.offsetHeight;
				}
				else y=y+offY;
			
		}
		
	var newXCoordinate =x
	var newYCoordinate =y
	moveObject(targetObjectId, newXCoordinate, newYCoordinate);
	// and make it visible
	if( changeObjectVisibility(targetObjectId, 'visible') ) {
	    // if we successfully showed the popup
	    // store its Id on a globally-accessible object
	    window.currentlyVisiblePopup = targetObjectId;
	    return true;
	} else {
	    // we couldn't show the popup, boo hoo!
	    return false;
	}
    } else {
	// there was no event object, so we won't be able to position anything, so give up
	return false;
    }
} // showPopup

function showPopup1 (targetObjectId, eventObj) {
    if(eventObj) {
	// hide any currently-visible popups
	hideCurrentPopup();
	// stop event from bubbling up any farther
	eventObj.cancelBubble = true;

	// move popup div to current cursor position 
	// (add scrollTop to account for scrolling for IE)
	//var newXCoordinate = (eventObj.pageX)?eventObj.pageX + xOffset:eventObj.x - 250 - xOffset + ((document.body.scrollLeft)?document.body.scrollLeft :0);
	//var newYCoordinate = (eventObj.pageY)?eventObj.pageY + yOffset:eventObj.y + yOffset + ((document.body.scrollTop)?document.body.scrollTop:0);
		viewport.getAll();
	var tip=null
	var offX = 50
    var offY = 30
	tip=document.getElementById(targetObjectId);
	if(tip&&tip.style)
		{
			
			var x=eventObj.pageX?eventObj.pageX:eventObj.clientX+viewport.scrollX;
			var y=eventObj.pageY?eventObj.pageY:eventObj.clientY+viewport.scrollY;
			
			if(x+tip.offsetWidth+offX>viewport.width+viewport.scrollX)
			{
				x=x- tip.offsetWidth- offX;if(x<0)x=0;
			}
			else
				x=x+offX;
			if(y+tip.offsetHeight+offY>viewport.height+viewport.scrollY)
				{
				y=y-tip.offsetHeight-offY;
				if(y<viewport.scrollY)y=viewport.height+viewport.scrollY-tip.offsetHeight;
				}
				else y=y+offY;
			
		}
		
	var newXCoordinate =x
	var newYCoordinate =y
	moveObject(targetObjectId, newXCoordinate, newYCoordinate);
	// and make it visible
	if( changeObjectVisibility(targetObjectId, 'visible') ) {
	    // if we successfully showed the popup
	    // store its Id on a globally-accessible object
	    window.currentlyVisiblePopup = targetObjectId;
	    return true;
	} else {
	    // we couldn't show the popup, boo hoo!
	    return false;
	}
    } else {
	// there was no event object, so we won't be able to position anything, so give up
	return false;
    }
} // showPopup1
function showPopup2 (targetObjectId, eventObj) {
    if(eventObj) {
	// hide any currently-visible popups
	hideCurrentPopup();
	// stop event from bubbling up any farther
	eventObj.cancelBubble = true;

	// move popup div to current cursor position 
	// (add scrollTop to account for scrolling for IE)
	//var newXCoordinate = (eventObj.pageX)?eventObj.pageX + xOffset:eventObj.x - 250 - xOffset + ((document.body.scrollLeft)?document.body.scrollLeft :0);
	//var newYCoordinate = (eventObj.pageY)?eventObj.pageY + yOffset:eventObj.y + yOffset + ((document.body.scrollTop)?document.body.scrollTop:0);
		viewport.getAll();
	var tip=null
	var offX = 0
    var offY = -5
	tip=document.getElementById(targetObjectId);
	if(tip&&tip.style)
		{
			
			var x=eventObj.pageX?eventObj.pageX:eventObj.clientX+viewport.scrollX;
			var y=eventObj.pageY?eventObj.pageY:eventObj.clientY+viewport.scrollY;
			
			if(x+tip.offsetWidth+offX>viewport.width+viewport.scrollX)
			{
				x=x- tip.offsetWidth- offX;if(x<0)x=0;
			}
			else
				x=x+offX;
			if(y+tip.offsetHeight+offY>viewport.height+viewport.scrollY)
				{
				y=y-tip.offsetHeight-offY;
				if(y<viewport.scrollY)y=viewport.height+viewport.scrollY-tip.offsetHeight;
				}
				else y=y+offY;
			
		}
		
	var newXCoordinate =x
	var newYCoordinate =y
	moveObject(targetObjectId, newXCoordinate, newYCoordinate);
	// and make it visible
	if( changeObjectVisibility(targetObjectId, 'visible') ) {
	    // if we successfully showed the popup
	    // store its Id on a globally-accessible object
	    window.currentlyVisiblePopup = targetObjectId;
	    return true;
	} else {
	    // we couldn't show the popup, boo hoo!
	    return false;
	}
    } else {
	// there was no event object, so we won't be able to position anything, so give up
	return false;
    }
} // showPopup2
function hideCurrentPopup() {
    // note: we've stored the currently-visible popup on the global object window.currentlyVisiblePopup
    if(window.currentlyVisiblePopup) {
	changeObjectVisibility(window.currentlyVisiblePopup, 'hidden');
	window.currentlyVisiblePopup = false;
    }
} // hideCurrentPopup



// ***********************
// hacks and workarounds *
// ***********************

// initialize hacks whenever the page loads
window.onload = initializeHacks;

// setup an event handler to hide popups for generic clicks on the document
document.onclick = hideCurrentPopup;

function initializeHacks() {
    // this ugly little hack resizes a blank div to make sure you can click
    // anywhere in the window for Mac MSIE 5
    if ((navigator.appVersion.indexOf('MSIE 5') != -1) 
	&& (navigator.platform.indexOf('Mac') != -1)
	&& getStyleObject('blankDiv')) {
	window.onresize = explorerMacResizeFix;
    }
    resizeBlankDiv();
    // this next function creates a placeholder object for older browsers
    createFakeEventObj();
}

function createFakeEventObj() {
    // create a fake event object for older browsers to avoid errors in function call
    // when we need to pass the event object to functions
    if (!window.event) {
	window.event = false;
    }
} // createFakeEventObj

function resizeBlankDiv() {
    // resize blank placeholder div so IE 5 on mac will get all clicks in window
    if ((navigator.appVersion.indexOf('MSIE 5') != -1) 
	&& (navigator.platform.indexOf('Mac') != -1)
	&& getStyleObject('blankDiv')) {
	getStyleObject('blankDiv').width = document.body.clientWidth - 20;
	getStyleObject('blankDiv').height = document.body.clientHeight - 20;
    }
}

function explorerMacResizeFix () {
    location.reload(false);
}
function fadeOut() {
	var agt=navigator.userAgent.toLowerCase();
	var is_major = parseInt(navigator.appVersion);
	var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
	var is_ie3    = (is_ie && (is_major < 4));
	var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
	var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
	if(is_ie5up)
	{
		/*infoProductPopup.style.filter="blendTrans(duration=2)";
		
		if (infoProductPopup.filters.blendTrans.status != 2) {
			infoProductPopup.filters.blendTrans.apply();
			infoProductPopup.style.visibility="hidden";
			infoProductPopup.filters.blendTrans.play();
		}*/
		    infoProductPopup.filters[0].Apply();

			if (infoProductPopup.style.visibility == "visible") {
					infoProductPopup.style.visibility = "hidden";
				infoProductPopup.filters.revealTrans.transition=12;
				}
				infoProductPopup.filters[0].Play();
    }
}


/*function fadeIn() {
    infoProductPopup.style.filter="blendTrans(duration=2)";
    // Make sure the filter is not playing.
    if (infoProductPopup.filters.blendTrans.status != 2) {
        infoProductPopup.filters.blendTrans.apply();
        infoProductPopup.style.visibility="visible";
        infoProductPopup.filters.blendTrans.play();
    }
}*/

//AJAX

 function makeRequest(url) {
        var http_request = false;
 
        if (window.XMLHttpRequest) { // Mozilla, Safari, ...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
                // See note below about this line
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!http_request) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }

        http_request.onreadystatechange = function() { alertContents(http_request); };
        http_request.open('GET', url, true);
        http_request.send(null);
		//alert(http_request.readyState)
    }

    function alertContents(http_request) {

		if (http_request.readyState == 4) {
            if (http_request.status == 200) {
               
            //var vals = http_request.responseText.split("$");
				//document.getElementById("txtName").innerHTML= vals[1]
				//document.getElementById("txtDesc").innerHTML=vals[2]
				//document.getElementById("largeImage").src=vals[0]
				
				var text = http_request.responseText
				//alert(text)
				// code for IE
				if (window.ActiveXObject)
				{
				var doc=new ActiveXObject("Microsoft.XMLDOM");
				doc.async="false";
				doc.loadXML(text);
				}
				// code for Mozilla, Firefox, Opera, etc.
				else
				{
				var parser=new DOMParser();
				var doc=parser.parseFromString(text,"text/xml");
				}

				var x=doc.documentElement;
				var root = doc.getElementsByTagName('NewDataSet')[0];
				var p = doc.getElementsByTagName('Product')[0];
				//alert(doc.getElementsByTagName('Product').length)
				var out = "<table width='100%' border='0' cellpadding = '0' cellspacing = '2' align='center'>"
				//for (var iNode = 0; iNode < doc.getElementsByTagName('Product').length; iNode++) {
					var child = doc.getElementsByTagName('Product')[0];
					
					out = out + "<tr><td colspan='4' class='jewelryHEAD'><div align ='center' id='txtName'>"+child.getElementsByTagName('name')[0].childNodes[0].nodeValue+"</div></td></tr>"
					if(child.getElementsByTagName('large_image')[0].childNodes[0] != null)
					out = out +  "<tr><td colspan='4' align='center'><img id='largeImage' hspace='0' vspace='0' align='middle' border='0' class='picLINK' src = '"+"../uploads/productimages/" + child.getElementsByTagName('large_image')[0].childNodes[0].nodeValue +"'></td></tr>"
					else
					out = out +  "<tr><td colspan='4' align='center'><img id='largeImage' hspace='0' vspace='0' align='middle' border='0' class='picLINK' src = '../uploads/productimages/'></td></tr>"
					/*
					if (x.childNodes[0].childNodes[iNode].childNodes[0] != null)
					{
					
						//if(x.childNodes[0].childNodes[iNode].nodeName == 'description'){
							//document.getElementById("txtDesc").innerHTML=x.childNodes[0].childNodes[iNode].childNodes[0].nodeValue
							
						//}
						
						if(trim(x.childNodes[0].childNodes[iNode].nodeName) == 'name'){
						
							//document.getElementById("txtName").innerHTML=x.childNodes[0].childNodes[iNode].childNodes[0].nodeValue
							out = out + "<tr><td colspan='4' class='jewelryHEAD'><div align ='center' id='txtName'>"+x.childNodes[0].childNodes[iNode].childNodes[0].nodeValue+"</div></td></tr>"
							}
						if(trim(x.childNodes[0].childNodes[iNode].nodeName) == 'large_image'){
							//document.getElementById("largeImage").src= "../uploads/productimages/" + x.childNodes[0].childNodes[iNode].childNodes[0].nodeValue
							out = out +  "<tr><td colspan='4' align='center'><img id='largeImage' hspace='0' vspace='0' align='middle' border='0' class='picLINK' src = '"+"../uploads/productimages/" + x.childNodes[0].childNodes[iNode].childNodes[0].nodeValue+"'></td></tr>"
							//alert(x.childNodes[0].childNodes[iNode].childNodes[0].nodeValue)
							}
						
					}*/
				   
				//}
				
				out += "<tr bgColor='#249792'><td colspan='4' align='center' class='reversedetailHEAD'>INFORMATION</td></tr>"
				//out += "<tr bgColor='#00FFFA'><td colspan='4' align='center' class='reversedetailHEAD'>INFORMATION</td></tr>"
				
				for(var i = 0 ; i < doc.getElementsByTagName('ProductProperties').length; i++){
					var Product = doc.getElementsByTagName('ProductProperties')[i];
					//var bg = "bgColor= '#efffff'"
					var bg = "bgColor= '#EAEAEA'"
					if (i % 4 == 0)
						bg = "bgColor= '#EAEAEA'"
					else
					bg = ""
					if (i % 2 == 0)
					{
						if ( i != 0 )
							out += "</tr><tr "+bg+">"
						else
							out += "<tr "+bg+">"
							
							
					}
					var pName = Product.getElementsByTagName('property_name')[0].childNodes[0].nodeValue;
					if (trim(pName) =='Measurement Length')
						pName = 'Length (mm)'
					if (trim(pName) =='Measurement Width')
						pName = 'Width (mm)'
					if (trim(pName) =='Measurement Depth')
						pName = 'Depth (mm)'
						
					out +="<td class='detailPOPUP' valign='top' >" + pName + "</td>"
					out +="<td class='detailPOPUP' valign='top' >" + Product.getElementsByTagName('property_value')[0].childNodes[0].nodeValue + "</td>"	
					
					//alert(Product.childNodes.length)
					/*for (var iNode = 0; iNode < Product.childNodes.length; iNode++) {
						if (iNode == 0)
							out +="<td class='detail' valign='top' >" + Product.childNodes[iNode].childNodes[0].nodeValue + "</td>"
						if (iNode == 1)
								out +="<td class='detail' valign='top' >" + Product.childNodes[iNode].childNodes[0].nodeValue + "</td>"	
							//document.write(Product.childNodes[iNode].childNodes[0].nodeValue + " -- ");
					}	*/	
					
				}
				out+="</tr>"
				infoProductPopup.innerHTML = out + "</table>"

		}
	
        }

    }
    function trim(s)
	{
		if(s !="")
		{
			while (s.substring(0,1) == ' ')
			{
				s = s.substring(1,s.length);
			}

			while (s.substring(s.length-1,s.length) == ' ')
			{
				s = s.substring(0,s.length-1);
			}
		}

		return s;
	}
    var temppc = 0
    function getPopupInfo(pc,cc)
    {
		if(document.getElementById("popupOnOff").innerHTML == "turn off")
		{
			document.getElementById("infoProductPopup").style.display = "block"
			if (temppc != pc)
			{
				temppc = pc
				makeRequest("ajaxproductinfopopup.aspx?iProductid="+pc+"&iCategoryid="+cc);
			}
		}
		else
		{
		//alert(document.getElementById("infoProductPopup").style.visibility)
		document.getElementById("infoProductPopup").style.display = "none"
		}
    }
//view port
var viewport = {
  getWinWidth: function () {
    this.width = 0;
    if (window.innerWidth) this.width = window.innerWidth - 18;
    else if (document.documentElement && document.documentElement.clientWidth) 
  		this.width = document.documentElement.clientWidth;
    else if (document.body && document.body.clientWidth) 
  		this.width = document.body.clientWidth;
  },
  
  getWinHeight: function () {
    this.height = 0;
    if (window.innerHeight) this.height = window.innerHeight - 18;
  	else if (document.documentElement && document.documentElement.clientHeight) 
  		this.height = document.documentElement.clientHeight;
  	else if (document.body && document.body.clientHeight) 
  		this.height = document.body.clientHeight;
  },
  
  getScrollX: function () {
    this.scrollX = 0;
  	if (typeof window.pageXOffset == "number") this.scrollX = window.pageXOffset;
  	else if (document.documentElement && document.documentElement.scrollLeft)
  		this.scrollX = document.documentElement.scrollLeft;
  	else if (document.body && document.body.scrollLeft) 
  		this.scrollX = document.body.scrollLeft; 
  	else if (window.scrollX) this.scrollX = window.scrollX;
  },
  
  getScrollY: function () {
    this.scrollY = 0;    
    if (typeof window.pageYOffset == "number") this.scrollY = window.pageYOffset;
    else if (document.documentElement && document.documentElement.scrollTop)
  		this.scrollY = document.documentElement.scrollTop;
  	else if (document.body && document.body.scrollTop) 
  		this.scrollY = document.body.scrollTop; 
  	else if (window.scrollY) this.scrollY = window.scrollY;
  },
  
  getAll: function () {
    this.getWinWidth(); this.getWinHeight();
    this.getScrollX();  this.getScrollY();
  }
  
}


//popups for diamonds

var menuLayers = {
  timer: null,
  activeMenuID: null,
  offX: 2,   // horizontal offset 
  offY: 0,   // vertical offset 
  show: function(id, e) {
  
    if(id == "Shape")
    id = document.getElementById("hidTempShape").value;
    if(id == "Cut")
    id = document.getElementById("hidCut").value;
    if(id == "Color")
    id = document.getElementById("hidColor").value;
    if(id == "Clarity")
    id = document.getElementById("hidClarity").value;
    
    var mnu = document.getElementById? document.getElementById(id): null;
    if (!mnu) return;
    this.activeMenuID = id;
    if ( mnu.onmouseout == null ) mnu.onmouseout = this.mouseoutCheck;
    if ( mnu.onmouseover == null ) mnu.onmouseover = this.clearTimer;
    viewport.getAll();
    this.position(mnu,e);
  },
  
  hide: function() {
    this.clearTimer();
    if (this.activeMenuID && document.getElementById) 
      this.timer = setTimeout("document.getElementById('"+menuLayers.activeMenuID+"').style.visibility = 'hidden'", 200);
  },
  
  position: function(mnu, e) {
    var x = e.pageX? e.pageX: e.clientX + viewport.scrollX;
    var y = e.pageY? e.pageY: e.clientY + viewport.scrollY;
    
    if ( x + mnu.offsetWidth + this.offX > viewport.width + viewport.scrollX )
      x = x - mnu.offsetWidth - this.offX;
    else x = x + this.offX;
  
    if ( y + mnu.offsetHeight + this.offY > viewport.height + viewport.scrollY )
      y = ( y - mnu.offsetHeight - this.offY > viewport.scrollY )? y - mnu.offsetHeight - this.offY : viewport.height + viewport.scrollY - mnu.offsetHeight;
    else y = y + this.offY;
    
    mnu.style.left = x + "px"; mnu.style.top = y + "px";
    this.timer = setTimeout("document.getElementById('" + menuLayers.activeMenuID + "').style.visibility = 'visible'", 200);
  },
  
  mouseoutCheck: function(e) {
    e = e? e: window.event;
    // is element moused into contained by menu? or is it menu (ul or li or a to menu div)?
    var mnu = document.getElementById(menuLayers.activeMenuID);
    var toEl = e.relatedTarget? e.relatedTarget: e.toElement;
    if ( mnu != toEl && !menuLayers.contained(toEl, mnu) ) menuLayers.hide();
  },
  
  // returns true of oNode is contained by oCont (container)
  contained: function(oNode, oCont) {
    if (!oNode) return; // in case alt-tab away while hovering (prevent error)
    while ( oNode = oNode.parentNode ) 
      if ( oNode == oCont ) return true;
    return false;
  },

  clearTimer: function() {
    if (menuLayers.timer) clearTimeout(menuLayers.timer);
  }
  
}
//image change
//document.getElementById("myImage").src="hackanm.gif"
function changeImage(imgName)
{
	//alert(document.getElementById("hidTopImage"))
	//alert(document.getElementById("hidTopImage").value)
	//document.getElementById("imgTopImage").src= document.getElementById("hidTopImage").value
	
	if(imgName == "imgTopImage")
	{
		//document.getElementById("imgTopImage").border = 1; hidWidth hidtable hidLength hidDepth hidGirdle hidCulet
		//document.getElementById("imgTopSketch").border = 0;
		//document.getElementById("imgTopProfile").border = 0;
		document.getElementById("txtWidthORtable").innerHTML = "";
		document.getElementById("txtLengthORdepth").innerHTML = "";
		document.getElementById("txtDepth").innerHTML = "";
		document.getElementById("txtGirdle").innerHTML = "";
		document.getElementById("txtCulet").innerHTML = "";
		//document.getElementById("txtLengthtoWidthratio").innerHTML = "";
		document.getElementById("txtWidthORtable").style.display = "none"
		document.getElementById("txtLengthORdepth").style.display = "none"
		document.getElementById("txtDepth").style.display = "none"
		document.getElementById("txtGirdle").style.display = "none"
		document.getElementById("txtCulet").style.display = "none"
		
		document.getElementById("imgTopImage").src = document.getElementById("hidTopImageEna").value
		document.getElementById("imgTopProfile").src = document.getElementById("hidSmallTopProfileDis").value;
		document.getElementById("imgTopSketch").src = document.getElementById("hidSmallTopSketchDis").value;
		
		document.getElementById("imgProduct").src = document.getElementById("hidTopImage").value
		document.getElementById("imgProduct").alt = "Top Image"
	}
	else if (imgName == "imgTopSketch")
	{
		//document.getElementById("imgTopImage").border = 0;
		//document.getElementById("imgTopSketch").border = 2;
		//document.getElementById("imgTopProfile").border = 0;
		document.getElementById("txtWidthORtable").style.width = "110px";
		document.getElementById("txtLengthORdepth").style.width = "150px";
		
		document.getElementById("txtWidthORtable").innerHTML = "WIDTH : " + document.getElementById("hidWidth").value + "  mm";
		document.getElementById("txtLengthORdepth").innerHTML = "LENGTH : " + document.getElementById("hidLength").value + "&nbsp;mm";
		document.getElementById("txtDepth").innerHTML = "";
		document.getElementById("txtGirdle").innerHTML = "";
		
		document.getElementById("txtWidthORtable").style.display = "block"
		document.getElementById("txtLengthORdepth").style.display = "block"
		document.getElementById("txtDepth").style.display = "none"
		document.getElementById("txtGirdle").style.display = "none"
		document.getElementById("txtCulet").style.display = "block"
		
		document.getElementById("txtWidthORtable").style.top = "226px";
		document.getElementById("txtWidthORtable").style.left = "160px";
		
		document.getElementById("txtLengthORdepth").style.top = "226px";
		document.getElementById("txtLengthORdepth").style.left = "10px";
		
		document.getElementById("txtCulet").style.top = "250px";
		document.getElementById("txtCulet").style.left = "50px";
		document.getElementById("txtCulet").style.width = "200px";

		//var temp = "";
		//if(document.getElementById("hidWidth").value != "")
		//{
		//var x =(document.getElementById("hidLength").value/document.getElementById("hidWidth").value).toString();
		//temp = x.substring(0,x.indexOf(".")+3)
		//}
		document.getElementById("txtCulet").innerHTML = "Length-to-Width ratio = " + document.getElementById("hidLengthWidth").value ;
		document.getElementById("txtCulet").align="left"
		//document.getElementById("txtLengthtoWidthratio").innerHTML = 
		
		document.getElementById("imgTopImage").src = document.getElementById("hidTopImageDis").value
		document.getElementById("imgTopProfile").src = document.getElementById("hidSmallTopProfileDis").value;
		document.getElementById("imgTopSketch").src = document.getElementById("hidSmallTopSketchEna").value;
		
		document.getElementById("imgProduct").alt = "Top Sketch"
		document.getElementById("imgProduct").src = document.getElementById("hidTopSketch").value
	}
	else if (imgName == "imgTopProfile")
	{
	
		//document.getElementById("imgTopImage").border = 0;
		//document.getElementById("imgTopSketch").border = 0;
		//document.getElementById("imgTopProfile").border = 2;
		document.getElementById("txtWidthORtable").innerHTML = "Table % : " + document.getElementById("hidtable").value;
		document.getElementById("txtLengthORdepth").innerHTML = "Depth : " + document.getElementById("hidDepth").value + "  mm";
		document.getElementById("txtDepth").innerHTML = "Depth% : " + document.getElementById("hidDepthPer").value;
		if(document.getElementById("hidGirdle").value == "")
			document.getElementById("txtGirdle").innerHTML = "Girdle : NA";
		else
			document.getElementById("txtGirdle").innerHTML ="Girdle : " + document.getElementById("hidGirdle").value;
		
		if(document.getElementById("hidCulet").value == "")
			document.getElementById("txtCulet").innerHTML = "Culet : NA";
		else
			document.getElementById("txtCulet").innerHTML =  "Culet : "+ document.getElementById("hidCulet").value;
		//document.getElementById("txtLengthtoWidthratio").innerHTML = "";
		document.getElementById("txtCulet").align="right"
		
		document.getElementById("txtWidthORtable").style.display = "block"
		document.getElementById("txtLengthORdepth").style.display = "block"
		document.getElementById("txtDepth").style.display = "block"
		document.getElementById("txtGirdle").style.display = "block"
		document.getElementById("txtCulet").style.display = "block"
		
		document.getElementById("txtWidthORtable").style.top = "30px";
		document.getElementById("txtWidthORtable").style.left = "85px";
		
		document.getElementById("txtLengthORdepth").style.top = "110px";
		document.getElementById("txtLengthORdepth").style.left = "1px";
		document.getElementById("txtLengthORdepth").style.width = "50px";
		
		document.getElementById("txtDepth").style.top = "110px";
		document.getElementById("txtDepth").style.left = "210px";
		document.getElementById("txtDepth").style.width = "50px";
		
		document.getElementById("txtGirdle").style.top = "190px";
		document.getElementById("txtGirdle").style.left = "30px";
		
		document.getElementById("txtCulet").style.top = "230px";
		document.getElementById("txtCulet").style.left = "150px";
		document.getElementById("txtCulet").style.width = "90px";
		
		
		document.getElementById("imgTopImage").src = document.getElementById("hidTopImageDis").value
		document.getElementById("imgTopProfile").src = document.getElementById("hidSmallTopProfileEna").value;
		document.getElementById("imgTopSketch").src = document.getElementById("hidSmallTopSketchDis").value;
				
		document.getElementById("imgProduct").alt = "Profile Sketch"
		document.getElementById("imgProduct").src = document.getElementById("hidTopProfile").value
	}
	//alert(document.getElementById(imgName).border)
	/*document.getElementById("imgTopImage").Style.border="0"
	document.getElementById("imgTopSketch").Style.border="0"
	document.getElementById("imgTopProfile").Style.border="0"*/
	
	//document.getElementById("imgName").border="1"
	//alert(document.getElementById("imgName").border)
}

function popupONorOFF()
{
	if(document.getElementById("popupOnOff").innerHTML == "turn off")
	{
		document.getElementById("popupOnOff").innerHTML = "turn on";
		document.getElementById("popupitemdescOnOff").innerHTML = "Pop-up item descriptions are <b>OFF</b> |";
	}
	else
	{
		document.getElementById("popupOnOff").innerHTML = "turn off";
		document.getElementById("popupitemdescOnOff").innerHTML = "Pop-up item descriptions are <b>ON</b> |";
	}
}