﻿function obsolete_alert(alertMessage, alertLink){
	if(!document.getElementById("obsolete")) {
		// create styled DIV with the alert
		eDIV = document.createElement("div");
		eDIV.setAttribute("id","obsolete");	
		eDIV.setAttribute("style","margin:0; position:absolute; top:0; width:96%; color:white; background-color:#e62020; height:50px; font-size:14px; font-weight:bold; text-align:center; font-family:Arial,sans-serif; padding:5px 2%;");

		// this is the text to translate
		//eDIV.appendChild(document.createTextNode(alertMessage));
		if((window.location.toString().indexOf(alertLink) == -1) && confirm(alertMessage + ' Spustelėję „Gerai“, sužinosite apie tai daugiau.')) {
			window.location = alertLink;
		} else {
			eDIV.innerHTML = alertMessage + ' <a href="' + alertLink + '" style="color: white;">Plačiau…</a>';

			cible = document.getElementsByTagName("body")[0];
			cible.appendChild(eDIV);

			//move the content down to avoid overlap with alert div
			document.getElementById("header-bar").setAttribute("style","margin-top:50px !important;");
			document.getElementById("header").setAttribute("style","margin-top:50px !important;");
		}
	}
}

function obsolete_check() {
	if((navigator.platform.toLowerCase().indexOf('win') != -1) && (navigator.product == 'Gecko'))
	{
		if(
			((navigator.userAgent.indexOf('rv:1.6') != -1) || (navigator.userAgent.indexOf('rv:1.7') != -1) || (navigator.userAgent.indexOf('rv:1.8') != -1))
			&&
			((navigator.userAgent.indexOf('Firefox') != -1) || (navigator.userAgent.indexOf('BonEcho') != -1))
			)
		{
			obsolete_alert ('Dėmesio! Panašu, jog Jūs naudojate pasenusią naršyklę. Patariame kuo skubiau ją atnaujinti!',  '/firefox/naujinimas#content');
		}
		else if(
			(navigator.userAgent.indexOf('rv:0.9') != -1) ||
			(navigator.userAgent.indexOf('rv:1.0') != -1) ||
			(navigator.userAgent.indexOf('rv:1.1') != -1) ||
			(navigator.userAgent.indexOf('rv:1.2') != -1) ||
			(navigator.userAgent.indexOf('rv:1.3') != -1) ||
			(navigator.userAgent.indexOf('rv:1.4') != -1) ||
			(navigator.userAgent.indexOf('rv:1.7') != -1) ||
			(navigator.userAgent.indexOf('rv:1.8') != -1)
			)
		{
			obsolete_alert ('Dėmesio! Panašu, jog Jūs naudojate pasenusią naršyklę. Patariame kuo skubiau ją atnaujinti!', '/seamonkey/naujinimas#content');
		}
	}
}

function obsolete_tb_warn() {
	obsolete_alert ('Dėmesio! Jeigu iki šiol naudojate „Thunderbird LT“ el. pašto programą, patariame kuo skubiau ją atnaujinti!', '/thunderbird/naujinimas#content');
}

try { // DOM
	window.addEventListener('load', obsolete_check, false);
} catch(err) {} // IE

