
// Global for target document object
var document_object;

// Global for DIV elments collection
var theelements;

// Create IE DHTML equalizer object
function ie_object(obj) 
{
	this.css1 = obj;
	this.name = obj.id;
	this.objResizeBy = domResizeBy;
	this.objHide = ieobjHide;
	this.objShow = ieobjShow;
	this.objGetLeft = domGetLeft;
	this.objGetTop = domGetTop;
	this.objSetTop = domSetTop;
	this.objSetLeft = domSetLeft;
	this.objMoveAbsolute = ieobjMoveAbsolute;
	this.objMoveRelative = ieobjMoveRelative;
	this.objGetWidth = ieobjGetWidth;
	this.objGetHeight = ieobjGetHeight;
	this.objSetHeight = ieobjSetHeight;
	this.objSetWidth = ieobjSetWidth;
	this.objSetZIndex = ieobjSetZIndex;
	this.objGetZIndex = ieobjGetZIndex;
	this.objSetClipRect = ieobjSetClipRect;
	this.objGetClipLeft = ieobjGetClipLeft;
	this.objGetClipRight = ieobjGetClipRight;
	this.objGetClipTop = ieobjGetClipTop;
	this.objGetClipBottom = ieobjGetClipBottom;
	this.replace_html = iereplace_html;
    this.objGetVisibility = ieobjGetVisibility;
	this.objChangeSource = ieobjChangeSource;
}

// Create IE DHTML equalizer object
function dom_object(obj) 
{
	this.css1 = obj;
	this.name = obj.id;
	this.objResizeBy = domResizeBy;
	this.objHide = ieobjHide;
	this.objShow = ieobjShow;
	this.objGetLeft = domGetLeft;
	this.objGetTop = domGetTop;
	this.objSetTop = domSetTop;
	this.objSetLeft = domSetLeft;
	this.objMoveAbsolute = ieobjMoveAbsolute;
	this.objMoveRelative = ieobjMoveRelative;
	this.objGetWidth = domGetWidth;
	this.objGetHeight = domGetHeight;
	this.objSetHeight = domSetHeight;
	this.objSetWidth = domSetWidth;
	this.objSetZIndex = ieobjSetZIndex;
	this.objGetZIndex = ieobjGetZIndex;
	this.objSetClipRect = domSetClipRect;
	this.objGetClipLeft = ieobjGetClipLeft;
	this.objGetClipRight = ieobjGetClipRight;
	this.objGetClipTop = ieobjGetClipTop;
	this.objGetClipBottom = ieobjGetClipBottom;
	this.replace_html = iereplace_html;
    this.objGetVisibility = ieobjGetVisibility;
	this.objChangeSource = ieobjChangeSource;
}


function domResizeBy(wincr,hincr) 
{
	this.css1.style.left-=hincr;
	this.css1.style.top-=wincr;
	this.css1.style.width+=(2 * hincr);
	this.css1.style.height+=(2 * wincr);
}


// Element's left position
function domGetLeft() 
{
	return parseInt(this.css1.style.left);
}

// Element's top position
function domGetTop () 
{
	return parseInt(this.css1.style.top);
}

// Set element's top position
function domSetTop (top) 
{
	this.css1.style.top = top + "px";
}

// Set element's left position
function domSetLeft(left) 
{
	this.css1.style.left = left + "px";
}

// Get element's width
function domGetWidth() 
{
	return this.css1.style.width;
}

// Get element's height
function domGetHeight() 
{
	return this.css1.style.height;
}

// Set element's height
function domSetHeight(height) 
{
	this.css1.style.height = height;
}

// Set element's width
function domSetWidth(width) 
{
	this.css1.style.width = width;
}

// Clip object
function domSetClipRect(top,left, bottom, right) 
{
	if (top == null) top = this.objGetClipTop();
	if (left == null) left = this.objGetClipLeft();
	if (bottom == null) bottom = this.objGetClipBottom();
	if (right == null) right = this.objGetClipRight();
      strng = "rect(" + top + "px " + right + "px " + bottom + "px " + left + "px)";
	this.css1.style.clip = strng;
}



// The IE specific scripting object methods
//*************************************************************************************

function ieobjGetVisibility() 
{
    return this.css1.style.visibility;
}

function ieobjResizeBy(wincr,hincr) 
{
	this.css1.style.pixelLeft-=hincr;
	this.css1.style.pixelTop-=wincr;
	this.css1.style.pixelWidth+=(2 * hincr);
	this.css1.style.pixelHeight+=(2 * wincr);
}


// Hide element
function ieobjHide() 
{
	this.css1.style.visibility = "hidden";
}

// Show element
function ieobjShow() 
{
	this.css1.style.visibility = "visible";
}

// Element's left position
function ieobjGetLeft() 
{
	return this.css1.style.pixelLeft;
}

// Element's top position
function ieobjGetTop () 
{
	return this.css1.style.pixelTop;
}

