/*  fullscreen_pic.js 
	by Memorybox crew
 --------------------------------------*/
/* Global arguments in:
	selector_class
 */
  $(document).ready(function(){
	fullscreen_pic();
	
	$(window).bind('resize', function () { 
		fullscreen_pic();
	});
 });
 
 
function fullscreen_pic() {
	
	/* new dimentions */
	var w_doc = $(window).width();
	var h_doc = $(window).height();
					
	/* original dimentions */
	var h_org = $(selector_class).attr("height");
	var w_org = $(selector_class).attr("width");
	
	var ratio = w_org/h_org;

	var w = w_doc - border_width*2; 
	var h = w / ratio;
	
	if (h < h_doc) { /*If screen is to heigh for image ratio */
		h = h_doc;
		w = h * ratio;
	}

	 $(selector_class).css({height: h +"px", width: w +"px", "border" : border_width+"px solid #"+ border_color});
	 $("#frame_bottom").css({height: border_width +"px", "background-color": "#"+border_color});
	  $("#frame_right").css({width: border_width +"px", "background-color": "#"+border_color,height: h_doc +"px"});

};
