$(document).ready(function() {
	
	/// show admin tools 
	//  commment actions
	$("div.work-list").hover(
	      function () {
			jQuery(this).find(".admin_tools").show();
	      }, 
	      function () {
			jQuery(this).find(".admin_tools").hide();
	      }
	    );
	
	// fade out flash data
	$(document).oneTime(5000, function() {
		$('div#flashdata div').fadeOut('slow');
	});
	
	// TinyMCE for text editing
	$('textarea').tinymce({
				script_url : '/js/tinymce/tiny_mce.js',
				theme : "advanced",
			    theme_advanced_buttons1 : "bold,italic,underline,link,unlink,undo", 
			    theme_advanced_buttons2 : "", 
			    theme_advanced_buttons3 : "",
			    button_tile_map: true,
				content_css : "/css/tinymce.css"
	});
	//alert("js found");
	
	// CAROUSEL
	setTimeout('$("div#carousel").jMyCarousel({visible: "100%",speed: 300}); $(document).find("div#carousel").animate({"opacity":1}, {duration:1000}, "jswing" );  ',500); // worked
	
	//  if clicked then load new flash vid
		// top links
   	$(this).find(".carlink").click(
      	function () {
			//clear flashhome div
			$('#flashHome').text("");
			var preview = $(this).find("#carimg").attr("src");
			var video = "/flvs/";
			video += $(this).find("#carimg").attr("title");
			var asp = $(this).find("#carimg").attr("aspect");
			
			
			// load new swf
			$('#flashHome').flash({
				// test_flashvars.swf is the flash document
				swf: '/flvs/player.swf',
				// size
				width: 602,
				height: 356,
				// flash vars
				flashvars: {
					vid: video,
					prev: preview,
					aspect: asp
				},
				// setup
				hasVersion: 10,
				expressInstaller: 'playerProductInstall',
				// other params
				params: {
				    wmode: 'transparent',
					allowfullscreen: 'true'
				}
			});
      	}
    );


	
	// pretty photo
	$("a[rel^='prettyPhoto']").prettyPhoto();
	
	
	// FLASH intergration using swfobject.js
	// #flashHome is the selector
	$('#flashHome').flash({
		// test_flashvars.swf is the flash document
		swf: '/flvs/player.swf',
		// size
		width: 602,
		height: 356,
		// flash vars
		flashvars: {
			vid: 'Showreel09.flv',
			prev: 'images/thumbs/Showreel09.jpg'
		},
		// setup
		hasVersion: 10,
		expressInstaller: 'playerProductInstall',
		// other params
		params: {
		    wmode: 'transparent',
			allowfullscreen: 'true',
		
		}
	});


	
});