﻿<!--
var $j = jQuery.noConflict();

function doNothing(){}
//DOM helper
function inv_clear(element)
{
    element.value='';
}
function XBrowser() { }
 
// detects Internet Explorer
XBrowser.isIE = document.all && window.ActiveXObject &&
    (navigator.userAgent.toLowerCase().indexOf('msie') > -1);
 
// Sets the 'class' of a DOM element

//useage: XBrowser.setClass(this,'myClass');
XBrowser.setClass = function setClass(element, val) {
    var attrName = (XBrowser.isIE ? 'className' : 'class');
    element.setAttribute(attrName, val);
}
    //useage: XBrowser.getClass(this);
XBrowser.getClass = function getClass(element) {
    var attrName = (XBrowser.isIE ? 'className' : 'class');
   return element.getAttribute(attrName); 
}

XBrowser.removeClass = function removeClass(element) {
    var attrName = (XBrowser.isIE ? 'className' : 'class');
   return element.removeAttribute(attrName); 
     
}
/*
//stylesheet switcher
function setActiveStyleSheet(title) {  var i, a, main;  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {      a.disabled = true;      if(a.getAttribute("title") == title) a.disabled = false;    }  }}
*/

//parse URL
function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

function clearAnchorClasses( elementID )
{
    // Make sure browser supports this dom method 
    if(!document.getElementsByTagName) return; 

    if(document.getElementById(elementID)!=null) 
    {
        // Get the input nodes
        var inputNodeList = document.getElementById(elementID).getElementsByTagName('a');

        // Make sure something was found
        if(!inputNodeList ) return;

        // Iterate through the list
        for( var i = 0; i < inputNodeList.length; i++ )
        {
            // Get an individual node
            var inputNode = inputNodeList.item(i);
            if ( XBrowser.getClass(inputNode)=="On")
            {
                XBrowser.removeClass(inputNode);
            }
        } 
    }
}

//for menu
function inv_highlightMenu()
{
  /*            <ul id="inv_LinkShell" class="L2">
                    <li><a href="/grants/default.aspx?id=56" class="On" id="inv_linkid_56">Grant Programs</a>
                        <ul class="L3">
                            <li><a href="/grants/default.aspx?id=58" id="inv_linkid_58">History of Art</a></li>
                            <li><a href="/grants/default.aspx?id=60" id="inv_linkid_60">Conservation</a></li>
                            <li><a href="/grants/default.aspx?id=62" id="inv_linkid_62">Digital Resources</a></li>
                            <li><a href="/grants/default.aspx?id=64" id="inv_linkid_64">Responsive Grants</a></li>
                        </ul>
                    </li>
                    <li><a href="/grants/default.aspx?id=66" id="inv_linkid_66">How to Apply</a></li>
                    <li><a href="/grants/pastGrants.aspx?id=68" id="inv_linkid_68">Past Grants</a></li>
                </ul> */
  if (document.getElementById)
  {
      
    //create the element first from the querystring  
    var linkID = gup('id'); //grab id param
    if (linkID != '34738') // hack for child page but not in menu
    {
        if (/^-?\d+$/.test(linkID))//integer?
        {
             //clear the default highlight   
            clearAnchorClasses('inv_LinkShell');  
            var elementID = "inv_linkid_" + linkID;   
            var linkElement =  document.getElementById(elementID); //get a Reference
            if (linkElement)//exists?
                XBrowser.setClass(linkElement,"On");
        }
    }  
  }
}

//for homepage
//For Image Highlights //
var  bgImageArray = ["/img/homepage/img.home.main.bg_1.jpg","/img/homepage/img.home.main.bg_2.jpg","/img/homepage/img.home.main.bg_3.jpg","/img/homepage/img.home.main.bg_4.jpg"];
if (document.images)
{
  preload_image_object = new Image();
   
   for(var li = 0; li< bgImageArray.length; li++) 
     preload_image_object.src = bgImageArray[li];
}
    
var homePreviousOff = new Image();
homePreviousOff.src = 'img/btn.home.previous_off.gif';
var homePreviousOver = new Image();
homePreviousOver.src = 'img/btn.home.previous_over.gif';
var homeNextOff = new Image();
homeNextOff.src = 'img/btn.home.next_off.gif';
var homeNextOver = new Image();
homeNextOver.src = 'img/btn.home.next_over.gif';
var inv_bgPos=0;
var inv_textPos=0;
var inv_GalleryPicturePos = 0;
function inv_PrevImage()
{
  //first Change the Image currentPosition - 1
  //inv_bgImageUpdate("prev");
  //next change the Text  currentPosition - 1
  inv_textUpdate("prev");
}
function inv_NextImage()
{
//first Change the Image currentPosition + 1
 // inv_bgImageUpdate("next");
  //next change the Text  currentPosition + 1
  inv_textUpdate("next");
}

