//---------------------------------------
// Copyright © 2000 T-Soft Design Limited
// www.tsoft.co.uk
//
// Author:		Tony Rogers
// Date:		01/10/2000
//---------------------------------------


var ie=document.all&&navigator.userAgent.indexOf("Opera")==-1
var dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1
var netscape=document.layers


// For use with Image Styler rollover images
function SwapImage(el, id, act)
	{
	if (document.images)
		el.src = eval( "isimages." + id + isamap[act] + ".src");
	}


// General object visibility control
function LayerVis()
	{ 
	var i, visStr, args, theObj;
	
	args = LayerVis.arguments;
	
	for (i=0; i<(args.length-2); i+=3)
		{
		visStr   = args[i+2];
		
		if (netscape && document.layers != null)
			{
			theObj = eval(args[i]);
				if (theObj) theObj.visibility = visStr;
			}
		else if (document.all != null)
			{
			if (visStr == 'show')
				visStr = 'visible';
			if (visStr == 'hide')
				visStr = 'hidden';
			
			theObj = eval(args[i+1]);
		
			if (theObj)
				theObj.style.visibility = visStr;
			}
		}
	}

// General object movement control
// Moves the second object to offset x, y from the first object

function LayerMove()
	{ 
	var i, visStr, args, theObj;
	
	args = LayerMove.arguments;

	theObj = GetLayer(args[0]);

	
	x = args[1];
	y = args[2];
	
	if (netscape && theObj)
		{
		if (window.innerWidth > 944)
			theObj.left =  (window.innerWidth - 944) / 2 - 8 + x;
		else
			theObj.left =  x - 2;
//		theObj.left = eval('window.pageXOffset') - 2 + x;
		theObj.top = y;
		}
	else if (ie && theObj)
		{
		if (document.body.clientWidth > 944)
			theObj.style.left =  (document.body.clientWidth - 944) / 2 + x;
		else
			theObj.style.left =  x + 2;
		theObj.style.top = y;
		}
	else if (dom && theObj)
		{
		if (document.body.clientWidth > 944)
			theObj.style.left =  (document.body.clientWidth - 944) / 2 + x;
		else
			theObj.style.left =  x + 5;
		theObj.style.top = y;
		}
	}

TimerID = 0;

function HideLayer(name)
	{
	var obj = GetLayer(name);

	if (netscape && obj)
		obj.visibility = "hide";
	else if ((ie || dom) && obj)
		obj.style.visibility = "hidden";
	else if (dom && obj)
		obj.setAttribute("visibility", "hidden");
	}

function ShowLayer(name)
	{
	var obj = GetLayer(name);

	if (netscape && obj)
		obj.visibility = "show";
	else if ((ie || dom) && obj)
		obj.style.visibility = "visible";
	else if (dom && obj)
		obj.setAttribute("visibility", "visible");
	}


function GetLayer(name)
	{
	if (netscape)
		layer = document.layers[name];
	else if (ie)
		layer = document.all[name];
	else if (dom)
		layer = document.getElementById(name);

	return(layer);
	}

function LayerAction(activate, name1)
	{
	if (activate)
		{
		clearTimeout(TimerID);
		HideLayers(name1);
		ShowLayer(name1);
		}
	else
		{
		clearTimeout(TimerID);
		TimerID = setTimeout('HideLayers("")', 1000);
		}
	}

ResizeTimer = 0;

function HideLayers()
	{
	}

function ResizeHandler(init)
	{
	if (init == 1)
		{
		if (netscape)
			{
			document.twidth = innerWidth;
			document.theight = innerHeight;
			ResizeTimer = setTimeout('ResizeHandler(0)', 500);

			}
		else
			window.onresize = ResizeHandler;
		}
	else
		{
		if (netscape)
			{
			if (document.twidth != innerWidth || document.theight != innerHeight)
				{
				location.reload();
				return(true);
				}

			ResizeTimer = setTimeout('ResizeHandler(0)', 500);
			}
		else
			{
			HideLayers("");
			window.onresize = ResizeHandler;

			}
		}


	return(true);
	}
