function deleteWin(winName){
    // serve a sovrascrivere una scheda eventualmente aperta precedentemente
    openedWin = window.open('',winName);
    openedWin.blur();
    openedWin.close();

}
//------------
function openWin(url,type,larghezza,altezza){

   winName = type;

  	features = "menubar=0,scrollbars=1,width="+larghezza+",height="+altezza;

	deleteWin(winName);

	aperta = window.open(url,winName,features);
	window.aperta.focus();
}


function onChangeContinente(obj)
{
	var url = document.location.href ;

	var str = new String(url);
	var index = str.indexOf("&idSel");

	if (index != -1){
		var substr = str.substr(0,index);
		var newUrl = substr + "&idSel=" + obj.value ;
	}else{
		var newUrl = url + "&idSel=" + obj.value ;
	}

	document.location = newUrl;
}


function onChangeProduct(obj)
{
	var url = document.location.href ;

	var str = new String(url);
	var index = str.indexOf("&idSel");

	if (index != -1){
		var substr = str.substr(0,index);
		var newUrl = substr + "&idSel=" + obj.value ;
	}else{
		var newUrl = url + "&idSel=" + obj.value ;
	}

	document.location = newUrl;

}

function onSelDealer()
{
	var url = document.location.href ;

	if(document.form_contact.nome.value == ""){
		var text = translate(p_lang, "noData");
		alert(text);
	}else if (document.form_contact.cognome.value == ""){
		var text = translate(p_lang, "noData");
		alert(text);
	}else{
		// INVIO
	}

}


function onSendMail(p_lang)
{
	var url = document.location.href ;

	if(document.form_contact.nome.value == ""){
		var text = translate(p_lang, "noData");
		alert(text);
	}else if (document.form_contact.cognome.value == ""){
		var text = translate(p_lang, "noData");
		alert(text);
	}else if (document.form_contact.email.value == ""){
		var text = translate(p_lang, "noData");
		alert(text);
	}else if (document.form_contact.messaggio.value == ""){
		var text = translate(p_lang, "noData");
		alert(text);
	}else{
		// --- INVIO ---

		document.form_contact.send.value ="sending";
		document.form_contact.action = document.location.href
		document.form_contact.submit()

	}

}



function onCheckConsenso(p_obj)
{
	document.form_contact.add.disabled = (p_obj.checked ==true) ? false : true;
}

function onConfermBtn()
{
	window.location = document.location.href
}

function translate(p_lang, p_value){
	var arrData = new Array();

	if(p_lang == "ita"){
		arrData["noData"] = "Devi inserire i campi obbligatori";
	}else{
		arrData["noData"] = "No data";
	}

	return arrData[p_value];
}


function onSendMail2(p_lang)
{
	var url = document.location.href ;

	if(document.form_contact.nome.value == ""){
		var text = translate(p_lang, "noData");
		alert(text);
	}else if (document.form_contact.cognome.value == ""){
		var text = translate(p_lang, "noData");
		alert(text);
	}else if (document.form_contact.email.value == ""){
		var text = translate(p_lang, "noData");
		alert(text);
	}else if (document.form_contact.address.value == ""){
		var text = translate(p_lang, "noData");
		alert(text);
	}else if (document.form_contact.date.value == ""){
		var text = translate(p_lang, "noData");
		alert(text);
	}else if (document.form_contact.tel.value == ""){
		var text = translate(p_lang, "noData");
		alert(text);
	}else if (document.form_contact.state.value == ""){
		var text = translate(p_lang, "noData");
		alert(text);
	}else if (document.form_contact.experience.value == ""){
		var text = translate(p_lang, "noData");
		alert(text);
	}else{
		// --- INVIO ---

		document.form_contact.send.value ="sending";
		document.form_contact.action = document.location.href
		document.form_contact.submit()

	}

}

