function msj(s){ window.status=s; return true; }

function precargar() {
	if(document.images) {
	var s=precargar.arguments;
	if(document.precargadas==null)
	 document.precargadas = new Array();
	var i=document.precargadas.length;
	with(document)
	 for(var j=0;j<s.length;j++,i++){
	   precargadas[i] = new Image;
	   precargadas[i].src = s[j];
	  }
	}
}

function d_obj(id){
	var o;
	if (document.all) o = document.all(id);
	else if (document.getElementById) o = document.getElementById(id); 
	else if (document.layers) o = document.layers[id];
	if (o) return(o);
	return(null);
}

function getRefToDivMod( divID, oDoc ) {
	if( !oDoc ) { oDoc = document; }
	if( document.layers ) {
		if( oDoc.layers[divID] ) { return oDoc.layers[divID]; } else {
			for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) {
				y = getRefToDivNest(divID,oDoc.layers[x].document); }
			return y; } }
	if( document.getElementById ) { return oDoc.getElementById(divID); }
	if( document.all ) { return oDoc.all[divID]; }
	return oDoc[divID];
}

function resizeWinTo( idOfDiv ) {
	var oH = getRefToDivMod( idOfDiv ); if( !oH ) { return false; }
	var x = window;
	x.resizeTo( screen.availWidth, screen.availHeight );
	var oW = oH.clip ? oH.clip.width : oH.offsetWidth;
	var oH = oH.clip ? oH.clip.height : oH.offsetHeight; if( !oH ) { return false; }
	x.resizeTo( oW + 200, oH + 200 );
	var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;
	if( x.innerWidth ) { myW = x.innerWidth; myH = x.innerHeight; }
	else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }
	else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }
	if( window.opera && !document.childNodes ) { myW += 16; }
	//second sample, as the table may have resized
	var oH2 = getRefToDivMod( idOfDiv );
	var oW2 = oH2.clip ? oH2.clip.width : oH2.offsetWidth;
	var oH2 = oH2.clip ? oH2.clip.height : oH2.offsetHeight;
	var ancho=oW2 + ( ( oW + 200) - myW );
	var alto=oH2 + ( (oH + 200 ) - myH );
	var scW = screen.availWidth ? screen.availWidth : screen.width;
	var scH = screen.availHeight ? screen.availHeight : screen.height;
  	x.moveTo(Math.round((scW-ancho)/2),Math.round((scH-alto)/2));
	x.resizeTo(ancho,alto);
}

function rollover(tipo,nmnu,nopc,nact,txt){
	var i,a;
	i=eval('document.images.i'+tipo+nmnu+''+nopc);
	a=d_obj('a'+tipo+nmnu+''+nopc);
	if(nopc!=nact){
		i.src='_res/ico_'+tipo+nmnu+'_2.gif';
		a.className='a_'+tipo+nmnu+'_2';
	}
	window.status=txt;
	return true;
}

function rollout(tipo,nmnu,nopc,nact){
	var i,a;
	i=eval('document.images.i'+tipo+nmnu+''+nopc);
	a=d_obj('a'+tipo+nmnu+''+nopc);
	if(nact==nopc){
		i.src='_res/ico_'+tipo+nmnu+'_1.gif';
		a.className='a_'+tipo+nmnu+'_1';
	}else{
		i.src='_res/ico_'+tipo+nmnu+'_0.gif';
		a.className='a_'+tipo+nmnu+'_0';
	}
	window.status='';
	return true;
}

function popup(b,qs,w,h){
	var s;
	var u=b+'popup.php?'+qs;
	var nomv='popup_'+qs;
	while(nomv.indexOf('&')>-1) nomv=nomv.replace('&','_')
	while(nomv.indexOf('=')>-1) nomv=nomv.replace('=','_')
	while(nomv.indexOf('.')>-1) nomv=nomv.replace('.','_')
	while(nomv.indexOf('-')>-1) nomv=nomv.replace('-','_');
/*	
	if(w>0) w='width='+w+',';
	else w='';
	if(h>0) h='height='+h+',';
	else h='';
	s='';
	if(w>'') s=s+w+',';
	if(h>'') s=s+h+',';
*/
	var w=window.open(u,nomv,s+'toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=1');
	if(w){
		w.focus();
	}
}

function vcreditos(){
	w=window.open('creditos.htm','creditos','width=214,height=232,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,resizeable=no,directories=no');
	w.focus;
}

var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// Gestionar todos los mensajes de FSCommand de una película Flash
function bannerFlash_DoFSCommand(command, args) {
	var bannerFlashObj = isInternetExplorer ? document.all.bannerFlash : document.bannerFlash;
	if (command == "galeria") {
		//alert(args);
		//alert(myLightbox);

		if (!document.getElementsByTagName){ return; }
		var anchors = document.getElementsByTagName('a');
		var areas = document.getElementsByTagName('area');

		// loop through all anchor tags
		for (var i=0; i<anchors.length; i++){
			var anchor = anchors[i];
			
			var relAttribute = String(anchor.getAttribute('rel'));
			
			// use the string.match() method to catch 'lightbox' references in the rel attribute
			if (anchor.getAttribute('href') && (relAttribute.toLowerCase().match('lightbox'))){
					myLightbox.start(anchor);
					return;
			}
		}

	}
}
// Ancla para Internet Explorer
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<script language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub bannerFlash_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call bannerFlash_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}
