// #############################################################################
// Funciones varias
function AgregarFavoritos(fav_url,fav_titulo){
if (document.all)
	window.external.AddFavorite(fav_url,fav_titulo)
}
function reemplazar(str, match, replace) {
  str=str+"";
  var a = str.indexOf(match);
  if (a >= 0) { str = str.substring(0,a) + replace + str.substring(a + match.length); }
  return str;
}
// #############################################################################
//Modifica la barra vertical, haciendola visible y ajustandola en altura al contenido
//de la pagina actual. Se toma en cuenta que el IMG de la barra vertical se llama "bannerv"
//y que el id del DIV de contenido es "contenido"
function BarraVertical(extra){
	var altura;
	var contenido = document.getElementById('contenido');
	var bannerv = document.getElementById('bannerv');
	if(contenido.offsetHeight){
		altura = contenido.offsetHeight;
	}
	if(contenido.style.pixelHeight){
		altura = contenido.style.pixelHeight;
	}
	altura = altura + 130 +extra;
	//bannerv.offsetHeight = altura;
	bannerv.style.pixelHeight = altura;
	bannerv.style.visibility = "visible";
}
// #############################################################################
function CrearCookie(nombre,valor,dias) {
	if (dias != 0) {
		var fecha = new Date();
		fecha.setTime(fecha.getTime() + dias*24*360*1000 );
		var expir = "; expires=" + fecha.toGMTString();
	}
	else var expir = "";
	document.cookie = nombre + "=" + valor + expir + "; path=/";
}
function LeerCookie(nombre) {
	nombre = nombre + "=";
	var tcook = document.cookie.split(';');
	for(var i=0 ; i < tcook.length ; i++) {
		var cook = tcook[i];
		while (cook.charAt(0)==' ') cook = cook.substring(1,cook.length);
		if (cook.indexOf(nombre) == 0) return cook.substring(nombre.length,cook.length);
	}
	return null;
}
function BorrarCookie(nombre) {
	CrearCookie(nombre,"",-1);
}
// #############################################################################
//Ocultar elemento, manteniendo el espacio que ocuparia en pantalla
function ocultar_mf(idElemento)
{
    document.getElementById(idElemento).style["visibility"] = "hidden";
}
//Mostrar elemento
function mostrar_mf(idElemento)
{
    document.getElementById(idElemento).style["visibility"] = "visible";
}
//Ocultar elemento, incluyendo el espacio que ocuparia si estuviera visible
function ocultar(idElemento)
{
    document.getElementById(idElemento).style["display"] = "none";
}
//Mostrar elemento como si fuera DIV
function mostrar_bloque(idElemento)
{
    document.getElementById(idElemento).style["display"] = "block";
}
//Mostrar elemento como si fuera SPAN
function mostrar_enlinea(idElemento)
{
    document.getElementById(idElemento).style["display"] = "inline";
}
// #############################################################################
//abrir ventana
function win(pagina,ancho,alto){
    izq=(screen.width)?(screen.width-ancho)/2:100;
    arr=(screen.height)?(screen.height-alto)/2:100;
    prop = 'top=' + arr + ',left=' + izq + ',width=' + ancho + ',height=' + alto +
           ',location=no , directories=no , menubar=no , toolbar=no , status=no , ' +
           'scrollbars=no , resizable=no , fullscreen=no';
    PopWin = window.open(pagina,'PopWin',prop);
    PopWin.focus();
}
// #############################################################################
function ListaCorreo(idioma){
    pagina='/lista.php';
    ancho = 825;
    alto = 400;
    izq=(screen.width)?(screen.width-ancho)/2:100;
    arr=(screen.height)?(screen.height-alto)/2:100;
    prop = 'top=' + arr + ',left=' + izq + ',width=' + ancho + ',height=' + alto +
           ',location=no , directories=no , menubar=no , toolbar=no , status=no , ' +
           'scrollbars=no , resizable=no , fullscreen=no';
    PopWin = window.open(pagina,'PopWin',prop);
    PopWin.focus();
}

