if( String( navigator.userAgent ).indexOf( 'MSIE' ) > -1 && parseInt( String( navigator.appVersion ).substr( String( navigator.appVersion ).indexOf( 'MSIE' ) + 5, 1 ) ) < 7 ){
	location.replace( './ie6.html' );
}

// FUNCION GENERAL DE AJAX
function fAjax( ajx ){
	
	if( window.XMLHttpRequest ){
		ajx.xhr = new XMLHttpRequest();
	} else
	if( window.ActiveXObject ){
		ajx.xhr = new ActiveXObject( 'Microsoft.XMLHTTP' );
	}
	
	if( ajx.xhr ){
		if( !ajx.metodo ){ ajx.metodo = "GET"; }
		ajx.url ? ajx.xhr.open( ajx.metodo, ajx.doc + ajx.url, true ) : ajx.xhr.open( ajx.metodo, ajx.doc, true );
		if( ajx.func ){
			ajx.xhr.onreadystatechange = ajx.func;
		}
		ajx.xhr.setRequestHeader( "Cache-Control", "no-cache;");
		ajx.xhr.setRequestHeader( "Pragma", "no-cache;");
		if( ajx.metodo == "POST" ){
			ajx.xhr.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded;");
			ajx.xhr.send( ajx.strPost );
		} else {
			ajx.xhr.send( null );
		}
	}
	
}

// Funci�n para mostrar la ficha desde el Banner Flash
function fBannerFlashMostrarFicha( ficha ){
	var tmpObj = new Object();
	tmpObj.fichaID = ficha;
	fMostrarFicha( null, tmpObj );
}


function Mficha( chica ) {
	
	var leftWF = Math.round( Math.max( ( ( ( screen.width - 893 ) / 2 ) - 5 ), 0 ) );
	var topWF = Math.round( Math.max( ( ( ( screen.height - 580 ) / 2 ) -24 ), 0 ) );
	
	var winFicha = window.open( './_html/ficha.php?fichaID=' + chica, 'Ficha' + chica, 'width=893,height=580,top=' + topWF + ',left=' + leftWF )
	winFicha.focus();

}

// PopUp ficha
function fMostrarFicha( evt, pActivo ){
	
	try{ fOcultarBPN(); }
	catch( e ){}
	
	var bpn = 1; // Bandera para saber si se abri� la ficha desde Buscar Por Nombre
	
	if( pActivo ){
		// ...cuando viene de BuscarPorNombre utilizando el teclado
		var fichaID = pActivo.fichaID;
		try{
			document.getElementById( 'inputBPN' ).blur();
		} catch( e ){}
		
	} else {
		var fichaID = ( evt ) ? evt.currentTarget.fichaID : event.srcElement.fichaID;
		if( evt ){
			bpn = ( evt.currentTarget.bpn ) ? 1 : 0;
		} else {
			bpn = ( event.srcElement.bpn ) ? 1 : 0;
		}
	}
	
	var strLoc = false;
	
	if( String( location ).length == String( location ).lastIndexOf( "/" ) + 1 ){ // Si es el INDEX
		strLoc = 'index';
	} else {
		strLoc = String( location ).substr( String( location ).lastIndexOf( "/" ) + 1 );
		if( strLoc.lastIndexOf( "." ) >= 0 ){
			strLoc = strLoc.substring( strLoc.indexOf( "-" ) + 1, strLoc.lastIndexOf( "." ) );
		}
	}
	
	// Declaramos que se abri� la ficha para insertar el 'click'
	var xhrRankFicha = new Object();
	xhrRankFicha.doc = "./_js/ajax/click_ficha.php?fichaID=" + fichaID + "&seccion=" + escape( strLoc ) + "&bpn=" + bpn;
	fAjax( xhrRankFicha );
	
	var leftWF = Math.round( Math.max( ( ( ( screen.width - 893 ) / 2 ) - 5 ), 0 ) );
	var topWF = Math.round( Math.max( ( ( ( screen.height - 580 ) / 2 ) -24 ), 0 ) );
	
	var winFicha = window.open( './_html/ficha.php?fichaID=' + fichaID, 'Ficha' + fichaID, 'width=893,height=590,top=' + topWF + ',left=' + leftWF )
	winFicha.focus();
	
}

// Funci�n para abrir ventanas de formularios
function fWindowFormulario( urlWF, nombreWF, anchoWF, altoWF ){
	leftWF = Math.round( Math.max( ( ( ( screen.width - anchoWF ) / 2 ) - 5 ), 0 ) );
	topWF = Math.round( Math.max( ( ( ( screen.height - altoWF ) / 2 ) -24 ), 0 ) );
	windowFormulario = window.open( urlWF, nombreWF, 'scrollbars=0,width=' + anchoWF + ',height=' + altoWF + ',top=' + topWF + ',left=' + leftWF );
	windowFormulario.focus();
}


function fInputFocus( inputID ){
	document.getElementById( inputID ).style.backgroundColor = "#AAAAAA";
	document.getElementById( inputID ).style.color = "#000000";
}
function fInputBlur( inputID ){
	document.getElementById( inputID ).style.backgroundColor = "#333333";
	document.getElementById( inputID ).style.color = "#AAAAAA";
}

