/* Drop-down Navigation
---------------------------------------------------------- */
sfHover = function() {
  var sfEls = document.getElementById("nav").getElementsByTagName("LI");
  for (var i=0; i<sfEls.length; i++) {
    sfEls[i].onmouseover=function() {
      this.className+=" sfhover";
    }
    sfEls[i].onmouseout=function() {
      this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
    }
  }
}
if (window.attachEvent) window.attachEvent("onload", sfHover); 

/* Initialize Functions on window.onload Event
---------------------------------------------------------- */
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

/* Popup Window
---------------------------------------------------------- */
function popWin(theURL,winName,features) { 
  window.open(theURL,winName,features);
}


/* Drop Down List navigation
    (used by the global locations list in the header)
---------------------------------------------------------- */
function goto_dropdown_selection(entered) {
  with (entered) 	{
    ref = options[selectedIndex].value; 
    splitcharacter = ref.lastIndexOf("&"); 

    if (splitcharacter != -1) {
      loc = ref.substring(0, splitcharacter); 
      target = ref.substring(splitcharacter + 1, 1000).toLowerCase();
    }
    else {
      loc = ref;
      target = "_self";
      }

    lowloc = loc.toLowerCase();
    
    if (lowloc == "false" || lowloc == "") {
			window.alert("Elija uno, por favor");
			
			
			entered.focus();
			
			
      return;
      }
    else if (target == "_self") {
      document.location = loc;
      } 
    else if (target == "_top") {
      top.location=loc;
      } 
    else if (target == "_blank") {
      window.open(loc);
      } 
    else if (target == "_parent") {
      parent.location = loc;
      }
    else {
      parent.frames[target].location = loc;
      } 
    }
  }


var spawnWin = null
var winCount = 0
var winName = "spawnWin"

function openSpawn(winURL, winWidth, winHeight, winFeatures, winLeft, winTop){
  var d_winLeft = 20
  var d_winTop = 20 
  winName = "spawnWin" + winCount++ 
  closePopWin()
  if (openSpawn.arguments.length>= 4)
    winFeatures = "," + winFeatures
  else
    winFeatures = ""
  if (openSpawn.arguments.length == 6)
    winFeatures += getLocation(winWidth, winHeight, winLeft, winTop)
  else
    winFeatures += getLocation(winWidth, winHeight, d_winLeft, d_winTop)
    spawnWin = window.open(winURL, winName, "width=" + winWidth + ",height=" + winHeight + winFeatures)
  self.name = "parent"
}

/* Win Features
toolbar,scrollbars,location,statusbar,menubar,resizable
*/

function closePopWin(){
  if (navigator.appName != "Microsoft Internet Explorer" || parseInt(navigator.appVersion)>=4) 
  if (spawnWin != null) if(!spawnWin.closed) spawnWin.close()
}

function getLocation(winWidth, winHeight, winLeft, winTop){
  return ""
}

function getLocation(winWidth, winHeight, winLeft, winTop){
  var winLocation = ""
  if (winLeft < 0) winLeft = screen.width - winWidth + winLeft
  if (winTop < 0) winTop = screen.height - winHeight + winTop
  if (winTop == "cen") winTop = (screen.height - winHeight)/2
  if (winLeft == "cen") winLeft = (screen.width - winWidth)/2
  if (winLeft>0 & winTop>0) winLocation =  ",screenX=" + winLeft + ",left=" + winLeft + ",screenY=" + winTop + ",top=" + winTop
  else winLocation = ""
  return winLocation
}


/* Start Flash  
   Rewrite these using new FlashObject JS when time permits
------------------------------------------------------------- */
  
  // Flash check
function FlashInstalled() {
 result = false;
 
 if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"])
 {
  result = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
 }
 else if (document.all && (navigator.appVersion.indexOf("Mac")==-1))
 {
// IE Windows only -- check for ActiveX control, have to hide code in eval from Netscape (doesn't like try)
  eval ('try {var xObj = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if (xObj) result = true; xObj = null; } catch (e) {}');
 }
 return result;
}
 
function FlashWrite(url,width,height,bgvalue)
{
 document.write(' <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
 document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ');
 document.write(' WIDTH=' + width + ' HEIGHT=' + height + '>');
 document.write(' <PARAM NAME=movie VALUE="' + url + '"> <PARAM NAME=quality VALUE=high> <param name=wmode value=transparent> <PARAM NAME=bgcolor VALUE="#' + bgvalue + '">  '); 
 document.write(' <EMBED src="' + url + '" quality=high wmode=transparent bgcolor="#'+ bgvalue +'" ');
 document.write(' swLiveConnect=FALSE WIDTH=' + width + ' HEIGHT=' + height);
 document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
 document.write(' </EMBED></OBJECT>');
}

function imgWrite(imgPath, map)
  {
  //This is to write out the image in case flash is not installed on user's machine
  document.write ('<img src="' + imgPath + '" usemap="' + map + '" border="0">');	
  }
/* End Flash - Rewrite these using new FlashObject JS when time permits
    now known as SWFObject:  http://blog.deconcept.com/swfobject/
---------------------------------------------------------- */