	//	Convert object name string or object reference into a valid object reference
function GetObject(ThisRef)
{
	if (typeof ThisRef != "string")
	{	return ThisRef	}
	if(document.getElementById)
	{	if(document.getElementById(ThisRef)){return document.getElementById(ThisRef)}}
	else if(document.all)
	{	if(document.all[ThisRef]){return document.all[ThisRef]}}
	else if(document.ids)
	{	if(document.ids[ThisRef]){return document.ids[ThisRef]}}
	else if(document.layers)
	{	if(document.layers[ThisRef]){return document.layers[ThisRef]}}
	
	return false;
}

function ChangeButton(ThisName,ThisColor,IndexNum)
{	
	ThisObject = GetObject(ThisName);
	if(ThisObject){ThisObject.style.backgroundColor = ThisColor}
}

//these functions "ChangeButton" and "ChangeBackground" are the same for now but 
//we may need to add some additional features to "ChangeButton" at some later date

function ChangeBackground(ThisName,ThisColor,IndexNum)
{	
	ThisObject = GetObject(ThisName);
	if(ThisObject){ThisObject.style.backgroundColor = ThisColor}
}

function ChangeClass(ThisName,ThisClass)
{	
	ThisObject = GetObject(ThisName);
	if(ThisObject){ThisObject.className = ThisClass}
}

function OpenWindow(WindowHREF,Width,Height,Name,ScreenX,ScreenY,LocationBar,ToolBar)
	{	if (Name == null || Name == ""){Name="DataWindow"} 
		if (WindowHREF == null || WindowHREF == ""){WindowHREF='""'} 
		if (Width != null && Width != "")
		{	Width=",Width="+(Width+50)}
		if (Height != null || Height != "")
		{	Height=",Height="+(Height+100)}
		if (ScreenX == null || ScreenX == ""){ScreenX = ""} else{ScreenX=",ScreenX="+ScreenX+",left="+ScreenX}
		if (ScreenY == null || ScreenY == ""){ScreenY = ""} else{ScreenY=",ScreenY="+ScreenY+",top="+ScreenY}
		if (LocationBar == null || LocationBar == ""){LocationBar = ""} else{LocationBar=",Location=yes"}
		if (ToolBar == null || ToolBar == ""){ToolBar = ""} else{ToolBar=",ToolBar=yes"}
		
		Options = Width+Height+ScreenX+ScreenY+LocationBar+ToolBar;
		Options += ',menubar,status,scrollbars,resizable,titlebar';
		DataWindow = window.open("",Name,Options);
		if (DataWindow.opener == null){DataWindow.opener = self};
		DataWindow.location = WindowHREF;
		DataWindow.focus();
	};
	
	
		// GLOBAL FUNCTION TO VIEW LARGE FORMAT PRODUCT IMAGE
	function MakeImageWindow(ImageLink,ImageName,ImageWidth,ImageHeight)
	{	ImageWidth = ImageWidth * 1 + 20;
		ImageHeight = ImageHeight * 1 + 20;
		WindowSpecs = "resizable,ScreenX=50,Screeny=50,left=50,top=50,width=" + ImageWidth + ",height=" + ImageHeight;
		if(window.ImageWindow){window.ImageWindow.close()};
		ImageWindow = window.open("","ImageWindow",WindowSpecs);
		if (ImageWindow.opener == null){ImageWindow.opener = self};
		NewContent = '<html><head><title>' + ImageName + '</title></head>';
		NewContent += '<BODY bgcolor="#ffffff" >';
		NewContent += '<center><IMG src="' + ImageLink + '" >';
		NewContent += '</body></html>';
		ImageWindow.document.open();
		ImageWindow.document.write(NewContent);
		ImageWindow.document.close();
		ImageWindow.focus();
	};
	

// This function goes through the options for the given
// drop down box and removes them in preparation for
// a new set of values
function emptyList( box ) {
	// Set each option to null thus removing it
	while ( box.options.length ) box.options[0] = null;
}

