/*---------------------------------------------------------------------------------------------------------------------
Copyright (C) 2002 Multimedia Solutions Corporation.
All rights reserved.

Description:	GENERAL FUNCTIONS
				Juan F. Sarria
Date:			04/23/2003
Modified:		04/28/2003
----------------------------------------------------------------------------------------------------------------------*/

NS5 = document.layers;
IE = document.all;
NS6 = document.getElementById && !document.all;

IE = (typeof(IE) != "undefined" && IE != false ) ? true : false;
NS = ((typeof(NS5) != "undefined" && NS5 != false) || (typeof(NS6) != "undefined" && NS6 != false)) ? true : false;

var MM_contentVersion = 4;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
		for (var i = 0; i < words.length; ++i)
		{
		if (isNaN(parseInt(words[i])))
		continue;
		var MM_PluginVersion = words[i]; 
		}
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
}

function moveFooter() {
	var iBottom = 0;
	
	if (document.all) {
		if (parseInt(document.body.scrollHeight) > parseInt(document.body.clientHeight)) {
			iBottom = parseInt(document.body.scrollHeight);
		}	
		else iBottom = parseInt(document.body.clientHeight);
		document.all["lyfooter"].style.pixelTop = iBottom - parseInt(document.all["lyfooter"].style.height);
		document.all["lyfooter"].style.visibility = "visible";
	}
	else if (document.layers)	{
		if (document.height > self.innerHeight) {
			iBottom = document.height;
		}	
		else iBottom = self.innerHeight;				
		document.layers["lyfooter"].top = parseInt(iBottom - document.layers["lyfooter"].document.height);
		document.layers["lyfooter"].visibility = "visible";				
	}
	else if (document.getElementById) { //NS6
		if (document.height > self.innerHeight) {
			iBottom = document.height;
		}	
		else iBottom = self.innerHeight;					
		document.getElementById("lyfooter").style.top = (parseInt(iBottom - parseInt(document.getElementById("lyfooter").style.height))) + "px";		
		document.getElementById("lyfooter").style.visibility = "visible";		
		
	}
	
}

function GetLyStatus(LayerID) {
	if (IE) return document.all[LayerID].style.visibility;
	else if (NS5) return document.layers[LayerID].visibility;
	else if (NS6) return document.getElementById(LayerID).style.visibility;
}

function OnOff(LayerID, Action) {
	if (LayerID.indexOf("Map") != -1 && Action.toLowerCase() != "hidden")	{
		GetMapLayersOff();
	}

	if (IE) document.all[LayerID].style.visibility = Action;
	else if (NS5) document.layers[LayerID].visibility = Action;
	else if (NS6) document.getElementById(LayerID).style.visibility = Action;
}

function TmpOnOff(LayerID, Action) {
	if (IE) document.all[LayerID].style.visibility = Action;
	else if (NS5) document.layers[LayerID].visibility = Action;
	else if (NS6) document.getElementById(LayerID).style.visibility = Action;
}


function GetMapLayersOff() {
	for (N=1; N <= 6; ++N ) TmpOnOff('Graph'+N,'hidden');
	for (N=1; N <= 6; ++N ) TmpOnOff('Map'+N,'hidden');
}

function SetPosition(LayerID, Position) {
	if (IE) document.all[LayerID].style.position = Position;
	else if (NS5) document.layers[LayerID].position = Position;
	else if (NS6) document.getElementById(LayerID).style.position = Position;
}

function swapimg(img, NewImg) {
	//document.images[img].src = NewImg;
}

function swaping(img, NewImg) {
	document.images[img].src = NewImg;
}

function GoToPage(Page) {
	if (Page != "") 
		document.location.href = Page; 
}

function Switch(Obj) {
	LayerID = "ly" + Obj.id;
	if (GetLyStatus(LayerID) == "hidden")	{
		SetPosition(LayerID, "");
		OnOff(LayerID, "");
	} else {
		SetPosition(LayerID, "absolute");
		OnOff(LayerID, "hidden");
	}
}