var popWindow = null;

function popwindow(url,width,height) {
	var midX = (screen.width/2)-(width/2);
	var midY = (screen.height/2)-(height/2);
	popWindow = window.open (''+[url]+'','popwin', "width="+[width]+",height="+[height]+",toolbar=no,menubar=no,scrollbars=yes,resizable=yes,top="+midY+",left="+midX+",screenX="+midX+",screenY="+midY+"");
	popWindow.focus();

}




var timer1 = null;
var timer2 = null;

var subMenuArr = new Array("about","news","services");

var mImgList = new Array("home","about","news","services","successstories","careers","contactus","login","consulting","ebusiness","itsupport");
var mOutImg = new Array();
var mOverImg = new Array();
var mSelImg = new Array();
var i,j;

//load images
for(i=0;i<mImgList.length;i++) {
	mOutImg[mImgList[i]] = new Image();
	mOutImg[mImgList[i]].src = "/images/m_"+mImgList[i]+"_0.gif";
	mOverImg[mImgList[i]] = new Image();
	mOverImg[mImgList[i]].src = "/images/m_"+mImgList[i]+"_1.gif";
	mSelImg[mImgList[i]] = new Image();
	mSelImg[mImgList[i]].src = "/images/m_"+mImgList[i]+"_2.gif";
}



function showSubMenu(id) {

	var i;
	var o1 = null;
	var o2 = null;

	for(i=0;i<subMenuArr.length;i++) {

		if(subMenuArr[i]==id) {

			if(document.all) {
				o1 = document.all(id+"sub");
				o2 = document.all("blanksub");
			} else if(document.getElementById) {
				o1 = document.getElementById(id+"sub");
				o2 = document.getElementById("blanksub");
			}

			if(o1!=null && o2!=null) {
				o2.style.display = "none";
				o1.style.display = "block";
			}

			break;
		}
	}
	
}


function resetSubMenus() {

	var i;
	var o1 = null;
	var o2 = null;

	for(i=0;i<subMenuArr.length;i++) {

		o1 = null;
		o2 = null;

		if(document.all) {
			o1 = document.all(subMenuArr[i]+"sub");
			o2 = document.all("blanksub");
		} else if(document.getElementById) {
			o1 = document.getElementById(subMenuArr[i]+"sub");
			o2 = document.getElementById("blanksub");
		}

		if(o1!=null && o2!=null) {
			o1.style.display = "none";
			o2.style.display = "block";
		}
	}
}



function resetMenuImages() {

	var i;

	for(i=0;i<mImgList.length;i++) {
		if(document.images && document.images[mImgList[i]]) {
			if(document.images[mImgList[i]].filters) { document.images[mImgList[i]].filters.blendTrans.apply(); }
			if(mImgList[i]==currentPage) {
				document.images[mImgList[i]].src = mSelImg[mImgList[i]].src;
			} else {
				document.images[mImgList[i]].src = mOutImg[mImgList[i]].src;
			}
			if(document.images[mImgList[i]].filters) { document.images[mImgList[i]].filters.blendTrans.play(); }
		}
	}
}


function mOvr(img) {

	resetMenuImages();
	resetSubMenus();
	clearTimeout(timer1);
	clearTimeout(timer2);


	if(document.images && document.images[img]) {
		if(document.images[img].filters) { document.images[img].filters.blendTrans.apply(); }
		if(img==currentPage) {
			document.images[img].src = mSelImg[img].src;
		} else {
			document.images[img].src = mOverImg[img].src;
		}
		if(document.images[img].filters) { document.images[img].filters.blendTrans.play(); }
	}
	showSubMenu(img);
}


function subMOvr(img) {

	clearTimeout(timer1);
	clearTimeout(timer2);


	if(document.images && document.images[img]) {
		if(document.images[img].filters) { document.images[img].filters.blendTrans.apply(); }
		if(img==currentPage) {
			document.images[img].src = mSelImg[img].src;
		} else {
			document.images[img].src = mOverImg[img].src;
		}
		if(document.images[img].filters) { document.images[img].filters.blendTrans.play(); }
	}
	showSubMenu(img);
}


function mOut(img) {
	if(document.images && document.images[img]) {
		if(document.images[img].filters) { document.images[img].filters.blendTrans.apply(); }
		if(img==currentPage) {
			document.images[img].src = mSelImg[img].src;
		} else {
			document.images[img].src = mOutImg[img].src;
		}
		if(document.images[img].filters) { document.images[img].filters.blendTrans.play(); }
	}
}


function resetAll() {
	timer1 = setTimeout("resetSubMenus();",600);
	timer2 = setTimeout("resetMenuImages();",670);

}
