
	
function getTargetPos(targetname, xoff, yoff, moveDiv) {
	//alert("xoff:" + xoff);
	//alert("yoff:" + yoff);
	var targetobj = document.getElementById(targetname);
	var targetDiv = document.getElementById? document.getElementById(moveDiv) : getRefToDiv(moveDiv);
	//alert(document.getElementById(targetname));
    //xpos = getposOffset(targetobj, "left");
	//ypos = getposOffset(targetobj, "top");
	//alert(getposOffset(targetobj, "top") - 18);
	//alert(getposOffset(targetobj, "top"));
	targetDiv.x = getposOffset(targetobj, "left") - xoff;
	targetDiv.y = getposOffset(targetobj, "top") - yoff;
	//alert(targetDiv.x);
	//alert(targetDiv.y);
	targetDiv.style.left = targetDiv.x; //- clearbrowseredge(mylayerobj, targetobj, "rightedge") + "px"
	targetDiv.style.top = targetDiv.y; //- clearbrowseredge(mylayerobj, targetobj, "bottomedge") + targetobj.offsetHeight + "px"
	targetDiv.style.display = "block";
	
	
	//xoff = getposOffset(targetobj, "left")
	//yoff = getposOffset(targetobj, "top"); //+ yoffset;
		
};

function getposOffset(what, offsettype){
	var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
	var parentEl=what.offsetParent;
	while (parentEl!=null){
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	};
	return totaloffset;
};

function getRefToDiv(divID,oDoc) {
  if( !oDoc ) { oDoc = document; }
  if( document.layers ) {
      if( oDoc.layers[divID] ) { return oDoc.layers[divID]; } else {
          //repeatedly run through all child layers
          for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) {
              //on success, return that layer, else return nothing
              y = getRefToDiv(divID,oDoc.layers[x].document); }
          return y; } }
  if( document.getElementById ) {
      return document.getElementById(divID); }
  if( document.all ) {
      return document.all[divID]; }
  return false;
};

function showpos(refPixel,xoff,yoff,moveDiv) {
alert(refPixel);
alert(moveDiv);
//var xoff = 0;
//var yoff = 0;
getTargetPos(refPixel, xoff, yoff, moveDiv);
//alert("X Offset: " + xoff);
//alert("Y Offset: " + yoff);
};

function setPos(refPixel,xoff,yoff) {
	var tx, ty
	var targetobj = document.getElementById(refPixel);
	tx = getposOffset(targetobj, "left");
	ty = getposOffset(targetobj, "top");
	//alert(Math.abs((ty + 3)- yoff));
	
	if (Math.abs((ty + 3)- yoff) > 3) {
		var targetDiv = document.getElementById? document.getElementById('mainBody') : getRefToDiv('mainBody');
		
		targetDiv.y = ty;
		targetDiv.x = tx;
	
		targetDiv.style.top = ty + 3;
		
	};
	
    
};
	

function showNavDiv(e, divid) {
	
	var navDivs = new Array();
    //Load subnav layers into array...
    navDivs.push("Specials");
    navDivs.push("BaseballBats");
    navDivs.push("WoodBaseballBats");
    navDivs.push("BaseballGloves");
    navDivs.push("Baseballs");
    navDivs.push("BattingGloves");
    navDivs.push("BaseballBags");
    navDivs.push("BattingHelmets");
    navDivs.push("CatchersGear");
    navDivs.push("PitchingMachines");
    navDivs.push("BaseballAccessories");
    navDivs.push("BaseballClothing");
    navDivs.push("BaseballShoes");
    navDivs.push("GiftCertificates");
    navDivs.push("ShopbyPosition");
    navDivs.push("ShopbyBrand");
    
    var i = 0;
	
	//make all possible display divs hidden
	for (i=0; i < navDivs.length; i++){
      if (navDivs[i] != divid){
        //alert("hiding div: " + navDivs[i]);
        document.getElementById(navDivs[i]).style.display='none';
        document.getElementById(navDivs[i]+'-red').style.display='none';
        document.getElementById(navDivs[i]+'-blue').style.display='inline';
        //document.getElementById(navDivs[i]-arrow).style.display='none';
        }
    }
	
	
	//now show this layer
	for (i=0; i < navDivs.length; i++){
      if (navDivs[i] == divid){
        //alert("showing div: " + navDivs[i]);
        document.getElementById(navDivs[i]).style.display='inline';
        document.getElementById(navDivs[i]+'-blue').style.display='none';
        document.getElementById(navDivs[i]+'-red').style.display='inline';
        }
    }
	
};

function hideAllNavDivs(){
    var navDivs = new Array();
    //Load subnav layers into array...
    navDivs.push("Specials");
    navDivs.push("BaseballBats");
    navDivs.push("WoodBaseballBats");
    navDivs.push("BaseballGloves");
    navDivs.push("Baseballs");
    navDivs.push("BattingGloves");
    navDivs.push("BaseballBags");
    navDivs.push("BattingHelmets");
    navDivs.push("CatchersGear");
    navDivs.push("PitchingMachines");
    navDivs.push("BaseballTrainingAids");
    navDivs.push("BaseballAccessories");
    navDivs.push("BaseballClothing");
    navDivs.push("BaseballShoes");
    navDivs.push("ProtectiveEquipment");
    navDivs.push("UmpiresGear");
    navDivs.push("Sunglasses");
    navDivs.push("GiftCertificates");
    navDivs.push("ShopbyPosition");
    navDivs.push("ShopbyBrand");
    
    var i = 0;
    
    //make all possible display divs hidden
	for (i=0; i < navDivs.length; i++){
      //alert("hiding div: " + navDivs[i]);
      document.getElementById(navDivs[i]).style.display='none';
    };
};
