// JAVASCRIPT FUNCTIONS
// Copyright Brenda C. Mondragon, All Rights Reserved
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
function stopErrors() { return true; }
window.onerror = stopErrors;

//breaks out of frames
if (top.location != location) top.location.href = location.href;

function styleAbbr()
{
  var oldBodyText, newBodyText, reg
  if (document.all)//ie
  {
    oldBodyText = document.body.innerHTML;
    reg = /<abbr([^>]*)>([^<]*)<\/abbr>/g;
    newBodyText = oldBodyText.replace(reg, '<abbr $1><span class=\"abbr\" $1>$2</span></abbr>');
    document.body.innerHTML = newBodyText;
  }
}


//onmouseover="toggleSelects(false,0);...
//onmouseout="toggleSelects(true,0);...
function toggleSelects(show, delay)
{
  //NOTE: currently the "delay" feature is not working (needs to be worked on)... so force delay to 0
  delay = 0;
  //only do if IE...
  var ua = navigator.userAgent.toLowerCase();
  if (ua.indexOf('msie') > -1)
  {
    elements = document.getElementsByTagName('select');
    for (var i = 0; i < elements.length; i++)
    {
      if (delay > 0) { setTimeout(toggleSelects_delay(elements[i], show), delay); }
      else
      {
        if (show) { elements[i].style.visibility = 'visible'; }
        else { elements[i].style.visibility = 'hidden'; }
      }
    }
  }
}
function toggleSelects_delay(element, show)
{
  if (show) { element.style.visibility = 'visible'; }
  else { element.style.visibility = 'hidden'; }
}


