/*
3 * Image preload
4 */
jQuery.preloadImages = function() {
 for(var i = 0; i<arguments.length; i++) {
 jQuery("<img>").attr("src", arguments[i]);
 }
}
$.preloadImages(
				'img/bot_sobrem-on.png',
				'img/bot_serv-on.png',
				'img/bot_galery-on.png',
				'img/bot_contact-on.png'
); 


$(document).ready(function() { 

// main nav rollovers
$('#nav_metodi').mouseover(function() {
$(this).attr('src', 'img/bot_sobrem-on.png')
}).mouseout(function() {
$(this).attr('src', 'img/bot_sobrem.png')
});

$('#nav_servicios').mouseover(function() {
$(this).attr('src', 'img/bot_serv-on.png')
}).mouseout(function() {
$(this).attr('src', 'img/bot_serv.png')
});

$('#nav_galeria').mouseover(function() {
$(this).attr('src', 'img/bot_galery-on.png')
}).mouseout(function() {
$(this).attr('src', 'img/bot_galery.png')
});

$('#nav_contacto').mouseover(function() {
$(this).attr('src', 'img/bot_contact-on.png')
}).mouseout(function() {
$(this).attr('src', 'img/bot_contact.png')
});


// screenshot rollovers
$('.screen a').mouseover(function() {
$(this).parents('.screen').addClass('screen_over');
}).mouseout(function() {
$(this).parents('.screen').removeClass('screen_over');
})

// image replacement
 if($('#logo')[0].offsetWidth == 288) { // if images are enabled
 $('h2.img').each(function() {
 string = $(this).text();
 filename = string.toLowerCase().replace(/ /g, '-').replace(/([^0-9a-z-])/g,'');
 $(this).html('<img src="img/' + filename + '.gif" height="38" alt="' + string + '" />');
 });
 }

});
