var sPoint=screen.height-(screen.height/4);
var limit=20;
var temp;
var interval;
var SelFab="";
var FPath = "";

if (navigator.appName == "Microsoft Internet Explorer"){
	limit = 45;
}else{
	limit = -48;
}
function wri(Obj,vald){
	if (navigator.appName == "Microsoft Internet Explorer"){
			this[Obj].innerHTML=vald;
	} else {
			document.getElementById(Obj).innerHTML=vald;
	}
}

<!--
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 updateChk(cid,index,val){
	eval("fChk"+cid+"["+index+"]='"+val+"'");
	SelFab = SelF.join(",")+","
	if (val==true){
		eval("document.frm.C"+eval("fCode"+cid+"["+index+"]")+".value='"+eval("fQty"+cid+"["+index+"]")+"'");
		if (SelFab.indexOf(eval("fCode"+cid+"["+index+"]")+",")==-1){
			SelF[SelV.length] = eval("fCode"+cid+"["+index+"]");
			SelV[SelV.length] = eval("fQty"+cid+"["+index+"]");
			getTotal('','');
		} else if (SelFab.indexOf(eval("fCode"+cid+"["+index+"]")+",")!=-1) {	// --- IUpdate Qty
			for (kl=0;kl < SelF.length;kl++){
				if (SelF[kl] == eval("fCode"+cid+"["+index+"]")){
					Pos = kl;
					SelV[Pos] = eval("fQty"+cid+"["+index+"]");
					break;
				}
			}
		}
	}else{
		if (SelFab.indexOf(eval("fCode"+cid+"["+index+"]")+",")!=-1){
			for (kl=0;kl < SelF.length;kl++){
				if (SelF[kl] == eval("fCode"+cid+"["+index+"]")){
					Pos = kl;
					SelV.splice(Pos,1);
					SelF.splice(Pos,1);
					break;
				}
			}
			getTotal('','');
		}
		
		eval("document.frm.C"+eval("fCode"+cid+"["+index+"]")+".value='-1'");
	}
}

function updateQty(cid,index,val){
	eval("fQty"+cid+"["+index+"]='"+val+"'");
	updateChk(cid,index,true);
}

