<!--
	
// *** top menus initialization

//bott1in=0
//bott2in=0
//bott3in=0
//bott4in=0

//---------------------------------------------------------------------------------------------------------------
// IE7 Resize Fix

function resizeFix() {
	if (widthCheck != document.documentElement.scrollWidth || heightCheck != document.documentElement.scrollHeight)
	document.location.href = document.location.href
}

function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}
//---------------------------------------------------------------------------------------------------------------


window.onunload = function(){}; //**** fix needed by FF to fire the onLoad event
				//**** after clicking the browser back button

function loadRoutines(ishome) {
	var fontSize = getCookie("fontSize")
	tsize=0
	if(fontSize) tsize=parseInt(fontSize)
	if(isNaN(tsize) || tsize<1 || tsize>6) {tsize=1} 
	setSize(tsize)
	
	if (ishome==1) {
		resize_id('home_area',265)
		var bm=document.getElementById("bottmenu")
		if (typeof(bm)!='undefined') bm.style.display='block';
		//startscroll()
		}
	else {
		resize_id('scroll_area',180)}	
	
	if (typeof(document.ndata1)!='undefined') 
		if (typeof(document.ndata1.CaptchaBox1)!='undefined' && document.ndata1.CaptchaBox1.value!='') document.ndata1.CaptchaBox1.value=''
	
}

function checksel(me) {
	if (document.getElementById(me).id=='current') return false
	return true
}

function increasetextsize() {
	tsize=parseInt(tsize)+1
	if (tsize>6) tsize=6
	setSize(tsize)
	setCookie("fontSize", tsize, 30);
}

function decreasetextsize() {
	tsize=parseInt(tsize)-1
	if (tsize<1) tsize=1
	setSize(tsize)
	setCookie("fontSize", tsize, 30);
}

function setSize(tsize) {
	switch (tsize) {
		case 1:
			tsize1='11px';
			lsize1='14px';break;
		case 2:
			tsize1='13px';
			lsize1='17px';break;
		case 3:	
			tsize1='18px';
			lsize1='21px';break;
		case 4:
			tsize1='23px';
			lsize1='26px';break;
		case 5:
			tsize1='27px';
			lsize1='30px';break;
		case 6:
			tsize1='31px';
			lsize1='34px';break;
		default:
			tsize1='11px';
			lsize1='14px';break;
		
	}
	document.getElementById('generic_text').style.fontSize=tsize1
	document.getElementById('generic_text').style.lineHeight=lsize1
}

function trim(stringToTrim) {
	if (typeof(stringToTrim)!='undefined') {
		return stringToTrim.replace(/^\s+|\s+$/g,"");
		}
	else	{return ''}
}

/* Module Set Cookie (string, string, int) */
function setCookie(c_name,value,expiredays){
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+';path=/'+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
/* Module Get Cookie (string) */
function getCookie(c_name){
	if(document.cookie.length>0){
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start!=-1){ 
			c_start=c_start + c_name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	return false;
}
/* depending on doctype, we have to use body or documentElement */

if (navigator.appName!='Microsoft Internet Explorer') document.documentElement.style.overflowY="scroll";

/******** ADJUST DIV HEIGHT *********/

function getObj(name){
	if (document.getElementById) {
        	this.obj = document.getElementById(name);
		if (this.obj!=null) this.style = document.getElementById(name).style;
	} else
	if (document.all) {
	        this.obj = document.all[name];	
		this.style = document.all[name].style;
	} else
	if (document.layers) {
	        this.obj = document.layers[name];	
		this.style = document.layers[name];
	}        
    
}

function getWinSize(){
     var myWidth = 0, myHeight = 0;
     if( typeof( window.innerWidth ) == 'number' ) {
       //Non-IE
       myWidth = window.innerWidth;
       myHeight = window.innerHeight;
     } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
       //IE 6+ in 'standards compliant mode'
       myWidth = document.documentElement.clientWidth;
       myHeight = document.documentElement.clientHeight;
     } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
       //IE 4 compatible
       myWidth = document.body.clientWidth;
       myHeight = document.body.clientHeight;
     }
   return {width:myWidth, height:myHeight};
}


function resize_id(obj,diffpixel) {
	var oWinSize = getWinSize();
	scrtop = document.documentElement.scrollTop;
	if (scrtop==0) scrtop = document.body.scrollTop; // ***fix for Chrome and Safari
	var n=oWinSize.height + scrtop - diffpixel; //181 is default, not for home page	
	var oContent = new getObj(obj);
	if (n>0 && oContent.style!=null) oContent.style.height = n.toString()+'px';
	if (oContent.style!=null) oContent.style.display = 'block';
}

/************************************/

// **************** per aggiungere eventi all'onload

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
  		}
  	else {
  		window.onload = function() {
      		if (oldonload) {
	        oldonload();
		}
		func();
		}
	}
}


//-->

