function Navegador(){
	//alert(navigator.appName) ;
	//alert(navigator.platform);
	//alert(navigator.userAgent);
	safari=0;

	safari = ((navigator.userAgent.replace("Safari","$$$")).indexOf('$')) ;


	if (((navigator.appName != "Netscape") && (navigator.platform == "MacPPC")) || ((navigator.appName != "Netscape") && (navigator.platform == "MacIntel"))) 
	//if ((navigator.appName != "Netscape") && (navigator.platform == "MacPPC"))  

		{
			var direccion = "";
			direccion="http://www.edicionessm.com.ar/Explorador/ErrorExplorador.htm" ;
			window.location=direccion;
		}

	if (((safari>0) && (navigator.platform == "MacPPC")) ||((safari>0) && (navigator.platform == "MacIntel")))
	//if ((safari>0) && (navigator.platform == "MacPPC")) 

		{
			var direccion = "";
			direccion="http://www.edicionessm.com.ar/Explorador/ErrorExplorador.htm" ;
			window.location=direccion;
		}
		
}
/*
  Rosa 20/07/07 
  Se cambia la funcion load porque en algunos navegadores no se conseguía el efecto de manera correts
  Se veía la letra como en 'negrita', parece cosa de la opacidad, segundo parámetro del FadeTo
*/
function load_antiguo(diff){
Navegador();

	oDiv = $("divPlaceContent");
	new Effect.FadeTo( oDiv , .5  , 100, 10, {complete:function(){oDiv.style.display="block";new Effect.FadeTo( oDiv , 1 , 100, 10, {complete:function(){ oDiv.style.display="block";verifHeight(diff);}});}})
	//oDiv.style.display="block";
	//verifHeight(diff);
}

function load(diff){
Navegador();
	/*Rosa 17-07-07 */
	//alert (verifHeight(diff));
	oDiv = $("divPlaceContent");
	//new Effect.FadeTo( oDiv , .5  , 100, 10, {complete:function(){oDiv.style.display="block";new Effect.FadeTo( oDiv , 1 , 100, 10, {complete:function(){ oDiv.style.display="block";verifHeight(diff);}});}})	
	new Effect.FadeTo( oDiv, .5, 100, 10, {
		complete:function(){
				//oDiv.style.opacity=100;
				//oDiv.style.filter=null; //"alpha(opacity:100)";
				oDiv.style.display="block";
			new Effect.FadeTo(oDiv , 1 , 100, 10, {
				complete:function(){ 
					oDiv.style.filter=null;
					oDiv.style.display="block";
					verifHeight(diff);
				}
			});
		}
	})	
	//oDiv.style.display="block";
	//verifHeight(diff);
}

function verifHeight(diffEntry){

//alert (findPosY($("divCtrlHeightComon")));
//alert (findPosY($("divCtrlHeightContent")));

 var diff = findPosY($("divCtrlHeightComon"))- (findPosY($("divCtrlHeightContent")));
 //alert (diffEntry)
 //alert (diff);
 if (diff < 0){ 
		var oImgComon = $("imgCtrlHeightComon");
		var diffToAdd = (diff * -1)+10;
		//alert("common: " + oImgComon);
		
		if (oImgComon != null){
			oImgComon.height = diffToAdd - diffEntry;
		}
	}else{
		var oImgContent = $("imgCtrlHeightContent");
		//alert("content: " + oImgContent);
		if (oImgContent != null){
			oImgContent.height = diff + 10;
		}
	}
}

function menuOver(oDiv){ 
	oDiv.style.background='#e2ddc5';
}
function menuOut(oDiv){
	oDiv.style.background='#ffffff';
}

 function findPosY(obj)
	{
		var curtop = 0;
		if (obj != null) 
		{
			if (obj.offsetParent)
			{
				while (obj.offsetParent)
				{
					curtop += obj.offsetTop
					obj = obj.offsetParent;
				}
			}
			else if (obj.y)
				curtop += obj.y;
		}
		return curtop;
	}
 
 function busquedad(){
	var oInput = document.getElementById('buscaAll');
	if  (oInput.value == '' ){location.href='ver_busquedas.aspx?id=8';}
	if  (oInput.value != '' ){location.href='ver_busquedas.aspx?id=8&criterio='+oInput.value;}
}