// Set element's top position
function ieobjSetTop (top) 
{
	this.css1.style.pixelTop = top;
}

// Set element's left position
function ieobjSetLeft(left) 
{
	this.css1.style.pixelLeft = left;
}

// Make absolute move
function ieobjMoveAbsolute(newleft, newtop) 
{
	this.objSetLeft(newleft);
    this.objSetTop(newtop);
}

// Move relative to current location
function ieobjMoveRelative(left, top) 
{
	this.objSetLeft(left + this.objGetLeft());
	this.objSetTop(top + this.objGetTop());  
}

// Get element's width
function ieobjGetWidth() 
{
	return this.css1.style.pixelWidth;
}

// Get element's height
function ieobjGetHeight() 
{
	return this.css1.style.pixelHeight;
}

// Set element's height
function ieobjSetHeight(height) 
{
	this.css1.style.pixelHeight = height;
}

// Set element's width
function ieobjSetWidth(width) 
{
	this.css1.style.pixelWidth = width;
}

// Set element's zindex order
function ieobjSetZIndex(zindex) 
{
	this.css1.style.zIndex = zindex;
}

// Get element's current zindex order
function ieobjGetZIndex(zindex) {
	return this.css1.style.zIndex;
}

// Clip object
function ieobjSetClipRect(top,left, bottom, right) 
{
	if (top == null) top = this.objGetClipTop();
	if (left == null) left = this.objGetClipLeft();
	if (bottom == null) bottom = this.objGetClipBottom();
	if (right == null) right = this.objGetClipRight();
      strng = "rect(" + top + "," + right + "," + bottom + "," + left + ")";
	this.css1.style.clip = strng;
}

// Convert string to value
function convert(strng) 
{
    var i = parseInt(strng);
    return i;
}

function get_entry(obj,indx) 
{
	strng = obj.css1.style.clip;
	strng = strng.slice(5,strng.length-1);
	var entries = strng.split(" ");
	if (indx == "top")
		if (entries[0] == "auto") 
		   return obj.objGetTop();
		else
		   return convert(entries[0]);
	else if (indx == "left")
		if (entries[3] == "auto") 
		   return obj.objGetLeft();
		else
		   return convert(entries[3]);
	else if (indx == "bottom")
		if (entries[2] == "auto") 
		   return obj.objGetHeight();
		else
		   return convert(entries[2]);
	else if (indx == "right")
		if (entries[1] == "auto") 
		   return obj.objGetWidth();
		else
		   return convert(entries[1]);	
}
	
// Clip object on left
function ieobjGetClipLeft() 
{
	return get_entry(this,"left");
}

// Clip object on right
function ieobjGetClipRight() 
{
	return get_entry(this, "right");
}

// Clip object at top
function ieobjGetClipTop() 
{
	return get_entry(this,"top");
}

// Clip object at bottom
function ieobjGetClipBottom()
{
	return get_entry(this,"bottom");
}

function iereplace_html(html_string) 
{
	this.css1.innerHTML = html_string;
} 

function ieobjChangeSource(sourcefile,width) 
{
  var name = this.name;
  this.css1.src = sourcefile;
}


// The Navigator specific scripting object methods
//*************************************************************************************

// Navigator object
function ns_object(obj) 
{	
	this.css1 = obj;
	this.name = obj.name;
	this.objResizeBy = nsobjResizeBy;
	this.objHide = nsobjHide;
	this.objShow = nsobjShow;
	this.objGetLeft = nsobjGetLeft;
	this.objGetTop = nsobjGetTop;
	this.objSetTop = nsobjSetTop;
	this.objSetLeft = nsobjSetLeft;
	this.objMoveAbsolute = nsobjMoveAbsolute;
	this.objMoveRelative = nsobjMoveRelative;
	this.objGetWidth = nsobjGetWidth;
	this.objGetHeight = nsobjGetHeight;
	this.objSetHeight = nsobjSetHeight;
	this.objSetWidth = nsobjSetWidth;
	this.objSetZIndex = nsobjSetZIndex;
	this.objGetZIndex = nsobjGetZIndex;
	this.objGetVisibility = nsobjGetVisibility;
	this.objSetClipRect = nsobjSetClipRect;
	this.objGetClipLeft = nsobjGetClipLeft;
	this.objGetClipRight = nsobjGetClipRight;
	this.objGetClipTop = nsobjGetClipTop;
	this.objGetClipBottom = nsobjGetClipBottom;
	this.objGetClipWidth = nsobjGetClipWidth;
	this.objGetClipHeight = nsobjGetClipHeight;
	this.replace_html = nsreplace_html;
	this.objChangeSource = nsobjChangeSource;
}


// The Navigator specific implementation

// Resize element
function nsobjResizeBy(w_incr, h_incr)
{
	this.css1.left-=w_incr / 2;
	this.css1.width-=w_incr / 2;
	this.css1.top+=h_incr / 2;
	this.css1.height+=h_incr / 2;
}

