<!--

var loadshort=0;

var showshort=0;

var state = "none"; 



function MM_openBrWindow(theURL,winName,features) { //v2.0
  
  window.open(theURL,winName,features);

}

	

function showhide(layer_ref) { 

	if (state == "block") { 

		state = "none"; 

		} else { 

		state = "block"; 

		} 

	if (document.all) { 

		//IS IE 4 or 5 (or 6 beta) 

		eval("document.all." + layer_ref + ".style.display =" + state + ""); 

		} 

	if (document.layers) { //IS NETSCAPE 4 or below 

		document.layers[layer_ref].display = state; 

		}	 

	if (document.getElementById &&!document.all) { 

		hza = document.getElementById(''+layer_ref+''); 

		hza.style.display = state; 

		} 

	} 



function hideme(iteimd) {

		var e = document.getElementById(''+iteimd+'');

		e.style.display='none';

	}



function go_search(uri) {

	document.forms['frm_ricerca'].action=uri+'.php';

	document.forms['frm_ricerca'].submit();

}



function gosearchall() {

	/*

	var str="";

	for(var i=1;i<4;i++) {

	if(document.forms['frm_adv_ricerca'].elements["pq"+i+""].value!==" ") {

		str += " "+document.forms['frm_adv_ricerca'].elements["sq"+i+""].value +""+ document.forms['frm_adv_ricerca'].elements["pq"+i+""].value;

		}

	}

	document.forms['frm_adv_ricerca'].q.value=str;

	*/



	document.forms['frm_adv_ricerca'].submit();

}



function postForm(container , target , formid ) {

 var params = Form.serialize($(''+formid+''));

 new Ajax.Updater(container, target, {asynchronous:true, method: 'post', parameters:params, evalScripts: true, onComplete: function () {document.getElementById(container).style.backgroundImage ='url(images/bkground.jpg)';}, onLoading: function () { document.getElementById(container).innerHTML=''; document.getElementById(container).style.backgroundImage='url(images/loading.gif)';}});

}



function getCat(container , target , params ) {

 new Ajax.Updater(container, target, {asynchronous:true, method: 'post', parameters:params, evalScripts: true});

//, onComplete: function () {document.getElementById(container).style.backgroundImage ='url(images/bkground.jpg)';}, onComplete: function() {	objects = document.getElementsByTagName("object"); for (var i = 0; i < objects.length; i++) { objects[i].outerHTML = objects[i].outerHTML;}}, onLoading: function () { document.getElementById(container).innerHTML=''; document.getElementById(container).style.backgroundImage='url(images/loading.gif)';}

}



function macroget(id) {

	var container='catwrap';

	var target='shortdetail_macrocat.php';

	var params='id_macrocat='+id;

	 new Ajax.Updater(container, target, {asynchronous:true, method: 'post', parameters:params, evalScripts: true , onComplete:showontre(id)});

//, onComplete: function () {document.getElementById(container).style.backgroundImage ='url(images/bkground.jpg)';}, onLoading: function () { document.getElementById(container).innerHTML=''; document.getElementById(container).style.backgroundImage='url(images/loading.gif)';}

}



var puObj="";



function shoutplayupdetail(channel) {

puObj = new Ajax.PeriodicalUpdater('container_tv_details', 'shoutdetail.php', {asynchronous:true, method: 'post', parameters: {uri: channel}, evalScripts: true, frequency: 30, decay: 1});

}





function updateElementPost(element, uri, params){

new Ajax.Updater(element, ''+uri+'', {asynchronous:true, method: 'post', parameters: params, evalScripts: true, onLoading: function () {    document.getElementById(element).innerHTML = '<div class="loading"><div style="position: absolute;top: 43%;left: 30%;">Visualizzazione dati in corso attendere...</div></div>';},onFailure: function(){ alert('Something went wrong...')}});

}