function seePic(idPic){
	AbreVentana("ver_imagen.aspx?id=" + idPic ,"", 665, 760, true);
}
	
function hidePic(){

	window.close();
}


function doTip(descripcion)
	{
		var sHtml = "";
		var sTitle = "";
		sTitle = "Mensaje";
		Text[0]=[sTitle, descripcion];
		stm(Text[0],Style[13]);
	}
	
	
	// Abre una popup centrada en la pantalla
	// parametros : 
	// -----------> URL_Ventana : url pagina 
	// -----------> OpcionesVentana : width, heigh, scroll etc (ver window.open())
	// -----------> Centrada : true or false
	// -----------> PosX, PosY : si centrada=false especifican las coordenadas de la ventana
	// --------------------------------------------------------------------------------------//
	function AbreVentana(URL_Ventana, OpcionesVentana, Ancho, Alto, Centrada, PosX, PosY) {

	if (Centrada) {
		PosX = (screen.availWidth)? ((screen.availWidth - Ancho)/2):20;
		PosY = (screen.availHeight)? ((screen.availHeight - Alto)/2):20;
		}
		
	if (OpcionesVentana == '')
		OpcionesVentana = 'width=' + Ancho;
	else
		OpcionesVentana += ',width=' + Ancho;

	OpcionesVentana += ',height=' + Alto + ',left=' + PosX
		+ ',top=' + PosY;
		
	return window.open(URL_Ventana, "", OpcionesVentana);
	
	}
	
	
	// Flooble.com's Animated Text script. Will animate a specified 
	// bit of text (determined by the ID of containing tag) by 
	// highlighting it with specified color one character at a time 
	// in a moving pattern.
	//
	// Summary of use: 
	//     call animate(tagID, color); where "tagID" is the ID 
	//     of the tag that contains text to be animated,
	//     and "color" is the color to use to highlight the text with.
	//
	// For more information, and detailed instructions, see 
	//     http://www.flooble.com/scripts/animate.php
	//
	// Copyright (c) 2002 by Animus Pactum Consulting Inc.
	// This script comes with no warranties whatsoever. 
	// Animus Pactum Consulting will not be responsible
	// for any damages resulting from its use.

        var ie4 = false;
        var isAnimated = false;
        if(document.all) {
                ie4 = true; 
        }       
        function setContent(name, value) {
                var d;  
                if (ie4) { 
                        d = document.all[name];
                } else {
                        d = document.getElementById(name);
                }       
                d.innerHTML = value;
                d.style.display = 'block'; 
        }       

	function getContent(name) {
		var d;
                if (ie4) {
                        d = document.all[name];
                } else {
                        d = document.getElementById(name);
                }
                return d.innerHTML;
	}

        function setColor(name, value) {
                var d;  
                if (ie4) { 
                        d = document.all[name];
                } else {
                        d = document.getElementById(name);
                }
                d.style.color = value;  
        }

	function getColor(name) {
                var d;
                if (ie4) {
                        d = document.all[name];
                } else {
                        d = document.getElementById(name);
                }
                return d.style.color;
        }

        function animate(name, col) {
		var value = getContent(name);
		if (value.indexOf('<span') >= 0) { return; }
		if (isAnimated) { return; }
		if (document.getElementById("txtFormBuscar").value != '' ) {
		isAnimated = true;
		var length = 0;
                var str = '';
		var ch;
		var token = '';
		var htmltag = false;	
                for (i = 0; i < value.length; i++) {
			ch = value.substring(i, i+1);
			if (i < value.length - 1) { nextch = value.substring(i+1, i+2); } else { nextch = ' '; }
			token += ch;
			if (ch == '<' && '/aAbBpPhHiIoOuUlLtT'.indexOf(nextch) >= 0) { htmltag = true; }
			if (ch == '>' && htmltag) { htmltag = false; }
			if (!htmltag && ch.charCodeAt(0) > 30 && ch != ' ' && ch != '\n') {		
                        	str += '<span id="' + name + '_' + length + '">' + token + '</span>';
				token = '';
				length++;
			}
                }
                setContent(name, str);
                command = 'animateloop(\'' + name + '\', ' + length + ', 0, 1, \'' + col + '\')';
                setTimeout(command , 100);
            }
        }

        function animateloop(name, length, ind, delta, col) {
		var next = ind + delta;
		if (next >= length) { delta = delta * -1; next = ind + delta; }
		if (next < 0) { delta = delta * -1; next = ind + delta; }
                setColor(name + '_' + ind, getColor(name + '_' + next));
                setColor(name + '_' + next, col);
                command = 'animateloop(\'' + name + '\', ' + length + ', ' + next + ', ' + delta + ', \'' + col + '\')';
                setTimeout(command , 100);
        }
        
        
