$(document).ready(function() {

	$("#carThumbnails img").css("opacity",0.5).mouseenter(function() {
		$(this).animate({"opacity": 1}, 150);
	}).mouseleave(function() {
		$(this).animate({"opacity": 0.5}, 150);
	});
	$("#carThumbnails a").click(function() {
		galleryShow(this.href);
		$("#carThumbnails .current").removeClass("current");
		$(this).addClass("current");

		return false;
	});

});

function galleryShow(imageFile) {

	$("#carBig img").fadeOut(500, function() {
		$("#carBig .loader").css("display", "block");
		var img = new Image();
		img.src = imageFile;
		$(img).load(function() {
			$("#carBig .loader").css("display", "none");
			$("#carBig img").attr("src", img.src).fadeIn(500);
		});
	});
	
};

//JAVASCRIPT FLASH INSERTION
//--------------------------

function flash(url, img, width, height, flashversionuser) {

    if (!flashversionuser) {
        flashtest = 6;
    } else {
        flashtest = parseInt(flashversionuser);
    }; 
    
    //alert("Flash installed (2=yes): "+FlashDetect.installed);
    //alert("Flash version installed: "+FlashDetect.major);    
    //alert("Testing for: "+flashtest);        

    if (FlashDetect.installed == true && FlashDetect.major >= flashtest) {
        
        document.write('<object width="'+width+'" height="'+height+'" align="middle" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">');
        document.write('<param value="sameDomain" name="allowScriptAccess" />');
        document.write('<param value="'+url+'" name="movie" />');
        document.write('<param value="high" name="quality" />');
        //document.write('<param value="noscale" name="scale" />');
        document.write('<param value="transparent" name="wmode" />');
        document.write('<param value="lt" name="salign" />');
        document.write('<param value="#ffffff" name="bgcolor" /><embed width="'+width+'" height="'+height+'" align="middle" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowscriptaccess="sameDomain" wmode="transparent" bgcolor="#ffffff" salign="lt" quality="high" src="'+url+'">');
        document.write('</embed>');
        document.write('</object>');
    } else {
        document.write('<img src="'+img+'" width="'+width+'" height="'+height+'" alt="" />');
    };
    
    flashtest == null;

}
