﻿$(document).ready(
	function() {
		// Precarga de imágenes
		var icons = ["", "home.png", "briefcase.png", "dices.png", "partners.png", "earth.png", "mail.png"];
		var imgs = [];
		for (var i=1; i<=icons.length; i++)
		{
			imgs[i] = new Image();
			imgs[i].src = "../imagenes/" + icons[i];
		}
		
		$('#enlaces a').hover
		(
			function() {
			var param = $(this).attr('rel');
			$('#icon').attr( 'class', 'bg_' + param);
			$('#icon').fadeIn(500);
			$('#icon').show();
			} ,
			function() {
			//$('#icon').fadeOut(1000);
			$('#icon').hide();
			//$('#icon img').attr('src', '');
			}
		);
		$('#enlaces a').click
		(
			function() {
				var param = $(this).attr('rel');
				//alert('<img src="' + imgs[param].src + '" alt="" />');
			}
		);
		$('#logo').mouseover(
			function() {
				$('#logo').css('cursor', 'pointer');
			}
		);
		$('#logo').click(
			function() {
				location.href = "http://pandoravox/home/index.php";
			}
		);
	}
);

function showIcon(which){
	
	oIcon = document.getElementById('icon');
	oIcon.style.visibility = "visible";
	
	oIcon_Src = document.getElementById('icon_img');
	oIcon_Src.src = "../imagenes/" + icons[which];
}

/*
function changeImage(img_id) {
	oFondo = document.getElementById('fondo');
	oFondo.src = "temp/img" + img_id + ".jpg";
	oMapa = document.getElementById('mapa');
	if (oMapa.style.visibility == "visible") {
		oMapa.style.visibility = "hidden";
	}
}
*/
function quitIcon(which){
	oIcon = document.getElementById('icon');
	oIcon.style.visibility = "hidden";
	//oIcon.src = "";
}
function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
} 
