﻿// Archivo JScript
$(document).ready(function() {
    $('#productos a').lightBox();
    $('.gallery A').lightBox();
    $('.products A').lightBox();
});


//ADAPTA LA VENTANA A LA IMAGEN Y LA CENTRA EN PANTALLA

function ajustar_pop_img(imagen_a_ajustar){
		var ancho = document.getElementById(imagen_a_ajustar).width;
		var alto = document.getElementById(imagen_a_ajustar).height;
		window.resizeTo(ancho+10, alto+48);
		window.moveTo((screen.availWidth /2) - (ancho / 2), (screen.availHeight/2) - (alto / 2)); 
	}

//AÑADE LA PAGINA A FAVORITOS	
 function AddToBookmarks(){
		if ((navigator.appName=="Microsoft Internet Explorer") && 
				(parseInt(navigator.appVersion)>=4)) {
			var url="http://www.mueblesjuliolluesma.com"; 
			var titulo="Tienda de muebles Julio Lluesma";
			window.external.AddFavorite(url,titulo);
		} else { 
			if(navigator.appName == "Netscape") 
				alert("Presione Crtl+D para agregar este sitio en sus Bookmarks"); 
		}
	}

//IMPRIME LA PÁGINA	
function Print() {
if (window.print)
    window.print();
else
    alert("Su navegador no soporta esta opción.");
}

//AMPLIA UNA IMAGEN
function ShowBigPicture(name, id) {
    
    ElementShow(name);
    ElementBodyCenter(name);
    element = getAspNetElement(name);
    document.getElementById('ampliada').src = '../../imagenes/productos/Lluesma-' + id + '.jpg';
}

//MUESTRA UN ELEMENTO
function ElementShow(name){
     getAspNetElement(name).style.display = 'block';
}

//OCULTA UN ELEMENTO
function ElementHidde(name){
   getAspNetElement(name).style.display = 'none';
}

//CENTRA UN ELEMENTO
function ElementBodyCenter(name){
   
    if (self.innerWidth)
	{
		bodyCenterWidth = self.innerWidth;
		bodyCenterHeight = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientWidth)
	{
		bodyCenterWidth = document.documentElement.clientWidth;
		bodyCenterHeight = document.documentElement.clientHeight;
	}
	else if (document.body)
	{
		bodyCenterWidth = document.body.clientWidth;
		bodyCenterHeight = document.body.clientHeight;
	}
    bodyCenterWidth = bodyCenterWidth/2;
    bodyCenterHeight = bodyCenterHeight/2;

    getAspNetElement(name).style.left = '30%';
    getAspNetElement(name).style.top = '20%';
}

//RETORNA UN ELEMENTO 
function getAspNetElement(name){
    var temp = name;
    
    while (temp.indexOf('$')> -1 ) {
        temp = temp.replace('$', '_');
    }
    return document.getElementById(temp);
}

	
	 