var bMLPopupAlreadyOpened = 0;

function showPopup( htmlFile ) {	
	window.open(htmlFile,'popup','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=no,width=400,height=390');		
}

function showML( htmlFile ) {
	if(bMLPopupAlreadyOpened == 0){
		bMLPopupAlreadyOpened = 1;
		window.open(htmlFile,'popup','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=no,width=400,height=240');
	}
	
}

function computeContentHeight()
{
	NS4 = document.layers;
	if (NS4)
	{
		return;
	}
	else if (!document.all && !document.getElementById)
	{
		return;
	}
	//else if (window.opera)
	//{
	//	return;					
	//}
	else
	{
		computeContentHeight_IE();
	}
}

function computeContentHeight_IE()
{
	if (document.documentElement && document.documentElement.clientHeight)
	{
		var h = document.documentElement.clientHeight-130;
		if (h > 0)
		{
		document.getElementById("underprimnav").style.height=h;
		}
	}
	else if (document.body)
	{
		var h = document.body.clientHeight-130;
		if (h > 0)
		document.all('underprimnav').style.height=h;
	}
}

function fullImage( htmlFile, title, w, h) {	
	title = title.split(" ").join("%20")	
	window.open(htmlFile + '&title=' + title,'','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=no,width=' + w + ',height=' + h);		
}

// =================================================================================================
/* function validEmail(addr) 
* ----------------------------------------------
* DESCRIPTION: 
*   checks is addr a valid email address
* INPUT PARAMETERS:
*   addr: email address in string format
* OUTPUT PARAMETERS:
*   returns true, if the email address is valid, otherwise false
*/
function validEmail( addr) 
{
	var a = false;
	var res = false;
	// is Regexp supported
	if(typeof(RegExp) == 'function')
	{
	var b = new RegExp('abc');
	if (b.test('abc') == true) {a = true;}
	}

	if(a == true)
	{
	reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)'+
					'(\\@)([a-zA-Z0-9\\-\\.]+)'+
					'(\\.)([a-zA-Z]{2,4})$');
	res = (reg.test(addr));
	}
	else
	{
	res = (addr.search('@') >= 1 &&
			addr.lastIndexOf('.') > s.search('@') &&
			addr.lastIndexOf('.') >= s.length-5)
	}
	return res;
}

////////////////////////////////////////////////////////////////////////////////
function trim(text){ 

	while(text.charAt(0)==' ')
		text=text.substring(1,text.length )
	while(text.charAt(text.length-1)==' ')
		text=text.substring(0,text.length-1)
	return text;	
}
////////////////////////////////////////////////////////////////////////////////	

////////////////////////////////////////////////////////////////////////////////	
function left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
////////////////////////////////////////////////////////////////////////////////	

////////////////////////////////////////////////////////////////////////////////	
function right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}
////////////////////////////////////////////////////////////////////////////////	























// sistemare...vecchio sito vedere se servono ed eventualmente spostare sopra



function showHistory( htmlFile ) {	
	window.open(htmlFile,'popup','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=yes,width=417,height=350');
}




