//Copyright (c) 2010 paulgrant.ca
//http://www.paulgrant.ca

var gaBrowsers = new Array();
gaBrowsers[ 0 ] = new Array("Firefox", "http://www.mozilla.com/firefox/");
gaBrowsers[ 1 ] = new Array("Safari", "http://www.apple.com/safari/");
gaBrowsers[ 2 ] = new Array("Chrome", "http://www.google.com/chrome/");

var gsColor = "#6699CC";	//A4A9B7

if(document.addEventListener)
{
	//document.addEventListener("DOMContentLoaded", Notification, false);
}
else if(window.attachEvent)
{
	window.attachEvent("onload", Notification);
}

function Notification()
{
	NotificationCreateDivs();

	NotificationMove();
}

function NotificationMove()
{
	$("#notification").hide();

	$("#notificationX").click(function () {
    	//$("#notification").hide();
    	$("#notification").slideUp("slow");
    });

	$("#notification").slideDown("slow");
}

function NotificationCreateDivs()
{
	var bIE = /*@cc_on!@*/false;	//((document.all) ? true : false); //	/*@cc_on!@*/false;

	var oDiv = document.createElement("div");

	oDiv.setAttribute("id","notification");

	if(bIE)
	{
		oDiv.style.position 	= "absolute";
		oDiv.style.bottom		= "0%";
	}
	else
	{
		oDiv.style.position 	= "fixed";
		oDiv.style.bottom		= "0%";
	}

	oDiv.style.right		= "2%";
	oDiv.style.height		= "175px";
	oDiv.style.width		= "200px";
	oDiv.style.border		= "3px solid "+gsColor;
	oDiv.style.borderBottom	= "0px";
	oDiv.style.backgroundColor	= "white";


	//TITLE
	var oDivTitle = document.createElement('div');

	oDivTitle.setAttribute("id","notificationTitle");

	oDivTitle.style.fontSize		= "11px";
	oDivTitle.style.fontFamily		= "Arial,Verdana";
	oDivTitle.style.width			= "100%";
	oDivTitle.style.height			= "18px";
	oDivTitle.style.backgroundColor	= gsColor;
	oDivTitle.style.borderBottom	= "2px solid "+gsColor;

	oDiv.appendChild(oDivTitle);

	//MSG
	var oDivMsg = document.createElement('div');

	oDivMsg.setAttribute("id","notificationMsg");

	oDivMsg.style.paddingLeft	= "10px";
	oDivMsg.style.paddingTop	= "1px";
	oDivMsg.style.fontFamily	= "Arial,Verdana";
	oDivMsg.style.color			= "white";
	oDivMsg.style.fontWeight	= "bold";

	oDivMsg.innerHTML = "Upgrade your web browser";

	oDivTitle.appendChild(oDivMsg);

	//CLOSE X
	var oDivX = document.createElement('div');

	oDivX.setAttribute("id","notificationX");

	oDivX.style.position 		= "absolute";
	oDivX.style.top				= "0px";
	oDivX.style.right			= "0px";
	oDivX.style.width			= "11px";
	oDivX.style.height			= "11px";
	oDivX.style.fontFamily		= "Arial,Verdana";
	oDivX.style.color			= "white";
	oDivX.style.fontWeight		= "bold";
	oDivX.style.cursor			= "pointer";
	//oDivX.style.border		= "1px solid black";

	oDivX.innerHTML = "X";

	oDivTitle.appendChild(oDivX);

	//CONTENT
	var oDivIn = document.createElement('div');

	oDivIn.setAttribute("id","notificationIn");

	oDivIn.style.padding 	= "10px";
	oDivIn.style.fontSize	= "11px";
	oDivIn.style.fontFamily	= "Arial,Verdana";
	oDivIn.style.backgroundColor	= "white";

	var iRand = Math.floor(Math.random() * gaBrowsers.length);

	var oBrowser = gaBrowsers[ iRand ];

	var sUrl = oBrowser[ 1 ];
	if(!sUrl)
		sUrl = gaBrowsers[ 0 ][ 1 ];

	var sString = "<a style='text-decoration:none;' target='_blank' href='" + sUrl + "'>Please click here to upgrade your web browser to the latest version,<br>Thank you!</a><br><br>";

	sString += "You may also try these browsers<br>";

	for(var i = 0; i < gaBrowsers.length; i++)
	{
		oBrowser = gaBrowsers[ i ];

		sString += "<a style='text-decoration:none;' target='_blank' href='" + oBrowser[ 1 ] + "'>" + oBrowser[ 0 ] + "</a><br>";
	}

	oDivIn.innerHTML = sString;

	oDiv.appendChild(oDivIn);


	document.body.appendChild(oDiv);

	return true;
}

//End.

