// Support Script (626)
// Copyright (c) 1997 by Elemental Software, Inc. - ALL RIGHTS RESERVED.
//
// This class manages collections of edge transitions (collections of
// class slideEdgeObject). This is how contracts such as "box in" is
// implemented, which is a collection of 4 slideEdgeObjects, one for each
// edge in a box.
//
function clipTransitionMgr(ocInfo, collectionName)
{
	this.ocInfo = ocInfo;
	this.fullName = this.ocInfo.fullName;
	this.collectionName = '.' + collectionName;

	this.removeTransitions = ctmRemoveTransitions;
	this.addTransition = ctmAddTransition;
	this.getCount      = ctmGetCount;
	this.execute       = ctmExecute;
}

function ctmRemoveTransitions()
{
	eval(this.fullName + this.collectionName + ' = new Array(0)'); // thank you garbage collector
}

function ctmAddTransition(edge, End, Duration)
{
	slideEdgeObj = new slideEdgeObject(this.ocInfo, edge, End, Duration);

	if (!eval(this.fullName + this.collectionName)) this.removeTransitions();

	nextIndex = eval(this.fullName + this.collectionName + '.length');

	slideEdgeObj.clipObjName = this.fullName + this.collectionName + '[' + nextIndex + ']';
	eval(this.fullName + this.collectionName + '[' + nextIndex + '] = slideEdgeObj');
}

function ctmGetCount()
{
	retCount = 0;
	if (eval(this.fullName + this.collectionName)) 
		retCount = eval(this.fullName + this.collectionName + '.length');

	return retCount;
}

function ctmExecute()
{
	if (eval(this.fullName + this.collectionName))
		for (iSlide=0; iSlide < eval(this.fullName + this.collectionName + '.length'); iSlide++)
			eval(this.fullName + this.collectionName + '[iSlide].slideEdgeExecute()');
}

// Support Script (627)
// Copyright (c) 1997 by Elemental Software, Inc. - ALL RIGHTS RESERVED.
//
// This class derives from objectInfo class. This class adds functionality to 
// manage the clipping region of a display object. This code essentially wraps
// clipping functionality for IE4.0 and NC4.0.
//
function setNthArg(str, N, arg, delim) // N is zero based
{
	retStr = null; // return null if we can't parse
	iStart = str.indexOf("(");

	for (i=0; i < N; i++)
	{
		iStart = str.indexOf(delim, iStart +1);
		if (iStart < 0) break;
	}

	if (iStart >= 0)
	{
		iStart++;
		iEnd = str.indexOf(delim, iStart);
		if (iEnd < 0) iEnd = str.indexOf(")", iStart);
		if (iEnd > 0)
		{
			retStr  = str.substring(0, iStart);
			retStr += arg;
			retStr += str.substring(iEnd, str.length);
		}
	}

	return retStr;
}

function getNthArg(str, N, delim) // N is zero based
{
	retArg = null;
	iStart = str.indexOf("(");

	for (i=0; i < N; i++)
	{
		iStart = str.indexOf(delim, iStart +1);
		if (iStart < 0) break;
	}

	if (iStart >= 0)
	{
		iStart++;
		iEnd = str.indexOf(delim, iStart);
		if (iEnd < 0) iEnd = str.indexOf(")", iStart);
		if (iEnd > 0)
		{
			retArg = str.substring(iStart, iEnd);
		}
	}

	return retArg;
}

function objectClipInfo(objName)
{
	// define methods
	this.resetClip = objectClipInfoResetClip;
	this.getClip   = ociGetClip;
	this.setClip   = ociSetClip;

	this.objectInfo = objectInfo; // inherit from object info
	this.objectInfo(objName);

	// mapping from edge name to argument number for IE40
	this.edgeToArgNumber = new Array(4);
	this.edgeToArgNumber['top']    = 0;
	this.edgeToArgNumber['right']  = 1;
	this.edgeToArgNumber['bottom'] = 2;
	this.edgeToArgNumber['left']   = 3;
}

function objectClipInfoResetClip()
{
	this.setClip('top',    0);
	this.setClip('right',  this.width);
	this.setClip('bottom', this.height);
	this.setClip('left',   0);	
}