function showFabs(CatID,Start){
	html = "<table width=\"100\" border=\"0\" bordercolor=\"#445599\" bgcolor=\"#FFFFFF\"><tr>";
	counter = 0;
	for (i=Start-1; i<Start+7; i++){
		if (i<=eval("fCode"+CatID+".length")-1){
			counter += 1;
			html += "<td valign=\"top\"><table width=\"100\" border=\"1\" bordercolor=\"#445599\" bgcolor=\"#FFFFFF\">";
			html += "<tr>";
			html += "<td align=\"center\" bgcolor=\"#D3DCED\">" + eval("fColor"+CatID+"[i]") + "<br>" + eval("fCode"+CatID+"[i]") + "</td>";
			html += "</tr>";
			html += "<tr>";
			if (eval("fZoom"+CatID+"[i]")=="Shirt"){
				html += "<td align=\"center\"><a href=\"" + window.location.href + "\" onClick=\"sel('I" +  eval("fCode"+CatID+"[i]") + "',"+CatID+","+i+"); return false\" onMouseOver=\"MM_swapImage('I" +  eval("fCode"+CatID+"[i]").substr(1) + ".jpg','','img/shirt/small/" +  eval("fCode"+CatID+"[i]").substr(1) + ".jpg',1)\" onMouseOut=\"MM_swapImgRestore()\"><img id=\"I" +  eval("fCode"+CatID+"[i]").substr(1) + ".jpg\" src=\""+FPath+"smallc/" +  eval("fCode"+CatID+"[i]").substr(1) + ".jpg\" alt=\"" + eval("fCode"+CatID+"[i]") + ", " + eval("fDesc"+CatID+"[i]") + "\" width=\"100\" height=\"100\"></a></td>";
			} else {
				html += "<td align=\"center\"><a href=\"" + window.location.href + "\" onClick=\"sel('I" +  eval("fCode"+CatID+"[i]") + "',"+CatID+","+i+"); return false\"><img src=\""+FPath+"smallc/" +  eval("fCode"+CatID+"[i]").substr(1) + ".jpg\" alt=\"" + eval("fCode"+CatID+"[i]") + ", " + eval("fDesc"+CatID+"[i]") + "\" width=\"100\" height=\"100\"></a></td>";
			}
			html += "</tr>";
			html += "<tr>";
			if (eval("fZoom"+CatID+"[i]")=="Shirt"){
				html += "<td align=\"right\"><a href=\"" + window.location.href + "\" onClick=\"zoom('" + eval("fCode"+CatID+"[i]") + "','" + eval("fDesc"+CatID+"[i]").replace("'","\\'") + "','" + eval("fColor"+CatID+"[i]") + " ($" + eval("fPrice"+CatID+"[i]") + ")','i'); return false;\"><img src=\"img/zi.gif\" align=\"right\" alt=\"Zoom\"></a><a href=\"viewshirt.php?Code="+ eval("fCode"+CatID+"[i]").substr(1) +"&Description="+eval("fDesc"+CatID+"[i]")+"&Color=" + eval("fColor"+CatID+"[i]") + "&Price=" + eval("fPrice"+CatID+"[i]") + "&CatPrefix=\" onClick=\"openwin(this.href,255,350); return false;\" style=\"color:#FF0000; font-style:italic\" onMouseOver=\"MM_swapImage('I" +  eval("fCode"+CatID+"[i]").substr(1) + ".jpg','','img/shirt/small/" +  eval("fCode"+CatID+"[i]").substr(1) + ".jpg',1)\" onMouseOut=\"MM_swapImgRestore()\">view shirt</a></td>";
			} else {
				html += "<td><a href=\"" + window.location.href + "\" onClick=\"zoom('" + eval("fCode"+CatID+"[i]") + "','" + eval("fDesc"+CatID+"[i]").replace("'","\\'") + "','" + eval("fColor"+CatID+"[i]") + " ($" + eval("fPrice"+CatID+"[i]") + ")','i'); return false;\"><img src=\"img/zi.gif\" align=\"right\" alt=\"Zoom\"> <font size=\"1\">Zoom</font></a></td>";				
			}

			html += "</tr>";
			html += "<tr>";
			html += "<td bgcolor=\"#EBF0FA\" valign=\"baseline\">";
			html += "<input type=\"checkbox\" name=\"chk" + eval("fCode"+CatID+"[i]") + "\" id=\"I" + eval("fCode"+CatID+"[i]") + "\" value=\"" + eval("fCode"+CatID+"[i]") + "\" onclick=\"updateChk(" + CatID + "," + i + ",this.checked);\"";
			if (eval("fChk"+CatID+"[i]") == 'true'){
				html += " checked";
			}
			html += ">Qty:<select name=\"Qty" + eval("fCode"+CatID+"[i]") + "\" size=\"1\" onChange=\"if (this.value>1) window.document.getElementById('I" + eval("fCode"+CatID+"[i]") + "').checked=true; updateQty(" + CatID + "," + i + ",this.value); getTotal('','');\">";
			if (eval("fColor"+CatID+"[i]").toLowerCase().indexOf("white") >= 0){
				//UL = 12;
				UL = 6;
			} else{
				UL = 6;
			}
			if (eval("fShirts"+CatID+"[i]") < UL && eval("fShirts"+CatID+"[i]") != ""){
				UL = eval("fShirts"+CatID+"[i]");
			}
			if (UL==0) UL = 1;
			for (j=1; j<=UL; j++){
				if (eval("fQty"+CatID+"[i]")==j){
					html += "<option value=\"" + j + "\" selected>" + j + "&nbsp;</option>";
				} else{
					html += "<option value=\"" + j + "\">" + j + "&nbsp;</option>";
				}
			}

			html += "</select>";
			html += "</td>";
			html += "</tr>";
			html += "</table></td>";
			if (counter%4 == 0){
				html += "</tr><tr>";
			}
		}
	}
	html += "</tr></table><center style=\"line-height:25px\">";
	TotalPages = parseInt(eval("fCode"+CatID+".length") / 8);
	CurPage = parseInt((Start-1)/8)+1;
	if (eval("fCode"+CatID+".length") % 8 !=0) TotalPages += 1;
	if (TotalPages > 1){
		if (CurPage > 1){
			html += "<a href=\"custom-shirts/\" onclick=\"showFabs(" + eval(CatID) + "," + eval((CurPage-1)*8-7) + "); return false;\" style=\"color:#FF0000;font-weight:600;text-decoration:none\"  class=\"link1\">&nbsp;&laquo;&nbsp;</font></a> ";		
		}
		for (u=1;u <= TotalPages;u++){
			if (u==CurPage){
				html += "<a class=\"link2\"><b style=\"color:#ffffff\">&nbsp;" + u + "&nbsp;</b></a>&nbsp;";
			} else {
				html += "<a href=\"custom-shirts/\" class=\"link1\" onclick=\"showFabs(" + eval(CatID) + "," + ((u-1)*8+1) + "); return false;\" style=\"text-decoration:none; color:#ff0000\">&nbsp;" + u + "&nbsp;</a>&nbsp; ";	
			}
		}
		if (CurPage < TotalPages){
			html += " <a href=\"custom-shirts/\" onclick=\"showFabs(" + eval(CatID) + "," + ((CurPage*8)+1) + "); return false;\" style=\"text-decoration:none;font-weight:600; color:#ff0000\" class=\"link1\">&nbsp;&raquo;&nbsp;</a>";
		}
	}
	html += "</center>";
	document.getElementById("tdFabs"+CatID).innerHTML = html;
}

function displayMovie(){
	if(sPoint>=limit){
		temp=sPoint+"px";
		window.document.getElementById("mp").style.top=temp;
		sPoint-=1;
	}
	else{
		window.clearInterval(interval);
	}
}

function hideMovie(){
	window.document.getElementById("mp").style.display="none";
}

function setVariables() {
	if (navigator.appName == "Microsoft Internet Explorer"){
		v=".pixelTop=";
		dS="";
		sD=".style";
		y="document.body.scrollTop + 170";
	} else {
		v=".top=";
		dS="document.getElementById('";
		sD="')";
		y="window.pageYOffset + 300";
	}
}

function checkLocation() {
	object="cat";
	yy=eval(y);
	eval(dS+object+sD+v+yy);
}

function sel(inp,cid,index){
	var Obj = new  Object();
	Obj = document.getElementById(inp);
	if (Obj.checked==true){
		Obj.checked = false;
	} else {
		Obj.checked = true;
	}
	updateChk(cid,index,Obj.checked);
}

function zoom(code,desc,col){
	lastRow = "";
	openp('zoom2.php?code=' + code + '&Description=' + col + ',%20' + desc);
}

function openp(inp){
	window.open (inp,"fabv",'toolbar=No,width=300,height=205,menubar=No,scrollbars=No');
}


