function selectCategory (cat_code,cat_lvl) {
// This function is used when a category link is pressed

	document.ps2form.form_select.value = "C";
	document.ps2form.cat_lvl.value = cat_lvl;
	document.ps2form.cat.value = cat_code;
	document.ps2form.submit();
}


//var message="© NIC Industries";
//function clickIE4(){if (event.button==2){alert(message);return false;}}
//function clickNS4(e){if (document.layers||document.getElementById&&!document.all){
//if (e.which==2||e.which==3){alert(message);return false;}}
//}
//if (document.layers){document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS4;}
//else if (document.all&&!document.getElementById){document.onmousedown=clickIE4;}
//document.oncontextmenu=new Function("alert(message);return false")


function hideLayers() {
    //layers to hide
    layers = new Array('contacts', 'leads', 'single');

    for(i=0;i<layers.length;i=i+1) {
        layer_ref = layers[i];
        if (document.layers) { //IS NETSCAPE 4 or below
            document.layers[layer_ref].style.display = 'none';
        }
        if (document.getElementById && !document.all) { //firefox and IE6
            thisLayer = document.getElementById(layer_ref);
            thisLayer.style.display = 'none';
        }
        if(document.all) { //not sure what browser this is for
            eval("document.all." + layer_ref + ".style.display = 'none'");
        }
    }
}

function hideLayer(layer_ref, delay) {
    pausecomp(delay);
    if (document.layers) { //IS NETSCAPE 4 or below
        document.layers[layer_ref].style.display = 'none';
    }
    if (document.getElementById && !document.all) { //firefox and IE6
        thisLayer = document.getElementById(layer_ref);
        thisLayer.style.display = 'none';
    }
    if(document.all) { //not sure what browser this is for
        eval("document.all." + layer_ref + ".style.display = 'none'");
    }
    
    MM_swapImgRestore();
    
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	
	return Array(curleft,curtop);
}


function pausecomp(millis)
{
var date = new Date();
var curDate = null;

do { curDate = new Date(); }
while(curDate-date < millis);
}

function showLayer(layer_ref, offset) {
    //if (document.layers) { //IS NETSCAPE 4 or below
    //    document.layers[layer_ref].style.display = 'block';
    //}
    //if (document.getElementById && !document.all) { //firefox and IE6
        thisLayer = document.getElementById(layer_ref);

        float_top = offset[1];
        float_left = offset[0];
        
        //alert([float_top,float_left]);
        thisLayer.style.top = float_top+24;
        thisLayer.style.left = float_left;
        thisLayer.style.display = 'block';

    //}
    //if(document.all) { //IE6 and others
    //    eval("document.all." + layer_ref + ".style.display = 'block'");
    //}
}

function selectLayer() {
    var sendto = document.form1.sendto;

    //hides all layers first
    hideLayers();

    if(sendto.selectedIndex >=2 && sendto.selectedIndex <= 5)
        showLayer(sendto.value);
}

