(function($) {
	$.fn.fullBg = function(){
		var bgImg = $(this);
		
		bgImg.addClass('fullBg');
		
		function resizeImg() {
			var imgwidth = bgImg.width();
			var imgheight = bgImg.height();
			
			var winwidth = $(window).width();
			var winheight = $(window).height();
			
			var widthratio = winwidth / imgwidth;
			var heightratio = winheight / imgheight;
			
			var widthdiff = heightratio * imgwidth;
			var heightdiff = widthratio * imgheight;
		
			if(heightdiff>winheight) {
				bgImg.css({
					width: winwidth+'px',
					height: heightdiff+'px'
				});
			} else {
				bgImg.css({
					width: widthdiff+'px',
					height: winheight+'px'
				});		
			}
		} 
		resizeImg();
		$(window).resize(function() {
			resizeImg();
		}); 
	};
})(jQuery)

jQuery(function($) {
	$("#background").fullBg();
});

if(document.getElementById("content")!=null)
{
	var sc=window.screen;
	var ht=sc.availHeight-250;
	var wt=sc.availWidth-500;
	document.getElementById("content").style.width=wt+"px";
	document.getElementById("content").style.height=ht+"px";
}

function openSub(cntrl)
{
	document.getElementById(cntrl).style.display='block';
}

if (document.getElementById("viewCollectionsBlock") != null) {
    var sc = window.screen;
    var ht = sc.availHeight - 250;
    var wt = sc.availWidth - 500;
    document.getElementById("viewCollectionsBlock").style.width = wt + "px";
    document.getElementById("viewCollectionsBlock").style.height = ht + "px";
}
