/**
 * No-Flash screen animation
 *
 * @author Husani Oakley
*/

var debug = false;

jQuery.noConflict();

 jQuery(document).ready(function() {

     //left button hover animation
     jQuery('div#button_left').hover(
	 function (){
	     jQuery('div#haveflash_static img').fadeOut('fast');
	     jQuery('div#haveflash_over img').fadeIn('fast');
	 },
	 function (){
	     jQuery('div#haveflash_static img').fadeIn('fast');
	     jQuery('div#haveflash_over img').fadeOut('fast');
	 }
     );
     //right button hover animation
     jQuery('div#button_right').hover(
	 function (){
	     jQuery('div#getflash_static img').fadeOut('fast');
	     jQuery('div#getflash_over img').fadeIn('fast');
	 },
	 function (){
	     jQuery('div#getflash_static img').fadeIn('fast');
	     jQuery('div#getflash_over img').fadeOut('fast');
	 }
     );
     //re-check flash version and display unique message based on results
     jQuery('div#haveflash_over img').click(
	 function (){
	     flash_version = getFlashVersion();
	     if(flash_version.major < 9){
		 //less than v9
		 msg_url = "/media/img/msg_flash8.png";
	     } else if((flash_version.major == 9) && (flash_version.release < 124)){
		 //less than v9.0.114
		 msg_url = "/media/img/msg_flash9ish.png";
	     } else {
		 //no flash
		 msg_url = "/media/img/msg_noflash.png";
	     }
	     jQuery('img.msg').fadeOut('slow', function(){
		 jQuery('img.msg').attr('src', msg_url).fadeIn('slow');  
	     })
	 }
     );
     
     //reveal initial message and buttons
     if(BrowserDetect.browser == "ie"){
	 jQuery('div#button_left').hover( );
	 jQuery('div#button_right').hover( );
	 jQuery('img.msg').css('display', 'block');
	 jQuery('div#buttons').css('display', 'block');
     } else {
	 jQuery('img.msg').effect("drop", { mode: "show", direction: "up" }, 1500);
	 jQuery('div#buttons').effect("drop", { mode: "show", direction: "down" }, 1500);
     }

 });

function getFlashVersion(){
    var flash_version;
    if(!debug){
	flash_version = swfobject.getFlashPlayerVersion();
    } else {
	flash_version = new Object;
	flash_version.major = 9;
	flash_version.release = 10;
    }
    return flash_version;
}