// JavaScript Document
	var myWidth = 0, myHeight = 0;
	var dimension;
	var currentBrowserdimantion;
	var gbimg;
	var imgLink;
	
	function initBGImage(_imgLink){
		imgLink = _imgLink;
	}
	
	function getBrowserSize() {
	 if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	  }
	}
	
	function resizeImage(gbimg) {
		
		currentBrowserdimantion = myWidth / myHeight;
		
		if(currentBrowserdimantion > dimension ){
			gbimg.height = myWidth / dimension;
			gbimg.width = myWidth;
						
		}else{
			gbimg.width = myHeight * dimension;
			gbimg.height = myHeight;
			
		}
	}
	
	function setDimension(gbimg){
		dimension = gbimg.width/gbimg.height;
	}
	
	window.onresize = function (){
		getBrowserSize();
		resizeImage(gbimg);
	}
	
	$(document).ready(function(){		
		getBrowserSize();
		
		gbimg = new Image();
		
		$(gbimg).load(function () {
			setDimension(gbimg);
			resizeImage(gbimg);
			$(this).hide();
			$('#background').append(this);
			$(this).fadeIn(3000);
		})
		.error(function () {
		})
    	.attr('src', imgLink);
	});