var speed = 500;
$(document).ready(function () { 
	$("#proBtnBox").mouseenter(function () { 
		$("#perBtnBox").stop().fadeTo(200, 0.5);
		proChange() 
	}).mouseleave(function () {
		$("#perBtnBox").stop().fadeTo(200, 1);
	});	
	$("#perBtnBox").click(function () {
		return checkBrowser();
	}).mouseenter(function () { 
		$("#proBtnBox").stop().fadeTo(200, 0.5);
		perChange() 
	}).mouseleave(function () {
		$("#proBtnBox").stop().fadeTo(200, 1);
	});
			
});
		
function proChange() {
	var zCheck = $("#proBg").css("zIndex");
	var zHeader = $("#proHeader").css("zIndex");
	if (zCheck == 1) {
		$("#perBg").stop().css({opacity: 1.0, zIndex: 1});
		$("#proBg").stop().hide().css("zIndex", 2).fadeIn(speed);
		$("#perContent").stop().css({opacity: 1.0, zIndex: 21});
		$("#proContent").stop().hide().css("zIndex", 22).fadeIn(speed);	
		$("#perFooter").stop().css({opacity: 1.0, zIndex: 31});
		$("#proFooter").stop().hide().css("zIndex", 32).fadeIn(speed);	
		
	}
	if (zHeader == 11) {
		$("#perHeader").stop().css({opacity: 1.0, zIndex: 11});
		$("#proHeader").stop().hide().css("zIndex", 12).fadeIn(speed);
	}
}
		
function perChange() {
	var zCheck = $("#perBg").css("zIndex");
	var zHeader = $("#perHeader").css("zIndex");
	if (zCheck == 1) {
		$("#proBg").stop().css({opacity: 1.0, zIndex: 1});
		$("#perBg").stop().hide().css("zIndex", 2).fadeIn(speed);
		$("#proContent").stop().css({opacity: 1.0, zIndex: 21});
		$("#perContent").stop().hide().css("zIndex", 22).fadeIn(speed);
		$("#proFooter").stop().css({opacity: 1.0, zIndex: 31});
		$("#perFooter").stop().hide().css("zIndex", 32).fadeIn(speed);
	}
	if (zHeader == 11) {
		$("#proHeader").stop().css({opacity: 1.0, zIndex: 11});
		$("#perHeader").stop().hide().css("zIndex", 12).fadeIn(speed);
		
	}		
}

function checkBrowser() {
	var fuckIE = jQuery.browser.msie;
	var ieFailLevel = jQuery.browser.version.substr(0,1);
	var pass = true;
	var msg;
	if (fuckIE == true){
		if (ieFailLevel == 6) {
			alert("I'm sorry but Internet Explorer 6 is not currently supported by this website. Please upgrade your browser to a more standards compliant browser such as Firefox, Safari or Google Chrome");
			pass = false;
		} else if (ieFailLevel == 7) {
			var ok = confirm("Internet Explorer 7 is not currently supported by this website. Please upgrade your browser to a more standards compliant browser such as Firefox, Safari or Google Chrome\n\nIf you would like to proceed to the site please press Ok (your results may vary). Or if you would like to stay here, please click Cancel");
			if (ok == true) {
  				pass = true;
  			} else {
  				pass = false;
  			}
		}
	}	
	return pass;	
}