function Contactos(idioma){
  	 pagina='/email.php';
    ancho = 825;
    alto = 700;
    izq=(screen.width)?(screen.width-ancho)/2:100;
    arr=(screen.height)?(screen.height-alto)/2:100;
    prop = 'top=' + arr + ',left=' + izq + ',width=' + ancho + ',height=' + alto +
           ',location=no , directories=no , menubar=no , toolbar=no , status=no , ' +
           'scrollbars=no , resizable=no , fullscreen=no';
    PopWin = window.open(pagina,'PopWin',prop);
    PopWin.focus();
}
// #############################################################################
//MARQUESINA
/* EJEMPLO DE COMO USAR:
	<BODY onLoad="marquesina_comenzar();">
	<DIV id="marquesina" style="visibility: hidden; position: absolute;">
	Mensaje de TEXTO LARGO MUY LARGO  en poco espacio
	</DIV>
	</BODY>
	el estilo tambien puede ser display:none
*/
//variables modificables por usuario
var m_superior; //posicion absoluta borde superior en pixeles
var m_ancho;    //ancho de marquesina en pixeles
//las siguientes variables se calculan por unica vez al iniciar marquesina
var m_anchotexto;	//lo uso al principio para saber ancho del texto renderizado
var m_altotexto;	//altura que ocupa el DIV que contiene texto de marquesina
var m_min;			//posicion absoluta por izquierda minima (es la mitad del ancho de la pantalla, menos la mitad del ancho de la marq)
var m_min2;
var m_max;			//posicion absoluta por derecha maxima (es la mitad del ancho de la pantalla, mas la mitad del ancho de la marq)
var m_id;			//identificador de la marq actual para evitar usuar marquesina_comenzar con parametros
var m_idinterval=0;
//variables temporales
var m_area;
var m_pos;
	
function marquesina_quitar(id){
	clearInterval(m_idinterval);
	document.getElementById(id).style.visibility = "hidden";
}

//Izquierda = posicion izquierda de la marquesina. Si es -1 se calcula auto. en base al ancho
//            deseado
//Ancho = ancho de la marq
//Arriba = posicion superior de la marq
//El DIV donde se coloca texto de marquesina debe tener posicionamiento absoluto, propiedad
//display:block y visibility:hidden
function marquesina_comenzar(id,izquierda,ancho,arriba) {
	m_id = id;
	m_min = izquierda;
	m_ancho = ancho;
	m_superior = arriba;
	if (m_min==-1) m_min = screen.width / 2 - m_ancho / 2;
	//dejo de desplazar marquesina
	clearInterval(m_idinterval);
	//aplico estilos por defecto, para luego poder obtener sus parámetros correctamente
	document.getElementById(id).style.position = "absolute";
	document.getElementById(id).style.overflow = "visible";
	document.getElementById(id).style.textAlign = "left";
	document.getElementById(id).style.whiteSpace = "nowrap";
	document.getElementById(id).style.pixelTop = m_superior;
	document.getElementById(id).style.height = "2em";
	//obtengo ancho del DIV
	m_anchotexto = document.getElementById(id).offsetWidth;
	m_altotexto = document.getElementById(id).offsetHeight;
	//calculo maximos y minimos
	m_min2 = m_min - m_anchotexto;
	m_max = m_min + m_ancho;
	//desplazo caja al final, con ancho 0
	m_area = "rect(0," + (m_ancho+1) + "," + m_altotexto + ",0)";
	document.getElementById(id).style.clip = m_area;
	document.getElementById(id).style.pixelLeft = m_max;
	document.getElementById(id).style.pixelWidth = 0;
	//una vez configurado, lo hago visible:
	document.getElementById(id).style.visibility = "visible";
	document.getElementById(id).style.overflow = "hidden";
	//tiempo en milisegundos entre llamado y llamado
	//m_idinterval = setTimeout("marquesina_centrada()",20);
	m_idinterval = setInterval("marquesina_centrada()",20);
}
function marquesina_centrada() {
	m_pos = document.getElementById(m_id).style.pixelLeft;
	if (m_pos > m_min) {
		m_area = "rect(0," + (m_max - m_pos) + "," + m_altotexto  + ",0)";
		document.getElementById(m_id).style.clip = m_area;
		document.getElementById(m_id).style.pixelLeft--;
		document.getElementById(m_id).style.pixelWidth++;
	}
	if ((m_pos <= m_min) && (m_pos > m_min2)){
		m_area = "rect(0," + ((m_min - m_pos) + m_ancho) + "," + m_altotexto + "," + (m_min - m_pos) + ")";
		document.getElementById(m_id).style.clip = m_area;
		document.getElementById(m_id).style.pixelLeft--;
		document.getElementById(m_id).style.pixelWidth++;
	}
	if (m_pos <= m_min2) {
		document.getElementById(m_id).style.visibility = "hidden";
		document.getElementById(m_id).style.clip = "rect(0," + (m_ancho+1) + "," + m_altotexto + ",0)";
		document.getElementById(m_id).style.pixelWidth = 0;
		document.getElementById(m_id).style.pixelLeft = m_max;
		document.getElementById(m_id).style.visibility = "visible";
	}
	//m_idinterval = setTimeout("marquesina_centrada()",20);
}
// #############################################################################
// Precargo imágenes 
S=new Image(8,16);
S.src="/content/footer/separador.gif";