function randomImage()
{
  //firstCheck to make sure source of images is available
  if  (bgImageArray != undefined && bgImageArray.length > 1)
  {
    var inv_bgPos=generateRandomNumber(0, bgImageArray.length-1);
    inv_updateImageBackground('HomeHeaderImage',bgImageArray[inv_bgPos]);
  }
}

function createLink(url,text)
{
    return '<a href="' + url + '">' + text + "</a>";
}

function generateRandomNumber(x, y) {
    var range = y - x + 1;
    return Math.floor(Math.random() * range) + x;
}

function inv_textUpdate(dir)
{
  if  (hpTextObjects.highlight.length > 1)
  {
        if (document.getElementById)
        {
            var titleDIV = document.getElementById('inv_title');
            var subtitleDIV = document.getElementById('inv_subtitle');
            var bodyDIV = document.getElementById('inv_body');
            if (dir=="prev") 
            {
                //assign the fields to the elements
                inv_textPos = inv_textPos -1;
                if (inv_textPos==-1) inv_textPos=hpTextObjects.highlight.length -1;
                titleDIV.innerHTML = hpTextObjects.highlight[inv_textPos].title;
                subtitleDIV.innerHTML = hpTextObjects.highlight[inv_textPos].subtitle;
                if (hpTextObjects.highlight[inv_textPos].url!='')
                    bodyDIV.innerHTML = hpTextObjects.highlight[inv_textPos].body + "&nbsp;" + createLink(hpTextObjects.highlight[inv_textPos].url,'Read more') + ".";
                else
                    bodyDIV.innerHTML = hpTextObjects.highlight[inv_textPos].body;
                
            }
            else
            {
                inv_textPos = inv_textPos+1;
                if (inv_textPos==hpTextObjects.highlight.length) inv_textPos=0;
                titleDIV.innerHTML = hpTextObjects.highlight[inv_textPos].title;
                subtitleDIV.innerHTML = hpTextObjects.highlight[inv_textPos].subtitle;
                if (hpTextObjects.highlight[inv_textPos].url!='')
                    bodyDIV.innerHTML = hpTextObjects.highlight[inv_textPos].body + "&nbsp;" + createLink(hpTextObjects.highlight[inv_textPos].url,'Read more') + ".";
                else
                    bodyDIV.innerHTML = hpTextObjects.highlight[inv_textPos].body;
            }
            // alert(hpTextObjects.highlight[inv_textPos].title + " - " + hpTextObjects.highlight[inv_textPos].subtitle + " - " + hpTextObjects.highlight[inv_textPos].body);
         }
         else
         {
            alert("You are using an outdated browser. Please upgrade to enjoy the features of this website. We recommend using Firefox at http://www.getfirefox.com");
         
         }
  }
}
  