function firstPage(){ 

	alert ("ya estas en la primera página");
	
}

function lastPage(){ 

	alert ("ya estas en la última página");
	
}

function popupOnLoad(){
	var yImg =  (findPosY($("controlHeight")) - 730)* -1;
	$("controlHeight").height = yImg + 10;
}

function AbreIframe(url, width, height){
	alert (url + "  " + width + "  " + height);
	var gallery = document.getElementById("divPlaceContent");
	var frame = document.getElementById("frameIntegrado");
	var frameVolver = document.getElementById("frameVolver");
	frame.width = width;
	frameVolver.style.width = width;
	frame.height = height;
	frame.src = url;
	new Effect.FadeTo(gallery, 0,500,10,
	{complete:function() {
		gallery.style.display = "none";
		new Effect.FadeTo(gallery, 0,1,1,
		{complete:function() {
			frame.style.display = "block";
			frameVolver.style.display = "block";
			new Effect.FadeTo(gallery, 1,500,10);
			}});
		}});
	}
	
function fade_onMouseOver(oDiv){
	new Effect.FadeTo( oDiv , .2  , 100, 10, {complete:function(){new Effect.FadeTo( oDiv , .9 , 100, 10);}})
}
	
function fade_onMouseOut(oDiv){
	new Effect.FadeTo( oDiv , .8 , 100, 10);
}

//**funciones de llamada a la biografía del autor**//
function cargaBio(id){
	//alert (id)
	fichaLibro.getBio(id, getBio_callback);}

function cargaBio2(id){
	//alert (id)
	verLibro.getBio(id, getBio_callback);}

function getBio_callback(response)
{
	if (response.error != null){
		alert(response.error.Type);
		alert(response.error.Message);
		return;
	}			
	var resp = response.value;
	
	if (resp!='')			
	{	
		//alert (resp)
		//contBio.innerHTML = resp;
		//contBio.style.visibility = "visible";
		//contBio.style.backgroundColor="#ffffff";
		document.getElementById("contBio").style.visibility = "visible";
		
		
		document.getElementById("contBio").innerHTML=resp;
		document.getElementById("contBio").style.backgroundColor="#ffffff";
		
		//$("contBio").innerHTML = resp;
		//$("contBio").style.visibility = "visible";
		//$("contBio").style.backgroundColor="#ffffff";
	//	iFrameFixCatalogo();
	}
}


function reload(){
	window.location.reload();
	iFrameFixCatalogo();}

function ocultarCapa(obj){
$(obj).style.display = "none";
//iFrameFixCatalogo();
}
function ocultarCapa_1(obj){
$(obj).style.visibility = "hidden";
document.getElementById("contBio").style.visibility = "hidden";
//iFrameFixCatalogo();
}
function iFrameFixCatalogo(){

	var iFix = $('divfixIframe');
	if (iFix != null){
		new Rico.Effect.Size( parent.document.getElementsByTagName("IFRAME")[0], null, findPixY(iFix) + 20, 1, 1);

			//alert (findPixY(iFix) + 20);
	}

}
