function addBookmark(titulo,url) {
	if (window.sidebar) { // Mozilla Firefox 
        window.sidebar.addPanel(titulo, url,"");
    } else if( window.external ) { // IE 
            window.external.AddFavorite( url, titulo); }
           else if(window.opera && window.print) { // Opera
///**alert("Para agregar a tu pagina a sus favoritos presione control + D") }**/
                window.external.AddFavorite( url, titulo); }
}

function subseccionIndex(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function ShowFlash(filepath,width,height,transparent) {
	document.write('<object codeBase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="'+width+'" height="'+height+'">\n');
	document.write('<param name="Movie" value="'+filepath+'">\n');
	document.write('<param name="Src" value="'+filepath+'">\n');
	document.write('<param name="Play" value="-1">\n');
	document.write('<param name="Loop" value="-1">\n');
	document.write('<param name="Quality" value="High">\n');
	document.write('<param name="EmbedMovie" value="0">\n');
	document.write('<param name="menu" value="false">\n');
	if (transparent == true)
    {
		document.write('<param name="WMode" value="Transparent">\n');
		document.write('<embed src="'+filepath+'" quality="high" wmode="transparent" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"/>\n');
	} else {
		document.write('<embed src="'+filepath+'" quality="high" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"/>\n');	
	}		
	document.write('</object>\n');
}

// Email.js version 5
var tld_ = new Array()
tld_[0] = "com";
tld_[1] = "org";
tld_[2] = "net";
tld_[3] = "es";
tld_[4] = "info";
var m_ = "mailto:";
var a_ = "@";
var d_ = ".";

function mail(name, dom, tl, params)
{
	var s = e(name,dom,tl);
	document.write('<a href="../paginas/'+m_+s+params+'">'+s+'</a>');
}
function mail2(name, dom, tl, params, display)
{
	document.write('<a href="../paginas/'+m_+e(name,dom,tl)+params+'">'+display+'</a>');
}
function e(name, dom, tl)
{
	var s = name+a_;
	if (tl!=-2)
	{
		s+= dom;
		if (tl>=0)
			s+= d_+tld_[tl];
	}
	else
		s+= swapper(dom);
	return s;
}
function swapper(d)
{
	var s = "";
	for (var i=0; i<d.length; i+=2)
		if (i+1==d.length)
			s+= d.charAt(i)
		else
			s+= d.charAt(i+1)+d.charAt(i);
	return s.replace(/\?/g,'.');
}

function AgregarFavorito()
{
    var portal = document.getElementById("txt_portal").value;
    var portalurl = document.getElementById("txt_portalurl").value;   
    
    addBookmark(portal, portalurl);
}


function load_map(nom_empresa, des_subseccion, imagen, nombre_div, x, y) {
	var $empresa = nom_empresa;
	var $subseccion = des_subseccion;
	var $imagenVer = imagen;
	
    if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById(nombre_div));
        map.setCenter(new GLatLng(x,y), 16);
        map.addControl(new GMapTypeControl());
        map.addControl(new GLargeMapControl());
        map.addControl(new GScaleControl());
        map.addControl(new GOverviewMapControl());
        map.setMapType(G_MAP_TYPE);
        function addtag(point, address) {
        var marker = new GMarker(point);
        GEvent.addListener(marker, "click", function() {
        marker.openInfoWindowHtml(address); } );
        return marker;
        }
        var point = new GLatLng(x,y);
        var address = '<b>'+$empresa+'</b><br/><i>'+$subseccion+'</i><br><img src="'+$imagenVer+'" width="150">';
        var marker = addtag(point, address);
        map.addOverlay(marker);
    }
}

function mostrar(nombreCapa) {
    if (document.getElementById(nombreCapa) != null) {
        document.getElementById(nombreCapa).style.display = "block";
    }
}
function ocultar(nombreCapa) {
    if (document.getElementById(nombreCapa) != null) {
        document.getElementById(nombreCapa).style.display = "none";
    }
} 

function ShowHideLayer(nombreCapa) {

    if (document.getElementById(nombreCapa).style.display == "none") {
        document.getElementById(nombreCapa).style.display = "block";
    }
    else {
        document.getElementById(nombreCapa).style.display = "none";
    }
}

//Specify affected tags. Add or remove from list:
var tgs = new Array( 'div','td','tr');

//Specify spectrum of different font sizes:
var szs = new Array( '14px','15px','16px','17px','18px','19px','20px' );
var startSz = 0;

function ts( trgt,inc ) {
	if (!document.getElementById) return
		var d = document,cEl = null,sz = startSz,i,j,cTags;
		
		sz += inc;
		if ( sz < 0 ) sz = 0;
		if ( sz > 6 ) sz = 6;
		startSz = sz;

	if (!( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];
	
		cEl.style.fontSize = szs[ sz ];
		
		for ( i = 0 ; i < tgs.length ; i++ ) {
		cTags = cEl.getElementsByTagName( tgs[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
	}
} 

/* ------------------------------- */

    
    function getObject(obj) {  
      var theObj;  
      if(document.all) {  
      if(typeof obj=="string") {  
              return document.all(obj);  
      } else {  
              return obj.style;  
      }  
      }  
      if(document.getElementById) {  
      if(typeof obj=="string") {  
              return document.getElementById(obj);  
      } else {  
              return obj.style;  
      }  
      }  
      return null;  
    }


    function montarObject(capa, tipo, codigo) {
        document.getElementById(capa).innerHTML = "";

        var tipoObject = "";
        if (tipo == "1") { tipoObject = "v"; }
        else { tipoObject = "p"; }

        document.getElementById(capa).innerHTML = "<object width=\"680\" height=\"387\"><param name=\"movie\" " +
							"value=\"http://www.youtube.com/" + tipoObject + "/" + codigo +
							"?hl=es_ES&version=3&rel=0&modestbranding=1&fs=1\"></param>" +
							"<param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" " +
							"value=\"always\"></param><embed src=\"http://www.youtube.com/" + tipoObject + "/" + codigo +
							"?hl=es_ES&version=3&rel=0&modestbranding=1&fs=1\" type=\"application/x-shockwave-flash\" width=\"680\" " +
							"height=\"387\" allowscriptaccess=\"always\" allowfullscreen=\"true\"></embed></object>";
    }