function ociSetClip(edge, newClip)
{
	edge.toLowerCase();
	var argNo = this.edgeToArgNumber[edge];
	if (!isNaN(argNo))
	{
		var obj = eval(this.fullName);
		if (obj && obj.clip)
		{
			eval('obj.clip.' + edge + ' = newClip;');
		}
		else
		{
			if (obj && obj.style)
			{
				if (obj.style.clip.length == 0)
					obj.style.clip = "rect(auto auto auto auto)";

				newClipStr = setNthArg(obj.style.clip, argNo, newClip, " ");
				if (newClipStr)
					obj.style.clip = newClipStr;
			}
		}
	} else alert("bad edge arg to ociSetClip '" + edge + "'");
}

function ociGetClip(edge)
{
	retClip = 0;
	edge.toLowerCase();

	argNo = this.edgeToArgNumber[edge];
	if (!isNaN(argNo))
	{
		var obj = eval(this.fullName);

		if (obj && obj.clip)
		{
			retClip = eval('obj.clip.' + edge);
		}
		else
		{
			if (obj && obj.style)
			{
				if (obj.style.clip.length == 0)
					obj.style.clip = "rect(auto auto auto auto)";

				retClip = getNthArg(obj.style.clip, argNo, " ");
				if (retClip == "auto")
				{
					if      (edge == "top")    retClip = 0;
					else if (edge == "right")  retClip = obj.offsetWidth;
					else if (edge == "bottom") retClip = obj.offsetHeight;
					else if (edge == "left")   retClip = 0;
				}
				else
					retClip = parseInt(retClip);
			}
		}
	} else alert("bad edge arg to ociGetClip '" + edge + "'");

	return retClip;
}

// Support Script (628)
function clipReveal(target, Speed, direction)
{
	ocInfo = new objectClipInfo(target);
	if (ocInfo.fullName.length > 0)
	{
		ocInfo.hide();

		ocXMgr = new clipTransitionMgr(ocInfo, "showSlideClip");

		edge = direction.toLowerCase();
		Duration = DurationToSeconds[Speed];

		if (!isNaN(Duration))
		{
			ocInfo.resetClip();
			ocXMgr.removeTransitions();
			Beg = End = 0;

			if (edge.indexOf("top") >= 0)
			{
				ocInfo.setClip("top", ocInfo.height);
				ocXMgr.addTransition("top", 0, Duration);
			}

			if (edge.indexOf("right") >= 0)
			{
				ocInfo.setClip("right", 0);
				ocXMgr.addTransition("right", ocInfo.width, Duration);
			}

			if (edge.indexOf("bottom") >= 0)
			{
				ocInfo.setClip("bottom", 0);
				ocXMgr.addTransition("bottom", ocInfo.height, Duration);
			}
			
			if (edge.indexOf("left") >= 0)
			{
				ocInfo.setClip("left", ocInfo.width);
				ocXMgr.addTransition("left", 0, Duration);
			}

			if (edge.indexOf("horizontal") >= 0)
			{
				ocInfo.setClip('left',  ocInfo.width /2);
				ocInfo.setClip('right', ocInfo.width /2);

				ocXMgr.removeTransitions();
				ocXMgr.addTransition('left', 0, Duration);
				ocXMgr.addTransition('right', ocInfo.width, Duration);
			}
			else if (edge.indexOf("vertical") >= 0)
			{
				ocInfo.setClip('top',    ocInfo.height /2);
				ocInfo.setClip('bottom', ocInfo.height /2);

				ocXMgr.removeTransitions();
				ocXMgr.addTransition('top', 0, Duration);
				ocXMgr.addTransition('bottom', ocInfo.height, Duration);
			}
			else if (edge.indexOf("box") >= 0)
			{
				ocInfo.setClip('left',  ocInfo.width /2);
				ocInfo.setClip('right', ocInfo.width /2);
				ocXMgr.removeTransitions();

				ocXMgr.addTransition('left', 0, Duration);
				ocXMgr.addTransition('right', ocInfo.width, Duration);

				// vertical code
				ocInfo.setClip('top',    ocInfo.height /2);
				ocInfo.setClip('bottom', ocInfo.height /2);

				ocXMgr.addTransition('top', 0, Duration);
				ocXMgr.addTransition('bottom', ocInfo.height, Duration);
			}


			if (ocXMgr.getCount() <=0) alert("clipReveal: Bad direction value = " + edge);

			// execute the reveal...

			ocInfo.show();
			ocXMgr.execute();
		}
		else alert("clipReveal: Bad duration value = " + [Duration]);
	}
}
// Support Script (633)
DurationToSeconds = new Array(3);
DurationToSeconds["Slow"]   = 6;
DurationToSeconds["Medium"] = 3;
DurationToSeconds["Fast"]   = 1;