function updateFloatingWindows(element, uri, params,imageuri){
//alert(document.getElementById('windowContent' + element).innerHTML);
new Ajax.Updater('windowContent' + element, ''+uri+'', {asynchronous:true, method: 'post', parameters: false, evalScripts: true, onLoading: function () {    document.getElementById('windowContent' + element).innerHTML = '<div class="loading"><div style="position: absolute;top: 45%;left: 30%;">Visualizzazione dati in corso attendere...</div></div>';},onFailure: function(){ alert('Something went wrong...')}});

}





function orderspaging(order, ordascdesc, cod_cliente ,pag) {

new Ajax.Updater('ordinidata', 'blocco_lista_ordini.php', {asynchronous:true, method: 'post', parameters: {sort: order, order:ordascdesc, codice_cliente:cod_cliente, page: pag}, evalScripts: true,  onLoading: function () { document.getElementById('ordinidata').innerHTML='<div class="loadingdiv"><div style="position: absolute;top: 43%;left: 30%;">Visualizzazione dati in corso attendere...</div></div>';}});

}

// Lorenzo 
function fatturepaging(order, ordascdesc, cod_cliente ,pag) {

new Ajax.Updater('fatturedata', 'blocco_lista_fatture.php', {asynchronous:true, method: 'post', parameters: {sort: order, order:ordascdesc, codice_cliente:cod_cliente, page: pag}, evalScripts: true,  onLoading: function () { document.getElementById('fatturedata').innerHTML='<div class="loadingdiv"><div style="position: absolute;top: 43%;left: 30%;">Visualizzazione dati in corso attendere...</div></div>';}});

}



function updateElement(element, uri, params){

 new Ajax.Updater(element, ''+uri+'?'+params, {method: 'get', evalScripts: true});

 //onLoading: function () { document.getElementById(''+element+'').innerHTML='<div id="loader"> </div>';}

}



function updateElementbyForm(element, uri, params, formname){

 var postparams = $(formname).serialize();

 postparams = postparams+'&'+params;

 new Ajax.Updater(element, ''+uri+'',	{asynchronous:true, method: 'post', parameters:postparams, evalScripts: true,  onLoading: function () { document.getElementById(element+'_cont').innerHTML='<div id="loader"> </div>';}});

}



function opendetail(uri) {

new Ajax.Updater('detail_prod', 'blocco_grab_voltimum.php',	{asynchronous:true, method: 'post', parameters:{url: uri}, evalScripts: true,  onLoading: function () { document.getElementById('detail_prod').innerHTML='<div id="loader"> </div>';}});

}



function ordersdetail(idorder, iduser ) {

new Ajax.Updater('detailed', 'blocco_dettaglio_ordine.php',	{asynchronous:true, method: 'post', parameters:{codice_ordine: idorder, codice_cliente:iduser}, evalScripts: true,  onComplete: showordersdetails()});

}


function showordersdetails() {

	var e = document.getElementById('innerbox');

	e.style.display='block';

	new Draggable('detailorder',{revert:false});

}	



function updalphaf(alpha,page,ord,sort) {

var alp = alpha;

new Ajax.Updater('fornitori_result', 'blocco_list_fornitori.php',	{asynchronous:true, method: 'post', parameters:{search:alpha, pag:page, ordine:ord, ascdesc:sort}, evalScripts: true,  onComplete: function () { document.getElementById('alphasearchtext').innerHTML='Lista Fornitori con iniziale <b style="color:orange;">'+alp+'</b>';}});

}





function fornitori_updatepaging(alpha, ord, sort, num , elembypage, curpage) {

new Ajax.Updater('footer_pag', 'fornitori_pager.php', {asynchronous:true, method: 'post', parameters: {search: alpha, order:ord, ascdesc:sort, k: num, pass: elembypage, pag: curpage}, evalScripts: true});

}



/*

function fornitori_paging(source, vcat, page) {

new Ajax.Updater('feat_interno', 'get_rss_video.php', {asynchronous:true, method: 'post', parameters: {rss_source: source, vclass:vcat, pag: page}, evalScripts: true , onComplete: function () {document.getElementById('feat_interno').style.backgroundImage ='';}, onLoading: function () { document.getElementById('feat_interno').innerHTML='<div id="loader"> </div>';}});

}

*/



