<!--
this.pictsLoaded = 0;

var del1=new Image();
del1.src="graphics/delete1.gif";
var del2=new Image();
del2.src="graphics/delete2.gif";
var ins1=new Image();
ins1.src="graphics/insert1.gif";
var ins2=new Image();
ins2.src="graphics/insert2.gif";

function preLoadPicts() {
	MM_preloadImages(
	
	'graphics/menu.gif');
	this.pictsLoaded = 1;
}

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 getObj(name)
{
//alert (name);
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);

	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];

	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
	this.obj = getObjNN4(document,name);

	this.style = this.obj;
  }

}

function getObjNN4(obj,name)
{
	var x = obj.layers;
	var thereturn;
	for (var i=0;i<x.length;i++)
	{
		if (x[i].id == name)
		 	thereturn = x[i];
		else if (x[i].layers.length)
			var tmp = getObjNN4(x[i],name);
		if (tmp) thereturn = tmp;
	}
	return thereturn;
}
function makecatinvis(){

var tempstr;
var numrecs;
var cat = new getObj("category");
me=cat.obj;
numrecs = me.options.length;

for (var i=0;i<numrecs;i++) {
selected = me.options[i].value;

tempstr = "subcat"+selected;
//d = document.getElementById(tempstr);
d = new getObj(tempstr);

if (document.layers){
d.style.visibility = 'hide';
d.style.display = 'none';
}
else
{
d.style.visibility = 'hidden';
d.style.display = 'none';
}
d.obj.value = 9999;

}
}

function makecatvis(){

var selected;
var tempstr;
var cat = new getObj("category");

makecatinvis();

me=cat.obj;


//me = document.getElementById("category");
selected = me.options[me.selectedIndex].value;
tempstr = "subcat"+selected;

d = new getObj(tempstr);
if (document.layers){
d.style.visibility = 'visible';
d.style.display = 'block';
}
else
{
d.style.visibility = 'visible';
d.style.display = 'block';
}


}


function makematvis(){

var tempstr;
var cat = new getObj("part_category");

makematinvis();

me=cat.obj;


//me = document.getElementById("category");
selected = me.options[me.selectedIndex].value;
tempstr = "material"+selected;

d = new getObj(tempstr);
if (document.layers){
d.style.visibility = 'visible';
d.style.display = 'block';
}
else
{
d.style.visibility = 'visible';
d.style.display = 'block';
}


}



function makematinvis(){

var tempstr;
var numrecs;
var cat = new getObj("category");
me=cat.obj;
numrecs = me.options.length;

for (var i=0;i<numrecs;i++) {
selected = me.options[i].value;

tempstr = "material"+selected;
//d = document.getElementById(tempstr);
d = new getObj(tempstr);

if (document.layers){
d.style.visibility = 'hide';
d.style.display = 'none';
}
else
{
d.style.visibility = 'hidden';
d.style.display = 'none';
}
}
}


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) { //v3.0
//x = getObj(n).obj;
//return x; 

  var p,i,x;  
if(!d) d=document; 
if (document.getElementById){
x = document.getElementById(n);
return x;
}

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); 
		}
		return x;

}

