/*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/ 

var ven_foto = '';
var ven_carr = '';

var w=1
var h=1


if (document.getElementById || document.all)
document.write('<div id="foto_detalle" style="position:absolute;visibility:hidden;left:0px;top:-1000px;z-index:1000!important;"><img src="img/pop_carrito_top.png" width="411" height="26"><div id="cont"><a href="javascript:;" onClick="hidetrail()" class="cerrar">[x] cerrar ventana</a><img src="img/tit_carrito.jpg"><h3>Producto agregado a su carrito de compras:</h3><div id="cont_img"><img id="ttimg" src="img/blank.gif"></div><h1 id="titulo"></h1><p id="epigrafe_reemplazar"></p><p><a href="carrito.php" target="_self"><img src="img/bot_ver_carrito.jpg"></a></p><div class="separador"></div></div><img src="img/pop_carrito_bot.png" width="411" height="26"><!--[if lte IE 6.5]><iframe></iframe><![endif]--></div>')
document.write('<div id="ver_foto" style="position:absolute;visibility:hidden;left:0px;top:-1000px;z-index:1000!important;"><img src="img/pop_foto_top.png" width="625" height="26"><div id="cont"><h1 id="titulo1"></h1><a href="javascript:;" onClick="hidetrail1()" class="cerrar">[x] cerrar ventana</a><div id="cont_img"><img id="ttimg1" src="img/blank.gif"></div><div class="separador"></div><a href="javascript:;" ><< anterior</a> || <a href="#"> siguiente >></a><div class="separador"></div></div><img src="img/pop_foto_bot.png" width="625" height="26"><!--[if lte IE 6.5]><iframe></iframe><![endif]--></div>')

function gettrailobj(){
	if( document.getElementById ){
			return document.getElementById("foto_detalle").style;
	} else if( document.all ){
			return document.all.foto_detalle.style;
	}
} 
function gettrailobj1(){
	if( document.getElementById ){
			return document.getElementById("ver_foto").style;
	} else if( document.all ){
			return document.all.ver_foto.style;
	}
} 



function truebody()
{
	return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
 
function hidetrail()
{
	
	document.getElementById('ttimg').src='img/blank.gif'
	gettrailobj().visibility="hidden"
	gettrailobj().left=-1000
	gettrailobj().top=0
}
function hidetrail1()
{
	
	document.getElementById('ttimg').src='img/blank.gif'
	gettrailobj1().visibility="hidden"
	gettrailobj1().left=-1000
	gettrailobj1().top=0
}

function showtrail(width,height,file,tit,epi)
{
	if(navigator.userAgent.toLowerCase().indexOf('opera') == -1)
	{
		centrar();
		
		w=width
		h=height
		
		document.getElementById('ttimg').src=file
		a = document.getElementById('epigrafe_reemplazar')
		a.innerHTML=""
		a.innerHTML=a.innerHTML.replace("",epi)
		gettrailobj().visibility="visible"
		// gettrailobj().width=w+"px"
		// gettrailobj().height=h+"px"

		b = document.getElementById('titulo')
		b.innerHTML=""
		b.innerHTML=b.innerHTML.replace("",tit)
		
	}
}
function showtrail_1(width,height,file,tit,epi)
{
	if(navigator.userAgent.toLowerCase().indexOf('opera') == -1)
	{
		centrar();
		
		w=width
		h=height
		
		document.getElementById('ttimg1').src=file
		a = document.getElementById('epigrafe_reemplazar')
		a.innerHTML=""
		a.innerHTML=a.innerHTML.replace("",epi)
		gettrailobj1().visibility="visible"
		// gettrailobj().width=w+"px"
		// gettrailobj().height=h+"px"

		b = document.getElementById('titulo1')
		b.innerHTML=""
		b.innerHTML=b.innerHTML.replace("",tit)
		
	}
}


function centrar(e){

	if( navigator.userAgent.toLowerCase().indexOf('opera') == -1 ){
		var foreItem=document.getElementById('foto_detalle');
		var foreItem1=document.getElementById('ver_foto');
        var scrollLeft = (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
        var scrollTop  = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
        var clientWidth;
        if (window.innerWidth) {
                clientWidth = (window.__safari ? window.innerWidth : Math.min(window.innerWidth, document.documentElement.clientWidth));
            } else {
                clientWidth = document.documentElement.clientWidth;
            }
        var clientHeight;
        if (window.innerHeight) {
            clientHeight = (window.__safari ? window.innerHeight : Math.min(window.innerHeight, document.documentElement.clientHeight));
        } else {
            clientHeight = document.documentElement.clientHeight;
        }
       	gettrailobj().left = scrollLeft+((clientWidth-foreItem.offsetWidth)/2)+'px';
        gettrailobj().top = scrollTop+((clientHeight-foreItem.offsetHeight)/2)+'px';
		gettrailobj1().left = scrollLeft+((clientWidth-foreItem1.offsetWidth)/2)+'px';
        gettrailobj1().top = scrollTop+((clientHeight-450)/2)+'px';
		//gettrailobj1().top = 100+'px';
		
	}
}

