if (document.all)
{ 
	document.onkeydown = function ()
				{ 
					var key_f5 = 116; // 116 = F5 
					var key_f6 = 117; // 117 = F6 
					var key_f11 = 122; // 122 = F11 
					var key_ctrl_r = 82; // 82 = ctrl-R

					if ((key_f5==event.keyCode) || (key_f6==event.keyCode) || ((key_ctrl_r==event.keyCode)&&(event.ctrlKey)) || (key_f11==event.keyCode))
					{ 
						event.keyCode = 27; 
						return false; 
					} 
				} 
} 


if (window.Event) 
	document.captureEvents(Event.MOUSEUP); 


function nocontextmenu()
{ 
event.cancelBubble = true 
event.returnValue = false; 
return false; 
} 

function norightclick(e) 
{ 
	if (window.Event) 
	{ 
		if (e.which !=1) 
			return false; 
	} 
	else 
		if (event.button !=1) 
		{ 
			event.cancelBubble = true 
			event.returnValue = false; 
			return false; 
		} 
} 

document.oncontextmenu = nocontextmenu; 
document.onmousedown = norightclick; 

var env = new env_settings();

function env_settings()
{
	// base attributes ...
	this.u_agent = navigator.userAgent.toLowerCase();
	this.b_name = navigator.appName.toLowerCase();
	this.int_ver = parseInt( navigator.appVersion );
	this.float_ver = parseFloat( navigator.appVersion );
	
	// not a base attribute, but I use this in different areas ...
	this.opera = ( this.u_agent.indexOf( "opera" ) != -1 );
	
	// platforms ...
	this.is_win = ( ( this.u_agent.indexOf( "win" ) != -1 ) && ( this.u_agent.indexOf( "3.1" ) == -1 ) );
	this.is_mac = ( this.u_agent.indexOf( "mac" ) != -1 );
	this.is_linux = ( this.u_agent.indexOf( "linux" ) != -1 );
	
	// browser/platform configurations ...
	this.good_ie = ( ( this.b_name.indexOf( "explorer" ) != -1 ) && ( this.int_ver >= 4 ) && ( !this.opera ) );
	this.good_ns = ( ( this.b_name.indexOf( "netscape" ) != -1 ) && ( this.int_ver >= 5 ));
	this.ns6 = ( ( this.b_name.indexOf( "netscape" ) != -1 ) && ( this.int_ver >= 5 ) );
	this.good_default = ( ( this.is_linux ) || ( this.is_mac ) || ( !this.good_ie && this.int_ver >= 5 ));
	this.other = ( this.opera );
	
	this.ideal_env = ( this.is_win && this.good_ie );
}


function toggleLayer(layerName, toggle)
{
	var theLayer = document.getElementById(layerName);

	if(toggle)
	{
		theLayer.style.visibility = "visible";
	}
	else
	{
		theLayer.style.visibility = "hidden";
	}
}


function moveLayer(layerName, posx, posy)
{
	var theLayer = document.getElementById(layerName);

	if(posx > -1 && posx != null && posx != "undefined")
	{
		theLayer.style.left = posx;
	}

	if(posy > -1 && posy != null && posy != "undefined")
	{
		theLayer.style.top = posy;
	}
}


function getLayerDimension(layerName, dimensionName)
{
	var theLayer = document.getElementById(layerName);
	var value = -1;

	if(dimensionName == 'width')
		value = theLayer.style.width;

	if(dimensionName == 'height')
		value = theLayer.style.height;

	if(dimensionName == 'left')
		value = theLayer.style.left;

	if(dimensionName == 'top')
		value = theLayer.style.top;

	return value;
}


function sizeLayer(layerName, width, height)
{
	var theLayer = document.getElementById(layerName);

	
	if(width > -1 && width != null && width != "undefined")
	{
		theLayer.style.width = width;
	}

	if(height > -1 && height != null && height != "undefined")
	{
		theLayer.style.height = height;
	}
}


function levelLayer(layerName, newlevel)
{
	var theLayer = document.getElementById(layerName);

	if(newlevel > -1)
	{
		
		theLayer.style.zIndex = newlevel;
	}
}


function setLayerText(layerName, text)
{
	var theLayer = document.getElementById(layerName);
	
	//alert(text);
	
	theLayer.innerHTML = text;
}


function frameLoad(framename, replacetext)
{
	var targetframe = eval(framename);
	targetframe.location.replace(replacetext);
}


function frameToggle(framename, focused)
{
	var targetframe = eval(framename);
	if (focused)
	{
		targetframe.focus();
	}
	else
	{
		targetframe.blur();
	}
}


function getCookie(Name)
{
	var search = Name + "=";
	
	if (document.cookie.length > 0) // if there are any cookies//
	{
		//alert(document.cookie);
		offset = document.cookie.indexOf(search);
		if (offset != -1) 
		{
			// if cookie exists
			offset += search.length;
			// set index of beginning of value
			end = document.cookie.indexOf(";", offset);
			// set index of end of cookie val
			if (end == -1)
				end = document.cookie.length;

			return unescape(document.cookie.substring(offset, end));
		}
	}
}

function setCookie(name, myPref, extratime)
{
	if(parseInt(extratime) != 0)
	{
		var today = new Date();
		today.setTime(today.getTime() + parseInt(extratime));
		document.cookie = name + "=" + escape(myPref) + ";expires=" + today.toGMTString();
	}
	else
	{
		document.cookie = name + "=" + escape(myPref);
	}
	//alert(document.cookie);
}