function inv_ChangePicture(dir)
{
  if  (imageGallery.picture.length > 1)
  {
        if (document.getElementById)
        {
            if (dir=="prev") 
            {
                //assign the fields to the elements
                inv_GalleryPicturePos = inv_GalleryPicturePos -1;
                if (inv_GalleryPicturePos==-1) inv_GalleryPicturePos=imageGallery.picture.length -1;
            }
            else
            {
                inv_GalleryPicturePos = inv_GalleryPicturePos+1;
                if (inv_GalleryPicturePos==imageGallery.picture.length) inv_GalleryPicturePos=0;
            }
              //update thumb picture and the bottom description zoom text.              
                inv_updateImage('inv_galleryImageSpan',imageGallery.picture[inv_GalleryPicturePos].topImageThumb.split("\'").join("'"));
                inv_updateImage('inv_galleryImageDescription',imageGallery.picture[inv_GalleryPicturePos].zoomTextMasterTopImage.split("'").join("\'"));
                //<a id="inv_galleryImageLink" href="javascript:DoNothing();" onClick="return Tip(escapeInfoBoxImage(this) + '&lt;br/&gt;This is zoom text from the original header INFOBOX .. this should NOT show when RANDOM is chosen.')" onMouseOver="return Tip('This is pop up text from the original header INFOBOX .. this should NOT show when RANDOM is chosen.')"><span id="inv_infoImageHeaderSpan"><img border="0" alt="header1" src="/uploadedImages/InfoBoxes/thumbs/infoboxHeader.jpg" /></span></a><br />
                 //update the gallery picture zoom link
                inv_removeInfoBoxAttributes("inv_galleryImageLink");
                if (imageGallery.picture[inv_GalleryPicturePos].zoomTextMasterTopImage.length>0 && imageGallery.picture[inv_GalleryPicturePos].photoCredits.length>0)
                 inv_UpdateInfoBoxLinkText("inv_galleryImageLink","onclick","return Tip(convertGalleryImage() + '<br/><div class=zoom>" + imageGallery.picture[inv_GalleryPicturePos].zoomTextMasterTopImage.split("\'").join("\\'") + "<br/>" + imageGallery.picture[inv_GalleryPicturePos].photoCredits.split("\'").join("\\'") + "<br/></div>')");
                else if (imageGallery.picture[inv_GalleryPicturePos].zoomTextMasterTopImage.length>0 && imageGallery.picture[inv_GalleryPicturePos].photoCredits.length<1)
                 inv_UpdateInfoBoxLinkText("inv_galleryImageLink","onclick","return Tip(convertGalleryImage() + '<br/><div class=zoom>" + imageGallery.picture[inv_GalleryPicturePos].zoomTextMasterTopImage.split("\'").join("\\'") + "<br/></div>')");
                else if (imageGallery.picture[inv_GalleryPicturePos].zoomTextMasterTopImage.length<1 && imageGallery.picture[inv_GalleryPicturePos].photoCredits.length>0)
                 inv_UpdateInfoBoxLinkText("inv_galleryImageLink","onclick","return Tip(convertGalleryImage() + '<br/><div class=zoom>" + imageGallery.picture[inv_GalleryPicturePos].photoCredits.split("\'").join("\\'") + "<br/></div>')");
                else
                 inv_UpdateInfoBoxLinkText("inv_galleryImageLink","onclick","return Tip(convertGalleryImage())");
                 //hover text
                if (imageGallery.picture[inv_GalleryPicturePos].popupTextMasterTopImage.length>0)
                 inv_UpdateInfoBoxLinkText("inv_galleryImageLink","onmouseover","return Tip('" + imageGallery.picture[inv_GalleryPicturePos].popupTextMasterTopImage.split("\'").join("\\'") + "')");
         }
         else
         {
         alert("You are using an outdated browser. Please upgrade to enjoy the features of this website. We recommend using Firefox at http://www.getfirefox.com");
         
         }
        }
}