// Support Script (779)
// Copyright (c) 1998 by Elemental Software, Inc. - ALL RIGHTS RESERVED.
//
// This class finds the named object in either 4.0 DOM and 
// gathers information about it.
//
function objectInfo(objName)
{
	this.fullName = ""; // if this does not get filled the object could not be found.

	if (objName.length == 0) return;

	this.hide = objectInfoHide;
	this.show = objectInfoShow;
	this.setLeft = objectInfoSetLeft;
	this.setTop  = objectInfoSetTop;
	this.getPosition  = objectInfoGetPosition;
	this.isValid      = objectInfoIsValid;
	this.isValidIE    = objectInfoIsValidIE;
	this.getZindex    = objectInfoGetZindex;
	this.setZindex    = objectInfoSetZindex;
	this.getDimension = objectInfoGetDimension;
	this.setDimension = objectInfoSetDimension;
 this.shiftTo      = objectInfoShiftTo;

	// find the named object in the DOM and then get the properties

	if (document.all) // IE
	{
		while (true)
		{
			if (eval("document.all.DBStyle" + objName))
			{
				if (eval("document.all.DBStyle" + objName + ".offsetWidth"))
				{
					this.fullName = "document.all.DBStyle" + objName;
					this.tagName  = this.fullName;
				}
			}
			else if (eval("document.all." + objName))
			{
				if (eval("document.all." + objName + ".offsetWidth"))
				{
					// Text in DIV tags are caught here
					this.fullName = "document.all." + objName;
					this.tagName  = this.fullName;
				}
				else if (eval("document.all." + objName + "." + objName) != null)
				{
					// Other tags are caught here.
					if (eval("document.all." + objName + "[1].tagName")  != "DIV")
					{
						this.fullName = "document.all." + objName + "[0]";
						this.tagName  = "document.all." + objName + "[1]";
					}
				}
			}

			// strip underscores out of input and try one more time
			if (this.fullName.length > 0) break;
			objName2 = objName.replace(/_/, "");
			if (objName2 == objName) break;
			objName = objName2;
		}

		
		if (this.fullName.length > 0)
		{
			this.styleKey = '.style'; // used to access style info
			this.width  = eval(this.fullName + ".offsetWidth");
			this.height = eval(this.fullName + ".offsetHeight");
		}
	}
	else  // NC
	{
		if (document.layers)
		{
			sectionNumber = 0;
			while (true)
			{
				sectionName = "LyrSection" + sectionNumber.toString();
				if (eval("document.layers." + sectionName) == null) break;  // can't find object in DOM

				// see if this is an object in the DOM
				if (eval("document.layers." + sectionName + ".document"))
				{
					while (true)
					{
						if (eval("document.layers." + sectionName + ".document.layers.LyrDBStyle" + objName))
						{
							this.fullName = "document.layers." + sectionName + ".document.layers.LyrDBStyle" + objName;
							this.tagName  = "document.layers." + sectionName + ".document." + objName; 
							break;
						}
						else if (eval("document.layers." + sectionName + ".document.layers.Lyr" + objName))
						{
							this.fullName = "document.layers." + sectionName + ".document.layers.Lyr" + objName;
							this.tagName  = "document.layers." + sectionName + ".document." + objName; 
							break;
						}
						else if (eval("document.layers." + sectionName + ".document.layers." + objName))
						{
							this.fullName = "document.layers." + sectionName + ".document.layers." + objName;
							this.tagName  = "document.layers." + sectionName + ".document." + objName; 
							break;
						}

						// strip underscores out of input and try one more time
						if (this.fullName.length > 0) break;
						objName2 = objName.replace(/_/, "");
						if (objName2 == objName) break;
						objName = objName2;
					}

				} else alert("objectInfo: " + "document.layers." + sectionName + ".document" + " is not an object");

				sectionNumber++;
			} // end while (looping over all SectionN relative positioning layers)

			if (this.fullName.length > 0 && "undefined" != typeof(eval(this.fullName + ".pageX")))
			{
				this.styleKey = '';

				if (eval(this.fullName + ".dbWidth"))
				{
					// we have previously set the values - get them from here, since if we changed
					// the clipping region the size will be wrong (it will be clipping size - not native size).
					this.width  = eval(this.fullName + ".dbWidth");
					this.height = eval(this.fullName + ".dbHeight");
				}
				else
				{
					// get the clipping size and save it off since we haven't yet clipped this guy.
					this.width  = eval(this.fullName + ".clip.width");
					this.height = eval(this.fullName + ".clip.height");
					eval(this.fullName + ".dbWidth  = this.width");
					eval(this.fullName + ".dbHeight = this.height");
				}
			}
			else
			{
				this.fullName = "";
				this.tagName  = "";
			}
		}  // end if (document.layers  e.g. NC)
	}
	this.object = null;
	if (this.fullName.length > 0)
		this.object = eval(this.fullName);
}

