function addcart(pic,price)
{document.getElementById("addcart").innerHTML="processing&nbsp;<img src='/vector/pict/wait4t.gif' align=absmiddle>";

 doHttpPost("/store/cart.php?mode=add&amount=1&product_code="+pic+"&ajax","addcart","");
 if (typeof isxcart !== 'undefined')
 {

  var cartcount=document.getElementById("cartcount").innerHTML;
  document.getElementById("cartcount").innerHTML=(parseInt(cartcount)+1);
  var carttotal=document.getElementById("carttotal").innerHTML.substring(1);
  carttotal=parseFloat(parseFloat(carttotal)+parseFloat(price));
  document.getElementById("carttotal").innerHTML="$"+carttotal.toFixed(2);
 }

 return false;
}

var ebay='',edit='',chain="",hrl="",hrl2="",hrl3="",callback="",http=getXHTTP();
imgw=new Image();imgw.src="/vector/pict/wait3.gif";

function dostat(s,t,u)
{if(s=="")window.status="SignTorch Vector Graphics";
	else {window.status=s;if((u||edit!='')&&t!=''&&t!=s)window.status+=" : "+t;}
 return true;
}

function doHttpPost(geturl,el,params)
{//while(hrl!="");hrl=el;
	if(hrl!="")setTimeout("doHttpPost('"+geturl+"','"+el+"','"+params+"')",250)
	else
	{hrl=el;
 	http.open("POST",geturl,true);
  http.onreadystatechange=getHttpRes;
  http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http.setRequestHeader("Content-length", params.length);
  http.setRequestHeader("Connection", "close");
  http.send(params);
 }
 return false;
}

function doHttpRequest(geturl,el)
{//while(hrl!="");hrl=el;http.open("GET",geturl,true);http.onreadystatechange=getHttpRes;http.send(null);return false;
	if(hrl!="")setTimeout("doHttpRequest('"+geturl+"','"+el+"')",250)
 else {hrl=el;http.open("GET",geturl,true);http.onreadystatechange=getHttpRes;http.send(null);}
 return false;
}
function getHttpRes()
{if(http.readyState==4){res=http.responseText;document.getElementById(hrl).innerHTML=res;hrl="";if(chain!="")eval(chain);}}


function getXHTTP()
{var xhttp;try{xhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e)
 {try{xhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e2)
  {try{xhttp=new XMLHttpRequest();}catch(e3){xhttp=false;}}
 } return xhttp;
}

// gets list then calls callback with results
function doListRequest(geturl,el,cb)
{//while(hrl3!="");hrl3=el;callback=cb;http.open("GET",geturl,true);http.onreadystatechange=getThumbRes;http.send(null);
if(hrl3!="")setTimeout("doListRequest('"+geturl+"','"+el+"','"+cb+"')",250)
 else
 	{hrl3=el;callback=cb;http.open("GET",geturl,true);http.onreadystatechange=getListRes;http.send(null);}
	}

function getListRes()
{if(http.readyState==4)
 {if(callback==""){document.getElementById(hrl3).innerHTML=http.responseText;}
  //else eval(callback+"('"+hrl3+"','"+http.responseText+"')");
  else {setTimeout("eval(\""+callback+"(\'"+hrl3+"\',\'"+http.responseText+"\')"+"\")",100);}
  hrl3="";callback="";
 }
}

function doHttpPopup(geturl,el,params)
{//while(hrl2!="");
	hrl2=el;
 http.open("POST",geturl,true);
 http.onreadystatechange=getHttpRes2;
 http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
 http.setRequestHeader("Content-length", params.length);
 http.setRequestHeader("Connection", "close");
 http.send(params);return false;
}
function getHttpRes2()
{if(http.readyState==4)
 {res=http.responseText;document.getElementById(hrl2).innerHTML=res;hrl2="";
 	setTimeout("setVisible(\"popup\")",100);
 }
}

function popup(pic,div,linkto)
{i=pic.split("/");if(typeof linkto==='undefined')linkto="";
 img1=new Image();img1.src=pic;
 window.status='SignTorch Vector Image Viewer';
 document.getElementById("popup").innerHTML="<div align=left style='background:#ffffff;padding:20px;width:300px;border:1px solid navy;'>Loading... <center><img src='/vector/pict/wait3.gif' align=top></center></div>";
 //document.getElementById("popup").innerHTML="<div align=left style='background:#ffffff;padding:20px;width:300px;border:1px solid navy;'>Loading... <center><img src='/vector/pict/wait3.gif' align=top></center>"+pic+"</div>";//alert(pic);
 setVisible("popup");
 imgloader(img1,pic,div,linkto);
 return false;
}

function imgloader(img1,pic,div,linkto)
{
 if(!img1.complete)imgWait=setTimeout('imgloader(img1,"'+pic+'","'+div+'","'+linkto+'")', 100);
 else{setHidden("popup");doHttpPopup("/vector/popup-"+div+".php?i="+pic+"&linkto="+linkto+ebay,"popup","");}
 return false;
}




function setVisible(div)
{var obj=document.getElementById(div);//alert("hello "+div);
 //if(document.body){theLeft=document.body.scrollLeft;theTop=document.body.scrollTop;}
 //else if(document.documentElement){theLeft=document.documentElement.scrollLeft;theTop=document.documentElement.scrollTop;}
 //theLeft+=(document.body.clientWidth-500)/2;theTop+=(document.body.clientHeight-600)/2;obj.style.left=theLeft+'px';obj.style.top=theTop+'px';obj.style.visibility='visible';
 //obj.style.marginLeft=""+parseInt((obj.offsetWidth/2-theLeft)*-1)+"px";
 //obj.style.marginTop=""+parseInt((obj.offsetHeight/2-theTop)*-1)+"px";

 wx=winx();
 wy=winy();
 sx=scrx();
 sy=scry();
 dx=parseInt(obj.offsetWidth);
 dy=parseInt(obj.offsetHeight);

 fx=Math.max(sx+(wx-dx)/2,sx);
 fy=Math.max(sy+(wy-dy)/2,sy);

 obj.style.marginLeft=fx+"px";
 obj.style.marginTop=fy+"px";



 obj.style.zIndex=10000;
 obj.style.visibility='visible';
 return false;
}
function setHidden(div){obj=document.getElementById(div);obj.style.visibility='hidden';}

function winx()
{return reVal(
		window.innerWidth?window.innerWidth:0,
		document.documentElement?document.documentElement.clientWidth:0,
		document.body?document.body.clientWidth:0
	);
}
function winy()
{return reVal(
		window.innerHeight?window.innerHeight:0,
		document.documentElement?document.documentElement.clientHeight:0,
		document.body?document.body.clientHeight:0
	);
}
function scrx()
{return reVal(
		window.pageXOffset?window.pageXOffset:0,
		document.documentElement?document.documentElement.scrollLeft:0,
		document.body?document.body.scrollLeft:0
	);
}
function scry()
{return reVal(
		window.pageYOffset?window.pageYOffset:0,
		document.documentElement?document.documentElement.scrollTop:0,
		document.body?document.body.scrollTop:0
	);
}
function reVal(n_win,n_doc,n_bod)
{var n_ret=n_win?n_win:0;
	if(n_doc&&(!n_ret||(n_ret>n_doc)))n_ret=n_doc;
	return n_bod&&(!n_ret||(n_ret>n_bod))?n_bod:n_ret;
}
