/* JavaScript for include in head section */

var iTimer;
var h=0;
var type;
var e='end';


function _slide(type) {
	if (e=='') window.clearInterval(iTimer);
	tmp = type;
	iTimer=setInterval("_effect(tmp)",5);
}


function _effect(t) {
	if (t=='on') {
		// La tendina si apre (The curtain opens)
		h=h+10
		if (h<70 && h>-1) {
			document.getElementById('table').style.height=h;
			document.getElementById('text').style.display='none';
			document.getElementById('count').value=h
			e='';
		} else {
			if (h==70) document.getElementById('text').style.display='block';
			window.clearInterval(iTimer);
			e = 'end';
		}
		
	} else {
		// La tendina si chiude (The curtain closes)
		h=h-10
		if (h>-10 && h<70) {
			document.getElementById('table').style.height=h;
			document.getElementById('text').style.display='none';
			document.getElementById('count').value=h
			e='';
		} else {
			window.clearInterval(iTimer);
			e = 'end';
		}
	}
}


function _border() {
	if (window.screen.Availheight=='600') {
		document.body.leftMargin='2px'; 	
	}
}


function _open_menu(n,t,l) {
	tmp=document.getElementById(''+n)
	tmp.style.display='block';
	tmp.style.top=t;
	tmp.style.left=l;
}


function _validation() {
	if (document.getElementById('tmp_user').value=='') {
		alert('Il campo USER ID è obligatorio.');
		document.login.tmp_user.focus();
		return (false);
	}

	if (document.getElementById('tmp_pass').value=='') {
		alert('Il campo PASSWORD è obbligatotio');
		document.login.tmp_pass.focus();
		return (false);
	}
	
	login.submit();
}


function _checkfield() {
	var regexp=/^[A-Za-z0-9_.-]+@[A-Za-z0-9_.-]+[.][A-Za-z]{2,6}$/;
	var PATPHONE=/^[0-9]{8,9}/;
	
	if (document.getElementById('an_marca').value=='') {
		alert('The field BRAND is required.');
		document.form.an_marca.focus();
		return (false);
	}
	
	if (document.getElementById('an_modello').value=='') {
		alert('The field MODEL is required.');
		document.form.an_modello.focus();
		return (false);
	}
	
	if (document.getElementById('an_nome').value=='') {
		alert('The field NAME is required.');
		document.form.an_nome.focus();
		return (false);
	}
	
	if (document.getElementById('an_nome').value.length<3) {
		alert('Type at least 3 characters in the field NAME.');
		document.form.an_nome.focus();
		return (false);
	}
	
	if (document.getElementById('an_cognome').value=='') {
		alert('The field SURNAME is required.');
		document.form.an_cognome.focus();
		return (false);
	}
	
	if (form.an_email.value.length==0) {
		alert('The field EMAIL is mandatory');
		document.form.an_email.focus();
		return (false);
	}
	
	if (regexp.test(form.an_email.value)==false) {
		alert('Incorrect characters in the field EMAIL');
		document.form.an_email.focus();
		return (false);
	}
	
	
	if (document.form.an_telefono.value.length==0) {
		alert('The field TELEPHONE is mandatory');
		document.form.an_telefono.focus();
		return (false);
  	}
	
	if (PATPHONE.test(document.form.an_telefono.value)==false) {
		alert('Incorrect characters in the field TELEPHONE');
		document.form.an_telefono.focus();
		return (false);
	}	
	
	return (true);
}


var r=0;
var v1=0;


function _detail(v) {
	v1 = v
	iTimer=setInterval("_help(v1)", 5);
}


function _close_help() {
	r=0;
	window.clearInterval(iTimer);
	document.getElementById('div_detail').style.display='none';
	document.getElementById('div_iframe').style.display='none';
}