function getE(id) {
	return document.getElementById(id);
}

/*
	Inserisce dinamicamente un filmato Flash.
	Per scavalcare il blocco di IE 6, che altrimenti ne richiede l'attivazione manuale.
*/
function print_flash_movie(nomefile, width, height, version) {
	var str;
	
	str = ('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + version + '" WIDTH="' + width + '" HEIGHT="' + height + '">');
	str = str + ('<PARAM NAME=movie VALUE="' + nomefile + '">');
	str = str + ('<PARAM NAME=quality VALUE=high>');
	str = str + ('<embed src="' + nomefile + '" quality=high ');
	str = str + ('swLiveConnect="FALSE" WIDTH="' + width + '" HEIGHT="' + height + '" border="0" TYPE="application/x-shockwave-flash"');
	str = str + ('PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></embed></OBJECT>');
	
	document.write(str);
}

/*
Controllo della validita' di un indirizzo e-mail.
Versione 2

Utilizzo: checkemail(document.userForm.u_email.value);

Puo', ad esempio, essere inserito nella funzione submitRecord() in questo modo:
	if (checkemail(document.my_form_name.email_field.value)==false) {
		alert("Attenzione: e' necessario inserire un indirizzo e-mail valido.")
		return;
	}
*/
var testresults;
function checkemail(email_addr) {
	var filter=/^[\'+\\./0-9A-Z^_\`a-z{|}~\-]+@[a-zA-Z0-9_\-]+(\.[a-zA-Z0-9_\-]+){1,3}$/i;
	if (filter.test(email_addr)) {
		testresults = true;
	}
	else {
		testresults = false;
	}
	
	return(testresults);
}

// Podda istituzionale - Pagina dei prodotti: fa lo switch tra i classici ed i freschi nella pagina con listing in Flash
function product_switch(type) {
	if (type=='freschi') {
		getE('img_freschi').style.display = '';
		getE('menu_freschi').style.display = '';
		getE('link_freschi_on').style.display = '';
		getE('link_classici_off').style.display = '';
		getE('link_freschi_off').style.display = 'none';
		getE('link_classici_on').style.display = 'none';
		getE('img_classici').style.display = 'none';
		getE('menu_classici').style.display = 'none';
	}
	else {
		getE('img_freschi').style.display = 'none';
		getE('menu_freschi').style.display = 'none';
		getE('img_classici').style.display = '';
		getE('menu_classici').style.display = '';
		getE('link_freschi_off').style.display = '';
		getE('link_classici_on').style.display = '';
		getE('link_freschi_on').style.display = 'none';
		getE('link_classici_off').style.display = 'none';
	}
}

// inclusioni delle scrollbars jScrollPane
function inc_jscrollpane__istituzionale() {
	var contentjscroller;
	var contentdiv = document.getElementById('box_htmlarea');
	if (contentdiv) {
		contentjscroller = document.createElement('div');
		contentjscroller.id = 'box_htmlareajscroll';
		contentjscroller.className = 'box_htmlareajscroll';
		contentjscroller.innerHTML = contentdiv.innerHTML + '<br />&nbsp;<div class="clear"></div>';
		contentdiv.innerHTML = '';
		contentdiv.appendChild(contentjscroller);
	
		$(function()
		{
			$('#box_htmlareajscroll').jScrollPane({scrollbarWidth:12,showArrows:true});
		});
	
	}
}

function inc_jscrollpane__prodotto() {
	var contentjscroller;
	var contentdiv = document.getElementById('descrizione_prodotto');
	if (contentdiv) {
		contentjscroller = document.createElement('div');
		contentjscroller.id = 'descrizione_prodottojscroll';
		contentjscroller.className = 'descrizione_prodottojscroll';
		contentjscroller.innerHTML = contentdiv.innerHTML + '<br />&nbsp;<div class="clear"></div>';
		contentdiv.innerHTML = '';
		contentdiv.style.textAlign = 'left';
		contentdiv.appendChild(contentjscroller);
	
		$(function()
		{
			$('#descrizione_prodottojscroll').jScrollPane({scrollbarWidth:12,showArrows:true});
		});
	
	}
}

function inc_jscrollpane__contatti() {
	var contentjscroller;
	var contentdiv = document.getElementById('box_contatti');
	if (contentdiv) {
		contentjscroller = document.createElement('div');
		contentjscroller.id = 'box_contattijscroll';
		contentjscroller.className = 'box_contattijscroll';
		contentjscroller.innerHTML = contentdiv.innerHTML + '<br />&nbsp;<div class="clear"></div>';
		contentdiv.innerHTML = '';
		contentdiv.appendChild(contentjscroller);
	
		$(function()
		{
			$('#box_contattijscroll').jScrollPane({scrollbarWidth:12,showArrows:true});
		});
	
	}
}

mw=null;
function openWindowDimBars(FileName,w,h,barre) {
	myWindow=window.open(FileName,'','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars='+barre+',resizable=0,top=10,left=10,width='+w+',height='+h);
	return myWindow;
}