/*
*	initialization of BROWSER vars, distinguish between
*	different browsers
*	ver 0.2 - support for:
*						- firefox
*						- explorer(TODO: distinguish between versions)
*						- opera
*/
{
	//alert(BROWSER + " " + navigator.userAgent); 
	var nav = navigator.userAgent.toLowerCase();
	var BROWSER= "X";
	if(nav.indexOf("firefox")!=-1){
		ifFadeAnimation = true;
		BROWSER = "F";
	}
	if(nav.indexOf("msie")!=-1 && nav.indexOf("opera")==-1){
		ifFadeAnimation = true;
		BROWSER = "E";
	}
	if(nav.indexOf("opera")!=-1){
		ifFadeAnimation = false;
		BROWSER = "O";
	}
}


/*
*	function returns string representing current date
*/

// TODO: This is not integrated into the rest of the translations scheme...
var days_en = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var days_pt = new Array("Domingo","Segunda-feira","Ter&#231;a-feira","Quarta-feira","Quinta-feira","Sexta-feira","S&aacute;bado");
var days_fr = new Array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");

var days = days_pt;
function changeLanguage(){
	try{
		days = eval("days_"+lang);
	}
	catch(e){
		days = days_en;
	}
}
var dateObj;

var bodyObj = document.getElementsByTagName("body")[0];
if(BROWSER !="E")
    if(!bodyObj.onload)
            bodyObj.setAttribute("onload","getCurrentDate();");
    else
         bodyObj.setAttribute("onload",bodyObj.onload+";getCurrentDate();");
else
    window.attachEvent("onload",getCurrentDate);
function getCurrentDate(){
	if(!dateObj){
		dateObj = document.getElementById("iscte_strip_date");
		changeLanguage();
	}
    if(!dateObj)
        setTimeout(getCurrentDate,1000);
	var myDate = new Date();
	var str = "";

	str+=days[myDate.getDay()]+ ", ";
	if(BROWSER == "E"){
		str += (myDate.getYear())+ " ";
	}
	else{
		str += (myDate.getYear()+1900)+ "-";
	}
	if(myDate.getMonth() < 9)
		str +="0";
	str += (myDate.getMonth()+1) + "-"
	if(myDate.getDate() < 10)
		str += "0";
	str += (myDate.getDate()) + " ";
	
	
	
	
	if(myDate.getHours() < 10)
		str += "0";
 	str += (myDate.getHours()) + ":";
	if(myDate.getMinutes() < 10)
		str += "0"; 
	str += (myDate.getMinutes()) + ":"; 
	if (myDate.getSeconds() < 10)
		str += "0"; 
	str += (myDate.getSeconds()); 
	
	dateObj.innerHTML = str;
	setTimeout(getCurrentDate,1000);
}
var no_try = 0;
setTimeout(initThatsWe, 1000);
function initThatsWe(){
	if(document.getElementById("isc"+"te_foo"+"ter").getElementsByTagName("span")[0]){
		if(BROWSER != "E")document.getElementById("isc"+"te_foo"+"ter").getElementsByTagName("span")[0].onclick = function(){thatsWe()}
		else document.getElementById("isc"+"te_foo"+"ter").getElementsByTagName("span")[0].attachEvent("onclick" , function(){thatsWe()});
	}
	else if(no_try < 4){
		no_try++;
	 	setTimeout(initThatsWe, 1000);
	}
}
function thatsWe(){
	var myDiv = document.getElementById("thats"+"We");
	if(!myDiv){
		myDiv = document.createElement("div");
		myDiv.id = "thats"+"We";
	}
	else{
		myDiv.style.display = "block";
	}
	
	myDiv.style.position = "absolute";
	myDiv.style.top = document.body.scrollHeight-screen.availHeight/2+"px";
	myDiv.style.left = screen.availWidth/2-100+"px"; 
	myDiv.style.backgroundColor = "#e47842";
	myDiv.style.color = "#fff";
	myDiv.style.height = "100px";
	myDiv.style.width = "300px";
	myDiv.style.textAlign = "center";
	myDiv.style.verticalAlign = "middle";
	myDiv.style.padding = "10px";
	myDiv.style.cursor = "pointer";
	str = "&#112;&#97;&#103;&#101;&#32;&#119;&#97;"
	str += "&#115;&#32;&#99;&#114;&#101;&#97;&#116;"
	str += "&#101;&#100;&#32;&#98;&#121;&#58;"
	str += "<br/><strong>&#70;&#114;&#97;&#110;&#99;&#105;&#115;"
	str += "&#99;&#111;&#32;&#84;&#101;&#105;&#120;&#101;&#105;"
	str += "&#114;&#97;</strong><br/><strong>";
	str += "&#83;&#233;&#114;&#103;&#105;&#111;&#32;"
	str += "&#80;&#105;&#231;&#97;&#114;&#114;&#97;&#32;"
	str += "</strong><br /><strong>"
	str += "&#321;&#117;&#107;&#97;&#115;&#122;&#32;&#80;"
	str += "&#97;&#99;&#105;&#111;&#114;&#107;&#111;&#119;&#115;&#107;&#105;"
	str += "</strong><br /><strong>"
	str += "&#74;&#111;&#227;&#111;&#32;&#70;&#114;&#97;&#100;&#101;"
	str += "</strong><br \><br \>"
	str += "&#99;&#108;&#105;&#99;&#107;&#32;&#116;&#111;&#32;&#99;&#108;&#111;&#115;&#101;&#46;&#46;&#46;" 
	myDiv.innerHTML =str;
	if(BROWSER != "E")myDiv.onclick = function(e){e.target.style.display="none";}
	else myDiv.attachEvent("onclick" , function(e){e.srcElement.style.display="none";});
	document.getElementsByTagName("body")[0].appendChild(myDiv);
}