	var	view=0;
	var cartlive=0;
	var customer=0;
	var sid;
	var remcat=0;
	var remcat2=0;
	var remcat3=0;
	var remcat4=0;
	var	gshopid;
	var	gsstat;
	var	gres=0;
	var	gtick=0;

	var hredummy;

	var pWin2;

	function makeRequestLines(url) {
        var http_request = false;
        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
                // See note below about this line
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }
        if (!http_request) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
        http_request.onreadystatechange = function() { alertContentsLines(http_request); };
        http_request.open('GET', url, true);
        http_request.send(null);
    }
	var	pp=0;
	var np=0;
	var fp=0;

	function alertContentsLines(http_request) {

        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
				var xmlobject = http_request.responseXML;
				
				var root = xmlobject.documentElement;
				var rdel=0;
				if(!root){
					alert(xmlobject.documentElement);
					return;
				}

				var items = root.getElementsByTagName("doc1");
				for (var i=0; i<items.length; i++) {
					// get one item after another

					var item = items[i];
					// now we have the item object, time to get the contents
					// get the name of the item
					
					var dtype = item.getElementsByTagName("dtype")[0].firstChild.nodeValue;
					var ncaps = item.getElementsByTagName("ncaps")[0].firstChild.nodeValue;
					var crit1 = item.getElementsByTagName("crit1")[0].firstChild.nodeValue;
					
					if(dtype==5){
						
						if(rdel==0){
							rdel=1;
							nextr=2;
							var trs=document.getElementById('cap_shop').rows.length
							for(ri=2; ri<trs; ri++){
								document.getElementById('cap_shop').deleteRow(2)
							}
							var tcaps = item.getElementsByTagName("tcaps")[0].firstChild.nodeValue;
							var pnum = item.getElementsByTagName("pnum")[0].firstChild.nodeValue;
							var ldep = item.getElementsByTagName("ldep")[0].firstChild.nodeValue;
							ldep*=1;
							pnum*=1;
							tcaps*=1;
							var pnum2=pnum+1;
							var ldep3=ldep+pnum

							var ldep2=ldep+pnum-1;
							if(ldep3>tcaps) ldep3=tcaps;
							document.getElementById('pnum').value=pnum2
							document.getElementById('ldep').value=ldep3
							document.getElementById('tcaps').value=tcaps
							document.getElementById("dep").value=ldep

							np=ldep2+1;
							pp=pnum-ldep;

							if(pp<=0) pp=0;
							if(np>=tcaps)np=0;
							var lim	= item.getElementsByTagName("lim")[0].firstChild.nodeValue;
							//alert(lim);
						}
						document.getElementById("rstatus").value="";
						document.getElementById('cap_shop').style.display="";
						document.getElementById('navi').style.display="";
						
						var tbl=document.getElementById('cap_shop');
						x=tbl.insertRow(nextr)
						if(msie==1){
							x.attachEvent ("onmouseover", SetHi1);
							x.attachEvent ("onmouseout", SetHi2);
						}
						else{
							//x.addEventListener("onmouseover", SetHi1, false);
							//x.addEventListener("onmouseout", SetHi2, false);
							x.onmouseover	= SetHi1;
							x.onmouseout	= SetHi2;

						}
						nextr++;

						var c0=x.insertCell(0)
						var c1=x.insertCell(1)
						var c2=x.insertCell(2)
						var c3=x.insertCell(3)
						var c4=x.insertCell(4)
						var c5=x.insertCell(5)
						var c6=x.insertCell(6)
						var c7=x.insertCell(7)
						var c8=x.insertCell(8)
						var c9=x.insertCell(9)
						var c10=x.insertCell(10)
						var c11=x.insertCell(11)
						var c12=x.insertCell(12)
						var c13=x.insertCell(13)
						var c14=x.insertCell(14)
						var c15=x.insertCell(15)
						var c16=x.insertCell(16)
						var c17=x.insertCell(17)
						var c18=x.insertCell(18)
						var c19=x.insertCell(19)
						var c20=x.insertCell(20)
						var c21=x.insertCell(21)

						c0.style.fontSize="7pt"; 
						c1.style.fontSize="7pt"; 
						c2.style.fontSize="7pt"; 
						c3.style.fontSize="7pt"; 
						c4.style.fontSize="7pt"; 
						c5.style.fontSize="7pt"; 
						c6.style.fontSize="7pt"; 
						c7.style.fontSize="7pt"; 
						c8.style.fontSize="7pt"; 
						c9.style.fontSize="7pt"; 
						c10.style.fontSize="7pt"; 
						c11.style.fontSize="7pt"; 
						c12.style.fontSize="7pt"; 
						c13.style.fontSize="7pt"; 
						c14.style.fontSize="7pt"; 
						c15.style.fontSize="7pt"; 
						c16.style.fontSize="7pt"; 
						c17.style.fontSize="7pt"; 
						c18.style.fontSize="7pt"; 
						c19.style.fontSize="7pt"; 
						c20.style.fontSize="7pt"; 
						c21.style.fontSize="7pt"; 

						

						c0.style.borderTopWidth="0px"; 
						c1.style.borderTopWidth="0px"; 
						c2.style.borderTopWidth="0px"; 
						c3.style.borderTopWidth="0px"; 
						c4.style.borderTopWidth="0px"; 
						c5.style.borderTopWidth="0px"; 
						c6.style.borderTopWidth="0px"; 
						c7.style.borderTopWidth="0px"; 
						c8.style.borderTopWidth="0px"; 
						c9.style.borderTopWidth="0px"; 
						c10.style.borderTopWidth="0px"; 
						c11.style.borderTopWidth="0px"; 
						c12.style.borderTopWidth="0px"; 
						c13.style.borderTopWidth="0px"; 
						c14.style.borderTopWidth="0px"; 
						c15.style.borderTopWidth="0px"; 
						c16.style.borderTopWidth="0px"; 
						c17.style.borderTopWidth="0px"; 
						c18.style.borderTopWidth="0px"; 
						c19.style.borderTopWidth="0px"; 
						c20.style.borderTopWidth="0px"; 
						c21.style.borderTopWidth="0px"; 

						

						c0.style.borderLeftWidth="0px"; 
						c1.style.borderLeftWidth="0px"; 
						c2.style.borderLeftWidth="0px"; 
						c3.style.borderLeftWidth="0px"; 
						c4.style.borderLeftWidth="0px"; 
						c5.style.borderLeftWidth="0px"; 
						c6.style.borderLeftWidth="0px"; 
						c7.style.borderLeftWidth="0px"; 
						c8.style.borderLeftWidth="0px"; 
						c9.style.borderLeftWidth="0px"; 
						c10.style.borderLeftWidth="0px"; 
						c11.style.borderLeftWidth="0px"; 
						c12.style.borderLeftWidth="0px"; 
						c13.style.borderLeftWidth="0px"; 
						c14.style.borderLeftWidth="0px"; 
						c15.style.borderLeftWidth="0px"; 
						c16.style.borderLeftWidth="0px"; 
						c17.style.borderLeftWidth="0px"; 
						c18.style.borderLeftWidth="0px"; 
						c19.style.borderLeftWidth="0px"; 
						c20.style.borderLeftWidth="0px"; 
						c21.style.borderLeftWidth="0px"; 

						

						c0.style.borderRightWidth="0px"; 
						c1.style.borderRightWidth="0px"; 
						c2.style.borderRightWidth="0px"; 
						c3.style.borderRightWidth="0px"; 
						c4.style.borderRightWidth="0px"; 
						c5.style.borderRightWidth="0px"; 
						c6.style.borderRightWidth="0px"; 
						c7.style.borderRightWidth="0px"; 
						c8.style.borderRightWidth="0px"; 
						c9.style.borderRightWidth="0px"; 
						c10.style.borderRightWidth="0px"; 
						c11.style.borderRightWidth="0px"; 
						c12.style.borderRightWidth="0px"; 
						c13.style.borderRightWidth="0px"; 
						c14.style.borderRightWidth="0px"; 
						c15.style.borderRightWidth="0px"; 
						c16.style.borderRightWidth="0px"; 
						c17.style.borderRightWidth="0px"; 
						c18.style.borderRightWidth="0px"; 
						c19.style.borderRightWidth="0px"; 
						c20.style.borderRightWidth="0px"; 
						c21.style.borderRightWidth="0px"; 

						c0.style.borderBottomWidth="1px"; 
						c1.style.borderBottomWidth="1px"; 
						c2.style.borderBottomWidth="1px"; 
						c3.style.borderBottomWidth="1px"; 
						c4.style.borderBottomWidth="1px"; 
						c5.style.borderBottomWidth="1px"; 
						c6.style.borderBottomWidth="1px"; 
						c7.style.borderBottomWidth="1px"; 
						c8.style.borderBottomWidth="1px"; 
						c9.style.borderBottomWidth="1px"; 
						c10.style.borderBottomWidth="1px"; 
						c11.style.borderBottomWidth="1px"; 
						c12.style.borderBottomWidth="1px"; 
						c13.style.borderBottomWidth="1px"; 
						c14.style.borderBottomWidth="1px"; 
						c15.style.borderBottomWidth="1px"; 
						c16.style.borderBottomWidth="1px"; 
						c17.style.borderBottomWidth="1px"; 
						c18.style.borderBottomWidth="1px"; 
						c19.style.borderBottomWidth="1px"; 
						c20.style.borderBottomWidth="1px"; 
						c21.style.borderBottomWidth="1px";

						


						c0.style.borderBottomColor="#999999"; 
						c1.style.borderBottomColor="#999999"; 
						c2.style.borderBottomColor="#999999"; 
						c3.style.borderBottomColor="#999999"; 
						c4.style.borderBottomColor="#999999"; 
						c5.style.borderBottomColor="#999999"; 
						c6.style.borderBottomColor="#999999"; 
						c7.style.borderBottomColor="#999999"; 
						c8.style.borderBottomColor="#999999"; 
						c9.style.borderBottomColor="#999999"; 
						c10.style.borderBottomColor="#999999"; 
						c11.style.borderBottomColor="#999999"; 
						c12.style.borderBottomColor="#999999"; 
						c13.style.borderBottomColor="#999999"; 
						c14.style.borderBottomColor="#999999"; 
						c15.style.borderBottomColor="#999999"; 
						c16.style.borderBottomColor="#999999"; 
						c17.style.borderBottomColor="#999999"; 
						c18.style.borderBottomColor="#999999"; 
						c19.style.borderBottomColor="#999999"; 
						c20.style.borderBottomColor="#999999"; 
						c21.style.borderBottomColor="#999999";

						
						

						c0.align="center";
						c1.align="right";
						c2.align="right";
						c3.align="center";
						c4.align="center";
						c5.align="center";
						c6.align="center";
						c7.align="center";
						c8.align="center";
						c9.align="center";
						c10.align="center";
						c11.align="center";
						c12.align="center";
						c13.align="center";
						c14.align="center";
						c15.align="center";
						c16.align="center";
						c17.align="center";
						c18.align="center";
						c19.align="center";
						c20.align="right";
						c21.align="right";

						//c1.parentElement.bgColor=panel4;
						x.bgColor=panel4

						//alert("boo 2");

						var imagex	= item.getElementsByTagName("image")[0].firstChild.nodeValue
						if(imagex!="-"){
							var image4	= item.getElementsByTagName("image4")[0].firstChild.nodeValue;
							tip99=" onmouseover=\"ddrivetip('<center><img width=120 src="+image4+"  /></center> ','beige','150')\"; onmouseout=\"hideddrivetip()\" ";
							var image	= "<"+item.getElementsByTagName("image")[0].firstChild.nodeValue+tip99+"  "+item.getElementsByTagName("image2")[0].firstChild.nodeValue+"<"+item.getElementsByTagName("image3")[0].firstChild.nodeValue+"</a>";
						}
						else{
							var image=imagex;
						}
						

						var capid	= item.getElementsByTagName("capid")[0].firstChild.nodeValue;
						var lcnt	= item.getElementsByTagName("lcnt")[0].firstChild.nodeValue;
						var cref	= "<"+item.getElementsByTagName("cref")[0].firstChild.nodeValue+"</a>";
						var cdesc	= item.getElementsByTagName("cdesc")[0].firstChild.nodeValue;
						var mfgname = item.getElementsByTagName("mfgname")[0].firstChild.nodeValue;
						var series	= item.getElementsByTagName("series")[0].firstChild.nodeValue;
						var cval	= item.getElementsByTagName("cval")[0].firstChild.nodeValue;
						var cvdc	= item.getElementsByTagName("cvdc")[0].firstChild.nodeValue;
						var tolcode	= item.getElementsByTagName("tolcode")[0].firstChild.nodeValue;
						var tolplus	= item.getElementsByTagName("tolplus")[0].firstChild.nodeValue;
						var tolminus= item.getElementsByTagName("tolminus")[0].firstChild.nodeValue;
						var tmin	= item.getElementsByTagName("tmin")[0].firstChild.nodeValue;
						var tmax	= item.getElementsByTagName("tmax")[0].firstChild.nodeValue;
						var clen	= item.getElementsByTagName("clen")[0].firstChild.nodeValue;
						var cw1		= item.getElementsByTagName("cw1")[0].firstChild.nodeValue;
						var cw2		= item.getElementsByTagName("cw2")[0].firstChild.nodeValue;
						var cdiam	= item.getElementsByTagName("cdiam")[0].firstChild.nodeValue;
						var pitch	= item.getElementsByTagName("pitch")[0].firstChild.nodeValue;
						var leadlen	= item.getElementsByTagName("leadlen")[0].firstChild.nodeValue;
						var style	= item.getElementsByTagName("style")[0].firstChild.nodeValue;
						var ttype	= item.getElementsByTagName("ttype")[0].firstChild.nodeValue;
						var stklvl	= item.getElementsByTagName("stklvl")[0].firstChild.nodeValue;
						var sell	= item.getElementsByTagName("sell")[0].firstChild.nodeValue;
						var buy		="<center><"+item.getElementsByTagName("buy")[0].firstChild.nodeValue+" /><"+item.getElementsByTagName("buy2")[0].firstChild.nodeValue+" "+item.getElementsByTagName("buy3")[0].firstChild.nodeValue+" /></center>";

						var tip4=" onmouseover=\"ddrivetip('Click to procede to checkout section','beige')\"; onmouseout=\"hideddrivetip()\" ";

						buy+="<input type='button' value='checkout' onclick='Checkout();' style=' font-size:7pt; background-color :"+butcolor+"' "+tip4+" />";

						cval=cval.replace("yF","µF");
						tmin=tmin.replace("^C","°C");
						tmax=tmax.replace("^C","°C");
						
						c0.innerHTML=image
						c1.innerHTML=cref
						c2.innerHTML=cdesc
						c3.innerHTML=mfgname
						c4.innerHTML=series
						c5.innerHTML=cval
						c6.innerHTML=cvdc
						c7.innerHTML=tolcode
						c8.innerHTML=tolplus
						c9.innerHTML=tolminus
						c10.innerHTML=tmin
						c11.innerHTML=tmax
						c12.innerHTML=clen
						c13.innerHTML=cw1
						c14.innerHTML=cw2
						c15.innerHTML=cdiam
						c16.innerHTML=""+pitch+" / <br />"+leadlen+"";
						c17.innerHTML=style
						c18.innerHTML=ttype
						c19.innerHTML=stklvl
						c20.innerHTML=sell
						c21.innerHTML=buy

						

					}
					
					if(dtype==6){
						document.getElementById("rstatus").value="There are no items matching selected parameters.";
						//alert("There are no items matching selected parameters.");
					}
					if(dtype=="10"){
						if(remcat<=0){
							var cl=document.getElementById('capacitance').length
							var i2=0;
							for(i2=1; i2<cl; i2++){
								document.getElementById('capacitance').remove(1);
							}
							remcat=1;
						}
						document.getElementById("rstatus").value="";
						var val		= item.getElementsByTagName("val")[0].firstChild.nodeValue;
						var inner	= item.getElementsByTagName("inner")[0].firstChild.nodeValue;
						inner=inner.replace("yF","µF");
						var oOption = document.createElement("OPTION");
						document.getElementById('capacitance').options.add(oOption);
						//oOption.innerText = inner;
						oOption.innerHTML = inner;
						oOption.value = val;
					}
					if(dtype=="11"){
						if(remcat2<=0){
							var cl=document.getElementById('vdc').length
							var i2=0;
							for(i2=1; i2<cl; i2++){
								document.getElementById('vdc').remove(1);
							}
							remcat2=1;
						}
						document.getElementById("rstatus").value="";
						var val		= item.getElementsByTagName("val")[0].firstChild.nodeValue;
						var inner	= item.getElementsByTagName("inner")[0].firstChild.nodeValue;
						inner=inner.replace("yF","µF");
						var oOption = document.createElement("OPTION");
						document.getElementById('vdc').options.add(oOption);
						//oOption.innerText = inner;
						oOption.innerHTML = inner;
						oOption.value = val;
					}
					if(dtype=="11a"){
						var ruri		= item.getElementsByTagName("ruri")[0].firstChild.nodeValue;
						alert(ruri);
					}
					if(dtype=="12"){
						if(remcat3<=0){
							var cl=document.getElementById('sid').length
							var i2=0;
							for(i2=1; i2<cl; i2++){
								document.getElementById('sid').remove(1);
							}
							remcat3=1;
						}
						document.getElementById("rstatus").value="";
						var val		= item.getElementsByTagName("val")[0].firstChild.nodeValue;
						var inner	= item.getElementsByTagName("inner")[0].firstChild.nodeValue;
						inner=inner.replace("yF","µF");
						var oOption = document.createElement("OPTION");
						document.getElementById('sid').options.add(oOption);
						//oOption.innerText = inner;
						oOption.innerHTML = inner;
						oOption.value = val;
					}
					if(dtype=="13"){
						if(remcat4<=0){
							var cl=document.getElementById('tid').length
							var i2=0;
							for(i2=1; i2<cl; i2++){
								document.getElementById('tid').remove(1);
							}
							remcat4=1;
						}
						var val		= item.getElementsByTagName("val")[0].firstChild.nodeValue;
						var inner	= item.getElementsByTagName("inner")[0].firstChild.nodeValue;
						inner=inner.replace("yF","µF");
						var oOption = document.createElement("OPTION");
						document.getElementById('tid').options.add(oOption);
						//oOption.innerText = inner;
						oOption.innerHTML = inner;
						oOption.value = val;
					}
					if(dtype=="100"){
					 	var shopid		= item.getElementsByTagName("shopid")[0].firstChild.nodeValue;
						//alert("Order Confirmed ")
						document.location="cap_ccorrect1.php"	
					}
					if(dtype=="120"){
						//alert("Order cancelled")
						document.location="cap_ccorrect1.php"	
					}
				}
				if(dtype=="5")window.scrollTo(0,400)
			}
		}
	}

	function ListResults(shopid,sstat){
		var	pnum=0;
		var catid=document.getElementById("catid").value
		catid*=1;

		var vdc = new Array()

		var capacitance=document.getElementById("capacitance").value
		//var vdc=document.getElementById("vdc").value

		var clen=document.getElementById("vdc").length;
		var i;
		var x=document.getElementById("vdc");
		var ai=0;
		var vdc="";
		for(i=0;i<clen;i++){
			if(x.options[i].selected==true){
				vdc+=x.options[i].value+" ";
				ai++;
			}
		}

		//alert(vdc[0]);
		
		var sid=document.getElementById("sid").value
		var tid=document.getElementById("tid").value
		var ldep=document.getElementById("dep").value
		document.getElementById("rstatus").value="Please wait";
		var url="cap_lines1.php?catid="+catid+"&capacitance="+capacitance+"&vdc="+vdc+"&sid="+sid+"&tid="+tid+"&sstat="+sstat+"&shopid="+shopid+"&pnum="+pnum+"&ldep="+ldep;
		//alert(url);
		makeRequestLines(url);
		
	}

	function ListResults2(shopid,sstat,dir){
		
		var catid=document.getElementById("catid").value
		catid*=1;
		var capacitance=document.getElementById("capacitance").value
		//var vdc=document.getElementById("vdc").value

		var clen=document.getElementById("vdc").length;
		var i;
		var x=document.getElementById("vdc");
		var ai=0;
		var vdc="";
		for(i=0;i<clen;i++){
			if(x.options[i].selected==true){
				vdc+=x.options[i].value+" ";
				ai++;
			}
		}
		
		//alert(vdc[0]);

		var sid=document.getElementById("sid").value
		var tid=document.getElementById("tid").value
		var ldep=document.getElementById("dep").value
		var pnum=0;
		switch(dir){
			case 1:
				pnum=pp;
				break;
			case 2:
				pnum=np;
				break;
			case 3:
				pnum=fp;
			break
		
		}
		pnum*=1;
		document.getElementById("rstatus").value="Please wait";
		var url="cap_lines1.php?catid="+catid+"&capacitance="+capacitance+"&vdc="+vdc+"&sid="+sid+"&tid="+tid+"&sstat="+sstat+"&shopid="+shopid+"&pnum="+pnum+"&ldep="+ldep;
		makeRequestLines(url);
		//alert(url);
	}

	function makeRequest(url) {
        var http_request = false;
        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
                // See note below about this line
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }
        if (!http_request) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
        http_request.onreadystatechange = function() { alertContents(http_request); };
        http_request.open('GET', url, true);
        http_request.send(null);
    }

	function alertContents(http_request) {

        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
				var xmldoc = http_request.responseXML;

				var dtype_node = xmldoc.getElementsByTagName('dtype').item(0);
				var dtype=dtype_node.firstChild.data;

				if(dtype=="1"){
						var btot_node = xmldoc.getElementsByTagName('btot').item(0);
						document.getElementById("btot").value=btot_node.firstChild.data;
						document.getElementById("btot2").value=btot_node.firstChild.data;
						var oline_node = xmldoc.getElementsByTagName('oline').item(0);
						var lv=oline_node.firstChild.data;
						var lvalue_node = xmldoc.getElementsByTagName('lvalue').item(0);
						document.getElementById(lv).value=lvalue_node.firstChild.data;
				}
				if(dtype=="2"){
					var mf1="style=\" font-size:7pt; \" ";
					var mf2="style=\" font-size:7pt; \" ";
					var mf3="style=\" font-size:7pt; \" ";
					var mf4="style=\" font-size:7pt; \" ";
					var mf6="style=\" font-size:7pt; \" ";
					var x=document.getElementById('cart_tab').insertRow(2)
					var c0=x.insertCell(0)
					var c1=x.insertCell(1)
					var c2=x.insertCell(2)
					var c3=x.insertCell(3)
					var c4=x.insertCell(4)
					var c5=x.insertCell(5)
					var c6=x.insertCell(6)
					var c7=x.insertCell(7)
					var c8=x.insertCell(8)
					var c9=x.insertCell(9)
					var c10=x.insertCell(10)
					var c11=x.insertCell(11)


					var capid_node = xmldoc.getElementsByTagName('capid').item(0);
					var capid=capid_node.firstChild.data;

					var capid2_node = xmldoc.getElementsByTagName('capid2').item(0);
					var capid2=capid2_node.firstChild.data;

					var capimage_node = xmldoc.getElementsByTagName('capimage').item(0);
					if(capimage_node.firstChild.data=="-"){
						capimage="-";
					}
					else{
						var capimage="<a href='#" +capid2+ "' onclick=ShowPic('" +capimage_node.firstChild.data+ "','"+capid2+ "');  title='Click for a larger image'><img src='" +capimage_node.firstChild.data+"' width='50' border='0' alt='Cap Picture' /></a>";
					}

					var cdesc_node = xmldoc.getElementsByTagName('cdesc').item(0);
					var cdesc=cdesc_node.firstChild.data;

					var cval_node = xmldoc.getElementsByTagName('cval').item(0);
					var cval=cval_node.firstChild.data;

					cval=cval.replace("yF","µF");

					var cvdc_node = xmldoc.getElementsByTagName('cvdc').item(0);
					var cvdc=cvdc_node.firstChild.data;

					var cstyle_node = xmldoc.getElementsByTagName('cstyle').item(0);
					var cstyle=cstyle_node.firstChild.data;

					var ttype_node = xmldoc.getElementsByTagName('ttype').item(0);
					var ttype=ttype_node.firstChild.data;

					var minord_node = xmldoc.getElementsByTagName('minord').item(0);
					var minord=minord_node.firstChild.data;

					var listp_node = xmldoc.getElementsByTagName('listp').item(0);
					var listp="£ "+listp_node.firstChild.data;

					var qty_node = xmldoc.getElementsByTagName('qty').item(0);
					var qty=qty_node.firstChild.data;

					var ncart_node = xmldoc.getElementsByTagName('ncart').item(0);
					var ncart=ncart_node.firstChild.data;

					var tvalu_node = xmldoc.getElementsByTagName('tvalu').item(0);
					var tvalu=tvalu_node.firstChild.data;

					var shopid_node = xmldoc.getElementsByTagName('shopid').item(0);
					var shopid=shopid_node.firstChild.data;

					var valu_node = xmldoc.getElementsByTagName('valu').item(0);
					var valu="£<input type='text' "+mf4+" id='lv"+capid2+"' value='"+valu_node.firstChild.data+"' size='5' readonly='readonly' style=\"font-size:7pt; text-align : right; \" />";

					var quant="<input type='text' "+mf1+" name='uc"+capid2+"' id='uc"+capid2+"' size='3' value='"+qty+"' /><input type='button' "+mf4+" value='Update' style=' background-color :"+butcolor+"' onclick=\"UpCart('uc"+capid2+"','"+capid2+"','lv"+capid2+"','"+shopid+"');\" />";
					var remove="<input type='button' "+mf2+" value='Remove Item' style=' background-color :"+butcolor+"' onclick=\"RemoveCart('uc"+capid2+"','"+capid2+"','"+shopid+"', this.parentNode.parentNode.rowIndex );  \"  />";

					c0.innerHTML=capimage
					c1.innerHTML=capid
					c2.innerHTML=cdesc
					c3.innerHTML=cval
					c4.innerHTML=cvdc
					c5.innerHTML=cstyle
					c6.innerHTML=ttype
					c7.innerHTML=minord
					c8.innerHTML=listp
					c9.innerHTML=quant
					c10.innerHTML=valu
					c11.innerHTML=remove
					
					c3.align="right";
					c4.align="right";
					c7.align="right";
					c8.align="right";

					c1.style.fontSize="7pt"; 
					c1.style.backgroundColor="#aaddff"; 
					c2.style.fontSize="7pt"; 
					c2.style.backgroundColor="#aaddff"; 
					c3.style.fontSize="7pt"; 
					c3.style.backgroundColor="#aaddff"; 
					c4.style.fontSize="7pt"; 
					c4.style.backgroundColor="#aaddff"; 
					c5.style.fontSize="7pt"; 
					c5.style.backgroundColor="#aaddff"; 
					c6.style.fontSize="7pt"; 
					c6.style.backgroundColor="#aaddff"; 
					c7.style.fontSize="7pt"; 
					c7.style.backgroundColor="#aaddff"; 
					c8.style.fontSize="7pt"; 
					c8.style.backgroundColor="#aaddff"; 
					c9.style.fontSize="7pt"; 
					c9.style.backgroundColor="#aaddff"; 
					c10.style.fontSize="7pt"; 
					c10.style.backgroundColor="#aaddff"; 
					c11.style.fontSize="7pt"; 
					c11.style.backgroundColor="#aaddff"; 

					document.getElementById("btot").value=tvalu;
					document.getElementById("btot2").value=tvalu;
					document.getElementById('litot2').value=ncart;
				}
				if(dtype=="2A"){
					
					var capid_node = xmldoc.getElementsByTagName('capid').item(0);
					var capid=capid_node.firstChild.data;
					var ncaps_node = xmldoc.getElementsByTagName('ncaps').item(0);
					var ncaps=ncaps_node.firstChild.data;
					var qty_node = xmldoc.getElementsByTagName('qty').item(0);
					var qty=qty_node.firstChild.data;
					ncaps*=1;
					qty*=1;

					var boqty=ncaps-qty;
					document.getElementById('backqty').value=boqty
					document.getElementById('ov1').value=qty
					document.getElementById('ov2').value=qty
					document.getElementById('over_tab').style.display="";
					document.getElementById('ovcap').value=capid;
					window.scrollTo(0,0)
				}
				if(dtype=="3"){
					var rown_node = xmldoc.getElementsByTagName('rown').item(0);
					var rown=rown_node.firstChild.data;
					var tvalu_node = xmldoc.getElementsByTagName('tvalu').item(0);
					var tvalu=tvalu_node.firstChild.data;
					var ncart_node = xmldoc.getElementsByTagName('ncart').item(0);
					var ncart=ncart_node.firstChild.data;

					document.getElementById('cart_tab').deleteRow(rown)
					document.getElementById("btot").value=tvalu;
					document.getElementById("btot2").value=tvalu;
					document.getElementById('litot2').value=ncart;
					if(tvalu<=0){
						document.getElementById('checkout_tab').style.display="none";
						document.getElementById('checkout_tab1').style.display="none";
						document.getElementById('checkout_tab2').style.display="none";
						document.getElementById('checkout_tab3').style.display="none";
						document.getElementById('checkout_tab4').style.display="none";
						document.getElementById('checkout_tab5').style.display="none";
						document.getElementById('rectab').style.display="none";
						document.getElementById('ordstatus').value="";
						document.getElementById('cart_tab').style.display="none";
						view=0;
						document.getElementById('vcart').value="View basket";

					}
				}
				if(dtype=="9"){
					var shopid_node = xmldoc.getElementsByTagName('shopid').item(0);
					var shopid=shopid_node.firstChild.data;

					var ri;
					var tvalu="0.00";
					var trs=document.getElementById('cart_tab').rows.length
					trs-=1;
					for(ri=2; ri<trs; ri++){
						document.getElementById('cart_tab').deleteRow(2)
					}
					document.getElementById('cart_tab').style.display="none";
					view=0;

					document.getElementById('vcart').value="View basket";
					document.getElementById('btot').value=tvalu;
					document.getElementById('btot2').value=tvalu;
					document.getElementById('litot2').value=0;
				}
				if(dtype=="20"){
					//alert("Lookup OK");

					var street_node = xmldoc.getElementsByTagName('street').item(0);
					var street=street_node.firstChild.data;
					var locality_node = xmldoc.getElementsByTagName('locality').item(0);
					var locality=locality_node.firstChild.data;
					var town_node = xmldoc.getElementsByTagName('town').item(0);
					var town=town_node.firstChild.data;

					var county_node = xmldoc.getElementsByTagName('county').item(0);
					var county=county_node.firstChild.data;

					var pcode_node = xmldoc.getElementsByTagName('pcode').item(0);
					var pcode=pcode_node.firstChild.data;

					var remember_node = xmldoc.getElementsByTagName('remember').item(0);
					var remember=remember_node.firstChild.data;

					var okhouse_node = xmldoc.getElementsByTagName('okhouse').item(0);
					var okhouse=okhouse_node.firstChild.data;


					if(locality=="-")locality="";

					document.getElementById("street").value=street;
					document.getElementById("add1").value=locality;
					document.getElementById("add2").value=town;
					document.getElementById("add3").value=county;
					document.getElementById("pcode").value=pcode;

					var fname=document.getElementById("fname").value;
					var lname=document.getElementById("lname").value;
					var coname=document.getElementById("coname").value;
					var hno=document.getElementById("hno").value;
					var email=document.getElementById("email").value;
					var btot=document.getElementById("btot").value;
					var ccode=document.getElementById("ccode").value;
					var title=document.getElementById("title").value;
					var vatcode=document.getElementById("vatcode").value;
					
					var tel=document.getElementById("tel").value;
					var mob=document.getElementById("mob").value;
					var fax=document.getElementById("fax").value;

					if(okhouse==1){
						var hre="cap_purchase1.php?fname="+fname+"&lname="+lname+"&hno="+hno+"&street="+street+"&locality="+locality+"&remember="+remember;
						hre+="&town="+town+"&county="+county+"&pcode="+pcode+"&email="+email+"&btot="+btot+"&ccode="+ccode+"&title="+title+"&coname="+coname;
						hre+="&tel="+tel+"&mob="+mob+"&fax="+fax;
						pWin2.document.location=hre;
						document.getElementById('ordstatus').value="Awaiting payment";
						timedCount2();
					}
					else{
						document.getElementById('hnoOver').style.display="";
						pWin2.window.close();
						alert("Address check - House number/name not found\r\nCheck the override box if you have entered the Number/Name correctly.");
						
					}

				}
				if(dtype=="21"){
					
					var street_node = xmldoc.getElementsByTagName('street').item(0);
					var street=street_node.firstChild.data;
					var locality_node = xmldoc.getElementsByTagName('locality').item(0);
					var locality=locality_node.firstChild.data;
					var town_node = xmldoc.getElementsByTagName('town').item(0);
					var town=town_node.firstChild.data;

					var county_node = xmldoc.getElementsByTagName('county').item(0);
					var county=county_node.firstChild.data;

					var pcode_node = xmldoc.getElementsByTagName('pcode').item(0);
					var pcode=pcode_node.firstChild.data;

					if(locality=="-")locality="";

					document.getElementById("street").value=street;
					document.getElementById("add1").value=locality;
					document.getElementById("add2").value=town;
					document.getElementById("add3").value=county;
					document.getElementById("pcode").value=pcode;
					pWin2.window.close();
					alert("Address check - House number/name not found");
				}
				if(dtype=="22"){
					var remember_node = xmldoc.getElementsByTagName('remember').item(0);
					var remember=remember_node.firstChild.data;

					var fname=document.getElementById("fname").value;
					var lname=document.getElementById("lname").value;
					var hno=document.getElementById("hno").value;
					var email=document.getElementById("email").value;
					var btot=document.getElementById("btot").value;
					var ccode=document.getElementById("ccode").value;
					var title=document.getElementById("title").value;
					var vatcode=document.getElementById("vatcode").value;
					var street=document.getElementById("street").value;
					var locality=document.getElementById("add1").value;
					var town=document.getElementById("add2").value;
					var county=document.getElementById("add3").value;
					var pcode=document.getElementById("pcode").value;
					var tel=document.getElementById("tel").value;
					var mob=document.getElementById("mob").value;
					var fax=document.getElementById("fax").value;

					var hre="cap_purchase1.php?fname="+fname+"&lname="+lname+"&hno="+hno+"&street="+street+"&locality="+locality+"&remember="+remember;
					hre+="&town="+town+"&county="+county+"&pcode="+pcode+"&email="+email+"&btot="+btot+"&ccode="+ccode+"&title="+title+"&vatcode="+vatcode;
					hre+="&tel="+tel+"&mob="+mob+"&fax="+fax;
					pWin2.document.location=hre;
					
					
					document.getElementById('ordstatus').value="Awaiting payment";



				}
				if(dtype=="30"){

					var title_node = xmldoc.getElementsByTagName('title').item(0);
					var title=title_node.firstChild.data;

					var fname_node = xmldoc.getElementsByTagName('fname').item(0);
					var fname=fname_node.firstChild.data;

					var lname_node = xmldoc.getElementsByTagName('lname').item(0);
					var lname=lname_node.firstChild.data;

					var coname_node = xmldoc.getElementsByTagName('coname').item(0);
					var coname=coname_node.firstChild.data;

					var hno_node = xmldoc.getElementsByTagName('hno').item(0);
					var hno=hno_node.firstChild.data;

					var street_node = xmldoc.getElementsByTagName('street').item(0);
					var street=street_node.firstChild.data;

					var locality_node = xmldoc.getElementsByTagName('locality').item(0);
					var locality=locality_node.firstChild.data;

					var town_node = xmldoc.getElementsByTagName('town').item(0);
					var town=town_node.firstChild.data;

					var county_node = xmldoc.getElementsByTagName('county').item(0);
					var county=county_node.firstChild.data;

					var pcode_node = xmldoc.getElementsByTagName('pcode').item(0);
					var pcode=pcode_node.firstChild.data;

					var country_node = xmldoc.getElementsByTagName('country').item(0);
					var country=country_node.firstChild.data;

					var email_node = xmldoc.getElementsByTagName('email').item(0);
					var email=email_node.firstChild.data;


					var nords_node = xmldoc.getElementsByTagName('nords').item(0);
					var nords=nords_node.firstChild.data;

					var customer_node = xmldoc.getElementsByTagName('customer').item(0);
					customer=customer_node.firstChild.data;
					
					var tel_node = xmldoc.getElementsByTagName('tel').item(0);
					var tel=tel_node.firstChild.data;
					
					var mob_node = xmldoc.getElementsByTagName('mob').item(0);
					var mob=mob_node.firstChild.data;
					
					var fax_node = xmldoc.getElementsByTagName('fax').item(0);
					var fax=fax_node.firstChild.data;


					if(locality=="-")locality="";
					if(title=="-")title="";
					if(fname=="-")fname="";
					if(lname=="-")lname="";
					if(coname=="-")coname="";
					if(tel=="-")tel="";
					if(mob=="-")mob="";
					if(fax=="-")fax="";
					
					document.getElementById("title").value=title;
					document.getElementById("fname").value=fname;
					document.getElementById("lname").value=lname;
					document.getElementById("coname").value=coname;
					document.getElementById("hno").value=hno;
					document.getElementById("street").value=street;
					document.getElementById("add1").value=locality;
					document.getElementById("add2").value=town;
					document.getElementById("add3").value=county;
					document.getElementById("pcode").value=pcode;
					document.getElementById("email").value=email;
					document.getElementById("tel").value=tel;
					document.getElementById("mob").value=mob;
					document.getElementById("fax").value=fax;
					var clen=document.getElementById("ccode").length;
					var i;
					var x=document.getElementById("ccode");
					var ai=0;
					for(i=0;i<clen;i++){
						if(x.options[i].value==country){
							x.options[i].selected=true;
						}
					}
					if(country=="GB"){
						document.getElementById('checkout_tab3').style.display="none";
						document.getElementById('checkout_tab5').style.display="none";	
					}
					else{
						document.getElementById('checkout_tab3').style.display="";
						document.getElementById('checkout_tab5').style.display="";	
					}
					document.getElementById('login').style.display="none"
					document.getElementById('logedin').style.display=""
					document.getElementById('whome').value=title+' '+fname+' '+lname;

					if(nords>=1){
						document.getElementById('pastord').style.display=""
					}

					var url="cap_checkeu1.php?ccode="+country;
					makeRequest(url);
				}
				if(dtype==="31"){
					var email_node = xmldoc.getElementsByTagName('email').item(0);
					var email=email_node.firstChild.data;
					var pw_node = xmldoc.getElementsByTagName('pw').item(0);
					var pw=pw_node.firstChild.data;
					alert("Your details have not been found\r\nCheck your email address and password");
				}
				if(dtype==="40"){
					var euvat_node = xmldoc.getElementsByTagName('euvat').item(0);
					var euvat=euvat_node.firstChild.data;
					if(euvat==1){
						document.getElementById('euvat').style.display="";
					}
					else{
						document.getElementById('euvat').style.display="none";
						document.getElementById('vatcode').value="";
					}
				}
				if(dtype=="60"){
					var cstat_node = xmldoc.getElementsByTagName('cstat').item(0);
					var cstat=cstat_node.firstChild.data;
					var invfile_node = xmldoc.getElementsByTagName('invfile').item(0);
					var invfile=invfile_node.firstChild.data;
					clearTimeout(t2)
					cstat*=1;
					gtick++;
					document.getElementById('ordstatus').value="Waiting "+gtick;
					switch(cstat){
						case 1:
							t2=setTimeout("timedCount3()",1000)
							break;
						case 2:
							OrderOK(invfile);
							document.getElementById('makep').disabled=true;
							break;
						case 3:
							OrderCancel();
							break;
					}
					
				}
				if(dtype=="90"){
					var emailcust_node = xmldoc.getElementsByTagName('emailcust').item(0);
					var emailcust=emailcust_node.firstChild.data;
					alert("Your password has been sent to your email address.");
				}
				if(dtype=="91"){
					var emailcust_node = xmldoc.getElementsByTagName('emailcust').item(0);
					var emailcust=emailcust_node.firstChild.data;
					alert("Sorry no record for "+emailcust);
				}
			}
			else {
                alert('There was a problem with the request.');
            }
		}
	}
	function LogIn(shopid){
		var emailcust=document.getElementById('emailcust').value;
		var pw=document.getElementById('pw').value;
		if(emailcust && pw){
			var url="cap_checkpw.php?emailcust="+emailcust+"&pw="+pw+"&shopid="+shopid;
			makeRequest(url);
		}
	}
	function AddCart(boxid,capid,shopid,but){
		var ncaps=document.getElementById(boxid).value;
		if(cartlive<=0){
			//document.getElementById('capid').value=capid;
			//document.getElementById('ncaps').value=ncaps;
			//document.getElementById('fselect').submit();	
		}
		else{
			var url="cap_addcart1.php?capid="+capid+"&ncaps="+ncaps+"&shopid="+shopid;
			makeRequest(url);
			but.value="added";
			but.disabled=true;

		
			document.getElementById('checkout_tab').style.display="none";
			document.getElementById('checkout_tab1').style.display="none";
			document.getElementById('checkout_tab2').style.display="none";
			document.getElementById('checkout_tab3').style.display="none";
			document.getElementById('checkout_tab4').style.display="none";
			document.getElementById('checkout_tab5').style.display="none";
			document.getElementById('rectab').style.display="none";
			document.getElementById('ordstatus').value="";
		}
	}
	function EditCap(capid,sstat){
		var hre="cap_edit1.php?capid="+capid+"&sstat="+sstat;
		pWin=window.open(hre, '_blank','toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes,status=yes,fullscreen=no,width=980,height=500,top=10,left=10'); 
		pWin.opener = self; 
	}
	function ShowPic(capic,capid){
		if(!capid) capid=-1;
		var hre="cap_pic1.php?capic="+capic+"&amp;capid="+capid;
		pWin=window.open(hre, '_blank','toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes,status=yes,fullscreen=no,width=600,height=400'); 
		pWin.opener = self; 
	}
	
	function ViewCart(){
		if(document.getElementById('btot').value>=0.1){
			if(view>=1){
				document.getElementById('cart_tab').style.display="none";
				view=0;
				document.getElementById('vcart').value="View basket";
			}
			else{
				
				document.getElementById('cart_tab').style.display="";
				view=1;
				document.getElementById('vcart').value="Hide basket";
			}
		}
	}
	function UpCart(boxid,capid,lvalue,shopid){
		var ncaps=document.getElementById(boxid).value;
		var url="cap_upcart1.php?capid="+capid+"&ncaps="+ncaps+"&lvalue="+lvalue+"&shopid="+shopid;
		makeRequest(url);
		document.getElementById('checkout_tab').style.display="none";
		document.getElementById('checkout_tab1').style.display="none";
		document.getElementById('checkout_tab2').style.display="none";
		document.getElementById('checkout_tab3').style.display="none";
		document.getElementById('checkout_tab4').style.display="none";
		document.getElementById('checkout_tab5').style.display="none";
		document.getElementById('rectab').style.display="none";
		document.getElementById('ordstatus').value="";
	}
	function RemoveCart(boxid,capid,shopid,rown){
		var ncaps=document.getElementById(boxid).value;
		var ncaps=document.getElementById(boxid).value;
		var url="cap_delrow1.php?capid="+capid+"&ncaps="+ncaps+"&shopid="+shopid+"&rown="+rown;
		makeRequest(url);
	}
	function Checkout(){
		view=0;
		ViewCart();
		if(cartlive>=1){
			if(document.getElementById('btot').value>=0.1){
				document.getElementById('checkout_tab').style.display="";
				document.getElementById('checkout_tab1').style.display="";
				document.getElementById('checkout_tab2').style.display="";
				var ccode=document.getElementById('ccode').value;
				if(ccode=="GB"){
					document.getElementById('checkout_tab3').style.display="none";
					document.getElementById('checkout_tab5').style.display="none";	
				}
				else{
					document.getElementById('checkout_tab3').style.display="";
					document.getElementById('checkout_tab5').style.display="";	
				}
				document.getElementById('checkout_tab4').style.display="";
				window.scrollTo(0,0)
			}
			
			var url="cap_checkeu1.php?ccode="+ccode;
			makeRequest(url);
		}
		
	}
	function KeepShopping(){
		document.getElementById('checkout_tab').style.display="none";
		document.getElementById('checkout_tab1').style.display="none";
		document.getElementById('checkout_tab2').style.display="none";
		document.getElementById('checkout_tab3').style.display="none";
		document.getElementById('checkout_tab4').style.display="none";
		document.getElementById('checkout_tab5').style.display="none";
		//document.getElementById('rectab').style.display="none";
	}
	function EmptyCart(shopid){
		document.getElementById('empty').value=1;
		var url="cap_empty1.php?shopid="+shopid;
		makeRequest(url);
		document.getElementById('checkout_tab').style.display="none";
		document.getElementById('checkout_tab1').style.display="none";
		document.getElementById('checkout_tab2').style.display="none";
		document.getElementById('checkout_tab3').style.display="none";
		document.getElementById('checkout_tab4').style.display="none";
		document.getElementById('checkout_tab5').style.display="none";
		document.getElementById('rectab').style.display="none";
		document.getElementById('ordstatus').value="";
	}
	function CheckPurchase(shopid){

		var okf=1;
		var msg1="";
		var override;

		sid=shopid;
		gshopid=shopid;

		var uk=0;
		var ccode=document.getElementById('ccode').value;

		if(document.getElementById('ccode').value=="GB"){
			uk=1;
		}
		else{
			uk=0;
		}

		if(!document.getElementById('title').value){
			okf=0;
			msg1+=" Title required \r\n";
		}
		if(!document.getElementById('fname').value){
			okf=0;
			msg1+=" First name required \r\n";
		}
		if(!document.getElementById('lname').value){
			okf=0;
			msg1+=" Last name required \r\n";
		}
		if(okf!=1){
			if(!document.getElementById('coname').value){
				okf=0;
				msg1+=" Company name or your name is required \r\n";
			}
			else{
				okf=1;
			}
		}
		if(!document.getElementById('hno').value){
			okf=0;
			msg1+=" House No./Name required \r\n";
		}
		if(uk<=0){
			if(!document.getElementById('street').value){
				okf=0;
				msg1+=" Street name required \r\n";
			}
			if(!document.getElementById('add2').value){
				okf=0;
				msg1+=" Town/City required \r\n";
			}
			if(!document.getElementById('add3').value){
				okf=0;
				msg1+=" County/State required \r\n";
			}
		}
		if(!document.getElementById('pcode').value){
			okf=0;
			msg1+=" Post code required \r\n";
		}
		if(!document.getElementById('email').value){
			okf=0;
			msg1+=" email required \r\n";
		}

		if(okf<=0){
			//pWin2.window.close();
			alert(msg1);
			return;
		}
		else{
			if(document.getElementById('override').checked==true){
				override=1;
			}
			else{
				override=0;
			}
			hredummy="cap_blank1.php";
			pWin2=window.open(hredummy, '_blank','toolbar=no,menubar=no,location=yes,scrollbars=yes,resizable=yes,status=yes,width=820,height=620,top=0,left=10'); 
			pWin2.opener = self
			
			var remember=0;
			if(document.getElementById('remember').checked==true) remember=1;

			var pcode=document.getElementById("pcode").value;	
			var hno=document.getElementById("hno").value;	
			var url="cap_checkadd1.php?pcode="+pcode+"&hno="+hno+"&shopid="+shopid+"&remember="+remember+"&uk="+uk+"&override="+override
			makeRequest(url);
		}
	}
	function ClearAll(){

		document.getElementById("catid").options[0].selected=true;
		document.getElementById("capacitance").options[0].selected=true;
		var clen=document.getElementById("vdc").length;
		var i;
		var x=document.getElementById("vdc");
		var ai=0;
		var vdc="";
		for(i=0;i<clen;i++){
			vdc+=x.options[i].selected=false;
		}
		document.getElementById("vdc").options[0].selected=true;
		document.getElementById("sid").options[0].selected=true;
		document.getElementById("tid").options[0].selected=true;
		CatChange();
	}
	function ShowPast(){

		var hre="cap_past1.php?customer="+customer;
		pWin=window.open(hre, '_blank','toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,status=yes,fullscreen=no,width=480,height=500,top=10,left=10'); 
		pWin.opener = self; 

	}

	function ShowCharges(shopid){
		var ccode=document.getElementById('ccode').value;
		var vatcode=document.getElementById('vatcode').value;
		var hre="cap_dcharge1.php?shopid="+shopid+"&ccode="+ccode+"&vatcode="+vatcode;
		pWin=window.open(hre, '_blank','toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,status=yes,fullscreen=no,width=680,height=500,top=10,left=10'); 
		pWin.opener = self; 
	}

	function Over(opt,shopid){

		document.getElementById('over_tab').style.display="none";
		var capid=document.getElementById('ovcap').value
		var inform=0;
		var backqty=0;

		if(opt=="1") var ncaps=document.getElementById('ov1').value
		if(opt=="2") { var ncaps=document.getElementById('ov2').value; inform=1; backqty=document.getElementById('backqty').value; }
		if(opt!="3"){
			var url="cap_addcart1.php?capid="+capid+"&ncaps="+ncaps+"&shopid="+shopid+"&inform="+inform+"&backqty="+backqty;
			makeRequest(url);
		}
	}

	function EditPromo(username){

		if(username){
			var hre="cap_edpromo1.php";
			pWin=window.open(hre, '_blank','toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,status=yes,fullscreen=no,width=820,height=600,top=10,left=10'); 
			pWin.opener = self; 
		}

	}
	
	function GetPass(){
		var emailcust=document.getElementById("emailcust").value
		if(emailcust){
			//alert(emailcust);
			var url="cap_getpass1.php?emailcust="+emailcust;
			makeRequest(url);	
		}
		else{
			alert("Please supply your email address");
		}
	}

	var	invfile;
	var	flip=0;
	var t;
	var t2;

	function timedCount2(){
		t2=setTimeout("timedCount3()",2500)
	}
	function timedCount3(){
		
		var url="cap_progress1.php?sid="+gshopid
		makeRequest(url);
	}

	function timedCount(){
		
		if(flip<=0){
			document.getElementById('rbut1').style.backgroundColor="#aaaaff"; 
			flip=1;
		}
		else{
			document.getElementById('rbut1').style.backgroundColor="#ffff00"; 
			flip=0;
		}
		t=setTimeout("timedCount()",500)
	}

	function StopCount(){
		document.getElementById('rbut1').style.backgroundColor="#aaaaff"; 
		clearTimeout(t)

	}

	function OrderCancel(){
		document.getElementById('ordstatus').value="PAYMENT CANCELLED";
	}
	
	function OrderOK(inv){
		invfile=inv;
		document.getElementById('ordstatus').value="ORDER COMPLETE";
		document.getElementById('rectab').style.display="";
		timedCount();
	}
	function ShowInvoice(shopid){
		var hre="_docs/"+invfile;
		pWin=window.open(hre, '_blank','toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes,status=yes,fullscreen=no,width=800,height=550,top=0,left=10'); 
		pWin.opener = self; 
		document.getElementById('makep').disabled=false;
		EmptyCart(shopid);
	}

	var	nflash=7;
	var flip2=0;

	function FlashList(){
		if(flip2<=0){
			document.getElementById("listr1").style.backgroundColor=hl1color;
			document.getElementById("listr2").style.backgroundColor=hl1color;
			flip2=1;
		}
		else{
			document.getElementById("listr1").style.backgroundColor=butcolor;
			document.getElementById("listr2").style.backgroundColor=butcolor;
			flip2=0;
		}
		nflash=nflash-1;
		if(nflash>=1) t2=setTimeout("FlashList()",500);
		else nflash=6;
	}
	function CatChange(){
		remcat=0;
		remcat2=0;
		remcat3=0;
		remcat4=0;
		var catid=document.getElementById('catid').value
		if(catid==-2){
			//alert("Termal devices")	
			document.location="https://www.rush-on-line.co.uk/thermistors/cap_index.php";
			//document.location="http://server/thermisters/cap_index.php";
		}
		else{
			var url="cap_catlines1.php?catid="+catid;
			document.getElementById("rstatus").value="Please wait";
			makeRequestLines(url);
			
			nextr=2;
			var trs=document.getElementById('cap_shop').rows.length
			for(ri=2; ri<trs; ri++){
				document.getElementById('cap_shop').deleteRow(2)
			}
			FlashList();	
		}
		
	}

	function CapChange(){
		remcat=0;
		remcat2=0;
		remcat3=0;
		remcat4=0;
		var catid=document.getElementById('catid').value
		var capacitance=document.getElementById("capacitance").value
		
		var url="cap_catlines2.php?catid="+catid+"&capacitance="+capacitance;
		makeRequestLines(url);
		nextr=2;
		var trs=document.getElementById('cap_shop').rows.length
		for(ri=2; ri<trs; ri++){
			document.getElementById('cap_shop').deleteRow(2)
		}
		FlashList();
	}
	function VoltChange(){
		remcat=0;
		remcat2=0;
		remcat3=0;
		remcat4=0;
		var catid=document.getElementById('catid').value
		var capacitance=document.getElementById("capacitance").value
		
		var vdc = new Array()
		var clen=document.getElementById("vdc").length;
		var i;
		var x=document.getElementById("vdc");
		var ai=0;
		var vdc="";
		for(i=0;i<clen;i++){
			if(x.options[i].selected==true){
				vdc+=x.options[i].value+" ";
				ai++;
			}
		}
		
		var url="cap_catlines3.php?catid="+catid+"&capacitance="+capacitance+"&vdc="+vdc;
		makeRequestLines(url);
		ListChange();
		FlashList();
	}
	function ListChange(){
		nextr=2;
		var trs=document.getElementById('cap_shop').rows.length
		for(ri=2; ri<trs; ri++){
			document.getElementById('cap_shop').deleteRow(2)
		}
	}
	function SetHi1(evt){
		if(msie==1){
			var ob=evt.srcElement
			ob.parentElement.bgColor='#ddddff';
			ob.bgColor="";
		}
		else{
			evt.currentTarget.bgColor='#DDDDFF';
		}
	}
	function SetHi2(evt){
		if(msie==1){
			var ob=evt.srcElement
			ob.parentElement.bgColor=panel4;
			ob.bgColor="";
		}
		else{
			evt.currentTarget.bgColor=panel4;
		}
	}