function objectInfoHide()
{	
	if (this.fullName.length > 0)
		eval(this.fullName + this.styleKey + ".visibility = 'hidden';");
}

function objectInfoShow()
{
	if (this.fullName.length > 0)
		eval(this.fullName + this.styleKey + ".visibility = 'visible';");
}

function objectInfoSetLeft(left)
{
	if (this.fullName.length > 0)
		eval(this.fullName + this.styleKey + ".left = left");
}

function objectInfoSetTop(top)
{
	if (this.fullName.length > 0)
		eval(this.fullName + this.styleKey + ".top = top");
}

function objectInfoGetPosition()
{
	ret = null;
	if (this.fullName.length > 0)
	{
		if ("undefined" != typeof(eval(this.fullName + ".offsetLeft")))
		{
			ret = new Object;
			ret.left   = eval(this.fullName + ".offsetLeft");
			ret.top    = eval(this.fullName + ".offsetTop");
		}
		else if ("undefined" != typeof(eval(this.fullName + ".pageX")))
		{
			ret = new Object;
			ret.left = eval(this.fullName + ".pageX");
			ret.top  = eval(this.fullName + ".pageY");
		}
	}
	return ret;
}

function objectInfoIsValid()
{
	return (this.fullName.length > 0 && this.object);
}

function objectInfoIsValidIE()
{
	return (this.fullName.length > 0 && this.object && document.all);
}


function objectInfoGetZindex()
{
	  if (this.fullName.length > 0)
  	{
	   ret = eval(this.fullName + this.styleKey + ".zIndex");
	   return (ret);
  	}
}

function objectInfoSetZindex(ind)
{
  if (this.fullName.length > 0 )
  {
    eval(this.fullName + this.styleKey + ".zIndex = ind");
  }
}

function objectInfoGetDimension()
{

   ret = null;
   ret = new Object;
   if (document.all) {  // IE
      ret.width = eval(this.fullName + ".offsetWidth");
      ret.height = eval(this.fullName + ".offsetHeight");
   }
   else {  // NC
      if (eval(this.fullName + ".dbWidth")) {
         ret.width  = eval(this.fullName + ".dbWidth");
         ret.height = eval(this.fullName + ".dbHeight");
      }
      else {
         ret.width = eval(this.fullName + ".clip.width");
         ret.height = eval(this.fullName + ".clip.height");
      }
   }
    
   return (ret);
}       

function objectInfoSetDimension(w, h)
{
   if (document.all) { // IE
     eval(this.fullName + this.styleKey + ".width = w");
     eval(this.fullName + this.styleKey + ".height = h");
   }
   else { // NC
     if (eval(this.fullName + ".clip.width")) {
        eval(this.fullName + ".clip.width = w");
        eval(this.fullName + ".clip.height = h");
     }
     eval(this.fullName + ".dbWidth = w");
     eval(this.fullName + ".dbHeight = h");
   }
   this.width = w;
   this.height = h;
}

