function up(id){
	document.getElementById(id).style.backgroundImage="url(images/menu_arrow5.gif)";
	document.getElementById(id).style.color="#00FF00";
}
function down(id){
	document.getElementById(id).style.backgroundImage="";
	document.getElementById(id).style.color="";
}
function start_desc(id){
	var d = document.getElementById('start-desc-cont');
	switch(id){
		case 'audio':
			d.innerHTML = '<strong>AUDIO</strong>';
			break;
		case 'ipod':
			d.innerHTML = '<strong>INTERFACCE IPOD</strong>';
			break;
		case 'tuning':
			d.innerHTML = '<strong>ACCESSORI TUNING</strong>';
			break;
		case 'vivavoce':
			d.innerHTML = '<strong>KIT VIVAVOCE</strong>';
			break;
		case 'illuminazione':
			d.innerHTML = '<strong>ILLUMINAZIONE</strong>';
			break;
		case 'elettrici':
			d.innerHTML = '<strong>ACCESSORI ELETTRICI</strong>';
			break;
		case 'navigatori':
			d.innerHTML = '<strong>NAVIGATORI PORTATILI</strong>';
			break;
	}
	//opacity(0,'start-desc-cont');
}
function start_undesc(){
	document.getElementById('start-desc-cont').innerHTML = "";
}
function opacity(n,id){
	
	clearTimeout(a);
	
	if(n == null)
		var n = 0;
		
	if(n < 5){
		n++;
		document.getElementById(id).style.filter = 'alpha(opacity=' + n * 20 + ')';
		document.getElementById(id).style.opacity = n / 5 ;
		var a = setTimeout('opacity(' + n + ',"' + id + '")',100);
	}
}
function mostra(id){
	document.getElementById(id).style.display = 'block';
}
function nascondi(id){
	document.getElementById(id).style.display = 'none';
}
function submenu(id){
	void(d=document);
	void(el=d.getElementsByTagName('DIV'));
	for(i=0;i<el.length;i++){
		if(el[i].id.substr(0,4) == 'sub_')
			void(el[i].style.display='none');
	}
	mostra(id);
}

function vediimg(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=450,left = 237,top = 159');");
}
function privacy(){
	if(document.getElementById('accetto').checked)
		document.getElementById('pulsone').disabled="";
	else
		document.getElementById('pulsone').disabled = "disabled";
}

function controlla(){
	if(document.getElementById('nome').value == '' || document.getElementById('cognome').value == '' || document.getElementById('eta').value == '' || document.getElementById('citta').value == '' || document.getElementById('provincia').value == '' || document.getElementById('prefcell').value == '' || document.getElementById('numcell').value == '' || document.getElementById('mail').value == ''){
		alert("Compilare tutti i campi!");
		return false;
	}else{
		post('sms_iscriviti.php','form1');	
	}
}
function getOffsetTop(elm) {
	var mOffsetTop = elm.offsetTop;
	var mOffsetParent = elm.offsetParent;
	var parents_up = 2; //the positioning div is 2 elements up the tree
	var contheight = 0;
	while(parents_up > 0) {
		mOffsetTop += mOffsetParent.offsetTop;
		mOffsetParent = mOffsetParent.offsetParent;
		parents_up--;
	}
	var fromtop = mOffsetTop;
	return fromtop;
}
function preventivo(id){
	var y = getOffsetTop(document.getElementById('p' + id));

	if (navigator.appName == "Microsoft Internet Explorer")
		y = y + 110;
	else
		y = y - 10;

	document.getElementById('preventivo').style.top = y + 'px';
	post('preventivo.php?id=' + id,'','preventivo');
	mostra('preventivo');
}