LOff_en=new Image(70,16);
LOff_en.src="/content/footer/lista_en_off.gif";

LOn_en=new Image(70,16);
LOn_en.src="/content/footer/lista_en_on.gif";

COff_en=new Image(70,16);
COff_en.src="/content/footer/contacto_en_off.gif";

COn_en=new Image(70,16);
COn_en.src="/content/footer/contacto_en_on.gif";

LOff_es=new Image(100,16);
LOff_es.src="/content/footer/lista_es_off.gif";

LOn_es=new Image(100,16);
LOn_es.src="/content/footer/lista_es_on.gif";

COff_es=new Image(70,16);
COff_es.src="/content/footer/contacto_es_off.gif";

COn_es=new Image(70,16);
COn_es.src="/content/footer/contacto_es_on.gif";

BotonOff_es=new Image(120,65);
BotonOff_es.src="/content/botones/es_off.gif";

BotonOn_es=new Image(120,65);
BotonOn_es.src="/content/botones/es_on.gif";

BotonOff_en=new Image(120,65);
BotonOff_en.src="/content/botones/en_off.gif";

BotonOn_en=new Image(120,65);
BotonOn_en.src="/content/botones/en_on.gif";


/* Selección de hoja de estilo por resolución */
if (screen.width < 1024) {
    link = document.getElementsByTagName("link")[0];
    link.href = "http://www.albertochahin.com.ar/800x600.css";
}
if (screen.width < 800) {
    link = document.getElementsByTagName("link")[0];
    link.href = "http://www.albertochahin.com.ar/640x480.css";
}

/* Cambia imagen de tag identificado con propiedad name */
function Cambiar(nombre,imagen){
    document.images[nombre].src = imagen.src;
}


function CamTam(ancho,alto){
    izq=(screen.width)?(screen.width-ancho)/2:100;
    arr=(screen.height)?(screen.height-alto)/2:100;
    window.resizeTo(ancho,alto);
}
// #############################################################################
// #############################################################################
// #############################################################################

	
var horizontal_offset="9px" //horizontal offset of hint box from anchor link

/////No further editting needed

var vertical_offset="0" //horizontal offset of hint box from anchor link. No need to change.
var ie=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1
if (whichedge=="rightedge"){
var windowedge=ie && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-30 : window.pageXOffset+window.innerWidth-40
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth+parseInt(horizontal_offset)
}
else{
var windowedge=ie && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
}
return edgeoffset
}

function showhint(menucontents, obj, e, tipwidth){
if ((ie||ns6) && document.getElementById("hintbox")){
dropmenuobj=document.getElementById("hintbox")
dropmenuobj.innerHTML=menucontents
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (tipwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=tipwidth
}
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
dropmenuobj.style.visibility="visible"
obj.onmouseout=hidetip
}
}

function hidetip(e){
dropmenuobj.style.visibility="hidden"
dropmenuobj.style.left="-500px"
}

function createhintbox(){
var divblock=document.createElement("div")
divblock.setAttribute("id", "hintbox")
document.body.appendChild(divblock)
}

