if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
		if(el.style.display != "block"){ //DynamicDrive.com change
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu") //DynamicDrive.com change
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}

function SwitchNoteOn(){
	if(document.getElementById)
	{
		var ar = document.getElementById("masterdiv").getElementsByTagName("span");
		for (var i=0; i<ar.length; i++)
		{
			if (ar[i].className=="submenu")
				ar[i].style.display = "block";
		}
	}
}

function SwitchNoteOff(){
	if(document.getElementById)
	{
		var ar = document.getElementById("masterdiv").getElementsByTagName("span");
		for (var i=0; i<ar.length; i++)
		{
			if (ar[i].className=="submenu")
				ar[i].style.display = "none";
		}
	}
}

function MM_preloadImages()
{ //v3.0
  var d=document; if(d.images)
  { 
	if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0) {
			d.MM_p[j]=new Image;
			d.MM_p[j++].src=a[i];
		}
	}
}

function showPic (whichpic) { 
	if (document.getElementById) { 
		document.getElementById('placeholder').src = whichpic.href; 
		if (whichpic.title) { 
			document.getElementById('desc').childNodes[0].nodeValue = whichpic.title; 
		} else { 
			document.getElementById('desc').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue; 
		} 
		return false; 
	} else { 
		return true; 
	} 
}

function show(id)
{
	document.getElementById(id).style.visibility = "visible";
	document.getElementById(id).style.display = "block";
}

function hide(id)
{
	document.getElementById(id).style.visibility = "hidden";
	document.getElementById(id).style.display = "none";
}
//cart2.asp
function ConfermaRimozione(str,lang)
{
	if (lang == 'ita') { msg = "Rimuovere l'articolo dal carrello?" }
	if (lang == 'eng') { msg = "Do you want to remove the article from the cart?" }
	if (confirm(msg) == true) {
		window.location = 'cart2.asp?elimina='+str;
	}
}
//cart2.asp
function ConfermaPrenotazione(lang)
{
	if (lang == 'ita') { msg = "Confermi la prenotazione?" }
	if (lang == 'eng') { msg = "Do you confirm the revervation?" }
	if (confirm(msg) == true) {
		window.location = 'prenota.asp';
	}
}
//cart2.asp
function ConfermaFermo(lang)
{
	if (lang == 'ita') { msg = "Confermi l'acquisto?" }
	if (lang == 'eng') { msg = "Do you confirm the purchase?" }
	if (confirm(msg) == true) {
		window.location = 'insert_fermo.asp';
	}
}
//dettaglio_disco.asp/dettaglio_disco_pop.asp/dettaglio_equip.asp
function ConfermaCommento(lang)
{
	if ((document.formCommento.commento.value == "" ) || (document.formCommento.commento.value == "scrivi un commento personale sull'articolo..." ) || (document.formCommento.commento.value == "leave a personal comment about this article..." )) {
		if (lang == 'ita') {
			alert("inserire il commento"); }
		else {
			alert("insert the comment"); }
	}
	else
	{
		document.formCommento.submit(); 
	}
}
//dettaglio_disco.asp/dettaglio_disco_pop.asp/dettaglio_equip.asp
function ConfermaAmico(lang)
{
	var msg = ""
	var ok;
	ok = true;
		
	if (document.formAmico.nome.value == ""){
		ok = false;
		if (lang == 'ita') {
			msg = msg + "nome obbligatorio\n"; }
		else {
			msg = msg + "name required\n"; }
	}
	if (document.formAmico.mail.value == "" || document.formAmico.mail.value.indexOf('@',0)== -1){
		ok = false;
		if (lang == 'ita') {
			msg = msg + "email non valida\n"; }
		else {
			msg = msg + "not valid email\n"; }
	}
	if (document.formAmico.mailr.value == "" || document.formAmico.mailr.value.indexOf('@',0)== -1){
		ok = false;
		if (lang == 'ita') {
			msg = msg + "email ricevente non valida\n"; }
		else {
			msg = msg + "recipient's email not valid\n"; }
	}
			
	if (ok) {
		document.formAmico.submit(); 
	}
	else  {
		alert(msg);	
	}
}
//feedback.asp
function ControlFormFeedback(lang)
{
	var msg = ""
	var ok;
	ok = true;
	
	if (trim(document.form_feedback.nome.value) == ""){
		ok = false;
		if (lang == 'ita') {
			msg = msg + "nome obbligatorio\n"; }
		else {
			msg = msg + "name required\n"; }
	}
	if (trim(document.form_feedback.mail.value) == "" || document.form_feedback.mail.value.indexOf('@',0)== -1){
		ok = false;
		if (lang == 'ita') {
			msg = msg + "e-mail non valida\n"; }
		else {
			msg = msg + "not valid e-mail\n"; }
	}
	if (trim(document.form_feedback.testo.value) == ""){
		ok = false;	
		if (lang == 'ita') {
			msg = msg + "inserire il feedback\n"; }
		else {
			msg = msg + "insert a feedback\n"; }
	}
	if (trim(document.form_feedback.captchacode.value) == ""){
		ok = false;	
		if (lang == 'ita') {
			msg = msg + "digitare il codice di sicurezza\n"; }
		else {
			msg = msg + "empty security code\n"; }
	}
	if (ok) {
		document.form_feedback.submit(); 
	}
	else  {
		alert(msg);	
	}
}