function myHandler(content,elementid) {

    var e = document.getElementById(elementid);

    e.innerHTML = "";

    e.innerHTML = content;

}



function postFormMail(container , target , formid ) {

 var params = Form.serialize($(container));

 new Ajax.Updater(container, target, {asynchronous:true, method: 'post', parameters:params, evalScripts: true, onLoading: function () { document.getElementById(container).innerHTML='';}});

}





function showontre(id) {

var d = document.getElementById('macrocat_'+id);

if (d) {

	for (var i = 1; i<=10; i++) {

		if (document.getElementById('macrocat_'+i)) {document.getElementById('macrocat_'+i).className='cattochose';}

		}

	d.className='catchosen';

	}

}

	

function montre(id) {

var d = document.getElementById('macrocat_'+id);

if (d) {

	for (var i = 1; i<=10; i++) {

		if (document.getElementById('macrocat_'+i)) {document.getElementById('macrocat_'+i).className='cattochose';}

		}

	d.className='catchosen';

	Cookie.Create('section', id, 5); //create open menu cookie save for 5 days

	// chiamata ajax

		if(showshort==0) {

			showshort=1;

			getCat('swfmenu' , '/detail_macrocat.php' , 'id_macrocat='+id );

		} else {

			macroget(id);

		}

	} else {

		if(Cookie.Read('section') !="" ) {

			if(document.getElementById('macrocat_'+Cookie.Read('section'))) {

			document.getElementById('macrocat_'+Cookie.Read('section')).className='catchosen';

			showshort=1;

			getCat('swfmenu' , '/detail_macrocat.php' , 'id_macrocat='+Cookie.Read('section'));

			}

		getCat('swfmenu' , '/detail_macrocat.php' , '');

		}

	}

}



	/* 

		General cookie function based on quirksmode examples

		http://www.quirksmode.org/js/cookies.html 

	*/

	var Cookie = {

		Create : function(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=/";

		},

		Read : function(name){

			var nameEQ = name.toLowerCase() + "=";

			var ca = document.cookie.split(';');

			for(var i=0;i < ca.length;i++) {

				var c = ca[i].toLowerCase();

				while (c.charAt(0)==' ') c = c.substring(1,c.length);

				if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);

			}

			return null;

		},

		Erase : function(){

			this.Create(name, "", -1);

		}

	};

	

 function chkusrdata() {

	var e=document.forms['modusrdata'];

	var err=0;

	if(e.sPass.value.length>0) {

		if(e.sPass.value!=e.sCPass.value){

		alert('Attenzione le password inserite non coincidono');

		e.sCPass.focus();

		err++;	

		}   

	}

	if(e.sEmail.value.length==0 && e.sPass.value.length==0) {
        
        alert('Attenzione occorre inserire l\'indirizzo di posta elettronica') ;
		er++;

	}

	if(err==0) {
	var params = Form.serialize('modusrdata');
    new Ajax.Updater('userdatadiv', 'blocco_personal_info.php', {asynchronous:true, method: 'post', parameters: params, evalScripts: true,  onLoading: function () { document.getElementById('userdatadiv').innerHTML='<div class="loadingdiv"><div style="position: absolute;top: 43%;left: 30%;">Salvataggio dati in corso attendere...</div></div>';}});
    //new Ajax.Updater('userdatadiv', 'blocco_personal_info.php',{asynchronous:true, method: 'post', parameters:params, evalScripts: true,  onLoading: function () { document.getElementById('userdatadiv').innerHTML='<div class="loading"><div style="position: absolute;top: 45%;left: 30%;">Visualizzazione dati in corso attendere...</div></div>';}});
	}

}

