jQuery.preloadImages = function() {
	for(var i = 0; i<arguments.length; i++)
	{
		jQuery("<img>").attr("src", arguments[i]);
	}
}
jQuery.preloadImages("img/map_home_east.jpg", "img/map_home_east_l_fhain.jpg", "img/map_home_east_t_fhain.jpg", "img/map_home_east_t_wsee.jpg", "img/map_home_west_l_dus_forum.jpg", "img/map_home_west_l_koeln_forum.jpg", "img/map_home_west_t_dus_garath.jpg", "img/map_home_west_t_dus_hweg.jpg", "img/map_home_west_t_euskirchen.jpg", "img/map_home_west_t_frechen.jpg", "img/map_home_west_t_koeln_ehrfeld.jpg", "img/map_home_west_t_koeln_radberg.jpg", "img/map_home_west_x.jpg", "img/map_home_east_x.jpg");

function SwitchUsedCarsFrame(url, id)
{
	//Disable all radios
	jQuery(".frameSelects").removeAttr("checked");
	//Select one special
	jQuery("#"+ id).attr("checked", "checked");
	//Set new url for frame
	frameDus.location = url;
}

function showHighlight(strArea) {
   	$('#homemap').attr({src: "img/map_home_"+strArea+"_x.jpg"});
}

function hideHighlight() {
	$('#homemap').attr({src: "img/map_home.jpg"});
}

function showRegion(intRegion) {
	if(intRegion == 1) {
        $("#homemap").hide();
        $("#mapwest").show();
    }
	if(intRegion == 2) {
        $("#homemap").hide();
        $("#mapeast").show();
    }
}

function showHome(Nr) {
	if(Nr == 1) {
		$("#mapwest").hide();
		$("#homemap").show();
	}
	if(Nr == 2) {
		$("#mapeast").hide();
		$("#homemap").show();
	}
}

function showDealer(Name, Nr) {
	$("#map"+Name).hide();
	$("#"+Name+Nr).show();
}

function hideDealer(Name, Nr) {
	$("#map"+Name).show();
	$("#"+Name+Nr).hide();
}

function rotateImages(rotImage, randomImage) {
   	var fadeinImage = randomImage+1;
	if(fadeinImage > rotImage) {
		fadeinImage = 0;
	}
	$("#visual"+randomImage).fadeOut(3000);
	$("#visual"+(fadeinImage)).fadeIn(3000, function() {
		window.setTimeout("rotateImages("+rotImage+", "+fadeinImage+");", 5000);
	});
}

function changeFrame(strCity) {
	$('#frameDus').attr({src: "http://www.eeis.de/kd/levy_"+strCity+".html"});
}

