function initIndret()
{
  var ele = xGetElementById('C');
  if (ele && xDef(ele.style, ele.offsetHeight)) { // another compatibility check
    xAddEventListener(window, 'resize', adjustLayout, false);
    adjustLayout(); 
  }
}
function adjustLayout() {
  var lch = xHeight("LeftContents");
  var rch = xHeight("RightContents");
  var cch = xHeight("Contents");
  var maxc = Math.max(cch, Math.max(lch, rch));
  var th = xHeight("TopBg");
  var wh = xClientHeight();
  var ch = wh - th;
  var max = Math.max(maxc, ch);
  xHeight("LeftCol", max);
  xHeight("CenterCol", max);
  xHeight("RightCol", max);
}
function openTellFriend(uri, pageUri, theLocale, site) {	
  if (window.location.search != "") {
    pageUri += window.location.search;		
  }
  pageUri = encodeURIComponent(pageUri); 
  if(theLocale)
    pageUri = "?__locale=" + theLocale + "&uri=" + pageUri + "&site=" + site;
  else
    pageUri = "?uri=" + pageUri + "&site=" + site;
  window.open(uri + pageUri, "tellfriend", "width=661,height=400,dependent=yes,status=no,toolbar=no,location=no,scrollbars=yes,resizable=yes");
}
function openContact(uri, supplierParam, theLocale, site) {	
  //if (window.location.search != "") {
  //  pageUri += window.location.search;		
  //}
  //pageUri = encodeURIComponent(pageUri); 
  var pageUri = "?";
  if(theLocale)
    pageUri += "__locale=" + theLocale + "&" + supplierParam + "&site=" + site;
  else
    pageUri += supplierParam + "&site=" + site;
  window.open(uri + pageUri, "contactsupplier", "width=661,height=400,dependent=yes,status=no,toolbar=no,location=no,scrollbars=yes,resizable=yes");
}
function viewImage(icon, img, cap, ilinks, idescs, elinks, edescs) {
  var img_tag = document.getElementById('ImageView');
  img_tag.src = img;
  if(cap) {
    img_tag.alt = cap;
    var cap_tag = document.getElementById('ImageCaption');
    if(ilinks && idescs) {
      var ls = ilinks.split("|");
      var ds = idescs.split("|");
      for(i=0; i<ls.length; i++) {
        cap += '<br><a href="' + ls[i] + '">' + ds[i] + '</a>'
      }
    }
    if(elinks && edescs) {
        var ls = elinks.split("|");
        var ds = edescs.split("|");
        for(i=0; i<ls.length; i++) {
          cap += '<br><a href="' + ls[i] + '" target="_blank">' + ds[i] + '</a>'
        }
      }
    cap_tag.innerHTML = cap;
  } else {
  	img_tag.alt = "";
  }
  var icon_list = document.getElementById('IconList').getElementsByTagName('img');
  for(var i = 0; i < icon_list.length; i++) {
    var icon_tag = icon_list[i];
	var cn = icon_tag.className;
	var ndx = cn.indexOf('Selected');
	if(ndx != -1) {
	  if(ndx == 0)
	    cn = cn.substring(0, ndx)+cn.substring(ndx+9)
	  else
	    cn = cn.substring(0, ndx-1)+cn.substring(ndx+8)
	}
	if(icon_tag.id == icon) {
	  if(cn.length == 0)
	    icon_tag.className = "Selected";
	  else
	    icon_tag.className = cn + " Selected";
	} else {
	  icon_tag.className = cn;
	}
  }
  adjustLayout();
}
function submitForm(form, key, value) {
    if(key!=null)
		document.getElementById(key).value=value;
	document.forms[form].submit();
}