function MM_showHideLayers() { //v3.0
	if (this.pictsLoaded == 1) {
		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 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
	if (this.pictsLoaded == 1) {
		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 open_popup(page,win,params)
{
params1= 'toolbar=no, scrollbars=1, location=0, statusbar=0, menubar=0, resizable=1, width=1, height=1, left=850, top=850';
window_handle = window.open(page,win,params1);
window_handle.close();
window_handle = window.open(page,win,params);
//window_handle.focus();
return false;

}// End Function

function pop(aw) {
	if (aw) MM_showHideLayers(aw,'','show', 'popend','','show');
}

function popClose() {
	MM_showHideLayers('popend','','hide', 'btn01menu','','hide', 'btn02menu','','hide', 'btn03menu','','hide', 'btn04menu','','hide','btn05menu','','hide','btn06menu','','hide','btn07menu','','hide');
}

function jump(aw, w) {
	if (aw=='dummyLink') return false
	if (w==0) {
		top.location = aw;
	} else {
		window.open(aw,'new','width=200,height=50,scrollbars=yes,toolbar=no,statusbar=no');
	}
}

function changetext(prmtext,prmimage){
// hide the text
	MM_showHideLayers('txtblock1','','hide', 'txtblock2','','hide', 'txtblock3','','hide', 'txtblock4','','hide', 'txtblock5','','hide', 'txtblock6','','hide', 'txtblock7','','hide', 'txtblock8','','hide', 'txtblock9','','hide', 'txtblock10','','hide');
// hide the images
	MM_showHideLayers('imageblock1','','hide', 'imageblock2','','hide', 'imageblock3','','hide', 'imageblock4','','hide', 'imageblock5','','hide', 'imageblock6','','hide', 'imageblock7','','hide', 'imageblock8','','hide', 'imageblock9','','hide', 'imageblock10','','hide');
// show the text
	if (prmtext) MM_showHideLayers(prmtext,'','show');

	if (prmimage) MM_showHideLayers(prmimage,'','show');

}
function SubmitOrder()
{

if (document.all){
	if (CheckCatalog(document.frames["cataloginfo"].document.forms["catalogform"])){
		document.frames["cataloginfo"].document.forms["catalogform"].submit();
		}
}
else
{
	alert ("trying to submit");
	if (CheckCatalog(document.frames["cataloginfo"].contentdocument.forms["catalogform"])){
		alert ("trying to submit");
		document.frames["cataloginfo"].contentdocument.forms["catalogform"].submit();


		}

}

}// End Function


//function SubmitResult(id, action)
//{
// this may be used if frames solution used for printed catalogs
//me = document.ResultForm;
//alert ("submitting form" + id + action);
//me.id.value = id;
//me.action.value = action;
//me.submit;


//}
function recalculatevalues()
{
//alert ("recalc called");
var max
var item
var cost
var tmptot = 0;
var tmpsub = 0;
me = document.basket;
//tmptot = parseInt(0);
max = me.length-2;
for (i=0;i<max;i++){
//alert(i+","+me[i].name+" "+me[i].value+" " +me[i+1].value +me[i+2].value);
if (me[i].name.substr(0,3) == "qty"){
item = me[i].name.substr(3,8);
//alert(i+","+me[i].value+" "+me[i+1].value);

if (me[i].value > 500 || me[i+1].value == ''){
tmpsub = parseInt(100* me[i].value * me[i+2].value );
}
else
{
tmpsub = parseInt(100* me[i].value * me[i+1].value );
}
tmptot += tmpsub;
tmpsub = tmpsub/100 ;
//alert (tmpsub);
eval("me.cost"+item+".value = round_amount(tmpsub,2)");

//alert (tmptot);

//me.total.value = (parseInt(me.total.value) + (parseInt(me[i].value) * parseInt(me[i+1].value)*100));
} 

}
tmptot = tmptot/100 ;
me.total.value = round_amount(tmptot,2);

}

// End Function


function calculatecost()
{
//alert ("recalc called");
var max
var item
var cost
var tmptot = 0;
var tempstr
var tmpstr
var storestring

tempstr = "calcvalue";


d = new getObj(tempstr);

tempstr = "calcamount";

e = new getObj(tempstr);

tmpstr = d.obj.value;

//alert (tmpstr);

// extract the rate from the string

loc = tmpstr.indexOf("per",1);

price = tmpstr.substring(2,loc-1);

loc = tmpstr.indexOf("=",1);

storestring = tmpstr.substring(0,loc+2) + "£";

//alert (storestring);

amount = e.obj.value;

tmptot = parseInt(100*amount*price);

tmptot = tmptot/100;
d.obj.value = storestring + round_amount(tmptot,2);

}

// End Function


function round_amount(value, precision)
{
        value = "" + value //convert value to string
        precision = parseInt(precision);

        var whole = "" + Math.round(value * Math.pow(10, precision));

        var decPoint = whole.length - precision;

        if(decPoint > 0)
        {
                result = whole.substring(0, decPoint);
                result += ".";
                result += whole.substring(decPoint, whole.length);
        }
        else
        {
                result = "0" ;
                result += ".";
                if (whole.length < precision){
			result += whole.substring(decPoint, whole.length);
			result += "0";
		}
		else
		{
			result += whole.substring(decPoint, whole.length);
		}
	 //       result = whole;
        }
	return result;
}
/* Functions that swaps images. */
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_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;
}
	

-->