// Lorenzo sito statico

    function LoadContenuti(Element,Page){
    
        focuswindow = document.getElementById(Element);
        new Ajax.Updater(Element, Page, {asynchronous:true, method: 'post', parameters: false, evalScripts: true,  onLoading: function () { focuswindow.innerHTML='<div class="loadingdivdetailstatic"><div style="position:absolute;top: 35%;left: 38%;">Visualizzazione dati in corso attendere...</div></div>';}});
    
    }
    
    function LoadOrdine(idorder,iduser){
    
        focuswindow = document.getElementById('ordini');
        new Ajax.Updater('ordini', 'blocco_dettaglio_ordine.php', {asynchronous:true, method: 'post', parameters: {codice_ordine: idorder, codice_cliente:iduser}, evalScripts: true,  onLoading: function () { focuswindow.innerHTML='<div class="loadordinidivstatic"><div style="position: absolute;top: 30%;left: 37%;">Visualizzazione dati in corso attendere...</div></div>';}});
    
    }
    
    function LoadInOrdineWin(Element,Page){
    
        focuswindow = document.getElementById(Element);
        new Ajax.Updater(Element, Page, {asynchronous:true, method: 'post', parameters: false, evalScripts: true,  onLoading: function () { focuswindow.innerHTML='<div class="loadordinidivstatic"><div style="position: absolute;top: 30%;left: 37%;">Visualizzazione dati in corso attendere...</div></div>';}});
    
    }
    
    function chkusrdatastatic() {

        var e=document.forms['modusrdata'];

        var err=0;

        if(e.sPass.value.length>0) {

            if(e.sPass.value!=e.sCPass.value){

            alert('Attenzione le password inserite non coincidono');

            e.sCPass.focus();

            err++;    

            }   

        }

        if(e.sEmail.value.length==0 && e.sPass.value.length==0) {
            
            alert('Attenzione occorre inserire l\'indirizzo di posta elettronica') ;
            er++;

        }

        if(err==0) {
        var params = Form.serialize('modusrdata');
        focuswindow = document.getElementById('userdatadiv');
        new Ajax.Updater('userdatadiv', 'blocco_personal_info_static.php', {asynchronous:true, method: 'post', parameters: params, evalScripts: true,  onLoading: function () {focuswindow.innerHTML='<div class="loadingdivstatic"><div style="position: absolute;top:43%;left: 35%;">Salvataggio dati in corso attendere...</div></div>';}});
        //new Ajax.Updater('userdatadiv', 'blocco_personal_info.php',{asynchronous:true, method: 'post', parameters:params, evalScripts: true,  onLoading: function () { document.getElementById('userdatadiv').innerHTML='<div class="loading"><div style="position: absolute;top: 45%;left: 30%;">Visualizzazione dati in corso attendere...</div></div>';}});
        }

    }
    
    function updateElementPostStatic(element, uri, params){

        focuswindow = document.getElementById(element);
        new Ajax.Updater(element, ''+uri+'', {asynchronous:true, method: 'post', parameters: params, evalScripts: true, onLoading: function () { focuswindow.innerHTML = '<div class="loadingstatic"><div style="position: absolute;top: 40%;left: 35%;">Visualizzazione dati in corso attendere...</div></div>';},onFailure: function(){ alert('Something went wrong...')}});

    }
    
    function orderspagingstatic(order, ordascdesc, cod_cliente ,pag) {

        focuswindow = document.getElementById('contenuti');
        new Ajax.Updater('contenuti', 'blocco_lista_ordini_static.php', {asynchronous:true, method: 'post', parameters: {sort: order, order:ordascdesc, codice_cliente:cod_cliente, page: pag}, evalScripts: true,  onLoading: function () { focuswindow.innerHTML='<div class="loadingdivstatic"><div style="position: absolute;top: 40%;left: 35%;">Visualizzazione dati in corso attendere...</div></div>';}});

    }
    
    function fatturepagingstatico(order, ordascdesc, cod_cliente ,pag) {

        focuswindow = document.getElementById('contenuti'); 
        new Ajax.Updater('contenuti', 'blocco_lista_fatture_static.php', {asynchronous:true, method: 'post', parameters: {sort: order, order:ordascdesc, codice_cliente:cod_cliente, page: pag}, evalScripts: true,  onLoading: function () { focuswindow.innerHTML='<div class="loadingdivstatic"><div style="position: absolute;top: 43%;left: 35%;">Visualizzazione dati in corso attendere...</div></div>';}});

    }
    

//-->