if (window.addEventListener)
window.addEventListener("load", createhintbox, false)
else if (window.attachEvent)
window.attachEvent("onload", createhintbox)
else if (document.getElementById)
window.onload=createhintbox

function openWin(url) {
if (typeof popWin == "undefined") {
var height = 600;
var width = 660;
var top = (screen.height - height) / 2;
var left = (screen.width - width) / 2;
var features = "screenX=" + left + ",screenY=" + top + ",top=" + top + ",left=" + left + ",width=" + width + ",height=" + height + ",resizable,scrollbars";
var popWin = open(url,"",features);
}
else
popWin.location.href = url;
}

function openLesson(url) {
	if (typeof popWin == "undefined") {
		var height = 600;
		var width = 820;
		var top = (screen.height - height) / 2;
		var left = (screen.width - width) / 2;
		var features = "screenX=" + left + ",screenY=" + top + ",top=" + top + ",left=" + left + ",width=" + width + ",height=" + height + ",resizable,scrollbars";
		var popWin = open(url,"",features);
	}
	else
		popWin.location.href = url;
}


execOnLoad = function() 
{
an_StartList();
}

window.onload=execOnLoad;

// ------------------------------------------------------------------------- \\

function updateContentForNav() {
  if (document.getElementById("secondary_navigation")) {
    var cw = document.getElementById("content-wrapper");
	if(cw && cw.style) {
		cw.style.marginRight = "200px";
		if (!cw.attributes["id"].value) { cw.style.width = "100%"; } /* IE 5.5 needs this also */
	};
  }
}

function an_StartList() {
  if (document.all&&document.getElementById && !window.opera) {
    navRoot = document.getElementById("primary-navigation");
    if (navRoot) {
      for (i=0; i<navRoot.childNodes.length; i++) {
   	    node1 = navRoot.childNodes[i];
       	if (node1.nodeName=="UL") {
	      for (j=0; j<node1.childNodes.length; j++) {
    	    node2 = node1.childNodes[j];
        	if (node2.nodeName=="LI") {
	          node2.onmouseover=function() {
    	        this.className+=" over";
        	  }
	          node2.onmouseout=function() {
    	        this.className=this.className.replace(" over", "");
        	  }
    } } } } }
	navRoot = document.getElementById("sites");
    if (navRoot) {
      for (i=0; i<navRoot.childNodes.length; i++) {
        node = navRoot.childNodes[i];
		if (node.attributes["class"].value) { cls = node.attributes["class"].value; } /* IE 6 */
		else { cls = node.attributes["class"]+""; /* IE 5.5 */ }
		if (cls.indexOf("expand") >= 0) {
          if (node.nodeName=="LI") {
            node.onmouseover=function() {
              this.className+=" over";
            }
            node.onmouseout=function() {
              this.className=this.className.replace(" over", "");
            }
    } } } }
	cls = "";
    navRoot = document.getElementById("site-tools");
    if (navRoot) {
      for (i=0; i<navRoot.childNodes.length; i++) {
   	    node1 = navRoot.childNodes[i];
       	if (node1.nodeName=="UL") {
	      for (j=0; j<node1.childNodes.length; j++) {
    	    node2 = node1.childNodes[j];
			if (node2.attributes["class"].value) { cls = node2.attributes["class"].value; /* IE 6 */ }
			else { cls = node2.attributes["class"]+""; /* IE 5.5 */ }
			if (cls.indexOf("expand") >= 0) {
        	if (node2.nodeName=="LI") {
	          node2.onmouseover=function() {
    	        this.className+=" over";
        	  }
	          node2.onmouseout=function() {
    	        this.className=this.className.replace(" over", "");
        	  }
    } } } } } }
} }


function an_IE_GetAttribute(tag,attribute,removeOnlyIfTwo) {
  attribute = attribute.toLowerCase();
  // Find the first instance of the attribute.
  var startOfClass = tag.toLowerCase().indexOf(attribute);
  if (startOfClass == -1) { return tag; /* probably need some kind of timeout event or something because IE sucks */ }
  // Make sure there is another class assigned
  if (startOfClass != tag.toLowerCase().lastIndexOf(attribute) || !removeOnlyIfTwo) {
    // Find the first space after the first class
    var lengthOfClass = tag.substring(startOfClass).indexOf(" ");
    // The string to remove is from 'class' up to the next space
    var classString = tag.substr(startOfClass,lengthOfClass)+" ";
    tag = an_StringReplace(tag,classString,"");
  }
  return tag;
}

