//PlusV.2 javascript Library V1.1 2001 - Baran Dilber

function swapImage(name, rpath, nsdoc) {
	str = (navigator.appName == 'Netscape') ? nsdoc+'.'+name : 'document.all.'+name;
	img = eval(str);
	if (img) {
		if (img.altsrc == null) {
			img.altsrc = img.src;
		} 
		img.src = rpath;
	}
}

function restoreImage(name, nsdoc) {
	str = (navigator.appName == 'Netscape') ? nsdoc+'.'+name : 'document.all.'+name;
	img = eval(str);
	if (img) {
		if (img.altsrc != null) {
			img.src = img.altsrc;
		} 
	}
}

function preloadImages() {
	var img_list = preloadImages.arguments;
	if (document.preloadlist == null)
	document.preloadlist = new Array();
	var top = document.preloadlist.length;
	for (var i=0; i < img_list.length; i++) {
		document.preloadlist[top+i] = new Image;
		document.preloadlist[top+i].src = img_list[i];
	}
}

function browserCheck() {
	var b = navigator.appName;
	if (b=="Netscape") this.b = "ns";
	else if (b=="Microsoft Internet Explorer") this.b = "ie";
	else this.b = b;
	this.v = parseInt(navigator.appVersion);
	this.ns = (this.b=="ns" && this.v>=4);
	this.ns4 = (this.b=="ns" && this.v==4);
	this.ns5 = (this.b=="ns" && this.v==5);
	this.ie = (this.b=="ie" && this.v>=4);
	this.ie4 = (navigator.userAgent.indexOf('MSIE 4')>0);
	this.ie5 = (navigator.userAgent.indexOf('MSIE 5')>0);
	if (this.ie5) this.v = 5;
	this.min = (thnavigator.appName == 'Netscape'||this.ie);
}

//openWindow marked for revision
function openWindow(url,width,height,winName){
	if(eval(winName + '== null') || eval(winName + '.closed')) {
		eval(winName + '= window.open(url,"' + winName + '","menubar=no,left=150,top=200,scrollbars=yes,resizable=no,width=" + width + ",height=" + height)');
	} else {
		eval(winName + '.location=url');
	}
}
function openWindow2(url,width,height,winName){
	if(eval(winName + '== null') || eval(winName + '.closed')) {
		eval(winName + '= window.open(url,"' + winName + '","menubar=no,left=150,top=200,scrollbars=no,resizable=no,width=" + width + ",height=" + height)');
	} else {
		eval(winName + '.location=url');
	}
}

function moveLayerTo(layerID,posx,posy) {
	if (navigator.appName == 'Netscape') {
		document.layers[layerID].left = posx
		document.layers[layerID].top = posy
	} 
	else {
		document.all[layerID].style.left = posx
		document.all[layerID].style.top = posy
	}
}

function moveLayerBy(layerID,offsetx,offsety) {
	if (navigator.appName == 'Netscape') {
		document.layers[layerID].left += offsetx
		document.layers[layerID].top += offsety
	} 
	else {
		document.all[layerID].style.posLeft += offsetx
		document.all[layerID].style.posTop += offsety
	}
}

function showLayers(){
	var layerList = showLayers.arguments;
	for (var i=0; i < layerList.length; i++) {
		if (navigator.appName == 'Netscape') document.layers[layerList[i]].visibility = "show"
		else document.all[layerList[i]].style.visibility = "visible"
	}
}

function hideLayers() {
	var layerList = hideLayers.arguments;
	for (var i=0; i < layerList.length; i++) {
		if (navigator.appName == 'Netscape') document.layers[layerList[i]].visibility = "hide"
		else document.all[layerList[i]].style.visibility = "hidden"
	}
}

function returnLayer(layerID) {
	if (navigator.appName == 'Netscape') return document.layers[layerID];
	else return document.all[layerID];
}

function showMenuItem(layerID,tracking) {
	tmpLayer = returnLayer(layerID);
	tmpLayer.isactive = true;
	tmpLayer.onmouseover = new Function('this.isactive = true')
	tmpLayer.onmouseout = new Function('this.isactive = false')
	if (navigator.appName == 'Netscape') document.layers[layerID].isactive = true;
	else document.all[layerID].isactive = true;
	showLayers(layerID);
	tracker(layerID,tracking);
}

function tracker(layerID,tracking) {
	tmpLayer = returnLayer(layerID)
	if (tmpLayer.isactive)
	{
		if (tracking == 'always') {
			moveLayerTo(layerID,document.mouseMoveX,document.mouseMoveY);
			setTimeout('tracker("' + layerID + '","always")',100);
		} else if (tracking == 'once') {
			moveLayerTo(layerID,document.mouseMoveX,document.mouseMoveY);
		}
	}
}

function hideMenuItem(layerID,delay) {
	tmpLayer = returnLayer(layerID);
	tmpLayer.isactive = false
	setTimeout('hider("' + layerID + '",' + delay + ')',delay);
}

function hider(layerID,delay) {
	tmpLayer = returnLayer(layerID);
	if (tmpLayer.isactive)
	{
		setTimeout('hider("' + layerID + '",' + delay + ')',100);
	} else {
		hideLayers(layerID)
	}
	
}
