// ----------------------------------------------------------------
function MM_findObj(n, d) { //v4.01
  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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
// ----------------------------------------------------------------
function TellFriend() {
var cgiRecomienda = '/cgi/recomienda.pl';
        cgiRecomienda = cgiRecomienda + "?url=" + document.URL;
        location.href = cgiRecomienda;
        return false;
}
// ----------------------------------------------------------------
function printThisPage() {
	window.print();
	return false;
}
// ----------------------------------------------------------------
// ----------------------------------------------------------------
/**
 * Gets the value of the specified data session.
 *
 * name  Name of the desired data session value.
 *
 * Returns a string containing value of specified,
 *   or null if does not exist.
 */
function getSessionData(name) {

	var dc = getCookie('EF_SESSION_DATA');
	if (dc != null) {
		var prefix = name + ":";
		var begin = dc.indexOf("&" + prefix);

		if (begin == -1) {
			begin = dc.indexOf(prefix);
			if (begin != 0) return null;
		} else {
			begin += 1;
		}
		var end = dc.indexOf("&", begin);
		if (end == -1) {
			end = dc.length;
		}
		return dc.substring(begin + prefix.length, end);
	} else {
		return null;
	}
}
// ----------------------------------------------------------------
/**
 * Gets the value of the specified cookie.
 *
 * name  Name of the desired cookie.
 *
 * Returns a string containing value of specified cookie,
 *   or null if cookie does not exist.
 */
function getCookie(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}
// ----------------------------------------------------------------
function popImage(imageURL, imageTitle, AutoClose) {
var isNN, isIE;
var optNN = 'status=no,statusbar=no,scrollbars=no,width=500,height=500,left=100,top=100';
var optIE = 'status=no,statusbar=no,scrollbars=no,width=150,height=100,left=100,top=100';

	if (parseInt(navigator.appVersion.charAt(0)) >= 4) {
		var isNN = (navigator.appName == "Netscape") ? 1 : 0;
		var isIE = (navigator.appName.indexOf("Microsoft") != -1) ? 1 : 0;
	}
	if (isNN) {
		imgWin = window.open('about:blank','',optNN);
	}
	if (isIE) {
		imgWin = window.open('about:blank','',optIE);
	}

	with (imgWin.document) {
		writeln('<html><head><title>Cargando...</title></head>');
		writeln('<sc'+'ript>');
		writeln('var isNN,isIE;');
		writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
		writeln('isNN=(navigator.appName=="Netscape")?1:0;');
		writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
		writeln('function reSizeToImage(){');
		writeln('if (isIE){');
		writeln('window.resizeTo(100,100);');
		writeln('width=100-(document.body.clientWidth-(document.images[0].width + 15));');
		writeln('height=100-(document.body.clientHeight-(document.images[0].height));');
		writeln('window.resizeTo(width,height);}');
		writeln('if (isNN){');
		writeln('window.innerWidth=document.images["GNImg"].width;');
		writeln('window.innerHeight=document.images["GNImg"].height;}}');
		writeln('function doTitle(){document.title="'+imageTitle+'";}');
		writeln('</sc'+'ript>');
		if (!AutoClose) writeln('<body bgcolor="ffffff" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
		else writeln('<body bgcolor="ffffff" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
		writeln('<div align="center"><a href="javascript:window.close();"><img name="GNImg" src='+imageURL+' border="0" title="Click para cerrar..."></div></body></html>');
		close();
	}
	return false;
}
// ----------------------------------------------------------------
function cambiarAPagina(mandato) {
        newURL = "/cgi/mkc.pl?" + mandato + "=1&URL=" + top.location.href;
        top.location.href = newURL;
        return false;
}
// ----------------------------------------------------------------
