/* This replaces media place holder images with mediaplayers */


(function ($) {
 
 	$(
 		function()
 		{
 			$("img.mediaHolder").each(
 				function (index) {
 					var a = this.id.split('|');
					var playerType = a[0];
					var src = a[1];
					var id = "media_"+index;
					var w = this.width;
					var h = this.height
				
					var div = $('<div class="mediaholder"></div>').css({ width:w+"px", height:h+"px", display:'inline' });
				
					$(this).hide();
					$(this).before( div );
					
				try {
					switch ( playerType )
					{
						case "flash" :
							div.html( new SWFObject(src, id, w, h, 8).getSWFHTML () );							
							break;
						case "mediaplayer" :
						case "youtube" :
							var mp = new SWFObject("/js/ced/lib/player.swf",id,w,h,9);
							mp.addParam("allowfullscreen","true");
							mp.addVariable("width",w);
							mp.addVariable("height",h);
							mp.addVariable("file",src);
							div.html(mp.getSWFHTML());
							break;
						case "wmvplayer" :
							new jeroenwijering.Player(div.get(0), '/js/ced/lib/wmvplayer.xaml', { file : src, height : h+"", width : w+"" } );
							break;
					}
				} catch (error) {
						alert("Error embedding media player for "+playerType+" : "+src+"\n"+error);
				}
		
				
 				}
 			
 			);
 		}
 	
 	)
 
 
 })(jQuery);
// Theme swapper
function checkTime() {
	var dd  = new Date();
	var mm = dd.getMonth();
	if ( mm < 3 ||  mm > 11 ) {
		//if ( mm = 12 ) {
		//	$('body').addClass('xmas');
		//} else { 
			jQuery('body').addClass('winter'); 
		//}
	}	
	else if ( mm > 2 && mm < 5) {
		jQuery('body').addClass('spring');	     	
	}
	else if (  mm > 4 && mm < 9 ) {
		jQuery('body').addClass('summer');   			 	    
	}
	else {
		jQuery('body').addClass('autumn');   
	}
}