/* ----------------------------------
jQuery slidin menu
---------------------------------- */
jQuery.preloadImages = function()
{
	for(var i = 0; i<arguments.length; i++)
	jQuery("<img>").attr("src", arguments[i]);
}
jQuery.preloadImages("http://www.ieub.org/wp-content/themes/t3tr15/img/works.png", "http://www.ieub.org/wp-content/themes/t3tr15/img/workso.png", "http://www.ieub.org/wp-content/themes/t3tr15/img/services4.png", "http://www.ieub.org/wp-content/themes/t3tr15/img/services4o.png", "http://www.ieub.org/wp-content/themes/t3tr15/img/contact.png", "http://www.ieub.org/wp-content/themes/t3tr15/img/contacto.png");

jQuery(document).ready(function(){
	
	jQuery("#iconbar li a").hover(
		function(){
			var iconName = jQuery(this).children("img").attr("src");
			var origen = iconName.split(".png")[0];
			jQuery(this).children("img").attr({src: "" + origen + "o.png"});
			jQuery(this).css("cursor", "pointer");
			jQuery(this).animate({ width: "240px" }, {queue:false, duration:"normal"} );
			jQuery(this).children("span").animate({opacity: "show"}, "fast");
		}, 
		function(){
			var iconName = jQuery(this).children("img").attr("src");
			var origen = iconName.split("o.")[0];
			jQuery(this).children("img").attr({src: "" + origen + ".png"});			
			jQuery(this).animate({ width: "116px" }, {queue:false, duration:"normal"} );
			jQuery(this).children("span").animate({opacity: "hide"}, "fast");
		});
});



jQuery(document).ready(function(){
jQuery("img.a").hover(
function() {
jQuery(this).stop().animate({"opacity": "0"}, "slow");
},
function() {
jQuery(this).stop().animate({"opacity": "1"}, "slow");
});
 
});




var scrollSpeed = 96;       // Speed in milliseconds
var step = 1;               // How many pixels to move per step
var current = 0;            // The current pixel row
var imageHeight = 992;     // Background image height
var headerHeight = 992;     // How tall the header is.

//The pixel row where to start a new loop
var restartPosition = -(imageHeight - headerHeight);

function scrollBg(){
   
    //Go to next pixel row.
    current -= step;
   
    //If at the end of the image, then go to the top.
    if (current == restartPosition){
        current = 0;
    }
   
    //Set the CSS of the header.
    jQuery('body').css("background-position","0 "+current+"px");
   
   
}

//Calls the scrolling function repeatedly
var init = setInterval("scrollBg()", scrollSpeed);