var promotion_index = 0;
function an_Promotions(step) {
 var promotions = document.getElementById("promotions-content");
 if (promotions && promotions.childNodes) {

  var len = 0; // number of LI child nodes -- Opera, Mozilla consider blank space as a text node
  for (var i = 0; i < promotions.childNodes.length; i++) { if (promotions.childNodes[i].nodeName == "LI") len++; }
  if (len == 1) return;

  var new_index = promotion_index + step;
  if (new_index < 0) new_index = len-1;
  if (new_index >= len) new_index = 0;

  var c = 0;
  for (i = 0; i < promotions.childNodes.length; i++) {
   if(promotions.childNodes[i].nodeName == "LI") {
    if (promotion_index == c) { promotions.childNodes[i].style.display = "none"; }
    if (new_index == c) { promotions.childNodes[i].style.display = "block"; }
    c++;
   }
  }
  promotion_index = new_index;
 }
}


// -----------------------------------------------------------------------------
// The following function cycles through the main nav HTML and highlights the
// appropriate top-level section.
// It also assembles and generates the page breadcrumbs based on values in the
// main nav.
function an_SetNavAndCrumbs() {
  var crumb = document.getElementById("breadcrumbs");
  if (crumb) {
	// If there are no list-item descendants, continue...
	if (crumb.getElementsByTagName('li').length == 0) {

		var breadcrumbs = ["Home", "/"];

		var loc = document.location+"";

		loc = loc.replace("://", "");
		loc = loc.substring(loc.indexOf("/"));

		var navroot = document.getElementById("primary-navigation");
		if (navroot) var c = an_GetChildrenOfType(navroot, "ul");

		if(c.defined) {
    	  c = an_GetChildrenOfType(c[0],"li");
	  	  for (var i = 0; i < c.length; i++) {
			// For every <li> child, we must test it's the href value of it's <a> child:
			var li = c[i];
			var a = an_GetChildrenOfType(li,"a")[0]; // first anchor child of current LI

			// NOTE: 'href' Refers to the href values taken from the primary nav, while 'loc' refers to the document location.
			var href = (a+"").replace("//","");
			href = href.substring(href.indexOf("/"));

			if (loc.indexOf(href) == 0) {
				// At this point, we've found the top-level section this page belongs to
				// Store the breadcrumb information:
				breadcrumbs[breadcrumbs.length] = a.firstChild.data;
				breadcrumbs[breadcrumbs.length] = href;

				// Set the proper section active:
				an_SetAttribute(li, "class", "active");

				// Now, we prepare to visit the second-level elements:
				var d = an_GetChildrenOfType(li, "div")[0];
				var ul = an_GetChildrenOfType(d, "ul")[0];
				c = an_GetChildrenOfType(ul,"li");


				for (var j = 0; j < c.length; j++) {
					var li = c[j];
					var a = an_GetChildrenOfType(li,"a")[0];
					var href = (a+"").replace("///","").replace("//","");

					href = href.substring(href.indexOf("/"));

					if (
					  (loc.indexOf(href) >= 0) &&                                // If href (URL from nav) matches document location
					  (href != breadcrumbs[breadcrumbs.length-1]) &&             // and href does not match previously breadcrumb URL 
					  !(                                                         // BUT NOT
					   (loc == href) ||                                          // if href and document location match
					   (loc.indexOf(href+'index.') >= 0) ||                      // or location refers to and href+index file
					   ((loc.lastIndexOf("/") == loc.length-1) && (loc == href)) // or href refers to a directory and loc == href (excludes subdirectories)
					  )
					) {
						// At this point, we've found the next level element
						// Store the breadcrumb information:
						breadcrumbs[breadcrumbs.length] = a.firstChild.data;
						breadcrumbs[breadcrumbs.length] = href;
						break;
					}
				}
				break;
			}
		  }
		}

//	  Remove any default breadcrumbs
//	  crumb.innerHTML = "";

	  // Loop through our breadcrumbs array
  	  for (var i = 0; i < breadcrumbs.length; i+=2) {
		// Create our text node
		var text = document.createTextNode(breadcrumbs[i]);

		// Create the anchor tag
		var a = document.createElement('a');
		an_SetAttribute(a, "href", breadcrumbs[i+1]);

		// Create the LI tag
		var li = document.createElement('li');

		// Finally, assemble everything and add it to the page.
		a.appendChild(text);
		li.appendChild(a);
		crumb.appendChild(li);
	  }

	  // If loc does not match the previously stored breadcrumb URL
	  if (loc != breadcrumbs[breadcrumbs.length-1]) {
	    // Set breadcrumb overrides for specific sections, and any exceptions
		// The format is an array of overides.
		// The overides consist of either:
		//  - a single directory sting, or
		//  - an array consisting a directory string and any exceptions within that directory.
		// Exceptions consist of either:
		//  - a string or regular expression pattern
		//  - an array of strings or regular expressions.

		// var breadcrumbOverride = new Array(
		//	new Array("/news/press/", "/index.html"),
		//	new Array("/news/releases/", new Array("/index.html", /\/\d\d\d\d\.html/i))
		// );
		// This will override using the <title> tag breadcrumb for files in /news/press/ with the exception of the index.html
		// It will also override using the <title> tag breadcrumb for files in /news/releases/ except index.html and files matching ####.html (for example: 2004.html, 2005.html)
		var breadcrumbOverride = new Array(
			new Array("/news/press/", new Array("/index.html", /\/\d\d\d\d\.html/i)),
			new Array("/news/releases/", new Array("/index.html", /\/\d\d\d\d\.html/i))
		);

		// Assign 'Type' properties to Array and String objects
		Array.prototype.Type="Array";
		String.prototype.Type="String";


		var proceed = true;
		for (var i = 0; i < breadcrumbOverride.length; i++) {
			// In case of a non-array element, we convert it to a 1-dimensional array
			if (breadcrumbOverride[i].Type != "Array") { breadcrumbOverride[i] = new Array(breadcrumbOverride[i]); }

			if (loc.match(breadcrumbOverride[i][0])) {
				// We're in an override section, so we set 'proceed' to false.
				proceed = false;

				// However, it is now necessary to check for exceptions to the override
				if (breadcrumbOverride[i][1]) {
					for (var j = 0; j < breadcrumbOverride[i][1].length; j++) {
						// In case of a non-array element, we convert it to a 1-dimensional array
						if (breadcrumbOverride[i][1].Type != "Array") { breadcrumbOverride[i][1] = new Array(breadcrumbOverride[i][1]); }

						// In the case of an index file, we also add a condition to match on an ending slash, not just 'index.html'
						if ((breadcrumbOverride[i][1][j]+"").match(/index\./)) { breadcrumbOverride[i][1][breadcrumbOverride[i][1].length] = /\/$/; }

						// Check for an exception case and update 'proceed' if found
						if (loc.match(breadcrumbOverride[i][1][j])) { proceed = true; break; }
					}
				}
			}
		}


	  	if (proceed) {
			// For the final crumb, we get the value from the <title> tag.
			var text_content = document.getElementsByTagName('title')[0].innerHTML;
			// Create the final LI node, and add it to the document.
			var text = document.createTextNode(text_content);
			var li = document.createElement('li');
			li.appendChild(text);
			crumb.appendChild(li);
		}
	  }
	}
  }
}

