function badBrowser(){// Define a bad browser
	if($.browser.msie && jQuery.browser.version <= '6.0'){ return true;}	
}

function getBadBrowser(c_name)// Make cookie
{
	if (document.cookie.length>0)
	{
	c_start=document.cookie.indexOf(c_name + "=");
	if (c_start!=-1)
		{ 
		c_start=c_start + c_name.length+1; 
		c_end=document.cookie.indexOf(";",c_start);
		if (c_end==-1) c_end=document.cookie.length;
		return unescape(document.cookie.substring(c_start,c_end));
		} 
	}
	return "";
}	

function setBadBrowser(c_name,value,expiredays)// Expire cookie
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value) + ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

if(badBrowser() && getBadBrowser('browserWarning') != 'seen' ){// Display Message
	$(function(){
		$('head').append(
			'<style type="text/css">'+
				'#browser-warning{background:#ef3e26;width:100%;border-top:solid 2px #fff;border-bottom:solid 2px #fff;color:#fff;padding:25px 0 15px 0px;float:left;}' +
				'#browser-warning-container{width:1010px;margin:0 0 0 -505px;left:50%;position:relative;float:left;}' +
				'#browser-warning h1, #browser-warning h2, #browser-warning h3{float:left;clear:both;width:1010px;text-align:center;}' +
				'#browser-warning h1{font-size:1.438em;}' +
				'#browser-warning h2{font-size:1em;margin-top:5px;}' +
				'#browser-warning h3{font-size:0.814em;font-style:italic;}' +
				'#browser-warning ul{float:left;list-style-type:none;margin:25px 0 25px;}' +
				'#browser-warning ul li{float:left;width:175px;height:195px;display:block;margin-left:62px;text-align:center;}' +
				'#browser-warning ul li a{display:block;width:175px;height:195px;font-size:0.689em;cursor:pointer;background:url(images/browsers.jpg) 0 0 no-repeat;position:relative;z-index:2;}' +
				'#browser-warning ul li a strong{display:block;position:relative;top:175px;}' +
				'#browser-warning ul li a.ff{background-position:-175px 0;}' +
				'#browser-warning ul li a.chrome{background-position:-350px 0;}' +
				'#browser-warning ul li a.ie{background-position:-525px 0;}' +
				'#browser-warning ul li a:hover{background-position:0 -195px;color:#afafaf;font-size:0.689em}' +
				'#browser-warning ul li a.ff:hover{background-position:-175px -195px;}' +
				'#browser-warning ul li a.chrome:hover{background-position:-350px -195px;}' +
				'#browser-warning ul li a.ie:hover{background-position:-525px -195px;}' +
				'#browser-warning #close{width:1010px;float:left;clear:both;}' +
				'#browser-warning #warningClose{color:#000;float:right;position:relative;z-index:2;}' +
				'#browser-warning #warningClose:hover{color:#afafaf;}' +
			'</style>'
		);
		$('body').prepend(
			'<div id="browser-warning">'+
				'<div id="browser-warning-container">' +
						'<h1>Your browser is not supported becasue it is unsafe &amp; out of date.</h1>' +
						'<h2>We recommend using the latest version of one of these popular browsers found below.</h2>' +
						'<ul>' +
							'<li><a href="http://www.apple.com/safari/download/" target="_safari"><strong>Safari 4+</strong></a></li>' +
							'<li><a href="http://www.getfirefox.com" target="_ff" class="ff"><strong>Firefox 3.6+</strong></a></li>' +
							'<li><a href="http://www.google.com/chrome/" target="_chrome" class="chrome"><strong>Chrome 10+</strong></a></li>' +
							'<li><a href="http://microsoft.com/ie9" class="ie"><strong>Internet Explorer 7+</strong></a></li>' +
						'</ul>' +
						'<h3>By closing this window you acknowledge that your experience on Caféwell will be severely degraded.</h3>' +
						'<div id="close"><a href="javascript:void()" id="warningClose">close</a></div>' +
					'</div><!-- /browser-warning-container -->' +
			'</div><!-- /browser-warning -->'
		);
		$('#warningClose').click(function(){
			setBadBrowser('browserWarning','seen');
			$('#browser-warning').slideUp('500');
			return false;
		});
	});	
}
