
/* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx */
/* inizio funzioni di sistema */

    function trim(stringa) 
        {
            while (stringa.substring(0,1) == ' ') { stringa = stringa.substring(1, stringa.length); }
            while (stringa.substring(stringa.length-1, stringa.length) == ' ') { stringa = stringa.substring(0,stringa.length-1); }
            return stringa;
        }
	function get_obj(obj_id) { return document.getElementById(obj_id); }
    function x_innerHTML(obj_id, testo) { get_obj(obj_id).innerHTML = trim(testo); }
    function obj_del(obj_id) { var obj_del = get_obj(obj_id); obj_del.parentNode.removeChild(obj_del); }
    function obj_fade(obj_id, valore)
    	{ 
        	if (typeof obj_id == 'string') 
            	{
                    get_obj(obj_id).style.opacity = (valore/10);
                    get_obj(obj_id).style.MozOpacity = (valore/10);
                    get_obj(obj_id).style.KhtmlOpacity = (valore/10);
                    get_obj(obj_id).style.filter = 'alpha(opacity='+ valore*10 +')';
                }
			else
            	{
                    obj_id.style.opacity = (valore/10);
                    obj_id.style.MozOpacity = (valore/10);
                    obj_id.style.KhtmlOpacity = (valore/10);
                    obj_id.style.filter = 'alpha(opacity='+ valore*10 +')';
                }
        
        }
    function obj_fade_in(obj_id, f_step, f_wait) { for (var i=0;i<11; i++) { window.setTimeout('obj_fade(\''+ obj_id +'\','+ i +')', f_wait + (f_step * i)); } }
    function obj_fade_out(obj_id, f_step, f_wait) { for (var i=0;i<10;i++) { window.setTimeout('obj_fade(\''+ obj_id +'\','+ (9-i) +')', f_wait + (f_step * i)); } }
    function set_LT(obj_id, x_left, x_top)
    	{
        	if (typeof obj_id == 'string') { get_obj(obj_id).style.left = x_left +'px'; get_obj(obj_id).style.top = x_top +'px'; }
			else { obj_id.style.left = x_left +'px'; obj_id.style.top = x_top +'px'; }
        }
	function carica_pagina_1(cp_pagina, cp_id_oggetto)
		{
			var cp_url = "_data/"+ cp_pagina;  
			if (window.XMLHttpRequest) { cp_req = new XMLHttpRequest(); } 
			else if (window.ActiveXObject) { cp_req = new ActiveXObject("Microsoft.XMLHTTP"); }
			cp_req.onreadystatechange = function ()
                {
                if (cp_req.readyState == 4)
                    {
                        if (cp_req.status == 200) { get_obj(cp_id_oggetto).innerHTML = cp_req.responseText; } 
                        else { server_problema('Err carica_pagina_1'); }
                    }
                }
			cp_req.open("GET", cp_url, true);
			cp_req.send(null);
		}

	function menu_01(id_obj)
		{
            get_obj('m_01').className = 's_menu';
            get_obj('m_02').className = 's_menu';
            get_obj('m_03').className = 's_menu';
            get_obj('m_04').className = 's_menu';
            get_obj(id_obj).className = 's_menu_2';
		}

    function fade_1(obj_name, valore)
        { 
            document.getElementById(obj_name).style.opacity = (valore / 10);
            document.getElementById(obj_name).style.MozOpacity = (valore / 10);
            document.getElementById(obj_name).style.KhtmlOpacity = (valore / 10);
            document.getElementById(obj_name).style.filter = 'alpha(opacity=' + valore*10 + ')';
        }

function open_text_box() { obj_fade_in('open_01', 80, 100); window.setTimeout('set_close()',1000); }
function close_text_box() { obj_fade_out('open_01', 80, 100); window.setTimeout('set_open()',1000); }
function set_close() { x_innerHTML('open_02', '<div id="box_testo_2"><a href="javascript:close_text_box();"><img src="../../_common/_graf/box_close.png" /></a></div>') }
function set_open() { x_innerHTML('open_02', '<div id="box_testo_2"><a href="javascript:open_text_box();"><img src="../../_common/_graf/box_open.png" /></a></div>') }
function start_intro() { obj_fade_out('intro', 100, 3000); window.setTimeout('set_close_intro()',3800); start_text_box(); }
function set_close_intro() { document.getElementById('intro').style.zIndex = '-1'; document.getElementById('intro').style.visibility = 'hidden'; }

/* fine funzioni di sistema */
/* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx */



