// navigation toggle
function togglemenu(nav,img){
	nav = document.getElementById(nav);
	img = document.getElementById(img);
	var imgpath = img.src;
	var state = nav.style.display;
	
	if( imgpath.indexOf("minus.gif") == -1) {
			imgpath = imgpath.split("plus.gif")[0];
	} else {
			imgpath = imgpath.split("minus.gif")[0];
	}
	
	if( state == "block") {
			nav.style.display = "none";
			img.src = imgpath + "plus.gif";
	} else {
			nav.style.display = "block";
			img.src = imgpath + "minus.gif";
	}
}

//contact javascript
var pages = new Array();
var contacts = new Array();
var root = "/services/catalog/";
var xmlhttp = false;
var contactime = null;


function togglecontacts(){
	var menu = document.getElementById("contactmenu");
	if( contactime ) window.clearTimeout(contactime);
	
	if(contacts[root+"contact1.html"] == null) getcontact(1);
	
	if(menu.style.display == "block") {
		menu.style.display="none";
	} else {
		menu.style.display="block";
	}

}

function contactsoff(){
	contactime = window.setTimeout("document.getElementById('contactmenu').style.display='none'", 800);
}

function contactson() {
	if( contactime ) window.clearTimeout(contactime);
	var menu = document.getElementById("contactmenu");
	menu.style.display="block";;
}

function getcontact(n) {
	
	var url = root+"contact"+n+".html";

	if(contacts[url] == null) {
		if( window.XMLHttpRequest) xmlhttp = new XMLHttpRequest();
		else if( window.ActiveXObject ) xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		
		if(xmlhttp){
			xmlhttp.onreadystatechange=handler;
			xmlhttp.open("GET", url, true);
			pages[url] = xmlhttp;
			pages[url].send(null);
		}
	} else {
		setcontact(url);
	}
}

function setcontact(url){
	document.getElementById("contactmenu").innerHTML = contacts[url].responseText;
}

function handler(){
	for( var i in pages){
		if( pages[i] != null)  {
			if(pages[i].readyState==4) {
				if(pages[i].status==200) {
					contacts[i] = pages[i];
					pages[i] = null;
					setcontact(i);
				}
			}
		}
	}
}

function printregular() {
	var win = window.open('','daughter','location=no,status=no,menubar=yes,toolbars=yes,directories=no,scrollbars=yes,resizable=no,width=660,height=420');
	win.document.open();
	win.document.write("<html><head><title>Printer Friendly</title><style>#pagenumbers, #pagenumbers2 {display: none}</style></head><body></body></html>");
	win.document.close();
	
	win.document.getElementsByTagName("body")[0].innerHTML = document.getElementById("bodytxt").innerHTML;
}