function objectInfoShiftTo(x, y)
{
   if (document.all) { // IE
      eval(this.fullName + this.styleKey + ".left = x");
      eval(this.fullName + this.styleKey + ".top  = y");
   }
   else { // NC
      eval(this.fullName + ".moveTo(x,y)");
   }
}
// Support Script (631)
// Copyright (c) 1997 by Elemental Software, Inc. - ALL RIGHTS RESERVED.
//
// Object that slides one edge of a display element (layer) from it's 
// current position to a new position.
// 
// Must be used with object objectClipInfo (an input argument).
//
function slideEdgeObject(ocInfo, edge, end, duration)
{
	this.incPeriod = 20;   // time for each increment in milliseconds
	this.clipObjName = ''; // string used to call setTimeout - caller must set this after instantialtion
	this.edge        = edge;
	this.ocInfo      = ocInfo;
	this.fullName    = this.ocInfo.fullName;
	this.clipEnd     = end;
	this.clipBeg     = this.ocInfo.getClip(this.edge); // initial guess, caller can change this.
	this.iStep       = 0;
	this.duration    = duration;
	this.nSteps      = (duration * 1000) / this.incPeriod;

	this.slideEdgeExecute = slideEdgeExecute;
}

function slideEdgeExecute()
{
	if (this.duration > 0)
	{
		this.iStep++;
		clipNow = this.clipBeg + (((this.clipEnd - this.clipBeg) * this.iStep) / this.nSteps);
		clipNow = Math.round(clipNow);
		this.ocInfo.setClip(this.edge, clipNow);

		if (this.iStep < this.nSteps)
			setTimeout(this.clipObjName + ".slideEdgeExecute()", this.incPeriod);
		else
			this.ocInfo.setClip(this.edge, this.clipEnd);
	}
	else // 0 duration - just move the thing
		this.ocInfo.setClip(this.edge, this.clipEnd);
}


function AdminImageThumb_onMouseOver() {
clipReveal("AdminImage", "Fast", "Bottom");
 }
function _AdminImageThumb_onMouseOver() { if (AdminImageThumb) return AdminImageThumb.onMouseOver(); }
function AdminImageThumb_onMouseOut() {
var objInfo = new objectInfo("AdminImage");
objInfo.hide();
 }
function _AdminImageThumb_onMouseOut() { if (AdminImageThumb) return AdminImageThumb.onMouseOut(); }
function LoginImageThumb_onMouseOver() {
clipReveal("LoginImage", "Fast", "Bottom");
 }
function _LoginImageThumb_onMouseOver() { if (LoginImageThumb) return LoginImageThumb.onMouseOver(); }
function LoginImageThumb_onMouseOut() {
var objInfo = new objectInfo("LoginImage");
objInfo.hide();
 }
function _LoginImageThumb_onMouseOut() { if (LoginImageThumb) return LoginImageThumb.onMouseOut(); }
function UpdateImageThumb_onMouseOver() {
clipReveal("UpdateImage", "Fast", "Bottom");
 }
function _UpdateImageThumb_onMouseOver() { if (UpdateImageThumb) return UpdateImageThumb.onMouseOver(); }
function UpdateImageThumb_onMouseOut() {
var objInfo = new objectInfo("UpdateImage");
objInfo.hide();
 }
function _UpdateImageThumb_onMouseOut() { if (UpdateImageThumb) return UpdateImageThumb.onMouseOut(); }
function AllListingsImageThumb_onMouseOver() {
clipReveal("AllListingsImage", "Fast", "Bottom");
 }
function _AllListingsImageThumb_onMouseOver() { if (AllListingsImageThumb) return AllListingsImageThumb.onMouseOver(); }
function AllListingsImageThumb_onMouseOut() {
var objInfo = new objectInfo("AllListingsImage");
objInfo.hide();
 }
function _AllListingsImageThumb_onMouseOut() { if (AllListingsImageThumb) return AllListingsImageThumb.onMouseOut(); }


