/***********************************************************************
*
* 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;
	}

var QualityLink = "";

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function P7_Snap() { //v2.62 by PVII
  var x,y,ox,bx,oy,p,tx,a,b,k,d,da,e,el,args=P7_Snap.arguments;a=parseInt(a);
  for (k=0; k<(args.length-3); k+=4)
   if ((g=MM_findObj(args[k]))!=null) {
    el=eval(MM_findObj(args[k+1]));
    a=parseInt(args[k+2]);b=parseInt(args[k+3]);
    x=0;y=0;ox=0;oy=0;p="";tx=1;da="document.all['"+args[k]+"']";
    if(document.getElementById) {
     d="document.getElementsByName('"+args[k]+"')[0]";
     if(!eval(d)) {d="document.getElementById('"+args[k]+"')";if(!eval(d)) {d=da;}}
    }else if(document.all) {d=da;} 
    if (document.all || document.getElementById) {
     while (tx==1) {p+=".offsetParent";
      if(eval(d+p)) {x+=parseInt(eval(d+p+".offsetLeft"));y+=parseInt(eval(d+p+".offsetTop"));
      }else{tx=0;}}
     ox=parseInt(g.offsetLeft);oy=parseInt(g.offsetTop);var tw=x+ox+y+oy;

     if(tw==0 || (navigator.appVersion.indexOf("MSIE 4")>-1 && navigator.appVersion.indexOf("Mac")>-1)) {
      ox=0;oy=0;if(g.style.left){x=parseInt(g.style.left);y=parseInt(g.style.top);
      }else{var w1=parseInt(el.style.width);bx=(a<0)?-5-w1:-10;
      a=(Math.abs(a)<1000)?0:a;b=(Math.abs(b)<1000)?0:b;
      x=document.body.scrollLeft + event.clientX + bx;
      y=document.body.scrollTop + event.clientY;}}
   }else if (document.layers) {x=g.x;y=g.y;var q0=document.layers,dd="";
    for(var s=0;s<q0.length;s++) {dd='document.'+q0[s].name;
     if(eval(dd+'.document.'+args[k])) {x+=eval(dd+'.left');y+=eval(dd+'.top');break;}}}
   if(el) {e=(document.layers)?el:el.style;
   var xx=parseInt(x+ox+a),yy=parseInt(y+oy+b);
   if(navigator.appName=="Netscape" && parseInt(navigator.appVersion)>4){xx+="px";yy+="px";}
   if(navigator.appVersion.indexOf("MSIE 5")>-1 && navigator.appVersion.indexOf("Mac")>-1){
    xx+=parseInt(document.body.leftMargin);yy+=parseInt(document.body.topMargin);
    xx+="px";yy+="px";}e.left=xx;e.top=yy;}}
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function NavigationList(pItem, HomeLink) {
	strIDs += '<tr><td align="left" class="leftnav"><img src="pixel.gif" width="1" height="1"></td></tr>';
	if(pItem != null) {
		for (var i = 1; i <= pItem.length; i++) { 
			strIDs += '&nbsp;<a href="' + pItem[i].sURL + '">'+ pItem[i].sName + '</a></td></tr>';
		}
	} else {
		strIDs += '<tr><td class="leftnav">no categories</td></tr>';
	}
	return strIDs
}


function GetTopNavDropDown(ar)
{
	var strIDs = '<select name="Category" class="FormSelect" id="Category">';
	var sel = " SELECTED";
	strIDs += '<OPTION ' + sel + ' VALUE="">Entire Store &nbsp;&nbsp;</OPTION>';
	for (var i=1;i<=ar.length;i++) {
		if (ar[i].sURL !=null) {
			strIDs += '<OPTION VALUE="' + ar[i].sURL + '&ACTINIC_REFERRER=' + escape(location.href) + '&NOCLEARFRAMES=1">' + ar[i].sName + '</OPTION>';
		}
	}
	strIDs+='</select>';
	return strIDs;
}

function GetTopNav(Section, HomeLink) {
	var returnString= '';

	if(Section != null) {
		for (var i = 1; i <= Section.length; i++) { 
			returnString+='  <tr>';
			returnString+='    <td width="176" class="leftnav"><a href="'+Section[i].sURL+'">'+Section[i].sName+'</a></td>';
			returnString+='  </tr>';
		}
	}

	return returnString;
}

function Get2LevelNav(Section, HomeLink) {
	var returnString= '';

	if(Section != null) {
		for (var i = 1; i <= Section.length; i++) { 
			if(Section[i].pChild && Section[i].pChild.length > 0) {
				returnString+='  <tr>';
				returnString+='    <td width="176" class="leftnav"><a href="javascript:;" onclick="resetMenu(\''+Section[i].nSectionId+'\')">'+Section[i].sName+'</a></td>';
				returnString+='  </tr>';
				returnString+='  <tr>';
				returnString+='    <td class="leftnav"><div style="display:none;padding-left:8px;" id="'+Section[i].nSectionId+'">';
				
				for(var j=1; j<=Section[i].pChild.length; j++) {
					returnString+=' <img src="pixel.gif" height="19" alt="spacer" width="1"><a href="'+Section[i].pChild[j].sURL+'" style="color:#ffffff;">'+Section[i].pChild[j].sName+'</a><br>';
				}
				returnString+='  <br></div></td>';
				returnString+='</tr>';
			} else {
				returnString+='  <tr>';
				returnString+='    <td width="176" class="leftnav"><a href="'+Section[i].sURL+'">'+Section[i].sName+'</a></td>';
				returnString+='  </tr>';
				returnString+='  <tr>';
				returnString+='    <td class="leftnav"></td>';
				returnString+='		</tr>';
			}
		}
	}

	return returnString;
}

function GetSection(pSectionArray, pSectionId) {
	if(!pSectionArray)
		return null;

	var i=1;
	var returnArray=null;
	while(i <= pSectionArray.length) {
		if(pSectionArray[i].nSectionId==pSectionId)
			return pSectionArray[i];

		returnArray=GetSection(pSectionArray[i].pChild, pSectionId);
		if(returnArray!=null)
			return returnArray;
		i++;
  }
	return null;
}

function GetParentSection(pSectionArray, pSectionId) {
	if(!pSectionArray)
		return false;

	var i=1;
	var returnArray=false;
	while(i <= pSectionArray.length) {
		if(pSectionArray[i].nSectionId==pSectionId)
			return true;
		returnArray=GetParentSection(pSectionArray[i].pChild, pSectionId);
		if(returnArray==true)
			return pSectionArray[i];
		else if(returnArray!=false) 
			return returnArray;
		i++;
  }
	return false;
}

function GetSubNav(pSectionArray, HomeLink) {
	var returnString='';
	if(typeof(document.forms[1].SID) != 'object')
		return returnString;
		
	var SectionId = document.forms[1].SID.value;
	if(SectionId==null) 
		return returnString;

	var Section = GetSection(pSectionArray, SectionId);
	if(Section == null)
		return returnString;
	returnString+='  <tr>';
	returnString+='    <td colspan="3" class="leftnav">&nbsp;</td>';
	returnString+='  </tr>';
	returnString+='  <tr>';
	returnString+='    <td colspan="2" class="leftnav"><strong>'+Section.sName+'</strong></td>';
	returnString+='  </tr>';

	if(Section.pChild && Section.pChild.length > 0) {
		for(var i=1; i<=Section.pChild.length; i++) {
			returnString+='  <tr>';
			returnString+='    <td width="140" align="left" valign="middle" class="leftnav"><a href="'+Section.pChild[i].sURL+'">'+Section.pChild[i].sName+'</a>&nbsp;</td>';
			returnString+='  </tr>';
		}
	}
	returnString+='  <tr>';
	returnString+='    <td class="leftnav">&nbsp;</td>';
	returnString+='  </tr>';

	var ParentSection = GetParentSection(pSectionArray, SectionId);
	if((ParentSection != false) && (ParentSection != true)) {
		if(ParentSection.pChild) {
			var j=1;
			while(j<=ParentSection.pChild.length) {
				if(ParentSection.pChild[j].nSectionId!=SectionId) {
					returnString+='  <tr>';
					returnString+='    <td colspan="2" class="leftnav"><strong><a href="'+ParentSection.pChild[j].sURL+'">'+ParentSection.pChild[j].sName+'</a></strong></td>';
					returnString+='  </tr>';
				}
				j++;
			}
		}
		returnString+='  <tr>';
		returnString+='    <td class="leftnav">&nbsp;</td>';
		returnString+='  </tr>';
		returnString+='  <tr>';
		returnString+='    <td class="leftnav"><a href="'+ParentSection.sURL+'">up level</a></td>';
		returnString+='  </tr>';
	} else {
		returnString+='  <tr>';
		returnString+='    <td class="leftnav"><a href="'+HomeLink+'">up level</a></td>';
		returnString+='  </tr>';

	}
	returnString+='  <tr>';
	returnString+='    <td class="leftnav">&nbsp;</td>';
	returnString+='  </tr>';
	return returnString;
}

function GetLeftNav(pSectionArray, HomeLink) {
	return Get2LevelNav(pSectionArray, HomeLink);
	/*
	if(typeof(document.forms[1]) != 'object')
		return GetTopNav(pSectionArray, HomeLink);
		
	if(typeof(document.forms[1].SID) != 'object') {
		return GetTopNav(pSectionArray, HomeLink);
	}	else {
		return GetSubNav(pSectionArray, HomeLink);
	}
	*/
}
/*
function FixImageURI(Features) {
	var ReturnString = '';
	var Position = Features.indexOf("<IMG SRC=");
	while(Position >=0) {
		ReturnString += Features.substring(0,Position+10);
		ReturnString += ImageLink;
		Features = Features.substring(Position+10, Features.length);
		Position = Features.indexOf("<IMG SRC=");
	}
	ReturnString += Features;
	return ReturnString;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
*/
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
}