// This function assigns new drop down options to the given
// drop down box from the list of lists specified
function fillList( box, arr ) {
	// arr[0] holds the display text
	// arr[1] are the values
	for ( i = 0; i < arr[0].length; i++ )
	{	// Create a new drop down option with the
		// display text and value from arr
		option = new Option( arr[0][i], arr[1][i] );
		box.options[box.length] = option;	// Add to the end of the existing options
	}
	box.selectedIndex=0;	// Preselect option 0
}

// This function performs a drop down list option change by first
// emptying the existing option list and then assigning a new set
function changeList( box )
{	// Isolate the appropriate list by using the value of the currently selected option
	list = SearchParams[box.options[box.selectedIndex].value];
	emptyList( box.form.SearchField );	// Next empty the slave list
	fillList( box.form.SearchField, list );	// Then assign the new list values
}


var ShadeMotion='open'; // The shade should be opened
var ShadeObj = ''; // the Div Tag Object
var ShadeTimeoutId = '';
var UnopenedShadeAmt = '';
var TopOfShade='';

function MoveShade(ObjectName,width,height,top,flap,CloseDelay) // 
{	ShadeObj = GetObject(ObjectName);
	if(ShadeObj && ShadeObj.style && ShadeObj.style.clip && ShadeObj.style.top && ShadeObj.style.visibility){}
	else{return false;}
	if(UnopenedShadeAmt == ''){UnopenedShadeAmt = height + flap;} // this is the total size of the open shade
	if(TopOfShade == ''){TopOfShade = top;} // this is the total size of the open shade
	
		if (  (UnopenedShadeAmt < height && ShadeMotion=='close') || (UnopenedShadeAmt>=1 && ShadeMotion=='open')  ) // if the shade is not already open  
		{
			if(UnopenedShadeAmt>=1) // if the shade isn't fully open
			{
					ShadeObj.style.visibility="visible"; // show the image
			}
			(ShadeMotion=='close')?UnopenedShadeAmt+=4:UnopenedShadeAmt-=4; // raise or lower the shade in 4 pixel increments
			(ShadeMotion=='close')?TopOfShade-=4:TopOfShade+=4; // move the location of the top of the shade in 4 pixel increments
			ShadeObj.style.clip="rect(" + UnopenedShadeAmt + ","+width+","+(height+flap)+",0)"; // the ad will only display in this size rectangle
			ShadeObj.style.top=TopOfShade; // set the location of the top of the ad
			ShadeTimeoutId = setTimeout("MoveShade('"+ObjectName+"',"+width+","+height+","+top+","+flap+")",20); // in 20 milliseconds, run the showad(full) routine this equivalent to frame delay
		}
		else  // the shade is fully open or clsoed
		{ 
			if (ShadeMotion=='open')
			{
				ShadeObj.style.clip="rect(0,"+width+","+(height+flap)+",0)"; // the ad will only display in this rectangle
				ShadeObj.style.top = height + flap + top; //the top of the ad now
				ShadeMotion='close'; // the shade is now fully open, so set it's next motion to close
				ShadeTimeoutId = setTimeout("MoveShade('"+ObjectName+"',"+width+","+height+","+top+","+flap+")",7000); // in 5 seconds, begin to close the shade
			}
			else
			{
				ShadeObj.style.visibility="visible"; // make the area within the div referenced by ShadeObj visible - this displays the open shade
				ShadeMotion='open';
			}
		}
	} 

function ShowClosedShade(ObjectName,width,height,top,flap) // if we want to display a closed shade
{ 	ShadeObj = GetObject(ObjectName);
	if(ShadeObj && ShadeObj.style && ShadeObj.style.clip && ShadeObj.style.top && ShadeObj.style.visibility){}
	else{return false;}
	ShadeObj.style.clip="rect("+height+","+width+","+(height+flap)+",0)"; // The ad will only display within this area
	ShadeObj.style.top = top + flap; //the top of the ad now 20 larger than top
	ShadeObj.style.visibility="visible"; // make the area within the div tags referenced by ShadeObj visible - this displays the closed shade
}