// Hide element
function nsobjHide() 
{
	this.css1.visibility = "hidden";
}

// Show element
function nsobjShow() 
{
	this.css1.visibility = "inherit";
}

// Element's left position
function nsobjGetLeft()
{
	return this.css1.left;
}

// Element's visibility
function nsobjGetVisibility()
{
	return this.css1.visibility;
}

// Element's top position
function nsobjGetTop ()
{
	return this.css1.top;
}

// Set element's top position
function nsobjSetTop(top)
{
	this.css1.top = top;
}

// Set element's left position
function nsobjSetLeft(left)
{
	this.css1.left = left;
}

// Make absolute move
function nsobjMoveAbsolute(newleft, newtop)
{
	this.objSetLeft(newleft);
	this.objSetTop(newtop);
}

// Move relative to current location
function nsobjMoveRelative(left, top) 
{
	this.objSetLeft(left + this.objGetLeft());
	this.objSetTop(top + this.objGetTop());
}

// Get element's width
function nsobjGetWidth()
{
	return this.css1.clip.width;
}

// Get element's height
function nsobjGetHeight()
{
	return this.css1.clip.height;
}

// Set element's width
function nsobjSetWidth(width)
{
	this.css1.clip.width = width;
}

// Set element's height
function nsobjSetHeight(height)
{
	this.css1.clip.height = height;
}

// Set element's zindex order
function nsobjSetZIndex(zindex)
{
	this.css1.zIndex = zindex;
}

// Get element's current zindex order
function nsobjGetZIndex()
{
	return style.zIndex;
}

// Clip object
function nsobjSetClipRect (top,left,bottom,right)
{
	if (top == null) top = this.objGetClipTop();
	if (left == null) left = this.objGetClipLeft();
	if (bottom == null) bottom = this.objGetClipBottom();
	if (right == null) right = this.objGetClipRight();
	this.css1.clip.left = left;
	this.css1.clip.right = right;
	this.css1.clip.top = top;
	this.css1.clip.bottom = bottom;
}

// Get current clip right 
function nsobjGetClipRight() 
{
	return this.css1.clip.right;
}

// Get current clip left
function nsobjGetClipLeft()
{
	return this.css1.clip.left;
}

// Get current clip top
function nsobjGetClipTop()
{
	return this.css1.clip.top;
}

// Get current clip bottom
function nsobjGetClipBottom()
{
	return this.css1.clip.bottom;
}

// Get current clip bottom
function nsobjGetClipWidth()
{
	return this.css1.clip.width;
}

// Get current clip bottom
function nsobjGetClipHeight()
{
	return this.css1.clip.height;
}


function nsreplace_html(html_string)
{
	this.css1.document.write(html_string);
	this.css1.document.close();
}

function nsobjChangeSource(sourcefile, width) {
   var clipbottom;
   this.objHide();
   clipbottom = this.objGetClipBottom();
   this.css1.load(sourcefile, width);
   this.css1.clip.bottom = clipbottom;
   this.objShow();
}


// Create the objects
//****************************************************************************************

// Function to create named and unnamed objects
function create_ie_objects() 
{
   theelements = document_object.document.all;
   theobjs = new Array();
   for (i = 0; i < theelements.length; i++)
   {
      if (theelements[i].id != "") 
		theobjs[theelements[i].id] = new ie_object(theelements[i]);
   }
}

// Function to instantiate equalizer objects
function create_ns_objects(newarray) 
{
   theobjs = new Array();
   
   for (i = 0; i < document_object.document.layers.length; i++)
   {
	  if (document_object.document.layers[i].name != "") 
   		theobjs[document_object.document.layers[i].name] = new ns_object(document_object.document.layers[i]);
   }
}

// Create DOM objects
function create_dom_objects()
{  
   theelements = document_object.document.getElementsByTagName("DIV");
   
   theobjs = new Array();
   for (i = 0; i < theelements.length; i++)
   {
      var obj = theelements[i];
      if (obj.id != "")
		 theobjs[obj.id] = new dom_object(obj);
   }
}

// Call correct object loading method    
function create_objects()
{
    // If 5.0 browser
    if (navigator.appVersion.indexOf("5.0") != -1)
		create_dom_objects();
	else
	{ 
    	if (navigator.appName == "Microsoft Internet Explorer")
			create_ie_objects();
        else
			create_ns_objects();
	}
}

// On load()
function js_init()
{
	create_objects();
	js_select(selection.res.selectedIndex);
}

//fselect
function js_select(a_i)
{
	if (a_i==0)
	{
		theobjs["info2"].objShow();
		theobjs["info1"].objHide();
	}
	if (a_i==1)
	{	
		theobjs["info1"].objShow();
		theobjs["info2"].objHide();
	}
}
