/***********************************************************************
*
* getCartItem		-	Gets the Actinic Cart Value & No of Items
*
* Input: nIndex	-	Cart item index to retrieve
*							1 = TOTAL_VALUE
*							3 = CART_COUNT
*
* Returns:				Requested cart item or 0 (zero) if not found
*
************************************************************************/

//CART_CONTENT = Cookie name
//1 = TOTAL_VALUE
//3 = CART_COUNT

function getCartItem(nIndex)
	{
	var act_cart= getCookie("CART_CONTENT")
	var sTemp =(act_cart != null) ? sTemp=act_cart.split("\t"):0;
	return (sTemp.length > 0) ? sTemp[nIndex] : 0;
	}

/***********************************************************************
*
* GotoAnchor - JS for jumping to an anchor - some user agents don't handle
*				anchors correctly if BASE HREF is present
*
* Input: 				sAnchor
*
* Returns:				nothing
*
************************************************************************/

function GotoAnchor(sAnchor)
	{
	window.location.hash = sAnchor;
	}
	

// -- NEW FOR TOP NAV DROP DOWN MENU --

// Function for drop down menu to hide all dropdowns behind a div
function hideDropDowns( frontDiv ) {
    if (navigator.appName != "Microsoft Internet Explorer")
      return;
    frontDiv = document.getElementById(frontDiv);
    
    for(var i = 0; i < document.all.tags( "SELECT" ).length; ++i) {
        obj = document.all.tags( "SELECT" )[i];
        obj.style.visibility = "hidden";
        obj.tempHidden = '0';
    }
}

// Function for drop down menu to show all dropdowns in the document
function showDropDowns() {
    if (navigator.appName != "Microsoft Internet Explorer")
      return;

    var arrSelect = document.getElementsByTagName("SELECT");
    for(var i = 0; i < arrSelect.length; ++i) {
        if (arrSelect[i].tempHidden == '0') {
            arrSelect[i].style.visibility = "visible";
            arrSelect[i].tempHidden = '';
        }
    }
}  

// Function to position the top nav drop down elements
function positionDropDownTab(currentDiv, parentObj) {
  divObj = document.getElementById(currentDiv);
  var top = findPosY(parentObj);
  var left = findPosX(parentObj);
  if (navigator.appName == "Microsoft Internet Explorer") {
     divObj.style.top = top + 17;
     divObj.style.left = left + 0;
  } 
  else {
     divObj.style.top = top + 9;
     divObj.style.left = left - 1.5;
  }
}

 // Function to find the X position of an element ******** KEEP ***********
 function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

 // Function to find the Y position of an element ******** KEEP ***********
  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }

 