function navOverOut(elementID,imgState) {
	if (document.images) {
		var elementName = elementID;
		var imgPath = eval(elementID + imgState + '.src');
		document[elementName].src = imgPath;
	}
}
//end homepage
function TabSwap(colIndex,element)
{
    if (document.getElementById)
    {
        // Get a reference to the th tag element on the page
        var nameTH = document.getElementById('inv_thName');
        var yearTH = document.getElementById('inv_thDate');
        var nameImage = document.getElementById('inv_imgName');
        var yearImage = document.getElementById('inv_imgDate');
        var nameSrc="";
        var yearSrc="";
        var lio=0;
        if (element.id == "inv_thName")
        {
            XBrowser.setClass(element,'Tab On');
            XBrowser.setClass(yearTH,'Tab-End');
         
            if (nameImage.src && yearImage.src)
            {
                lio = nameImage.src.lastIndexOf("/");
                nameSrc = nameImage.src.substr(lio+1);
                nameSrcPre = nameImage.src.substr(0,lio+1);
                lio = yearImage.src.lastIndexOf("/");
                yearSrc = yearImage.src.substr(lio+1);
                yearSrcPre = yearImage.src.substr(0,lio+1);
                if (nameSrc=="icon.arrow_right_blue.gif")
                {
                    nameImage.src= nameSrcPre + "icon.arrow_down.gif";
                    yearImage.src= yearSrcPre + "icon.arrow_right_blue.gif";
                    Grid1.sort(colIndex,false);
                }
                else if (nameSrc=="icon.arrow_down.gif")
                {
                    nameImage.src= nameSrcPre + "icon.arrow_up.gif";
                    yearImage.src= yearSrcPre + "icon.arrow_right_blue.gif";
                    Grid1.sort(colIndex,true);
                }
                else if (nameSrc=="icon.arrow_up.gif")
                {
                    nameImage.src= nameSrcPre + "icon.arrow_down.gif";
                    yearImage.src= yearSrcPre + "icon.arrow_right_blue.gif";
                    Grid1.sort(colIndex,false);
                }
            }
        }
        else
        {
            XBrowser.setClass(element,'Tab-End On');
            XBrowser.setClass(nameTH,'Tab');
          
            if (nameImage.src && yearImage.src)
            {
                lio = nameImage.src.lastIndexOf("/");
                nameSrc = nameImage.src.substr(lio+1);
                nameSrcPre = nameImage.src.substr(0,lio+1);
                lio = yearImage.src.lastIndexOf("/");
                yearSrc = yearImage.src.substr(lio+1);
                yearSrcPre = yearImage.src.substr(0,lio+1);
                if (yearSrc=="icon.arrow_right_blue.gif")
                {
                    yearImage.src = yearSrcPre + "icon.arrow_down.gif";
                    nameImage.src = nameSrcPre + "icon.arrow_right_blue.gif";
                    Grid1.sort(colIndex,false);
                }
                else if (yearSrc=="icon.arrow_down.gif")
                {
                    yearImage.src = yearSrcPre + "icon.arrow_up.gif";
                    nameImage.src = nameSrcPre + "icon.arrow_right_blue.gif";
                    Grid1.sort(colIndex,true);
                }
                else if (yearSrc=="icon.arrow_up.gif")
                {
                    yearImage.src = yearSrcPre + "icon.arrow_down.gif";
                    nameImage.src = nameSrcPre + "icon.arrow_right_blue.gif";
                    Grid1.sort(colIndex,false);
                }
            }
        }
    }
   
}

function inv_switchColor(position,dir)
{
    return;

    //first get the DOM position of the arrow
    if (document.getElementById)
    {
        // Get a reference to the li tag element on the page
        var liElement = document.getElementById('inv_' + position);
        // Get a reference to the class attribute to see what it's value is
        if (dir==undefined)
        {
            var liClassValue = XBrowser.getClass(liElement);
            //Check if it is Not opened 
            if (liClassValue!="Cell On") 
            {
               XBrowser.setClass(liElement,'Cell On');
            }
            else
            {
               XBrowser.setClass(liElement,'Cell Off');        
            }
        }
        else if (dir=='Cell On')
        {
              XBrowser.setClass(liElement,'Cell On');
        }
        else if (dir=='Cell Off')
        {
             XBrowser.setClass(liElement,'Cell Off');
        }
    }
}


  function 	inv_ExpandAll(elementArrayName) 
  {
       if (elementArrayName!=undefined||elementArrayName!=null)
       {
            var x=0;
            while (x < elementArrayName.length)
            {
               if (elementArrayName[x].runtimer==null) ArrowSwap(x,'down'); 
               elementArrayName[x].slidedown();
               x++;
            }
        }
  }
  
  function inv_CollapseAll(elementArrayName) 
  {
       if (elementArrayName!=undefined||elementArrayName!=null)
       {
            var x=0;
            while (x < elementArrayName.length)
            {
               if (elementArrayName[x].runtimer==null) ArrowSwap(x,'up'); 
               elementArrayName[x].slideup();
               x++;
            }
        }
  }
  
  function inv_ToggleAll(elementArrayName) 
  {
       if (elementArrayName!=undefined||elementArrayName!=null)
       {
            var x=0;
            while (x < elementArrayName.length)
            {
               if (elementArrayName[x].runtimer==null ) ArrowSwap(x); 
               elementArrayName[x].slideit();
               x++;
            }
        }
  }
   
   
function ArrowSwap(position,dir)
{

    //first get the DOM position of the arrow
    if (document.getElementById)
    {
        // Get a reference to the li tag element on the page
        var liElement = document.getElementById('inv_li' + position);
        // Get a reference to the class attribute to see what it's value is
        
        if (dir==undefined)
        {
            var liClassValue = XBrowser.getClass(liElement);
            //Check if it is Not opened 
            if (liClassValue!="Opened") 
            {
                XBrowser.setClass(liElement,'Opened');
               
            }
            else
            {
               XBrowser.removeClass(liElement);        
            }
        }
        else if (dir=='up')
        {
              XBrowser.removeClass(liElement);  
        }
        else if (dir=='down')
        {
             XBrowser.setClass(liElement,'Opened');
        }
    }
}



