<!--
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";

// add some logic here for navigator


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 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 OpenAdvert()
{
//open advert screen in own window
//
window.open('advert/advert.swf','newwin',"toolbar=no, scrollbars=1, location=0, statusbar=0, menubar=no, resizable=1, width=600, height=400, left=50, top=100");


}// End Function

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;
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);
if (me[i].name.substr(0,3) == "qty"){
item = me[i].name.substr(3,8);
//alert(i+","+me[i].value+" "+me[i+1].value);

tmptot += parseInt(100* me[i].value * me[i+1].value );
//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 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;
}
	
	
-->