//ROLLOVERS
//body onload="preload_images('/images/img1.gif','/images/img2.gif'
function preload_images()
{
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preload_images.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}
//<a ... onmouseover="image_over('img_name','','/images/img1.gif',1);"
//<img ... name="img_name"
function image_over()
{
  var i,j=0,x,a=image_over.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=find_obj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//<a ... onmouseout="image_out();"
function image_out()
{
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function find_obj(n, d)
{
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=find_obj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

//IN IMG TAG: onerror="image_reload('img_name','<name of image to load>')"
var image_reload_j = 0;
function image_reload(name, imgSrc)
{
  //theImg = document.images[name];
  theImg = find_obj(name);
  if (theImg != null) {
    var x = theImg.width;
    var y = theImg.height;
    image_reload_j++;
    if (image_reload_j > 1) {
      theImg.onerror = image_reload_stop_load();
      return;
    }
    img =        new Image (x,y);
    img.src    = imgSrc;
    theImg.src = img.src;
  }
  return;
}
function image_reload_stop_load () { return; }

function ns_resize_fix()
{
  if (document.layers) {
    setTimeout('window.onresize=ns_doResize',500);
  }
}

function ns_doResize()
{
  window.location.reload();
}

//EX: <select name="frmSelect" onchange="jumpList('parent',this)">
function jumpList(target, obj)
{
  loc = obj.options[obj.selectedIndex].value;
  sendTo(target, loc);
}

function sendTo(target, loc)
{
  eval(target + ".location='" + loc + "'");
}

//onclick = "return confirmDelete();"
function confirmDelete()
{
  return (confirm('Are you sure you want to delete?'));
}

function writeYear() {
  RightNow = new Date(); var TheYear = RightNow.getYear()
  if (TheYear >= 100 && TheYear <= 1999) { TheYear = TheYear + 1900; }
  else { TheYear = TheYear; }
  return TheYear;
}

//<body onbeforeunload="doHourglass();" onunload="doHourglass();">
function doHourglass()
{
  document.body.style.cursor = 'wait';
}

//<a href="javascript:addBookmark();">
function addBookmark()
{
  var cmd = "Ctrl+D";
  if ((navigator.userAgent.indexOf("Macintosh") != -1) || (navigator.userAgent.indexOf("Mac_PowerPC") != -1) || (navigator.userAgent.indexOf("Mac OS") != -1)){ cmd = "Cmd+D"; }
  var txt   = "First click OK and then hit "+ cmd +" to bookmark this page.";
  var url   = this.location;
  var title = document.title;
  var ver   = navigator.appName
  var num   = parseInt(navigator.appVersion);
  if ((ver == "Microsoft Internet Explorer") && (num >= 4) && (window.external)) { window.external.AddFavorite(url,title); }
  else { if (ver == "Netscape") { alert(txt); } }
}
//<script language="JavaScript" type="text/javascript">document.write(writeAddBookmarkLink());</script>
function writeAddBookmarkLink()
{
  var txt = "";
  var ver   = navigator.appName
  var num   = parseInt(navigator.appVersion);
  if (((ver == "Microsoft Internet Explorer") && (num >= 4) && (window.external)) || ver == "Netscape") {
    txt = txt + "<a href=\"javascript:addBookmark();\" title=\"\" onmouseover=\"return overlib('<div align=center>Bookmark This Page</div>',WIDTH,'180',LEFT,VAUTO);\" onmouseout=\"return nd();\">";
    txt = txt + "<img src=\"/images/tiny/bookmark.gif\" width=\"12\" height=\"12\" alt=\"\" title=\"\" border=\"0\" />";
    txt = txt + "</a>";
  }
  return txt;
}

function emptyTextBox(theTextBox)
{
  theTextBox.value = "";
}

function stripTextBoxWhiteSpace(theTextBox)
{
  var strValue = theTextBox.value;
  //if (typeof (strValue.replace) == 'function') //strValue = strValue.replace(/\s/g, '');
  strValue = Trim(strValue);
  theTextBox.value = strValue;
}

//returns a copy of a string without leading spaces
function LTrim(str)
{
  var whitespace = new String(" \t\n\r");
  var s = new String(str);
  if (whitespace.indexOf(s.charAt(0)) != -1) {
    var j=0, i = s.length;
    while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
    {
      j++;
      s = s.substring(j, i);
    }
  }
  return s;
}

//onmouseover="modifyClassName(this, 'switch_expander_hover', 1);" onmouseout="unmodifyClassName(this, 'switch_expander_hover');"
function modifyClassName(obj, modClass, bolAdd)
{
  if (obj != null)
  {
    if (bolAdd == 1) { obj.className = obj.className + ' ' + modClass; }
    else { obj.className = modClass; }
    //alert('Changed To : ' + obj.className);
  }
}
function unmodifyClassName(obj, modClass)
{
  if (obj != null)
  {
    obj.className = obj.className.replace(' ' + modClass,'');
    //alert('Back To : ' + obj.className);
  }
}


//returns a copy of a string without trailing spaces
function RTrim(str)
{
  var whitespace = new String(" \t\n\r");
  var s = new String(str);
  if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
    var i = s.length - 1;
    while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
    {
      i--;
      s = s.substring(0, i+1);
    }
  }
  return s;
}

function Trim(str)
{
  return RTrim(LTrim(str));
}

//example: <a href="javascript:void(0);" onclick="clearTextBoxes(document.forms[1],'tb_');">
function clearTextBoxes(whichForm,substringMatch)
{
  if (whichForm) {
    if (whichForm.elements) {
      for(var i = 0; i < whichForm.elements.length; i++ ) {
        if (whichForm.elements[i].type == "text")
        {
          if (substringMatch == '' || (whichForm.elements[i].name.indexOf(substringMatch) != -1))
          {
            whichForm.elements[i].value = '';
          }
        }
      }
    }
  }
}

function uncheckRadio(radioField,qty)
{
  for (var i=0; i < qty; i++) {
    radioField[i].checked = false;
  }
}

//example: <a href="javascript:void(0);" onclick="uncheckAllRadio(document.forms[1],'_grow');">
function uncheckAllRadio(whichForm,substringMatch)
{
  if (whichForm) {
    if (whichForm.elements) {
      for(var i = 0; i < whichForm.elements.length; i++ ) {
        if (whichForm.elements[i].type == "radio")
        {
          if (substringMatch == '' || (whichForm.elements[i].name.indexOf(substringMatch) != -1))
          {
            whichForm.elements[i].checked = false;
          }
        }
      }
    }
  }
}

//example: <a href="javascript:void(0);" onclick="uncheckAllCheckboxes(document.forms[1],'activate_on_boot');">
function uncheckAllCheckboxes(whichForm,substringMatch)
{
  if (whichForm) {
    if (whichForm.elements) {
      for(var i = 0; i < whichForm.elements.length; i++ ) {
        if (whichForm.elements[i].type == "checkbox")
        {
          if (
          (substringMatch == '')
          ||
            (
            (whichForm.elements[i].name.indexOf(substringMatch) != -1)
            ||
            (whichForm.elements[i].id.indexOf(substringMatch) != -1)
            )
          )
          {
            whichForm.elements[i].checked = false;
          }
        }
      }
    }
  }
}

//example: <a href="javascript:void(0);" onclick="checkAllCheckboxes(document.forms[1],'activate_on_boot');">
function checkAllCheckboxes(whichForm,substringMatch)
{
  if (whichForm) {
    if (whichForm.elements) {
      for(var i = 0; i < whichForm.elements.length; i++ ) {
        if (whichForm.elements[i].type == "checkbox")
        {
          if (
          (substringMatch == '')
          ||
            (
            (whichForm.elements[i].name.indexOf(substringMatch) != -1)
            ||
            (whichForm.elements[i].id.indexOf(substringMatch) != -1)
            )
          )
          {
            whichForm.elements[i].checked = true;
          }
        }
      }
    }
  }
}

//onClick="checkNext(this.form,this,<<num_software_config>>);"
function checkNext(thisForm,objCheckbox,numberFields)
{
  isChecked = objCheckbox.checked;
  numIndex = getIndex(thisForm,objCheckbox);
  numEndfield = numIndex + numberFields;
  if (numIndex && numIndex != 0) {
    var numStartfield = numIndex + 1;
    for (theCount=numStartfield; theCount<=numEndfield; theCount++) {
      if (isChecked) {
        if (thisForm.elements[theCount]) { thisForm.elements[theCount].checked = true; }
      }
      else {
        if (thisForm.elements[theCount]) { thisForm.elements[theCount].checked = false; }
      }
    }
  }
}

//onmouseover="modifyClassName(this, 'switch_expander_hover', 1);" onmouseout="unmodifyClassName(this, 'switch_expander_hover');"
//specify "bolAdd" as 1 if you want to be able to modify it back....
function modifyClassName(obj, modClass, bolAdd)
{
  if (obj != null)
  {
    if (bolAdd == 1) { obj.className = obj.className + ' ' + modClass; }
    else { obj.className = modClass; }
    //alert('Changed To : ' + obj.className);
  }
}
function unmodifyClassName(obj, modClass)
{
  if (obj != null)
  {
    obj.className = obj.className.replace(' ' + modClass,'');
    //alert('Back To : ' + obj.className);
  }
}

/* =============================================================== */
// DISABLE ENTER SUBMIT - USAGE: <body onload="disableEnterSubmit();">
// TESTED - WORKS IN: NS 4 (Win); NS 7 (Win); IE 4+ (Win); Mozilla/Firefox/Gecko (Win); Opera 7 (Win)
// TESTED - DOES NOT WORK IN: NS 6 (Win); Opera 6 (Win)
function checkKeyPress(e)
{
  if (!e) { e = window.event; }
  var key = (typeof e.which == 'number') ? e.which : e.keyCode;
  if (!document.all && document.getElementById)
  {
    if (e.target.type != 'textarea')
    {
      if (key == 13) { return false; }
    }
  }
  else
  {
    if (e.srcElement.type != 'textarea')
    {
      if (key == 13) { return false; }
    }
  }
}
function disableEnterSubmit()
{
  document.onkeypress = checkKeyPress;
  if (document.layers) { document.captureEvents(Event.KEYPRESS); }
  if (!document.all && document.getElementById) { document.addEventListener("keypress", checkKeyPress, true); }
}
/* =============================================================== */


//if checkbox next to qty field is checked and the qty is 0 - sets it to 1
//assumes qty field is field directly previous to checkbox
function fillQtyFieldIfChecked(thisForm,isChecked,cbName)
{
  numIndex = getIndexByName(thisForm,cbName);
  if (numIndex > -1) {
    numQtyField = numIndex - 1;
    if (isChecked) {
      if (thisForm.elements[numQtyField]) {
        if (thisForm.elements[numQtyField].value == "0") {
          thisForm.elements[numQtyField].value = "1";
        }
      }
    }
    else {
      if (thisForm.elements[numQtyField]) {
        if (thisForm.elements[numQtyField]) { thisForm.elements[numQtyField].value = "0"; }
      }
    }
  }
}

function getIndex(whichForm,whatElement)
{
  theIndex = -1;
  if (whichForm) {
    if (whichForm.elements) {
      for (var i=0; i<whichForm.elements.length; i++) {
        if (whatElement == whichForm.elements[i]) { theIndex = i; break; }
      }
    }
  }
  return theIndex;
}

function getIndexByName(whichForm,whatElement)
{
  theIndex = -1;
  if (whichForm) {
    if (whichForm.elements) {
      for (var i=0; i<whichForm.elements.length; i++) {
        if (whatElement == whichForm.elements[i].name) { theIndex = i; break; }
      }
    }
  }
  return theIndex;
}

function getIndexByNameSubstring(whichForm,substringMatch)
{
  theIndex = -1;
  if (whichForm) {
    if (whichForm.elements) {
      for (var i=0; i<whichForm.elements.length; i++) {
        if (whichForm.elements[i].name.indexOf(substringMatch) != -1) { theIndex = i; break; }
      }
    }
  }
  return theIndex;
}

//<asp:checkbox ... onclick="checkboxFillTextFromText(this.form,this,'formin_Email','formin_Technical_Contact_Email');" />
function checkboxFillTextFromText(whichForm,objCheckbox,tbFromNameSubstring,tbToNameSubstring)
{
  isChecked = objCheckbox.checked; //alert(isChecked);
  var numIndexFrom = getIndexByNameSubstring(whichForm,tbFromNameSubstring);
  var numIndexTo   = getIndexByNameSubstring(whichForm,tbToNameSubstring);
  if (numIndexTo > -1 && numIndexFrom > -1)
  {
    if (isChecked) {
      if (whichForm.elements[numIndexTo] && whichForm.elements[numIndexFrom]) {
        whichForm.elements[numIndexTo].value = whichForm.elements[numIndexFrom].value;
      }
    }
    else { if (whichForm.elements[numIndexTo]) { whichForm.elements[numIndexTo].value = ''; } }
  }
}



function openBrWindow(theURL,winName,features)
{
  window.open(theURL, winName, features);
  if (winName.opener == null) { winName.opener = self; }
}
//EXAMPLES (BEST USE) ("pops up" a new window with or w/o JavaScript):
//<a href="help/" target="_newwin" onclick="openBrWindow('< url here >','help','toolbar=no,status=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=750,height=500'); return false;" class="text_smallest">
//<a href="" target="_newwin" onclick="openBrWindow('','help','toolbar=no,status=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=700,height=630'); return false;" class="nocolor" title="View a larger image of the Intel Blade Server family"><img src="/images/transparent.gif" width="280" height="210" alt="" border="0" align="right" hspace="10" vspace="0" title="View a larger image of the Intel Blade Server family" /></a>
//ANOTHER (OLDER) EXAMPLE: href="javascript:void(0);" onclick="openBrWindow('http://somewhere/','new_window','toolbar=yes,status=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes,width=750,height=500');"

function CreatePopup(content,title,width,height)
{
  //set whatever defaults you want
  if (width == 0 || width == null)    { width = 300; }
  if (height == 0 || height == null)  { height = 240; }
  if (title == "" || title == null)   { title = ""; }
  ShowWin = window.open("", "", "location=no,directories=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no,width=" + width + ",height=" + height + "");
  ShowWin.document.write("<html>\n");
  ShowWin.document.write("<head>\n");
  ShowWin.document.write("<title>" + title + "</title>\n");
  ShowWin.document.write("</head>\n");
  ShowWin.document.write("<body style=\"background-color: #fff; font-family: arial, sans-serif;\">\n");
  ShowWin.document.write("<br />\n");
  ShowWin.document.write("<br />\n");
  ShowWin.document.write("<p style=\"margin: 5px 10px;\">" + content + "</p>\n");
  ShowWin.document.write("<br />\n");
  ShowWin.document.write("<br />\n");
  ShowWin.document.write("</body>\n");
  ShowWin.document.write("</html>\n");
  ShowWin.document.close();
}

function launchCenter(url, name, height, width, bolLocation)
{
  var str = "height=" + height + ",innerHeight=" + height;
  str += ",width=" + width + ",innerWidth=" + width;
  if (window.screen) {
    var ah = screen.availHeight - 30;
    var aw = screen.availWidth - 10;

    var xc = (aw - width) / 2;
    var yc = (ah - height) / 2;

    str += ",left=" + xc + ",screenX=" + xc;
    str += ",top=" + yc + ",screenY=" + yc;
  }
  str += 'toolbar=yes,status=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes';
  if (bolLocation) { str += ",location=yes"; }
  return window.open(url, name, str);
}

function openImageWindow(imageSrc, imageTitle)
{
  if (document.all || document.layers) {
    //fileName = '/images/<popup .aspx>?' + escape(imageSrc) + '&' + escape(imageTitle);
    myWindowHandle = window.open(fileName,'windowName','directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=yes');
    myWindowHandle.focus();
  }
}

function cancelIt()
{
  if (document.mainform.MainPage.value != '') {
    location.href = document.mainform.MainPage.value;
  }
  else {
    if (document.referrer != '') {
        location.href = document.referrer;
    }
    else {
        history.go(-1);
    }
  }
}

//onChange="focusNext(this.form,this.name)"
function focusNext(what,which)
{
  for (var i=0;i < what.elements.length;i++) {
      if (what.elements[i].name == which) {
          what.elements[i+1].focus();
      }
  }
  return -1;
}

function firstFocus()
{
  setTimeout('focusIt()',1000);
}
function firstFocus2000()
{
  setTimeout('focusIt()',2000);
}
function focusIt()
{
  if(document.forms[0]) {
    if(document.forms[0].elements[0]!=null) {
      var i;
      var max = document.forms[0].length;
      for( i = 0; i < max; i++ ) {
        if (document.forms[0].elements[i].type != "hidden"
        && !document.forms[0].elements[i].disabled
        &&  document.forms[0].elements[i].name != "sp-q"
        ) {
          document.forms[0].elements[i].focus();
          break;
        }
      }
    }
  }
}
function focusIt()
{
  if(document.forms[0]) {
    if(document.forms[0].elements[0]!=null) {
      var i;
      var max = document.forms[0].length;
      for( i = 0; i < max; i++ ) {
        if (document.forms[0].elements[i].type != "hidden"
        && !document.forms[0].elements[i].disabled
        &&  document.forms[0].elements[i].name != "sp-q"
        ) {
          document.forms[0].elements[i].focus();
          break;
        }
      }
    }
  }
}
//focuses 2nd form's first field (since the search form is the first "form" on most pages)
function focusIt2()
{
  if(document.forms[1]) {
    if(document.forms[1].elements[0]!=null) {
      var i;
      var max = document.forms[1].length;
      for( i = 0; i < max; i++ ) {
        if (document.forms[1].elements[i].type != "hidden"
        && !document.forms[1].elements[i].disabled
        &&  document.forms[1].elements[i].name != "sp-q"
        ) {
          document.forms[1].elements[i].focus();
          break;
        }
      }
    }
  }
}

//CODE: var strvalue = "abc##123##zzz##$$$"; var returnArraySize = customSplit(strvalue, "##", "NewArray");
//RETURNS: NewArray[0] = "abc"; NewArray[1] = "123"; returnArraySize = "4"
function customSplit(strvalue, separator, arrayName)
{
  var n = 0;

  if (separator.length != 0) {
    while (strvalue.indexOf(separator) != -1) {
      eval("arr"+n+" = strvalue.substring(0, strvalue.indexOf(separator));");
      strvalue = strvalue.substring(strvalue.indexOf(separator)+separator.length, strvalue.length+1);
      n++;
    }
    eval("arr" + n + " = strvalue;");
    arraySize = n+1;
  }
  else {
    for (var x = 0; x < strvalue.length; x++) {
      eval("arr"+n+" = \"" + strvalue.substring(x, x+1) + "\";");
      n++;
    }
    arraySize = n;
  }

  eval(arrayName + " = new makeArray(arraySize);");

  for (var i = 0; i < arraySize; i++)
    eval(arrayName + "[" + i + "] = arr" + i + ";");

  return arraySize;
}


// COOKIE FUNCTIONS
// SET:
// function setIntroCookie() {
//   var expdate = new Date(); expdate.setTime (expdate.getTime() + 90*(24 * 60 * 60 * 1000)) // expires in 90 days
//   setCookie ('intro', 'true', expdate, '/');
// GET:
// if (acceptsCookies()) {
//   if ((!readCookie('intro')) || (readCookie('intro') == '')) { . . .

// does user accept cookies
function acceptsCookies()
{
  if (readCookie('acceptsCookies') == 'yes') { return true; }
  var answer;
  document.cookie = 'acceptsCookies=yes; path=/';
  if (document.cookie == '') answer = false; else answer = true;
  return answer;
}
// read cookies
function readCookie(name)
{
  if(document.cookie == '') return false;
  else return unescape(getCookieValue(name));
}
// get cookie values
function getCookieValue(name)
{
  var firstChar, lastChar, endOfName;
  var theBigCookie = document.cookie;
  firstChar = theBigCookie.indexOf(name);
  if((firstChar != -1) && (theBigCookie.charAt(firstChar + name.length) == '=')) {
    firstChar += name.length + 1;
    lastChar = theBigCookie.indexOf(';', firstChar);
    if(lastChar == -1) lastChar = theBigCookie.length;
    return theBigCookie.substring(firstChar, lastChar);
  } else {
    return false;
  }
}
// set cookies (if the user accepts them)
function setCookie (name, value)
{
 if (acceptsCookies()) {
  var argv = setCookie.arguments;
  var argc = setCookie.arguments.length;
  var expires = (argc > 2) ? argv[2] : null;
  var path = (argc > 3) ? argv[3] : null;
  var domain = (argc > 4) ? argv[4] : null;
  var secure = (argc > 5) ? argv[5] : false;
  document.cookie = name + "=" + escape (value) +
    ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
    ((path == null) ? "" : ("; path=" + path)) +
    ((domain == null) ? "" : ("; domain=" + domain)) +
    ((secure == true) ? "; secure" : "");
 }
}
function deleteCookie(name)
{
  var exp = new Date();
  exp.setTime(exp.getTime() - 1);
  var cookieVal = getCookieValue(name);
  if (cookieVal != null) {
    setCookie(name, cookieVal, exp);
  }
  return;
}
// END OF COOKIE FUNCTIONS



function blankArray(arrayLength)
{
  this.length = arrayLength;
  for (var i=0; i < this.length; i++) {
    this[i] = "";
  }
}

//<a href="javascript:void(0);" onclick="jsPrint();">print out</a> <a href="javascript:void(0);" onclick="jsPrint();"><img src="/images/tiny/print.gif" width="16" height="16" alt="" border="0" align="top" /></a>
function jsPrint() { window.print(); }

//<a href="javascript:void(0);" onclick="jsSave('aspen_systems.html');">save</a> <a href="javascript:void(0);" onclick="jsSave('aspen_systems.html');"><img src="/images/tiny/save.gif" width="16" height="16" alt="" border="0" align="top" /></a>
function jsSave(fileName)
{
  if (document.execCommand) {
    if (fileName.length > 0) { document.execCommand("SaveAs",false,fileName); }
    else { document.execCommand("SaveAs"); }
  }
}


function clearInputDefault(obj)
{
  if (obj != null) { if (obj.value == obj.defaultValue) { obj.value = ''; } }
}

function showStatus(text)
{
  window.status = text;
}

//<a id="testLinkCss" style="display: block; visibility: hidden;"></a>
function cssIsEnabled()
{
  var linkObj = document.getElementById("testLinkCss");//reference to test link
  var linkDisplay = "inline";//default link display

  //retrieve the computedStyle display of the link (moz & opera 7.2+)
  if (typeof document.defaultView != "undefined" && typeof document.defaultView.getComputedStyle != "undefined")
  {
    linkDisplay = document.defaultView.getComputedStyle(linkObj,"").getPropertyValue("display");
  }
  //retrieve the currentStyle display of the link (internet explorer)
  else if(typeof linkObj.currentStyle != "undefined")
  {
    linkDisplay = linkObj.currentStyle.display;
  }
  //if display is not 'inline' then CSS is deemed to be enabled
  //this is also the fallback position if no property is detected (Safari and Opera <7.2)
  return (linkDisplay != "inline");
}

function inspect(elm)
{
  var str = "";
  for (var i in elm){ str += i + ": " + elm.getAttribute(i) + "\n"; }
  alert(str);
}
/*EXAMPLE:
table = document.getElementById("tableMain");
inspect(table);
*/


//=============================================================================
//***Cross browser attach event function. For 'evt' pass a string value with the leading "on" omitted
//***e.g. AttachEvent(window,'load',MyFunctionNameWithoutParenthesis,false);
function AttachEvent(obj,evt,fnc,useCapture)
{
	if (!useCapture) { useCapture=false; }
	if (obj)
	{
	  if (obj.addEventListener) { obj.addEventListener(evt,fnc,useCapture); return true; }
	  else if (obj.attachEvent) { return obj.attachEvent("on"+evt,fnc); }
	  else { MyAttachEvent(obj,evt,fnc); obj['on'+evt]=function(){ MyFireEvent(obj,evt) }; }
  }
} 

//The following are for browsers like NS4 or IE5Mac which don't support either attachEvent or addEventListener
function MyAttachEvent(obj,evt,fnc)
{
	if (!obj.myEvents) obj.myEvents={};
	if (!obj.myEvents[evt]) obj.myEvents[evt]=[];
	var evts = obj.myEvents[evt];
	evts[evts.length]=fnc;
}

function MyFireEvent(obj,evt)
{
	if (!obj || !obj.myEvents || !obj.myEvents[evt]) { return; }
	var evts = obj.myEvents[evt];
	for (var i=0,len=evts.length;i<len;i++) evts[i]();
}

//=============================================================================