function an_GetChildrenOfType(n,t) {
	// This function returns an array of child nodes of type 't'
	var a = [];
	var c = 0;
	// Cycle through all child nodes:
	for (var i = 0; i < n.childNodes.length; i++) {
		if (n.childNodes[i].nodeName.toLowerCase() == t.toLowerCase()) {
			a[c] = n.childNodes[i];
			c++;
		}
	}
	a.length=c;
	a.defined=true;
	return a;
}

function an_SetAttribute(node,att,val) {
	var current = "";
	if (node.attributes[att]) {
		current = node.attributes[att].nodeValue;
		val = current ? current + " " + val : val;
		node.attributes[att].nodeValue = val;
	} else {
		node.setAttribute(att,val);
	}
		
}

//-----------------------------------------------------------------------------
// toggleRegion
//  This function cycles through a series of HTML tags (img, div, etc) and sets
//  all the visibility of all but one to hidden. The other is made visible.
//  It takes two or more arguments:
//   1  - The tag number to make visible.
//   2+ - The tag ID, minus it's sequence number: 'image' in the case of
//       'image0', 'image1', 'image2', etc...
//  By convention, 0 is the default ID. Initial states of the tags must
//   be defined elsewhere.
function toggleRegion(which, region) {
	// Cycle through arguments, and apply the appropriate rollover status
	for (var a = 1; a < arguments.length; a++) {
		var i = 1;
		var x = document.getElementById(arguments[a]+i);

		// Cycle through all rollover tag (starting at 1, ending at the first sequentially non-existant element)
		while (x) {
			// Set all images hidden, except 'which'
			if (which != i) { x.style.visibility="hidden"; }
			x = document.getElementById(arguments[a]+(++i));
		}

		// Make the selected tag visible
		x = document.getElementById(arguments[a]+which);
		if (x) {
			x.style.visibility="visible";
		} else {
			x = document.getElementById(arguments[a]+0);
			if (x) x.style.visibility="visible";
		}
	}
}
//------------------------------------------------------------------------------


