/*
Cufon.replace("#left ul li a", {hover: true});
Cufon.replace("#address", {hover: true});
Cufon.replace(".column p", {hover: true});
Cufon.replace(".column ul li", {hover: true});
Cufon.replace("h2", { fontFamily: 'bodoni' });
Cufon.replace("#friends-form", { fontFamily: 'bodoni' });
Cufon.replace(".contact-form");
Cufon.replace("#text-2");
Cufon.replace("#text-1");
*/

$(document).ready(function() {
  
  $(".kleur").mouseover(function () {
  
  	// split the filename, so we can add the prefix at the filename
  	if($(this).attr('src').indexOf("http://vroeg.klanten-enzo.nl") == -1) {
  		parts = $(this).attr('src').split(".");
  	} else {
  		strip_domain = $(this).attr('src').split("http://vroeg.klanten-enzo.nl");
  		parts = strip_domain[1].split(".");
  	}
  		
  	filename = "";
  	
  	// to fix a bug where there are multiple dots in the filename, loop
  	// trough the parts until te last dot, and combine that as the filename
  	for(i=0;i<parts.length-1;i=i+1) {
  		filename = filename+parts[i];
  	}
  	
  	// the extension is the last part (array, so minus one)
  	extension = parts[parts.length-1];
  	
  	// change the src so the image is updates with the prefix
    $(this).attr("src", filename+'_kleur.'+extension);
    
  });

  $(".kleur").mouseout(function () {
  
  	// split the filename trough our prefix
  	parts = $(this).attr('src').split("_kleur");
  	
  	// prefix is gone, now attach the parts
    $(this).attr("src", parts[0]+parts[1]);
  	
  });
  
	$( "#dialog" ).dialog({
		minWidth: 605,
		autoOpen: false,
		resizable: false,
		draggable: false,
		modal: true,
		closeOnEscape: true,
		show: "fade",
		hide: "fade",
	});

	
	$(".close-dialog").click(function() {
	
		$( "#dialog" ).dialog( "close" );
	});
	
});
