// JavaScript Document
//<script language="javascript1.2">

function setVisible(lan)
{
	i=1
	while(!(document.getElementById(i)==null)) {
		if(i==lan){
			document.getElementById(i).style.display = '';
		}
		else
		{
			document.getElementById(i).style.display = 'none';
		}
		i++;
	}  
	createCookie("lan",lan,365);     
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = 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 eraseCookie(name) {
	createCookie(name,"",-1);
}

/* 
Create the new window 
*/ 
function openInNewWindowMail() { 
// Change "_blank" to something like "newWindow" to load all links in the same new window 
var newWindow = window.open(this.getAttribute('href'), 'MailFriend','toolbar=no,width=240px,height=400px,resizable=no,menubar=no,toolbar=no,status=no'); 
newWindow.focus(); 
return false; 
} 
function openInNewWindowChat() { 
// Change "_blank" to something like "newWindow" to load all links in the same new window 
var newWindow = window.open(this.getAttribute('href'), 'Chat','toolbar=no,width=600px,height=410px,resizable=no,menubar=no,toolbar=no,status=no'); 
newWindow.focus(); 
return false; 
}
/* 
Add the openInNewWindow function to the onclick event of links with a class name of "non-html" 
*/ 
function getNewWindowLinks() { 
// Check that the browser is DOM compliant 
	if (document.getElementById && document.createElement && document.appendChild) { 
		// Change this to the text you want to use to alert the user that a new window will be opened 
		var strNewWindowAlert = ""; 
		// Find all links 
		var objWarningText; 
		var strWarningText; 
		var link; 
		var links = document.getElementsByTagName('a'); 
		for (var i = 0; i < links.length; i++) 
		{ 
			link = links[i]; 
			// Find all links with a class name of "non-html" 
			if (/\bnon\-html\-mail\b/.exec(link.className)) 
			{ 
				// Create an em element containing the new window warning text and insert it after the link text 
				objWarningText = document.createElement("em"); 
				strWarningText = document.createTextNode(strNewWindowAlert); 
				objWarningText.appendChild(strWarningText); 
				link.appendChild(objWarningText); 
				link.onclick = openInNewWindowMail; 
			} 
			else if (/\bnon\-html\-chat\b/.exec(link.className)) 
			{ 
				// Create an em element containing the new window warning text and insert it after the link text 
				objWarningText = document.createElement("em"); 
				strWarningText = document.createTextNode(strNewWindowAlert); 
				objWarningText.appendChild(strWarningText); 
				link.appendChild(objWarningText); 
				link.onclick = openInNewWindowChat; 
			} 
		} 
		objWarningText = null; 
	} 
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(getNewWindowLinks);

/*
</script>
*/