<!--
var ns4 = document.layers;
var op5 = (navigator.userAgent.indexOf("Opera 5")!=-1)||(navigator.userAgent.indexOf("Opera/5")!=-1);
var op6 = (navigator.userAgent.indexOf("Opera 6")!=-1)||(navigator.userAgent.indexOf("Opera/6")!=-1);
var agt = navigator.userAgent.toLowerCase();
var mac = (agt.indexOf("mac")!=-1);
var ie = (agt.indexOf("msie") != -1);
var mac_ie = mac && ie;


function PopUp(url, header, width, height, scrollbars)
{
  var scrollbars = (scrollbars == null) ? "no" : scrollbars;

  myWindow = window.open(url, header, "width="+width+",height="+height+",resizable=yes,scrollbars="+scrollbars);
  window.myWindow.focus();
}

function resizeWindow(width, height)
{
  window.resizeTo(width, height);
}

function setShipping(obj)
{
  if(obj.shippingMode.checked == true)
    {
      obj.shippingFirstName.value         = obj.billingFirstName.value;
      obj.shippingLastName.value          = obj.billingLastName.value;
      obj.shippingCompanyName.value       = obj.billingCompanyName.value;

      obj.shippingCountryId.selectedIndex = obj.billingCountryId.selectedIndex;

      obj.shippingAddress1.value          = obj.billingAddress1.value;
      obj.shippingAddress2.value          = obj.billingAddress2.value;
      obj.shippingCity.value              = obj.billingCity.value;


      obj.shippingStateId.selectedIndex   = obj.billingStateId.selectedIndex;
      obj.shippingZip.value               = obj.billingZip.value;
      obj.shippingPhone.value             = obj.billingPhone.value;
      obj.shippingFax.value               = obj.billingFax.value;
      xajax_getStates('selectShippingStateId', obj.shippingCountryId.value, obj.billingStateId.value, 'shippingStateId', 'inputText');
    }
  else
    {
      obj.shippingFirstName.value         = '';
      obj.shippingLastName.value          = '';
      obj.shippingCompanyName.value       = '';
      obj.shippingCountryId.selectedIndex = '';
      obj.shippingAddress1.value          = '';
      obj.shippingAddress2.value          = '';
      obj.shippingCity.value              = '';

      obj.shippingStateId.selectedIndex   = '';
      obj.shippingZip.value               = '';
      obj.shippingPhone.value             = '';
      obj.shippingFax.value               = '';
      xajax_getStates('selectShippingStateId', obj.shippingCountryId.value, '', 'shippingStateId', 'inputText');
    }
}

function getElementHeight(Elem)
{
	 if (ns4)
	 {
		  var elem = getObjNN4(document, Elem);
		  return elem.clip.height;
	 }
	 else
	 {
		  if(document.getElementById)
			   var elem = document.getElementById(Elem);
		  else if (document.all)
			   var elem = document.all[Elem];

			 if (op5)
			   xPos = elem.style.pixelHeight;
		  else
			   xPos = elem.offsetHeight;

		  return xPos;
	 }
}

function getElementWidth(Elem)
{
	 if (ns4)
	 {
		  var elem = getObjNN4(document, Elem);
		  return elem.clip.width;
	 }
	 else
	 {
		  if(document.getElementById)
			   var elem = document.getElementById(Elem);
		  else if (document.all)
			   var elem = document.all[Elem];

		  if (op5)
		    xPos = elem.style.pixelWidth;
		  else
		    xPos = elem.offsetWidth;

		  return xPos;
	 }
}

function hideAdditionalDiamondInfo (rowNo)
{
  document.getElementById('diaPopup' + rowNo).style.visibility = 'hidden';
}

function showAdditionalDiamondInfo (rowNo, rowsCount, diaId)
{
  var minPopUpHeight = 325;
  var topOffset = 0;
  var leftOffset = -198;
  var arrowHeight = 47;
  var arrowTopOffset = 0;
  var arrowTargetOffset = 0; //point to wich arrow should target.. from this we should calculate popUp offset and then recalculate arrowTopOffset to local coordinates of popUp

  //rowsCount
  //arrowTargetOffset = document.getElementById('trid' + rowNo).offsetTop;
  //topOffset = document.getElementById('trid' + rowNo).offsetTop - Math.round(arrowHeight/4);

  var arrowOffset = document.getElementById('trid' + rowNo).offsetTop - Math.round(arrowHeight/4) + 3;

  if(document.getElementById('diaPopup' + rowNo))
  {
    if (document.getElementById('popArrow' + rowNo))
    {
      document.getElementById('popArrow' + rowNo).style.top = arrowOffset + 'px';
    }
    document.getElementById('diaPopup' + rowNo).style.top = topOffset + 'px';
    document.getElementById('diaPopup' + rowNo).style.left = leftOffset + 'px';
    document.getElementById('diaPopup' + rowNo).style.display = 'block';
    document.getElementById('diaPopup' + rowNo).style.visibility = 'visible';
  }
  else
  {
    currentPopup = document.createElement('div');
    currentPopup.setAttribute('id','diaPopup' + rowNo);
    document.getElementById('diamondsSearchResults').appendChild(currentPopup);

    currentPopup.style.width = '198px';
    currentPopup.style.position = 'absolute';

    currentPopup.style.top = topOffset + 'px';
    currentPopup.style.left = leftOffset + 'px';

    currentPopup.style.display = 'block';
    currentPopup.style.visibility = 'visible';

    document.getElementById('diaPopup' + rowNo).style.zIndex = 5002;

    var resultsTableHeight = document.getElementById('resultsTable').offsetHeight + 5;
    if (resultsTableHeight < minPopUpHeight) resultsTableHeight = minPopUpHeight;

    xajax_getDiaAddInfo(rowNo, diaId, resultsTableHeight, arrowOffset);
  }
}

