jQuery(document).ready(function() {
   resizeWindow();
   $(window).bind("resize", resizeWindow);
   $('#background').css('z-index','-1');
});



function resizeWindow( e ) {
   var h = $(window).height();
   var w = $(window).width();
   var videoWidth = w;
   var videoHeight = h;

   var vratio = 1280/720;
   var wratio = w/h;

   if (wratio > vratio) {
        videoHeight = (w / 1280) * 720;
   } else {
        videoWidth = h * vratio;
   }

   $("#background").empty().removeClass();

   var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
    if(!is_chrome)
       $("#background").flash({ src: "../swf/kgnew.swf", width: videoWidth, height: videoHeight, wmode: 'transparent', scale: 'exactfit'});
	
	$('#background').css('top', '0');

	if(videoHeight > h) {
		var diff = videoHeight - h;
		diff = '-' + diff + 'px';
		$('#background').css('top', diff);
		
	}
	
	//logo
	var sol = w - (w/20.7) - 163;
	sol = sol + 'px';
	$('#logo').css('left', sol);
	
	var ust = h/13.6;
	ust = ust + 'px';
	$('#logo').css('top', ust);
	
	//contact
	if (h > 350) {
		
		var solContact = w - (w/20.7) - 108;
		solContact = solContact + 'px';
		$('#contact').css('left', solContact);
		
		var ustContact = h/1.21;
		ustContact = ustContact + 'px';
		$('#contact').css('top', ustContact);
	}
	
	//social
	if (h > 350) {
		
		var solS = (w/20.7);
		solS = solS + 'px';
		$('#social').css('left', solS);
		
		var ustS = h/1.21 - 8;
		ustS = ustS + 'px';
		$('#social').css('top', ustS);
	}
	
	
}

resizeWindow(null); 

