	h_init = 120;
	w_init = 160;

(function($){

$(function(){
	
	h_init = $("#visualwall img[class!='no_resize']:first").height();
	w_init = $("#visualwall img[class!='no_resize']:first").width();
	
	var nbVideoStr = $("#nb_videos").html();
	var $nbvideoWrt = $("#nb_video_write");
	$nbvideoWrt.css('color','rgb(48,82,250)');
		switch(nbVideoStr)
		{	
			case null : {$nbvideoWrt.html("no seesmic post").after(" is shown");break;}
			case 1 : {$nbvideoWrt.html("<strong>"+VideoStr+"</strong> seesmic post ").after("is shown");break;}
			default : {$nbvideoWrt.html("<strong>"+nbVideoStr+"</strong> seesmic posts ").after("are shown");break;}
		}
		
$("#visualwall img[class!='no_resize']").hover(
		function(){var com_class = $(this).attr("class");
			$("#visualwall img[class='"+com_class+"']").each(function(){$(this).css("opacity","0.8").css("filter","alpha(opacity=80)");});
		},
		function(){
			var com_class = $(this).attr("class");
			$("#visualwall img[class='"+com_class+"']").each(function(){$(this).css("opacity","1").css("filter","alpha(opacity=100)");});
		}
		);
		
		$("#choice_autoplaywall").toggle(function(){$(this).html("ON");},function(){$(this).html("OFF");});
});
})(jQuery);

	var w_max = 160;
	var step = 8;
	var ratio = h_init/w_init;


function showtitle(data, time)
{
	var title = window.document.getElementById('title');
	title.innerHTML = data;
	var date = window.document.getElementById('date');
	date.innerHTML = time;

}

function reset(){$("#visualwall img[class!='no_resize']").width(w_init).height(h_init);showtitle("Dimensions",w_init + "x" + h_init);}
function resize(sign)
{	var $img_ref = $("#visualwall img[class!='no_resize']:first");
	var h_cur = $img_ref.height();
	var w_cur = $img_ref.width();
	if((sign == 1) && !((w_cur + step) > w_max))
	{$("#visualwall img[class!='no_resize']").width(w_cur + step).height(h_cur + (step * ratio));}
	else if((sign == -1) && !((w_cur - step) <= 0))
	{$("#visualwall img[class!='no_resize']").width(w_cur - step).height(h_cur - (step * ratio));}
	showtitle("Dimensions",$img_ref.width() + "x" + $img_ref.height());
}

function viewvideodrawer(url){
	var div_video = jQuery('#'+url+' .video_container')[0];
	seesmic.player.createPlayer(div_video, url, true, true);
$.blockUI({ message: $('#'+url), css: {  width: '300px', heigth: '410px',backgroundColor:'rgb(68,68,68)', border: '1px solid #fff', top:  (jQuery(window).height() - 467) /2 + 'px', left: (jQuery(window).width() - 300) /2 + 'px'},baseZ: 200});
}

function viewrecorderdrawer(thread_id){
	seesmic.player.createRecorder(document.getElementById("recorderHolder"), 'Visual Seesmic by Tiil', thread_id);
	$.blockUI({ message: $('#recorder_drawer'), css: {  width: '300px', heigth: '250px',backgroundColor:'rgb(68,68,68)', border: '1px solid #fff', top:  (jQuery(window).height() - 250) /2 + 'px', left: (jQuery(window).width() - 300) /2 + 'px'},baseZ: 200});
}

function viewoptiondrawer() {
$.blockUI({ message: $("#options_panel"), css: {width: '425px', heigth: '500px',backgroundColor:'rgb(68,68,68)', border: '3px solid #000', top:  (jQuery(window).height() - 353) /2 + 'px', left: (jQuery(window).width() - 425) /2 + 'px'}});}

function viewcreditsdrawer(){
$.blockUI({ message: $("#credits_panel"), css: { width:'210px',heigth:'450px',backgroundColor:'rgb(53,53,53)', border: '1px solid #000', top:  (jQuery(window).height() - 450 ) /2 + 'px', left: (jQuery(window).width() - 210 ) /2 + 'px'}});
setTimeout(jQuery.unblockUI, 4000);
}

function close(){$.unblockUI();}
function videoFromRecorder(videoUri, title, url_thumbnail, recState, hasTitle){
	close();
	$("#postimage").attr('src','img/posted.jpg');
}