function DisplayUploader() {
var obj,args=DisplayUploader.arguments;
document.getElementById('Uploader').src = args[2];
MM_showHideLayers('UploaderLayer','','show');
}
function HideUploader() {
var obj,args=HideUploader.arguments;
document.getElementById('Uploader').src = "imageuploader.php";
window.location.reload();
//	window.location.href = unescape(top.document.location.pathname);
MM_showHideLayers('UploaderLayer','','hide');
}
function FindMatch() {
var obj,args=FindMatch.arguments;
if(args.length < 2) return false;
for (var i = 0; i < args[1].length; i++) {
if(args[1][i] == args[0]) {
return true;
}
}
return false;
}

function rotator() {
	var whichImage = Math.round(Math.random()*(theImages.length-1));

	document.write('<a href="javascript:;" onclick="MM_goToURL(\'parent\',\''+theUrls[whichImage]+'\');return document.MM_returnValue"><img src="'+theImages[whichImage]+'" alt="Feature Product" /></a>');
}

function resetMenu(obj){
	var el="";
	if(section_tree != null) {
		for (var i = 1; i <= section_tree.length; i++) { 
			if(el = document.getElementById(section_tree[i].nSectionId)){
				el.style.display = "none";
			}
		}
	}
	if(document.getElementById){
		el = document.getElementById(obj);
		el.style.display = "block";
	}
}