function f(tdName) {
  var td = document.getElementById(tdName);
  td.style.backgroundImage='url(images/menuOverBg.gif)';
  td.style.backgroundRepeat='repeat-x';
  td.style.backgroundPosition='bottom';
}

function showPleaseWait(flag, element)
{
  var divWait = document.getElementById('pleaseWait');
  var divContent = document.getElementById(element);
  var tableWait = document.getElementById('pleaseWaitTable');

  if(flag==true)
  {
//    tableWait.style.position = 'absolute';
    tableWait.style.height = getElementHeight(element) + "px";
    divWait.style.display = "";
    divContent.style.display = "none";
  }
  else
  {
    divWait.style.display = "none";
    divContent.style.display = "";
  }
}

//function showPleaseWait(flag, element)
//{
//  var divWait = document.getElementById('pleaseWait');
//  var divContent = document.getElementById(element);
//  var tableWait = document.getElementById('pleaseWaitTable');
//
//  if(flag==true)
//  {
//    tableWait.style.height = getElementHeight(element) + "px";
//    divWait.style.display = "block";
//    divContent.style.display = "none";
//  }
//  else
//  {
//    divWait.style.display = "none";
//    divContent.style.display = "block";
//  }
//}

function fo(tdName) {
  var td = document.getElementById(tdName);
  td.style.background='transparent';
}

function getBrowser(objectName)
{
  if (document.all) {
    if (window.ActiveXObject) document.getElementById(objectName).style.marginLeft='0px';
    else document.getElementById(objectName).style.marginLeft='50%';
  } else {
    document.getElementById(objectName).style.marginLeft='50%';
  }
}

function fullInfoView(id, id1)
{
  var trFullInfo = document.getElementById(id);
  var tdFullInfo = document.getElementById(id1);

  if (trFullInfo.style.display == "none")
  {
    tdFullInfo.innerHTML = "<a href='#' onClick=\"fullInfoView('"+id+"', '"+id1+"'); return false;\" style=\"font-size: 16px; text-decoration: none;\" title=\"View Details\"><img src=\"images/minus.gif\" alt=\"\" /></a>";
    if (ie)
      trFullInfo.style.display = "inline";

    else
      trFullInfo.style.display = "";//table-row";
  }
  else
  {
    tdFullInfo.innerHTML = "<a href=\"#\" onClick=\"fullInfoView('"+id+"', '"+id1+"'); return false;\" style=\"font-size: 16px; text-decoration: none;\" title=\"View Details\"><img src=\"images/plus.gif\" alt=\"\" /></a>";
    trFullInfo.style.display = "none";
  }
}

function mail(id, section)
{
  PopUp('mail.php?section='+section+'&id='+id, 'email', 300, 700);
}


function ieCheck()
{
  if(ie)
    return true;
  else
    return false;
}

function paymentMethodOnChange(paymentMethod)
{
  if (paymentMethod == 'creditCard')
    document.getElementById('creditcardOptionsTable').style.display = 'block';
  else
    document.getElementById('creditcardOptionsTable').style.display = 'none';
}

function showBlock(blockName)
{
  blockId = blockName + 'Block';
  controlerId = blockName + 'Ctrl';
  var block = document.getElementById(blockId);
  block.style.display = (block.style.display == "none") ? "" : "none";
  control = document.getElementById(controlerId);
  if (control != undefined)
  {
    control.src = (block.style.display == "none")? "images/external/rh_exp_r.gif" : "images/external/rh_exp.gif";
  }

  pathname = location.pathname;
  myDomain = pathname.substring(0,pathname.lastIndexOf('/')) +'/';
  // Установка параметра expire на год вперед
  var largeExpDate = new Date ();
  largeExpDate.setTime(largeExpDate.getTime() + (365 * 24 * 3600 * 1000));

  setCookie('min_' + blockName, (block.style.display == "none")? 'hide' : 'show', largeExpDate, myDomain);
}

function getCookieVal (offset)
{
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
  endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function getCookie (name)
{
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen)
  {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0)
      break;
  }
  return null;
}

function setCookie(name, value, expires, path, domain, secure)
{
  var curCookie = name + "=" + escape(value) +
  ((expires) ? "; expires=" + expires.toGMTString() : "") +
  ((path) ? "; path=" + path : "") +
  ((domain) ? "; domain=" + domain : "") +
  ((secure) ? "; secure" : "")
  document.cookie = curCookie

}
//-->