// JScript source code by TJP
function createCookie()
{
	var days = 100
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000)); //100 is the number of days until expiration
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = ""; //else it expires when closing the browser
	document.cookie = "lindab_new=true"+expires+"; path=/";
}
//return the value of the speciefied cookie
function readCookie()
{
	var nameEQ = "lindab_new=";
	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 false;
}
//called on page load to check for the cookie and act on it
//if it is the italian langref, then the popup page shoud be displayed
function workCookie(langref)
{
if (langref == 23)
{
	if (readCookie() == false)
	{
		//create the cookie
		createCookie();
		//show the info page
		popup('popup/info_popup.asp?langref=' + langref, 435, 400);
	}
	else
	{
		//do nothing
	}
}
}
function popup(url,win_height,win_width) 
{
	pos_horizon = ((screen.width/2)-(win_width/2));
	pos_vertical = ((screen.height/2)-(win_height/2));
	window.open(url,"Information","width="+win_width+",height="+win_height+",top="+pos_vertical+",left="+pos_horizon+",scrollbars=no,menubar=no,toolbar=no");
}
