/*
 * Tooltip script
 * powered by jQuery (http://www.jquery.com)
 *
 * written by Alen Grakalic (http://cssglobe.com)
 *
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */



this.tooltip = function(){
	/* CONFIG */
		xOffset = 10;
		yOffset = 20;
		active = 0;
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
	/* END CONFIG */
	$("a.tooltip").mouseover(function(e){
	active = 1;
		this.t = this.rel;
		this.title = "";
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");
    },
	function(){
//		this.rel = this.t;
		$("#tooltip").remove();
		active = 0;
    });

	$("a.tooltip").mouseout(function(e){
		$("#tooltip").remove();
		active = 0;

});


	$("a.tooltip").mousemove(function(e){
if(!active) {
//alert(this.rel);
		this.t = this.rel;
		this.title = "";
		$("#tooltip").remove();
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
/*			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
 */
			.fadeIn("fast");
}

		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});
};


// starting the script on page load
$(document).ready(function(){

/*$("img").each(function(i) {
this.title = 'your new alt text';
} ); */

tooltip();
});



function hidediv(id) {
    if(document.getElementById(id) != null) {
    	document.getElementById(id).style.display = 'none';
    }
}

function showdiv(id) {
    if(document.getElementById(id) != null) {
    	document.getElementById(id).style.display = 'block';
    }
}


function togglediv(id) {
    if(document.getElementById(id).style.display == 'none') {
        document.getElementById(id).style.display = 'block';
    } else {
        document.getElementById(id).style.display = 'none';
    }
}


//Change state

function overstate(nombreCapa){
    if(document.getElementById(nombreCapa) != null) {
    	document.getElementById(nombreCapa).className="overstat";
    }
}

function offstate(nombreCapa){
	document.getElementById(nombreCapa).className="offstat";
}


function overstatedouble(nombreCapa, nombreEnlace){
	document.getElementById(nombreCapa).className="overstat";
	document.getElementById(nombreEnlace).className="overlink";
}

function offstatedouble(nombreCapa, nombreEnlace){
	document.getElementById(nombreCapa).className="offstat";
	document.getElementById(nombreEnlace).className="offlink";
}




