// JavaScript Document

$(document).ready(function() {
	// Preload dei rollover
	$("img").each(function() {
		// Prende l'url originale
		rollsrc = $(this).attr("src");
		rollON = rollsrc.replace(/.jpg$/ig,"_over.jpg");
		$("<img>").attr("src", rollON);
	});
	
	//over del mouse
	$("#abc").mouseover(function(){
		imgsrc = $(this).children("img").attr("src");
		matches = imgsrc.match(/_over/);
		// non compie il rollover se il mouse è già over
		if (!matches) {
			imgsrcON = imgsrc.replace(/.jpg$/ig,"_over.jpg"); // esclude l'estensione del file
			$(this).children("img").attr("src", imgsrcON);
		}

	});
	
	//out del mouse
	$("#abc").mouseout(function(){
		$(this).children("img").attr("src", imgsrc);
	});
});
