/*
	XTRA JS
   	(C) COCOE.com
*/

// BROWSERS
is=new Array();
is.dom  = document.getElementById?1:0;
is.ua   = navigator.userAgent.toLowerCase();
is.ie   = is.ua.match(/msie/)||0;
is.mac  = is.ua.match(/mac/)||0;

// Lanza un link en el iframe
linkTO=function(s){
	var indice=s.selectedIndex;
	var enlace=s.options[indice].value.split(",")[0];
	var frmW=s.options[indice].value.split(",")[1];
	var frmH=s.options[indice].value.split(",")[2];
	var winW=s.options[indice].value.split(",")[3];
	var winH=s.options[indice].value.split(",")[4];
	window.frames["contenidoIframe"].location.replace("about:blank")
	resizeIFrame(frmW,frmH)
	resizeWindowToFit(winW, winH)
	setTimeout('window.frames["contenidoIframe"].location.replace("'+enlace+window.showdisclaimer+'")',200)
}

// resize del IFRAME
oldW=0;
oldH=0;
resizeIFrame=function(w,h){
	if (oldW!=w||oldH!=h) {
		oldW=w
		oldH=h
		var frmObj=document.getElementById("contenidoIframe")
		frmObj.style.width=w+"px"
		frmObj.style.height=h+"px"
		frmObj.style.visibility="inherit"
	}
}

// Width del espacio cliente
getClientWidth=function(){
	var w=null;
	if (typeof(window.innerWidth)=='number') {
		w=window.innerWidth
	} else if( document.documentElement &&  document.documentElement.clientWidth ) {
			w=document.documentElement.clientWidth;
	} else if( document.body && document.body.clientWidth ) {
			w=document.body.clientWidth;
	}
	return w
}

// Height del espacio cliente
getClientHeight=function(){
	var h=null;
	if (typeof(window.innerHeight)=='number') {
		h=window.innerHeight
	} else if( document.documentElement &&  document.documentElement.clientHeight ) {
	      		h=document.documentElement.clientHeight;
	} else if( document.body && document.body.clientHeight ) {
	      		h=document.body.clientHeight;
	}
	return h
}


// resize de la ventana para que el interior mida lo correcto
oldWinW=0
oldWinH=0
resizeWindowToFit=function(w,h){
	if (oldWinW!=w||oldWinH!=h) {
		oldWinW=w
		oldWinH=h
		var docW=getClientWidth()
		var docH=getClientHeight()
		window.resizeBy(w-docW,h-docH);
	
		var docW=getClientWidth()
		var docH=getClientHeight()
		if (docW!=w||docH!=h) {
			window.resizeBy(w-docW,h-docH);
		}
	}
}

/*
	NOSECONDMOUSE v.1.1b
	(c) Gabriel Suchowolski power[z]one / www.microbians.com / powerz@microbians.com
	Distributed under the terms of the GNU LGPL license (www.gnu.org)
	Available at http://www.microbians.com
*/

function NSclick(e) {
	if (e.preventDefault) { 
    		if (e.button == 2 || e.button == 3) {
      			e.preventDefault();
			return false;
  		}
	} else {
		if (e.which == 3) {
			return false;
		}
	}
}

if (is.ie) { 
	document.oncontextmenu = new Function("return false;")
} else if (is.dom) {
	document.onmousedown=NSclick;
	document.captureEvents(Event.MOUSEDOWN);
} else {
	document.onmouseup=NSclick;
}

/*
   MISC FUNCTIONS addon v.1.1
   Req: genLIB [ GNU LGPL license ] : www.microbians.com 
*/

parseQuery=function() {
	var a=new Array()
	var query=location.search.substring(1);
	var pairs=query.split("&"); 
	for(var i=0; i<pairs.length; i++) {
		var pos=pairs[i].indexOf('='); 
		if (pos==-1) continue; 
		var argname=pairs[i].substring(0,pos).toLowerCase(); 
		var value=pairs[i].substring(pos+1); 
		a[argname]=unescape(value); 
	}
	a['length']=pairs.length
	return a
}

window.showdisclaimer=parseQuery().showdisclaimer||""
if (window.showdisclaimer!="") window.showdisclaimer="?showdisclaimer="+window.showdisclaimer

setCookie=function(n,v){document.cookie=n+"="+v+"; expires=Monday, 04-Apr-2020 05:00:00 GMT"}
getCookie=function(n){var c=document.cookie;var i=c.indexOf(n);if(i!=-1){var nst=(c.indexOf("=",i)+1);var nen=c.indexOf(";",i);if (nen==-1){nen=c.length};return c.substring(nst,nen)}}

// IE6 FIX for ActiveX
documentWriter=function(o){document.write(o)}