activemenu = 0;

function r(src) {
	src.style.backgroundColor='#9B9A79';
	src.style.color='#FFF';
	handPointer(src);
}
function o(src) {
	src.style.backgroundColor='transparent';
	src.style.color='#000';
}


function over(src) {
	src.style.backgroundColor = "#858585";
	handPointer(src);
}
function out(src) {
	src.style.backgroundColor = "#9B9B9B";
}


function rb(src) {
	handPointer(src);
    objMyImg = new OpacityObject(src.id,'i/boxr');
    objMyImg.setBackground();

}
function ob(src) {
        objMyImg = new OpacityObject(src.id,'i/box');
        objMyImg.setBackground();
}

function handPointer(src) {
	if (navigator.appName.indexOf("Internet Explorer") == -1) {
		src.style.cursor = "pointer";
	} else {
		src.style.cursor = "hand";
	}
}

function swap(what) {
	img = document.getElementById(what);
	name = img.src.substr(0,img.src.length-6)+"_r.gif"
	if (img.src != name) {
		img.src = img.src.substr(0,img.src.length-4)+"_r.gif";
	}

}

function swapback(what) {
	img = document.getElementById(what);
	name = img.src.substr(0,img.src.length-6)+"_r.gif"
	if (img.src == name) {
		img.src = img.src.substr(0,img.src.length-6)+".gif";
	}
}

function hideall() {
	if (activemenu == 0) {
		document.getElementById('aboutnav').style.display = 'none';
		document.getElementById('servicesnav').style.display = 'none';
		document.getElementById('epurchasingnav').style.display = 'none';
		document.getElementById('managednav').style.display = 'none';
		document.getElementById('supplierevalnav').style.display = 'none';
		document.getElementById('suppliersourcenav').style.display = 'none';
		document.getElementById('bestpracnav').style.display = 'none';
		document.getElementById('procoutnav').style.display = 'none';
		document.getElementById('researchnav').style.display = 'none';
		document.getElementById('procurementnav').style.display = 'none';
		document.getElementById('knowledgenetworknav').style.display = 'none';
		document.getElementById('risknav').style.display = 'none';
		swapback('about');
		swapback('services');
		swapback('knowledgenetwork');
	}
}

function hidenav() {
	timerID = setTimeout("hideall();", 1000);
}

function hidemenus() {
	activemenu = 0;
	hidenav();
}

function showmenu(what,submenu) {
	activemenu = 0;
	hideall();
	swap(what);
	men = document.getElementById(what+"nav");
	if (submenu!== "") {
		men2 = document.getElementById(submenu);
		men2.style.display = 'block'; 
	}
	activemenu = men;
	men.style.display = 'block';
}

function overnav(what,submenu) {
	handPointer(submenu);
	submenu.style.backgroundColor = "#858585";
	par = submenu.parentNode;
	swap(what);
	par.style.display = 'block';
	activemenu = par;
}

function outnav(what) {
	what.style.backgroundColor = "#9B9B9B";
	par = what.parentNode;
	activemenu = 0;
	hidenav();
}

function showregister() {
	if (window.opener) {
		window.opener.document.location = '/register.php';
		window.close();
	} else {
		document.location = '/register.php';
	}
}

function showcontact() {
	if (window.opener) {
		window.opener.document.location = '/contactfrm.php';
		window.close();
	} else {
		document.location = '/contactfrm.php';
	}
}

function checkaddr(what){
	var str = what;
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	    return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
	    return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	    return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
	    return false
	 }
	
	 if (str.indexOf(" ")!=-1){
	    return false
	 }

 	 return true
}