var aclsSpinner = new Image();
aclsSpinner.src = '/img/ajax/img.logo.acls.progress.gif';

function MM_jumpMenu(targ,selObj,restore){ //v3.0
ecmPopUpWindow(selObj.options[selObj.selectedIndex].value, 'pdf', 600, 500, 'true', 'true')
  //eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function printWindow()
{
 if(window.print)
  window.print()
 else
  alert('To print this page, pull down the File menu and select Print.');
}

function runSearch(){
//alert("run search routine");
//
var ns4 = (document.layers);
var ie4 = (document.all && !document.getElementById);
var ie5 = (document.all && document.getElementById);
var other = (!document.all && document.getElementById);


    // Netscape 4
    if(ns4){
       alert("Please upgrade your browser. This browser does not support features in this website designed for your convenience and objects on the pages might not be displayed properly. We suggest using the latest version of Firefox from www.getfirefox.com or latest version of Internet Explorer which can be upgraded thru windows update.");
        window.location="search.aspx";
    }
    // Explorer 4
    else if(ie4){
        alert("Please upgrade your browser. This browser does not support features in this website designed for your convenience and objects on the pages might not be displayed properly. We suggest using the latest version of Firefox from www.getfirefox.com or latest version of Internet Explorer which can be upgraded thru windows update.");
         window.location="search.aspx";
    }
    // W3C - Explorer 5+ and other DOM browsers
    else if(ie5 || other){
      var searchVal =  document.getElementById('searchTextField').value;
	  
      var searchString = "search.aspx?s=" + searchVal;
       window.location=searchString;
	    
    }
}


function ecmPopUpWindow(url, hWind, nWidth, nHeight, nScroll, nResize) {
 var popupwin,  cToolBar;
cToolBar = 'toolbar=0,location=0,directories=0,status=' + nResize + ',menubar=0,scrollbars=' + nScroll + ',resizable=' + nResize + ',width=' + nWidth + ',height=' + nHeight;
popupwin = window.open(url, hWind, cToolBar);
return popupwin;
}

function getRefLetterData()
{
   //first check if AJAX is available
   
   
   //else submit the form normally
   
}

 //infoboxRandomHeaders.header[i].topImage
        //infoboxRandomHeaders.header[i].topImageZoomable
        //infoboxRandomHeaders.header[i].topImageThumb
        //infoboxRandomHeaders.header[i].popupTextMasterTopImage
        //infoboxRandomHeaders.header[i].zoomTextMasterTopImage
        
function randomInfoBoxHeaderImage()
{
   //firstCheck to make sure source of images is available
  if  (infoboxRandomHeaders.header != undefined && infoboxRandomHeaders.header.length > 1)
  {
    var inv_rndPos=generateRandomNumber(0, infoboxRandomHeaders.header.length-1);
    inv_updateImage('inv_infoImageHeaderSpan',infoboxRandomHeaders.header[inv_rndPos].topImageThumb);
    //<a id="inv_infoboxHeaderLink" href="javascript:DoNothing();" onClick="return Tip(escapeInfoBoxImage(this) + '&lt;br/&gt;This is zoom text from the original header INFOBOX .. this should NOT show when RANDOM is chosen.')" onMouseOver="return Tip('This is pop up text from the original header INFOBOX .. this should NOT show when RANDOM is chosen.')"><span id="inv_infoImageHeaderSpan"><img border="0" alt="header1" src="/uploadedImages/InfoBoxes/thumbs/infoboxHeader.jpg" /></span></a><br />
    inv_removeInfoBoxAttributes("inv_infoboxHeaderLink");
    if (infoboxRandomHeaders.header[inv_rndPos].topImageZoomable=="true" && infoboxRandomHeaders.header[inv_rndPos].zoomTextMasterTopImage.length>0)
     inv_UpdateInfoBoxLinkText("inv_infoboxHeaderLink","onclick","return Tip(escapeInfoBoxImage(this) + '<br>" + infoboxRandomHeaders.header[inv_rndPos].zoomTextMasterTopImage + "')");
    else
     inv_UpdateInfoBoxLinkText("inv_infoboxHeaderLink","onclick","return Tip(escapeInfoBoxImage(this))");
     
    if (infoboxRandomHeaders.header[inv_rndPos].popupTextMasterTopImage.length>0)
     inv_UpdateInfoBoxLinkText("inv_infoboxHeaderLink","onmouseover","return Tip('" + infoboxRandomHeaders.header[inv_rndPos].popupTextMasterTopImage + "')");
  }
}
  //infoboxRandomFooters.footer[i].footerImage
        //infoboxRandomFooters.footer[i].footerImageZoomable
        //infoboxRandomFooters.footer[i].footerImageThumb
        //infoboxRandomFooters.footer[i].popupTextMasterBottomImage
        //infoboxRandomFooters.footer[i].zoomTextMasterBottomImage
        
function replaceApos(str)
{
 return str;
}  
      
function randomInfoBoxFooterImage()
{
   //firstCheck to make sure source of images is available
  if  (infoboxRandomFooters.footer != undefined && infoboxRandomFooters.footer.length > 1)
  {
    var inv_rndPos=generateRandomNumber(0, infoboxRandomFooters.footer.length-1);
    inv_updateImage('inv_infoImageFooterSpan',infoboxRandomFooters.footer[inv_rndPos].footerImageThumb);
   
    inv_removeInfoBoxAttributes("inv_infoboxFooterLink");
    if (infoboxRandomFooters.footer[inv_rndPos].footerImageZoomable=="true" && infoboxRandomFooters.footer[inv_rndPos].zoomTextMasterBottomImage.length>0)
     inv_UpdateInfoBoxLinkText("inv_infoboxFooterLink","onclick","return Tip(escapeInfoBoxImage(this) + '<br>" + infoboxRandomFooters.footer[inv_rndPos].zoomTextMasterBottomImage + "')");
    else
     inv_UpdateInfoBoxLinkText("inv_infoboxFooterLink","onclick","return Tip(escapeInfoBoxImage(this))");
     
    if (infoboxRandomFooters.footer[inv_rndPos].popupTextMasterBottomImage.length>0)
     inv_UpdateInfoBoxLinkText("inv_infoboxFooterLink","onmouseover","return Tip('" + infoboxRandomFooters.footer[inv_rndPos].popupTextMasterBottomImage + "')");
     
  }
}

function inv_removeInfoBoxAttributes(elementID)
{
    if (document.getElementById)
    {
        //get a Reference to <div id="HomeHeaderImage" style="background: url('img/img.home.main.bg_2.jpg') 0 0;"></div>
        var textElement = document.getElementById(elementID);
        if (textElement)
        {
            textElement.removeAttribute("onclick");
            textElement.removeAttribute("onmouseover");
            textElement.removeAttribute("alt");
        }
    }
}


//use this function to update infobox popuptext and zoomtext
function inv_UpdateInfoBoxLinkText(elementID,attr,stringData)
{
    if (document.getElementById)
    {
        //get a Reference to <div id="HomeHeaderImage" style="background: url('img/img.home.main.bg_2.jpg') 0 0;"></div>
        var textElement = document.getElementById(elementID);
        if (textElement)
        {
            textElement.setAttribute(attr,stringData);
            if  (XBrowser.isIE)
                textElement.parentNode.innerHTML = textElement.parentNode.innerHTML;
        }
    }
}

//use this to update an image background - specify the elements ID and the path to the image
function inv_updateImageBackground(elementID,imagePath)
{
        if (document.getElementById)
        {
            //get a Reference to <div id="HomeHeaderImage" style="background: url('img/img.home.main.bg_2.jpg') 0 0;"></div>
            var bgImageElement = document.getElementById(elementID);
            if (bgImageElement)
              bgImageElement.style.backgroundImage = "url('" + htmlEntityDecode(imagePath) + "')";
        }
        else
        {
           alert("You are using an outdated browser. Please upgrade to enjoy the features of this website. We recommend using Firefox at http://www.getfirefox.com");
         
        }
}

//use this to update an image - specify the elements ID and the path to the image
function inv_updateImage(theElementID,imagePath)
{
        if (document.getElementById)
        {
            //get a Reference to 
            var elementToChange = document.getElementById(theElementID);
            elementToChange.innerHTML = htmlEntityDecode(imagePath);
        }
}

function htmlEntityDecode(str) {
  
  var ta=document.createElement("textarea");
  ta.innerHTML=str.replace(/</g,"&lt;").replace(/>/g,"&gt;");
  return ta.value;
 
}

function escapeHTML(str)
{
   var div = document.createElement('div');
   var text = document.createTextNode(str);
   div.appendChild(text);
   return div.innerHTML;
}

function escapeInfoBoxImage(o)
{
  //This is needed because we can not simplt put an XML node with an image tag
  //into an attribute because XSLT parser will not allow this
  //so take the thumbnail version of the image and strip the thumb path to get the full path
  //which is passed into the pop-up script as a parameter  
  var imgTag =  o.innerHTML;
  rExp = '/thumbs';
  return imgTag.replace(rExp,'');
}

function convertGalleryImage()
{
  //This is needed because we can not simplt put an XML node with an image tag
  //into an attribute because XSLT parser will not allow this
  //so take the thumbnail version of the image and strip the thumb path to get the full path
  //which is passed into the pop-up script as a parameter  
  if (document.getElementById)
  {
     //get a Reference to inv_galleryImageSpan so we can grab the image tag
     
    var inv_galleryImageSpan = document.getElementById("inv_galleryImageSpan");
    var imageThumbText = inv_galleryImageSpan.innerHTML;
    rExp = '/thumbs';
    imageThumbText = imageThumbText.replace(rExp,'');
    //next convert the text to conform the image " to work with the ws tooltip issues
    //Take any " and convert to \' 
    
  // imageThumbText = imageThumbText.split('"').join("&quot;");
   return imageThumbText;
    
  }
}
//jQuery Methods 1.2.6
function jqID(myid)
  { return '#'+myid.replace(/:/g,"\\:").replace(/\./g,"\\.");}

function jqArrowSwapElement(elementName,dir)
{
    //first get the DOM position of the arrow
    if (document.getElementById)
    {
        // Get a reference to the li tag element on the page
        var liElement = $j(jqID(elementName));
        // Get a reference to the class attribute to see what it's value is
        
        if (dir==undefined)
        {
           if (liElement.hasClass("InvArrowOpened"))
            liElement.removeClass().addClass("InvArrowClosed");
           else
            liElement.removeClass().addClass("InvArrowOpened");

        }
        else if (dir=='up')
        {
              liElement.removeClass().addClass("InvArrowClosed");
        }
        else if (dir=='down')
        {
              liElement.removeClass().addClass("InvArrowOpened");
        }
    }
}

function jqArrowSwapClass(arrowSwapClass,dir)
{
    //first get the DOM position of the arrow
    if (document.getElementById)
    {
        // Get a reference to the li tag element on the page
        var liElement = $j("." + arrowSwapClass);
        // Get a reference to the class attribute to see what it's value is
        
        if (dir==undefined)
        {
           if (liElement.hasClass("InvArrowOpened"))
            liElement.removeClass().addClass("InvArrowClosed");
           else
            liElement.removeClass().addClass("InvArrowOpened");

        }
        else if (dir=='up')
        {
              liElement.removeClass().addClass("InvArrowClosed");
        }
        else if (dir=='down')
        {
              liElement.removeClass().addClass("InvArrowOpened");
        }
    }
}

function jqSlideExpandAll(classToExpand,arrowSwapClass)
 {
    $j(document).ready( function() { 
        $j("." + classToExpand).slideDown("fast");
        $j("." + arrowSwapClass).removeClass().addClass("InvArrowOpened");
    });
    return false;
 } 
 
 function jqSlideCollapseAll(classToCollapse,arrowSwapClass)
 {
    $j(document).ready( function() { 
        $j("." + classToCollapse).slideUp("fast");
        $j("." + arrowSwapClass).removeClass().addClass("InvArrowClosed");
    });
    return false;
 } 
 
 function jqToggleSlide(elementToToggle,arrowSwapElement)
 {
    $j(document).ready( function() { 
        $j(jqID(elementToToggle)).slideToggle("fast");
        jqArrowSwapElement(arrowSwapElement);
    });
    return false;
 }
  
 function populateElement(selector, defvalue) {
    if($j.trim($j(selector).val()) == "") {
        $j(selector).val(defvalue);
    }
  
    $j(selector).focus(function() {
        if($j(selector).val() == defvalue) {
            $j(selector).val("");
        }
    });
    
    $j(selector).blur(function() {
        if($j.trim($j(selector).val()) == "") {
            $j(selector).val(defvalue);
        }
    });
 }

 
  $j(document).ready( function() {
  populateElement('#ctl00_header1_txtSearch', 'Search');

  }); 
//-->
