
function ieVersion() {
  var rv = -1;
  if (navigator.appName == 'Microsoft Internet Explorer') {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}
var version = ieVersion();

if ((navigator.appName=="Microsoft Internet Explorer") && (version < 7) && readCookie('end6Off') != '1') {
	makeWindow(); 
}


function closeLayer(theobject,makeCook) {
	var makeCook = makeCook;
	document.getElementById(theobject).style.display="none";
	if (makeCook > '0') {
		createCookie('end6Off',1,14400);
	}
}


function createCookie(name,value,minutes) {
	var minutes = minutes;
	if (minutes) {
		var date = new Date();
		date.setTime(date.getTime()+(minutes*60*1000));
		var expires = "; expires="+date.toGMTString();
	} else {
		var expires = "";
	}
	document.cookie = name+"="+value+expires+"; path=/";
}


function readCookie(the_name) {
	var nameEQ = the_name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}


function makeWindow() {

	bit = '<div id="ie6-lights" class="lights"></div>' +
'<div id="ie6-warning" class="warning">' +
'<h2>Trafford College</h2>' +
'<p><strong>Welcome to Trafford College, we\'ve been busy at work bringing you new features to our website.</strong></p>' +
'<p>However there is one catch...</p>' +
'<p>We are now no longer supporting Internet Explorer Version 6 (The Web Browser that you are viewing this page with).</p>' +
'<p>IE 6 an eight-year-old browser that cannot cope with the demands of the modern internet. For the best web experience, we strongly recommend upgrading to <a href="http://www.getfirefox.com/">Firefox</a>, <a href="http://www.opera.com/">Opera</a>, <a href="http://www.apple.com/safari/">Safari</a>, <a href="http://www.google.com/chrome">Google Chrome</a>, or a more recent version of <a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a>.</p>' +
'<p>Internet Explorer Version 6 is no longer supported by Microsoft, is full of security problems and is very unsafe to use.</p>' +
'<p>Our website is not tested in IE6 and you may have difficulty viewing. However, if you would like to view our website without upgrading you can do... ' +
'<a href="#" onclick="closeLayer(\'ie6-warning\',\'1\');closeLayer(\'ie6-lights\',\'1\');return false;">View Site</a></p>' +
'</div>';
	document.write(bit);
	
}