/* detect browser and display message */
jQuery(function($) {
	if(($.browser.safari && $.browser.version.substr(0,3) < 523) || ($.browser.msie && $.browser.version < 7)) {
		if($.cookie('oldbrowser') != 'hidden') {
			$('body').prepend('<div id="oldbrowser" style="margin:0px auto;padding:20px;background-color:none;width:670px;"><div style="padding:20px;background-color:#fff;border:2px solid #990000;"><p style="font-size:1.7em;">Please update your web browser.</p><p>This website will work on this outdated browser.<br />Please download an up to date web browser and visit us again!</p><p>For ie users - Microsoft is campaigning to <a href="http://www.ie6countdown.com/" style="color:#000;text-decoration:underline;">encourage you to upgrade your browser.</a> (It is a security risk)</p><p>Firefox is a great browser and it\'s easy to install : <a href="https://www.spreadfirefox.com/node&id=0&t=306" id="#oldbrowserff"><img border="0" alt="Firefox 3" title="Firefox 3" src="/images/shared/110x32_get_ffx.png"/></a></p><p><a style="text-decoration:underline;" href="javascript:void(0)" onclick="$(\'#oldbrowser\').hide();$(\'#pagewrapper\').show();$(\'#footerWrap\').show();$.cookie(\'oldbrowser\', \'hidden\');" style="color:#000;">Try loading the website anyway…</a></p></div></div>');
			$('#pagewrapper').hide();
			$('#footerWrap').hide();
		}
		
	}
});

$('A[rel="_blank"]').each(function(){
   $(this).attr('target', '_blank');
});

function var_dump(obj) {
   if(typeof obj == "object") {
	    var out = '';
	    for (var i in obj) {
	        out += i + ": " + obj[i] + "\n";
	    }
      return "Type: "+typeof(obj)+((obj.constructor) ? "\nConstructor: "+obj.constructor : "")+"\nValue: " + out;
   } else {
      return "Type: "+typeof(obj)+"\nValue: "+obj;
   }
}//end function var_dump

function windowWidth() {
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
	} else if( document.documentElement && document.documentElement.clientWidth) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
	} else if( document.body && document.body.clientWidth) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
	}
	return myWidth;
}


function windowHeight() {
	if( typeof( window.innerHeight ) == 'number' ) {
		//Non-IE
		myHeight = window.innerHeight;
	} else if( document.documentElement && document.documentElement.clientHeight) {
		//IE 6+ in 'standards compliant mode'
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && document.body.clientHeight) {
		//IE 4 compatible
		myHeight = document.body.clientHeight;
	}
	return myHeight;
}
