/* requires jquery 1.x */

function utils() {
}

utils.initTooltips = function(){  
	    /* CONFIG */        
	        xOffset = 0;
	        yOffset = -10;       
	    /* END CONFIG */        
	    $(".tooltip").hover(function(e){                                             
	        this.t = this.title;
	        this.title = "";                                      
	        $("body").append("<p id='tooltip'>"+ this.t +"</p>");
	        $("#tooltip")
	            .css("top",(e.pageY - yOffset) + "px")
	            .css("left",(e.pageX + xOffset) + "px")
	            .fadeIn("fast");        
	    },
	    function(){
	        this.title = this.t;        
	        $("#tooltip").remove();
	    }); 
	    $("a.tooltip").mousemove(function(e){
	        $("#tooltip")
	            .css("top",(e.pageY - yOffset) + "px")
	            .css("left",(e.pageX + xOffset) + "px");
	    });         
	}
	
utils.initCollapsables = function() {
	    $(".collapse_next").bind("click", function(e) {
			if(e.target)
		        $(e.target).next().toggleClass("collapsed");
			else	
		        $(e.srcElement).next().toggleClass("collapsed");
	        /** fixes footer display issue in IE6 when collapsable elements change height */
            $('#footer_container').css("display", "none");
            $('#footer_container').css("display", "block");
	    });
	}


utils.openInNewWindow = function(url) {
    var wwidth = $(window).width();
    var wheight = $(window).height();
    var w = Math.round(wwidth * 0.5);
    var h = Math.round(wheight * 0.7);
    var left = wwidth - w;
    var top = wheight - h;
    window.open(url, '', 'left=' + left + ',top=' + top + ',height='+h+', width='+w+', toolbar=no, menubar=no, location=no, directories=no, status=no, resizable, scrollbars=yes');
}        

