/* Javascript file */
function flash_add() {
 var n;
	switch (window.location.pathname) {
		case '/':
			n = "";
		break;
		case '/azienda.html':
			n = "1";
		break;
		case '/prodotti.html':
			n = "2";
		break;
		case '/servizi.html':
			n = "3";
		break;
		case '/galleria-auto.html':
			n = "4";
		break;
		case '/news.html':
			n = "5";
		break;
		default:
			n = (Math.floor(Math.random()*6)+1).toString();
	}
	so = new SWFObject("/swf/head" + n + ".swf", "swfhead", "900", "253", "8", "#000000");
	so.addParam("wmode", "transparent");
	so.write("header");
}
function decorations_add() {
	var obj_body = document.getElementsByTagName("body").item(0);
	
	var obj_decoration_header_bg = document.createElement("div");
	obj_decoration_header_bg.setAttribute('id','header-decoration-bg');
	obj_body.appendChild(obj_decoration_header_bg);
	
	var obj_decoration_header_handles = document.createElement("div");
	obj_decoration_header_handles.setAttribute('id','header-decoration-handles');
 	obj_body.appendChild(obj_decoration_header_handles);
	
	var obj_decoration_header_stripe = document.createElement("div");
	obj_decoration_header_stripe.setAttribute('id','header-decoration-stripe');
 	obj_body.appendChild(obj_decoration_header_stripe);

}
function page_init() {
	flash_add();
	decorations_add();
}
function prodotti_changebrand (brand_id) {
	if (brand_id != "nul") {
		brand = brand_id.split("|");
		window.location = "/prodotti_marca_" + brand[0] + "_" + brand[1] + ".html";
	};
}
function frmcheck(frm) {
	if (frm.nome.value.length == 0) { window.alert("Devi inserire il tuo nome"); frm.nome.focus(); return false; }
	if (frm.email.value.length == 0) { window.alert("Devi inserire la tua email"); frm.email.focus(); return false; }
	if (frm.message.value.length == 0) { window.alert("Scrivi il tuo messaggio nell'area di testo"); frm.message.focus(); return false; }
	var emailFilter=/^.+@.+\..{2,3}$/;if (!(emailFilter.test(frm.email.value))) { window.alert("Devi inserire un indirizzo email valido"); frm.email.focus(); return false; }
	return true;
}
var so;
Event.observe(window, 'load', page_init, false);