<!-- 
// gracias jorge... ;) 

// ----------------------------------------------- establece preferencias
	if (typeof(traphref_preferences)!="object"){
		traphref_preferences={}
	}
	
	function isnull(variable,defecto){
		eval("valor="+variable);
		if (valor==null || valor==undefined){
			eval (variable+"="+defecto)
		}
	}

	isnull('traphref_preferences["pToolbar"]',"'no'")
	isnull('traphref_preferences["pDirs"]',"'no'")
	isnull('traphref_preferences["pStatus"]',"'no'")
	isnull('traphref_preferences["pMenubar"]',"'no'")
	isnull('traphref_preferences["pScroll"]',"'no'")
	isnull('traphref_preferences["pHeight"]',300)
	isnull('traphref_preferences["pWidth"]',300)
	isnull('traphref_preferences["pRes"]',"'yes'")
	isnull('traphref_preferences["pName"]',"'popupw'")
	isnull('traphref_preferences["pTitle"]',"''")
	
// ----------------------------------------------- fin preferencias

function trapHref(e) {
	
	if (browserInfo()=="IE"){ var osrc=window.event.srcElement } 	
	if (browserInfo()=="MZ"){ var osrc=this	} 	
	
	src=(osrc.tagName == "A")? osrc : osrc.parentNode
	
    if (src.tagName == "A" && (src.target.toLowerCase()=="_popup")){
		
		var srcRedir=(src.getAttribute("pRedirect")!=null)? src.getAttribute("pRedirect") : 0
		
		var srcHref=src.href
		var srcToolbar=(src.getAttribute("pToolbar")!=null)? src.getAttribute("pToolbar") : traphref_preferences["pToolbar"]
		var srcDirectories=(src.getAttribute("pDirs")!=null)? src.getAttribute("pDirs") : traphref_preferences["pDirs"]
		var srcStatus=(src.getAttribute("pStatus")!=null)? src.getAttribute("pStatus") : traphref_preferences["pStatus"]
		var srcMenubar=(src.getAttribute("pMenubar")!=null)? src.getAttribute("pMenubar") : traphref_preferences["pMenubar"]
		var srcScrollbars=(src.getAttribute("pScroll")!=null)? src.getAttribute("pScroll") : traphref_preferences["pScroll"]
		var srcHeight=(src.getAttribute("pHeight")!=null)? src.getAttribute("pHeight") : traphref_preferences["pHeight"]
		var srcWidth=(src.getAttribute("pWidth")!=null)? src.getAttribute("pWidth") : traphref_preferences["pWidth"]
		var srcResizable=(src.getAttribute("pRes")!=null)? src.getAttribute("pRes") : traphref_preferences["pRes"]
		var srcName=(src.getAttribute("pName")!=null)? src.getAttribute("pName") : traphref_preferences["pName"]
		var srcTitle=(src.getAttribute("pTitle")!=null)? src.getAttribute("pTitle") : traphref_preferences["pTitle"]
		var isImg=(src.pIsImg!=null)? (src.pIsImg.toLowerCase()=="true") : (".jpg;.gif;.bmp;.png;".indexOf(srcHref.substr(srcHref.lastIndexOf("."),srcHref.length))!=-1)
		//var isImg=(src.pIsImg!=null)? (src.pIsImg.toLowerCase()=="true") : src.pIsImg
			
		if (typeof(window[srcName])=="object"){
			window[srcName].close()
			window[srcName]=null
		}
	
		if (srcRedir=="1") {
			popup=window.open("/cg/redirect.php?"+srcHref,srcName,'toolbar='+srcToolbar+',directories='+srcDirectories+',status='+srcStatus+',menubar='+srcMenubar+',scrollbars='+srcScrollbars+',resizable='+srcResizable);
		} else if (!isImg) {
			popup=window.open(srcHref,srcName,'toolbar='+srcToolbar+',directories='+srcDirectories+',status='+srcStatus+',menubar='+srcMenubar+',scrollbars='+srcScrollbars+',height='+srcHeight+',width='+srcWidth+',resizable='+srcResizable);
		} else {
			popupw=window.open('',srcName,'toolbar='+srcToolbar+',directories='+srcDirectories+',status='+srcStatus+',menubar='+srcMenubar+',scrollbars='+srcScrollbars+',height='+srcHeight+',width='+srcWidth+',resizable='+srcResizable);
			popupw.document.write ("<html><head><title>"+srcTitle+"</title></head><BODY bgcolor='#ffffff' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0' onload=this.opener.reescala_img('no')><table width=100% border=0 cellspacing=0 cellpadding=0><tr><td>");
			popupw.document.write ("<a href='javascript:self.close();'><img id='f' src='" +srcHref+"' border=0 alt='Pulsa para cerrar'></a></td></tr></table></body></html>");
			popupw.document.close()
		}
		
		if (browserInfo()=="IE"){
			window.event.returnValue = false;
		}
		if (browserInfo()=="MZ"){
			e.stopPropagation();
			e.preventDefault()
		}
	}
}

function reescala_img(scrollc) {

	var fotowidthadd=(browserInfo()=="IE")? ((scrollc=="yes")? 32 : 12) : 20
	var fotoheightadd=(browserInfo()=="IE")? ((scrollc=="yes")? 32 : 32) : 20
	if (isWindow("popupw")){
		obj=popupw.document.getElementById("f")
		fotowidth=obj.width+fotowidthadd
		fotoheight=obj.height+fotoheightadd
		
		if (fotowidth>screen.availWidth){fotowidth=screen.availWidth;popupw.moveTo(0,null)}
		if (fotoheight>screen.availHeight){fotoheight=screen.availHeight;popupw.moveTo(null,0)}
		popupw.resizeTo(fotowidth,fotoheight)
		popupw.moveTo((screen.width-fotowidth)/2,(screen.height-fotoheight)/2);
	}
    
}

function reescala_html(tgtWin) {
	var winWidth = tgtWin.outerWidth ? tgtWin.outerWidth : tgtWin.document.body && tgtWin.document.body.clientWidth ? tgtWin.document.body.clientWidth : null;
	var docHeight = tgtWin.document.height ? tgtWin.document.height+32: tgtWin.document.body && tgtWin.document.body.scrollHeight ? tgtWin.document.body.scrollHeight +32 : null;
	if (winWidth && docHeight){
		tgtWin.resizeTo(
			(winWidth<=screen.availWidth)? winWidth:(screen.availWidth-50),
			(docHeight<=screen.availHeight)?docHeight:(screen.availHeight-50)
		)
	}
}

function browserInfo(){
	var agn=navigator.userAgent.toLowerCase()
	
	var isMozilla=agn.indexOf("mozilla")!=-1
	var isGecko=agn.indexOf("gecko")!=-1
	var isIE=agn.indexOf("msie")!=-1
	
	if (isMozilla && isGecko){ result_name="MZ"	} else if (isMozilla && !isIE){	result_name="NS" } else if (isIE){ result_name="IE"	}

	return result_name
}

function isWindow(srcName){	return (typeof(window[srcName])=="object") }

onload=function(){
	if (browserInfo()=="IE"){
		document.body.onclick=trapHref
	}

	if (browserInfo()=="MZ"){
		mainBody = document.getElementsByTagName("body")[0];
		parsedAnchors = mainBody.getElementsByTagName("a"); 
		for (var i = 0; i < parsedAnchors.length; i++) { 
			parsedAnchors[i].addEventListener("click", trapHref, false); 
		} 
	}
}
//-->