function trim(stringa)
{
	while (stringa.substring(0,1) == ' '){
	stringa = stringa.substring(1, stringa.length);
	}
	while (stringa.substring(stringa.length-1, stringa.length) == ' '){
	stringa = stringa.substring(0,stringa.length-1);
	}
	return stringa;
}

//addtorestock.asp
var good;
function checkEmailAddress(field,lng) {
	var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);

	if (goodEmail)
	{
	good = true
	}
	else
	{
		if (lng == 'ita') {
        alert('digitare correttamente gli indirizzi mail'); }
        if (lng == 'eng') {
        alert('insert valid and correct e-mail'); }
		field.focus()
		field.select()
		good = false
	}
}
function sendRes(lng){
   good = false
   checkEmailAddress(document.restock.mail,lng)
   if ((document.restock.mail.value ==
        document.restock.mailx.value)&&(good)){
      document.restock.submit(); 
   }     
   if ((document.restock.mail.value !=
          document.restock.mailx.value)&&(good)){
          if (lng == 'ita') {
          alert('digitare correttamente gli indirizzi mail'); }
          if (lng == 'eng') {
          alert('insert valid and correct e-mail'); }
   }
}
//buoni.asp
function ControlFormBuoni(lang)
{
	var msg 
	var ok;
	ok = true;
	msg = "";

	if (document.buono.importo.value == ""){
		ok = false;
		if (lang == 'ita') {
			msg = msg + "specificare un importo\n"; }
		else {
			msg = msg + "amount required\n"; }
	}
	if (ok) {
		document.buono.submit(); 
	}
	else  {
		alert(msg);	
	}
}
//buybanner.asp
function ControlFormBanner(lang)
{
	document.form_banner.submit(); 
}
function sel(id)
{
	elem = document.getElementById(id);
	elem.checked = true;
}	
//pa_pref.asp
function ChiediConferma(act)
{
    if(confirm("Confermi/Do you confirm?")==true)
    {
	    document.form_pref.act.value = act;
	    document.form_pref.submit();
    }
}
//pa_restock.asp
function ChiediConferma2(act)
{
    if(confirm("Confermi/Do you confirm?")==true)
    {
	    document.form_rest.act.value = act;
	    document.form_rest.submit();
    }
}
//pa_sms.asp
function ConfermaNumero(lang)
{
	if (lang == 'ita') { msg = "confermi il numero di cellulare?" }
	if (lang == 'eng') { msg = "do you confirm the mobile phone number?" }
	if (confirm(msg) == true) {
	document.form_num.submit();
	}
}
function ConfermaCodice(lang)
{
	if (lang == 'ita') { msg = "confermi il codice di attivazione?" }
	if (lang == 'eng') { msg = "do you confirm the activation code?" }
	if (confirm(msg) == true) {
	document.form_code.submit(); 
	}
}
function ConfermaDisattivazione(lang)
{
	if (lang == 'ita') { msg = "confermi la disattivazione del servizio?" }
	if (lang == 'eng') { msg = "do you want disable the service?" }
	if (confirm(msg) == true) {
	document.form_code.submit(); 
	}
}
//search.asp
function ControlFromSearch()
{
	//if (document.advsearch.keyword.value == "" )  {
		//
	//}else {
		document.advsearch.submit();
	//}
}
function showdate(valore_combo)
{
    switch (valore_combo)
    {
        case "*":
            document.advsearch.dal.disabled=false;
            document.advsearch.al.disabled=false;
            break;
        default:
            document.advsearch.dal.disabled=true;
            document.advsearch.al.disabled=true;
            break;
    }
}
//toptunes_ins.asp
function ControlFromTopTunes(lang)
{
	var msg 
	var ok;
	ok = true;
	msg = "";

	if (document.topten.Nome.value == ""){
		ok = false;
		if (lang == 'ita') {
			msg = msg + "nome obbligatorio\n"; }
		else {
			msg = msg + "name required\n"; }
	}
	if (document.topten.From.value == ""){
		ok = false;	
		if (lang == 'ita') {
			msg = msg + "club + ubicazione obbligatorio\n"; }
		else {
			msg = msg + "club required\n"; }
	}
	if (document.topten.email.value == "" || document.topten.email.value.indexOf('@',0)== -1){
		ok = false;
		if (lang == 'ita') {
			msg = msg + "e-mail non valida\n"; }
		else {
			msg = msg + "not valid e-mail\n"; }
	}
	if (ok) {
		document.topten.submit(); 
	}
	else  {
		alert(msg);	
	}
}

function checkFrameset(){
    if (!parent.frameplayercontent) {
        parent.window.location='index.asp?url='+document.URL;
    }
}