function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		button1_over = newImage("../img/home_solutions_button1-over.gif");
		button2_over = newImage("../img/home_solutions_button2-over.gif");
		button3_over = newImage("../img/home_solutions_button3-over.gif");
		preloadFlag = true;
	}
}

var productTarget = "_top";
function productThere(){
if(!document.productForm.productMenu.selectedIndex==""){
window.open(document.productForm.productMenu.options[document.productForm.productMenu.selectedIndex].value,productTarget,"");
	}
}

var demoTarget = "_blank";
function demoThere(){
if(!document.demoForm.demoMenu.selectedIndex==""){
window.open(document.demoForm.demoMenu.options[document.demoForm.demoMenu.selectedIndex].value,demoTarget,"");
	}
}

// ----------------------------------------------------------------------------
// Sets onclick events for anchors having the class 'popupLink'
//  Assigns a ?referer to popupLinks with a target value of "wForm"
initPopups = function() {
  var x = new Array()
  x[0] = document.getElementById('toolbox');

  var list = new Array();
  var c = 0;
  // Collect all <a/> tags within the areas defined in 'x'
  for (var i = 0; i < x.length; i++) {
   if (x[i]) {
    var y = x[i].getElementsByTagName('a');
 for (var j = 0; j < y.length; j++) {
  list[c] = y[j];
  c++;
 }
   } 
  }

  // Set default values
  var width = 800; var height = 600; var scroll = 1; var resize = 1; var status = 1;
  if (list.length > 0) {
    for (var i=0; i < list.length; i++) {
    if (list[i].className == "popupLink") {
    if (!list[i].onclick) { // Make sure not to overwrite an existing onclick event
       list[i].onclick = function() {
      var wHref = this.href;
      var wName = this.target;
      if (wName=="_blank" || wName=="") { wName = "default"; }
      if (wName=="wForm") { wHref += "?referer=" + window.location; width = 640; height = 480; scroll = 0; status = 0; }
      popup(wHref, wName, width, height, scroll, resize, status);
      return false;
} } }   }  }   }

function AddBookmark(url) {
	if (typeof popWin == "undefined") {
		var height = 620;
		var width = 470;
		var top = (screen.height - height) / 2;
		var left = (screen.width - width) / 2;
		var features = "screenX=" + left + ",screenY=" + top + ",top=" + top + ",left=" + left + ",width=" + width + ",height=" + height;
		var popWin = open(url,"",features);
	}
	else
		popWin.location.href = url;
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}


//AC_RunActiveContent

var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

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 = '';
  if (isIE && isWin && !isOpera)
  {
    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 += '</object>';
  }
  else
  {
    str += '<embed ';
    for (var i in embedAttrs)
    {
      str += i + '="' + embedAttrs[i] + '" ';
    }
    str += '> </embed>';
  }

  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":
      case "id":
        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 "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;
}

