function showChooseCountry()
{
	window.open('ChooseCountry.aspx','_blank','location=no,toolbar=no,menubar=no,directories=no,status=no,resizable=yes,scrollbars=yes,left=200,top=200');
}

function showChooseCountry2()
{
	window.open('ChooseCountry.aspx?method=2','_blank','location=no,toolbar=no,menubar=no,directories=no,status=no,resizable=yes,scrollbars=yes,left=300,top=200');
}

function showProductDetail(PID, CID, RID)
{
	window.open('popupProduct.aspx?PID=' + PID + '&CID=' + CID + '&RID=' + RID ,'_blank','location=no,toolbar=no,menubar=no,directories=no,status=no,resizable=yes,scrollbars=yes,left=100,top=100');
}

function showEmail(PID)
{
	window.open('emailFriend.aspx?PID=' + PID ,'_blank','location=no,toolbar=no,menubar=no,directories=no,status=no,resizable=no,scrollbars=yes,left=100,top=100, width=650,height=400');
}

function showFeedback()
{
	window.open('Feedback.aspx','_blank','location=no,toolbar=no,menubar=no,directories=no,status=no,resizable=no,scrollbars=yes,left=100,top=100, width=650,height=400');
}

function showEmailWishlist()
{
	window.open('emailWIshlist.aspx','_blank','location=no,toolbar=no,menubar=no,directories=no,status=no,resizable=no,scrollbars=yes,left=100,top=100, width=650,height=400');
}

function showSofasPopup(colour, category,range,product)
{
	window.open('popupMTOSofas.aspx?colour=' + colour + '&CID=' + category + '&RID=' + range + '&PID=' + product,'_blank','location=no,toolbar=no,menubar=no,directories=no,status=no,resizable=no,scrollbars=yes,left=100,top=100, width=340,height=350');
}

function pngFix()
{
  // IE6 only
  if (typeof document.body.style.maxHeight != 'undefined' || !document.all) {
    return
  }
  for(var i = 0; i < document.images.length; i++) {
    var img = document.images[i]
    var imgName = img.src.toUpperCase()
    if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
      var imgID = (img.id) ? "id='" + img.id + "' " : ""
      var imgClass = (img.className) ? "class='" + img.className + "' " : ""
      var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
      var imgStyle = "display:inline-block;" + img.style.cssText
      if (img.align == "left") imgStyle = "float:left;" + imgStyle
      if (img.align == "right") imgStyle = "float:right;" + imgStyle
      if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
      var strNewHTML = "<span " + imgID + imgClass + imgTitle
      + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
      + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
      + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
      img.outerHTML = strNewHTML
      i = i - 1
    }
  }
}

function configureMenus(menu)
{
  // hide all submenus
  var ULs = $(menu).getElementsByTagName('UL')
  for (var i = 0; i < ULs.length; i++) {
    if (ULs[i].parentNode.id != menu) {
      if (ULs[i].parentNode.className != 'open') {
		ULs[i].style.display = 'none'
      }
    }
  }
  // add effects to submenus
  var cuePlus = document.createElement('SPAN')
  cuePlus.appendChild(document.createTextNode('+'))
  var cueMinus = document.createElement('SPAN')
  cueMinus.appendChild(document.createTextNode('-'))
  var obj = $(menu).getElementsByTagName('UL')[0].getElementsByTagName('LI')[0]
  while (obj.nextSibling) {
    if (obj.nodeType == 1) {
      // check for sub <ul>
      ULs = obj.getElementsByTagName('UL')
      if (ULs.length > 0) {
        firstLink = obj.getElementsByTagName('A')[0]
        firstLink.href = 'javascript:void(0)'
		if (firstLink.parentNode.className != 'open') {
			firstLink.appendChild(cuePlus.cloneNode(true))
		} else {
			firstLink.appendChild(cueMinus.cloneNode(true))
		}
        firstLink.onclick = function() {
          subMenu = this.parentNode.getElementsByTagName('UL')[0]
          if (subMenu.style.display == 'none') {
            new Effect.BlindDown(subMenu)
            this.getElementsByTagName('SPAN')[0].innerHTML = '-'
          } else {
            new Effect.BlindUp(subMenu)
            this.getElementsByTagName('SPAN')[0].innerHTML = '+'
          }
        }
      }
    }
    obj = obj.nextSibling
  }
}