	// <!--
	function postBack(frmName, trgt) {
		var act = '';
		if (''+trgt != 'undefined')
		{
			act = '#'+trgt;
		}
		document.forms[frmName].action = act;
		document.forms[frmName].submit();
	}
	function ricerca()	{
		if (document.forms['frmRicerca'].radioProdotto.checked)
		{
			if (document.forms['frmRicerca'].ric_CDmacroarea.selectedIndex == 0)
			{
				alert('<%= diz("Selezionare almeno la macroarea") %>');
				return;
			}
			else
			{
				document.forms['frmRicerca'].azione.value = 'ricerca';
				document.forms['frmRicerca'].form_action.value = 'prodotti.asp';
				document.forms['frmRicerca'].submit();
			}
		}
		if (document.forms['frmRicerca'].radioParola.checked)
		{
			if (document.forms['frmRicerca'].ric_parola.value == '')
			{
				alert('<%= diz("Indicare un testo da cercare") %>');
				return;
			}
			else
			{
				document.forms['frmRicerca'].azione.value = 'ricerca';
				document.forms['frmRicerca'].form_action.value = 'prodotti.asp';
				document.forms['frmRicerca'].submit();
			}
		}
		if (document.forms['frmRicerca'].radioAzienda.checked)
		{
			if (document.forms['frmRicerca'].ric_nome_azienda.value == '' && document.forms['frmRicerca'].ric_dove.value == '')
			{
				alert('<%= diz("Indicare un nome o una localitÃ  da cercare") %>');
				return;
			}
			else
			{
				document.forms['frmRicerca'].azione.value = 'ricerca';
				document.forms['frmRicerca'].form_action.value = 'ricerca_azienda.asp';
				document.forms['frmRicerca'].submit();
			}
		}
		if (document.forms['frmRicerca'].radioImmagine.checked)
		{
			if (document.forms['frmRicerca'].ric_immagine.value == '')
			{
				alert('<%= diz("Indicare un testo da cercare") %>');
				return;
			}
			else
			{
				document.forms['frmRicerca'].azione.value = 'ricerca';
				document.forms['frmRicerca'].form_action.value = 'ricerca_immagine.asp';
				document.forms['frmRicerca'].submit();
			}
		}
	}
	function nuova_ricerca(CDtipoRicerca,CDmacroarea,CDcategoria,CDsottocategoria,CDclasseProdotto, DSparola, DSnomeAzienda,DSluogo, DSimmagine, DTinsMin, NRtopResults)
	{
		document.forms['frmRicercaBis'].azione.value = 'ricerca';
		var pars = '';
		if (''+NRtopResults != 'undefined')
		{
			pars = '?top=' + NRtopResults;
		}
		switch(CDtipoRicerca)
		{
			case 'parola':
			case 'prodotto':
				document.forms['frmRicercaBis'].form_action.value = 'prodotti.asp' + pars;
				break;
			case 'azienda':
				document.forms['frmRicercaBis'].form_action.value = 'ricerca_azienda.asp' + pars;
				break;
			case 'immagine':
				document.forms['frmRicercaBis'].form_action.value = 'ricerca_immagine.asp' + pars;
				break;
		}
 		document.forms['frmRicercaBis'].radioRicerca.value = CDtipoRicerca;
		document.forms['frmRicercaBis'].ric_CDmacroarea.value = CDmacroarea;
		document.forms['frmRicercaBis'].ric_CDcategoria.value = CDcategoria;
		document.forms['frmRicercaBis'].ric_CDsottocategoria.value = CDsottocategoria;
		document.forms['frmRicercaBis'].ric_CDclasseProdotto.value = CDclasseProdotto;
		document.forms['frmRicercaBis'].ric_parola.value = DSparola;
		document.forms['frmRicercaBis'].ric_nome_azienda.value = DSnomeAzienda;
		document.forms['frmRicercaBis'].ric_dove.value = DSluogo;
		document.forms['frmRicercaBis'].ric_immagine.value = DSimmagine;
		document.forms['frmRicercaBis'].ric_dataInsMin.value = DTinsMin;
		document.forms['frmRicercaBis'].submit();
	}
	function pagina(num_pag)
	{
		document.forms['frmPagina'].pagina.value=num_pag;
		postBack('frmPagina');
	}
	function fn_elementi_pagina(idTendina)
	{		
		document.forms['frmPagina'].pagina.value = '1';
		document.forms['frmPagina'].nn_el_pagina.value = document.getElementById(idTendina).value;
		postBack('frmPagina');
	}
	function fn_ordina_per(idTendina)
	{
		document.forms['frmPagina'].ordina_per.value = document.getElementById(idTendina).value;
		postBack('frmPagina');
	}
	function mostra_nascondi(idContenitore)
	{
		var controllo = document.getElementById(idContenitore);
		if (controllo.style.display == 'none')
		{
			controllo.style.display = 'inline';
		}
		else
		{
			controllo.style.display = 'none';
		}
	}
	function dettaglio_prodotto(idprodotto)
	{
		document.forms['frmPagina'].action = 'dettaglio_prodotto.asp?idprodotto='+idprodotto;
		document.forms['frmPagina'].submit();
	}
	function dettaglio_azienda(cdazienda)
	{
		document.forms['frmPagina'].action = 'dettaglio_azienda.asp?cdazienda='+cdazienda;
		document.forms['frmPagina'].submit();
	}
	function preventivo_prodotto(idprod)
	{
		document.forms['frmPagina'].action = "preventivo_dettaglio_prodotto.asp?prev_prod=" + idprod;
		document.forms['frmPagina'].submit();
	}
	function ritorna_a_elenco()	{
		var pg_elenco = '<%= rap(request("pg_elenco")) %>';
		document.forms['frmPagina'].action = 'prodotti.asp';
		if (pg_elenco != '')
		{
			document.forms['frmPagina'].action = pg_elenco;
		}
		document.forms['frmPagina'].submit();
	}
	function uploadImg(imgf,imgd,imgrp,maxDim,displayW,displayH)
	{
		var pars = 'imgf='+imgf+'&imgd='+imgd+'&imgrp='+imgrp+'&maxDim='+maxDim;
		var obj = showModalDialog('/sito/oi_expoclima/_frames/frm_immagini.asp?'+pars,'Upload Immagini',"dialogWidth:600px;dialogHeight:400px;status:no;help:no");
		document.getElementById(imgf).value = obj.desc;
		var width = parseInt(obj.width);
		var height = parseInt(obj.height);
		var rW = width / displayW;
		var rH = height / displayH;
		var ratio = width / height;
		if (Math.max(rW,rH)==rW)
		{
			width = Math.min(width,displayW);
			height = Math.round(width / ratio);
		}
		else
		{
			height = Math.min(height,displayH);
			width = Math.round(height * ratio);
		}
		var imagePath = '/personali/oi_expoclima/_sistema/img_redim.asp?img=' + obj.path + '&width=' + width + '&height=' + height + '&quality=100';
		document.getElementById('img_'+imgf).src = imagePath;
		document.getElementById('img_'+imgf).hspace = Math.round((displayW - width)/2);
		document.getElementById('img_'+imgf).vspace = Math.round((displayH - height)/2);
		document.getElementById('img_'+imgf).width = width;
		document.getElementById('img_'+imgf).height = height;
	}
	function delImg(imgrp,imgf,imgW,imgH)
	{
		var noImgName = imgrp +'immagine_not_found.gif';
		var fullPath = '/personali/oi_expoclima/_sistema/img_redim.asp?img=' + noImgName + '&width=' + imgW + '&height=' + imgH + '&quality=100';
		document.getElementById('img_'+imgf).src = fullPath;
		document.getElementById('img_'+imgf).hspace = 0;
		document.getElementById('img_'+imgf).vspace = 0;
		document.getElementById(imgf).value = '';
	}
	// Serializza i campi modificabili in una variabile con separatore ed esegue il submit della form
	function updField(wh,kf,kv,updF,updHtmlF,HTMLEditorIndex)
	{
		if(''+HTMLEditorIndex=='undefined')
		{
			HTMLEditorIndex = -1;
		}
		if (updHtmlF.indexOf(',')>0)
		{
			updHtmlF = updHtmlF.split(',');
		}
		else
		{
			updHtmlF = Array(updHtmlF);
		}
		var k;
		var filedValore = '';
		var filed_sep = '';
		for (k in updHtmlF)
		{
			if (k != HTMLEditorIndex)
			{	
				filedValore = filedValore + filed_sep + document.getElementById(updHtmlF[k]).value;
			}
			else
			{
				//filedValore = filedValore + filed_sep + FCKeditorAPI.GetInstance(updHtmlF[k]).GetHTML(true);
				filedValore = filedValore + filed_sep + tinyMCE.get(updHtmlF[k]).getContent();
			}
			filed_sep = 'Ã?Â§Ã?Â§';
		}
		document.getElementById('valore').value = filedValore;
		document.getElementById('fld').value = updF;
		document.getElementById('kf').value = kf;
		document.getElementById('wh').value = wh;
		document.getElementById('kv').value = kv;
		document.forms['frmUpdFld'].submit();
	}
	function delField(wh,kf,kv,updF)
	{
		var updHtmlF
		if (updF.indexOf(',')>0)
		{
			updHtmlF = updF.split(',');
		}
		else
		{
			updHtmlF = Array(updF);
		}
		var k;
		var filedValore = '';
		var filed_sep = '';
		for (k in updHtmlF)
		{
			filedValore = filedValore + filed_sep + '';
			filed_sep = ','
		}
		document.getElementById('valore').value = filedValore;
		document.getElementById('fld').value = updF;
		document.getElementById('kf').value = kf;
		document.getElementById('wh').value = wh;
		document.getElementById('kv').value = kv;
		document.forms['frmUpdFld'].submit();
	}
	function modCont(tc,nrc,pagDest,fldConst,valConst,parAdds)
	{
		var pars = 'tipoContenuto='+tc+'&NRcontatore='+nrc;
		if (''+fldConst != 'undefined' && ''+valConst != 'undefined')
		{
			pars = pars + '&fldConst=' + fldConst;
			pars = pars + '&valConst=' + valConst;
		}
		if (''+parAdds != 'undefined')
		{
			pars = pars + '&' + parAdds;
		}
		//var obj = window.showModalDialog('/sito/oi_expoclima/_frames/frm_contenuti.asp?'+pars,'Gestione Contenuto',"dialogWidth:600px;dialogHeight:400px;status:no;help:no");
		var obj = window.open("/sito/oi_expoclima/_frames/frm_contenuti.asp?"+pars,'GestioneContenuto', "width=600,height=400,status=no,help=no");
		location.href = pagDest;
	}
	function delCont(tc,nrc,pagDest,fldConst,valConst)
	{
		var pars = 'op=del&tipoContenuto='+tc+'&NRcontatore='+nrc;
		if (''+fldConst != 'undefined' && ''+valConst != 'undefined')
		{
			pars = pars + '&fldConst=' + fldConst;
			pars = pars + '&valConst=' + valConst;
		}
		//var obj = showModalDialog('/sito/oi_expoclima/_frames/frm_contenuti.asp?'+pars,'Gestione Contenuto',"dialogWidth:450px;dialogHeight:300px;status:no;help:no");
		var obj = window.open("/sito/oi_expoclima/_frames/frm_contenuti.asp?"+pars,'GestioneContenuto', "width=450,height=300,status=no,help=no");
		location.href = pagDest;
	}
	function statoCont(tc,nrc,pagDest)
	{
		var pars = 'tipoContenuto='+tc+'&kv='+nrc;
		var obj = showModalDialog('/sito/oi_expoclima/_frames/frm_stato_cont.asp?'+pars,'Gestione Stato',"dialogWidth:450px;dialogHeight:300px;status:no;help:no");
		location.href = pagDest;
	}
	function openWin(pathPag,nWidth,nHeight,bolCheck,pagDest)
	{
		var obj = showModalDialog(pathPag,'Expoclima',"dialogWidth:"+nWidth+"px;dialogHeight:"+nHeight+"px;status:no;help:no");
		if (!(bolCheck && ''+obj == 'undefined'))
		{
			location.href = pagDest;
		}
	}
	function setInGoldList(cdTipoCont,nrCont,cdCont)
	{
		document.getElementById('tipoCont').value = cdTipoCont;
		document.getElementById('nrCont').value = nrCont;
		document.getElementById('cdCont').value = cdCont;
		document.forms['frmGoldList'].submit();
	}
	function messaggio(cdDest,nrConv,nrPadre,dsOgg)
	{
		var pars = 'dest='+cdDest;
		if (''+nrConv != 'undefined')
		{
			pars = pars + '&conv=' + nrConv;
		}
		if (''+nrPadre != 'undefined')
		{
			pars = pars + '&padre=' + nrPadre;
		}
		if (''+dsOgg != 'undefined')
		{
			pars = pars + '&ogg=' + dsOgg;
		}
		var obj = showModalDialog('/sito/oi_expoclima/_frames/frm_messaggi.asp?'+pars,'Expoclima',"dialogWidth:600px;dialogHeight:500px;status:no;help:no");
	}
	function rispostaRichOfferta(cdDest,nrMsg,nrPadre,dsOgg)
	{
		var pars = 'dest='+cdDest;
		if (''+nrMsg != 'undefined')
		{
			pars = pars + '&conv=' + nrMsg;
		}
		if (''+nrPadre != 'undefined')
		{
			pars = pars + '&padre=' + nrPadre;
		}
		if (''+dsOgg != 'undefined')
		{
			pars = pars + '&ogg=' + dsOgg;
		}
		var obj = showModalDialog('/sito/oi_expoclima/_frames/frm_messaggi.asp?ty=ricOff&'+pars,'Expoclima',"dialogWidth:600px;dialogHeight:500px;status:no;help:no");
	}
	
	function invia_ricerca() {
	if(document.getElementById('txt_ricerca').value != 'Cerca su Expoclima'){
		document.forms['frmRicerca'].submit();
		}
	}
	
	function call_elenco(pag) {
		document.forms['frmRicerca'].action=pag;
		document.forms['frmRicerca'].submit();
	}
	
	function openSegnala (tipo, nome, urlf) { 
    	//var a=showModalDialog('segnala.asp?TP='+tipo+'&ID='+nome+'&urlf='+urlf,"","dialogWidth:510px;dialogHeight:600px;status:no;help:no;scroll:yes");
		window.open('segnala.asp?TP='+tipo+'&ID='+nome+'&urlf='+urlf,"","width=580px,height=600px,status=no,help=no,scroll=yes")
	} 
	
	// ---
	var arrFieldName = new Array("nomef", "cognomef", "indirizzof", "provinciaf", "capf", "comunef", "telefonof", "emailf", "testo_richiesta")
	var arrFieldDsc = new Array("nome", "cognome", "indirizzo", "provincia", "cap", "comune", "telefono", "email", "testo richiesta")

	function ControllaForm_contatto() {
		var check = true;
		for (i = 0; i <= arrFieldName.length-1 && check; i++) {
			nome = arrFieldName[i];
			dsc = arrFieldDsc[i];
			alert ( nome + " " + dsc );
			if (document.getElementById(nome).value == "" ) {
				alert("Il campo \'" + dsc + "\' Ã¨ obbligatorio!");
				check = false;
			}
		}
		if (document.forms['form_ric_info'].aziendaf != undefined) {
			//alert ("ok");
			if (document.forms['form_ric_info'].tipof[0].checked) {
				if (document.forms['form_ric_info'].aziendaf.value == '') {
					alert("Il campo \'azienda\' Ã¨ obbligatorio!");
					check = false;
				}
			}
		} 
		if (check) {
			document.forms["form_ric_info"].action = "invia_messaggio.asp";
	    	document.forms["form_ric_info"].submit();
			//alert("ok");
		}
	}
	
	function ControllaForm_agenda() {
		var check = true;
		for (i = 0; i <= arrFieldName.length-1 && check; i++) {
			nome = arrFieldName[i];
			dsc = arrFieldDsc[i];
			//alert ( nome + " " + dsc );
			if (document.getElementById(nome).value == "" ) {
				alert("Il campo \'" + dsc + "\' Ã¨ obbligatorio!");
				check = false;
			}
		}
		if (document.forms['agenda_progettista'].aziendaf != undefined) {
			if (document.forms['agenda_progettista'].tipof[0].checked) {
				if (document.forms['agenda_progettista'].aziendaf.value == '') {
					alert("Il campo \'azienda\' Ã¨ obbligatorio!");
					check = false;
				}
			}
		}
		if (check) {
			document.forms["agenda_progettista"].action = "agendaProgettista_ok.asp";
	    	document.forms["agenda_progettista"].submit(); 
		}
	}
	
	function ControllaForm_mailist() {
		var check = true;
		for (i = 0; i <= arrFieldName.length-1 && check; i++) {
			nome = arrFieldName[i];
			dsc = arrFieldDsc[i];
			//alert ( nome + " " + dsc );
			if (document.getElementById(nome).value == "" ) {
				alert("Il campo \'" + dsc + "\' Ã¨ obbligatorio!");
				check = false;
			}
		}
		if (document.forms['iscrizione_newsletter'].aziendaf != undefined) {
			if (document.forms['iscrizione_newsletter'].tipof[0].checked) {
				if (document.forms['iscrizione_newsletter'].aziendaf.value == '') {
					alert("Il campo \'azienda\' Ã¨ obbligatorio!");
					check = false;
				}
			}
		}
		if (check) {
			document.forms["iscrizione_newsletter"].action = "iscrizioneNewsletter_ok.asp";
	    	document.forms["iscrizione_newsletter"].submit(); 
		}
	}
	
	// ---

	function switch_cat_set(quale) {
		if (quale == 'set') {
			document.getElementById('categoriaf').style.display = 'none';
			document.getElementById('aziendaf').style.display = 'none';
			document.getElementById('aziendaf').value = '';
			document.getElementById('cat_label').style.display = 'none';
			document.getElementById('settoref').style.display = '';
		} else {
			document.getElementById('categoriaf').style.display = '';
			document.getElementById('aziendaf').style.display = '';
			document.getElementById('cat_label').style.display = '';
			document.getElementById('settoref').style.display = 'none';
		}
	}
	
	function cambia_lingua() {
/*		if(document.getElementById("scelta_lingua").value == "ita")
			location.href = "http://expoclima.net";
		else
			location.href = "http://expoclima.co.uk";*/
		switch(document.getElementById("scelta_lingua").value){
		case "ita":
			location.href = "http://expoclima.net";
			break;
		case "eng":
			location.href = "http://expoclima.co.uk";
			break;
		case "esp":
			location.href = "http://expoclima.es";
			break;
		}
	}
	
	// -->