function HideDivs(DivList)
{	var DivId = DivList;
	DivAry=DivList.split(",");
	for ( i = 0; i < DivAry.length; i++ )
	{	DivId = DivAry[i];
		if(document.all && document.all.style)
		{	if(document.all[DivId]){document.all[DivId].style.visibility = "hidden"}}
		else if(document.getElementById)
		{	if(document.getElementById(DivId)){document.getElementById(DivId).style.visibility = "hidden"}}
		else if(document.ids)
		{	if(document.ids[DivId]){document.ids[DivId].display = "none"}}
		else if(document.layers)
		{	if(document.layers[DivId]){document.layers[DivId].visibility = "hidden"}}
	}
}

function ShowDivs(DivList)
{	var DivAry = new Array();
	DivAry=DivList.split(",");
	for ( i = 0; i < DivAry.length; i++ )
	{	DivId = DivAry[i];
		if(document.all && document.all.style)
		{	if(document.all[DivId]){document.all[DivId].style.visibility = "visible"}}
		else if(document.getElementById)
		{	if(document.getElementById(DivId)){document.getElementById(DivId).style.visibility = "visible"}}
		else if(document.ids)
		{	if(document.ids[DivId]){document.ids[DivId].display = "inline"}}
		else if(document.layers)
		{	if(document.layers[DivId]){document.layers[DivId].visibility = "display"}}
	}
}

function HideLayer(LayerName)
{	
	if (document.layers)
	{	document.LayerName.visibility = 'hidden'	}
	else
	{	document.all.LayerName.style.visibility = 'hidden'   }
}

function TextAreaTab()
{	if(window.event)
	{	var e = window.event; 
		if (e.keyCode == 9)
		{	e.srcElement.value = e.srcElement.value + "\t"; 
			e.srcElement.focus() 
			return false; 
		} 
		return true; 
	}
}

function TrackCount(fieldObj,maxChars,fieldID)
{ // use: onKeyUp="TrackCount(this, 100,'countdown')" You have <span id="countdown" style="font-weight: bold">100</span> remaining characters
  var diff = maxChars - fieldObj.value.length;

  // Need to check & enforce limit here also in case user pastes data
  if (diff < 0)
  {
    fieldObj.value = fieldObj.value.substring(0,maxChars);
    diff = maxChars - fieldObj.value.length;
  }

  if( fieldID != null )
  {
    var element = document.getElementById(fieldID)
    if( element != null )
    {
        element.innerHTML=diff;
    }
  }

}


function setCookie(name, value, expires, path, domain, secure) {
/*
   name - name of the cookie
   value - value of the cookie
   [expires] - expiration date of the cookie
     (defaults to end of current session)
   [path] - path for which the cookie is valid
     (defaults to path of calling document)
   [domain] - domain for which the cookie is valid
     (defaults to domain of calling document)
   [secure] - Boolean value indicating if the cookie transmission requires
     a secure transmission
   * an argument defaults when it is assigned null as a placeholder
   * a null placeholder is not required for trailing omitted arguments
*/
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}



function getCookie(name) {
/*
  name - name of the desired cookie
  return string containing value of specified cookie or null
  if cookie does not exist
*/
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}



function deleteCookie(name, path, domain) {
/*
   name - name of the cookie
   [path] - path of the cookie (must be same as path used to create cookie)
   [domain] - domain of the cookie (must be same as domain used to
     create cookie)
   path and domain default if assigned null or omitted if no explicit
     argument proceeds
*/
  if (getCookie(name)) {
    document.cookie = name + "=" +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}


function fixDate(date) {
// date - any instance of the Date object
// * hand all instances of the Date object to this function for "repairs"
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0)
    date.setTime(date.getTime() - skew);
}

// flash scripts

  
  //v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}


//--> end hide JavaScript