<!--
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)
{
  myWindow = window.open(url, header, "width="+width+",height="+height+",resizable=yes");
  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'); 
    }
  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');
    }
}

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.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\">-</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\">+</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;
}

//-->