function GetManufacturerJump() {
	if((nLevel!=null) && (nLevel>1)) {
		document.write('<table width="100%" bgcolor="#888888" border="0" cellspacing="1" cellpadding="5"><tr><td bgcolor="#fefeef" class="content" align="right">');
		document.write('<form name="jumpvendor" method="get" action="">Shop By Brand: <select name="selectJump" id="selectJump" onclick="MM_jumpMenu(\'parent\',this,0)"><option value="javascript:;">Select Manufacturer</option>');
		document.write('</select></form></td></tr></table>');
	}
}

function PopulateManufacturerJump(linkHref) {
	if((nLevel!=null) && (nLevel>1)) {
		if(document.forms[2]==null) return;
		var sectionId = document.forms[2].SID.value;
		var section = GetSection(section_tree,sectionId);
		if(section==null) return;
		if(section.pChild==null) {
			if(el = document.getElementById("manufacturerDrop")){
				el.style.display = "none";
			}
			
				return;
		}
		
		for (x = 0; x < vendors.length; x++) {
			document.forms['jumpvendor'].selectJump.options[x+1] = new Option(vendors[x],linkHref+'?TB=A&GB=A&SX='+sectionId+'&SS=&S_VENDOR1_0='+vendors[x]);
		}	
	}
}

function URLencode(sStr) {
    return escape(sStr).replace(/\+/g, '%2C').replace(/\"/g,'%22').replace(/\'/g, '%27');
}


var vendors = new Array();
vendors[0] = "Adidas";
vendors[1] = "Brine";
vendors[2] = "Diadora";
vendors[3] = "KwikGoal";
vendors[4] = "Nike";
vendors[5] = "Official Sports";
vendors[6] = "Puma";
vendors[7] = "Select";
vendors[8] = "Sondico";
vendors[9] = "Umbro";