var browser;

function detectbrowser() {
var id=navigator.userAgent.toLowerCase();
		var styles='<link href="';
		if (id.indexOf("applewebkit")!=-1) {
			styles=styles+"webkit.css";
			browser=3;
		} else if (id.indexOf("opera")!=-1) {
			browser=3;
		} else if (id.indexOf("gecko")!=-1 && (id.indexOf("likegecko")==-1 || id.indexOf("compatible")==-1)) { 
			browser=1;
		} else if (id.indexOf("msie 6")!=-1) {
			styles=styles+"msie6.css";
			browser=2;
		} else if (id.indexOf("msie 7")!=-1 || id.indexOf("msie 8")!=-1) {
			styles=styles+"msie78.css";
		}
		styles=styles+'" rel="stylesheet" type="text/css" media="all" />';
		document.write(styles);
}

function ieminmaxwidth() {
		var maxwidth=1680;
		var minwidth=1260;
		var width=document.documentElement.clientWidth; 
		if (width>maxwidth) width=maxwidth;
		if (width<minwidth) width=minwidth;
		if (document.getElementById('wrapper')!=null) { document.getElementById('wrapper').style.width=width+"px"; }
}

detectbrowser();

$(document).ready(function() {

	$('a').click(function() {
  		this.blur();
	});


	function resize() {
		if (browser==2 && resolution!=2) { ieminmaxwidth(); }
		var doc=$(document).height();
		var h2=$('div#wrapper').height();
		var newheight=h2-479-80;
		if (browser==3) {
			var h3=$('div#footer').offset().top+$('div#footer').height();
			$('div#wrapper').css({ 'height' : h3+34+'px' });	
			newheight=h3+34-$('div#rightcontent').offset().top;
		}
		$('div#rightcontent').css({ 'height' : newheight+'px' });
	}
	
	var resizeTimer = null;
	$(window).bind('resize', function() {
	   		if (resizeTimer) clearTimeout(resizeTimer); 
   		 	resizeTimer = setTimeout(resize, 100);
	});

	window.onload=function() {
		resize();
	}

});

