var popUpWin=0;
var aperta=0;

function popup()
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  
  var width = "400";
  var height = "400";
  var left = "100";
  var top = "50";
  if (document.getElementById('width') != null && document.getElementById('width').value != ""){
	  width = document.getElementById('width').value;
  }
  if (document.getElementById('height') != null && document.getElementById('height').value != ""){
	  height = document.getElementById('height').value;
  }
  if(document.getElementById('file')!= null && document.getElementById('file').value != "")
  {
  	
	popUpWin = open(document.getElementById('file').value, 'popup', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
  }
}

function finestra(testo1, testo2, focus_p, params) {
		 if(aperta) aperta.window.close();

		 var aperta = window.open("","popup_vuota",params);

		 if(focus_p) aperta.window.focus();

		 aperta.document.open();
		 
		 // Caratteri speciali: ' sostituito con \' o &#039;
		 var testoCompleto = "<html>";
		 testoCompleto = testoCompleto + "<head>";
		 testoCompleto = testoCompleto + "<link rel=\"stylesheet\" href=\"Resources/default_SNT Style Sheet 2 Look and feel 2.css\" />";
		 testoCompleto = testoCompleto + "</head>";
		 testoCompleto = testoCompleto + "<body bgcolor=\"#000000\"  leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">";	
		 testoCompleto = testoCompleto + "<center>";
		 testoCompleto = testoCompleto + "<table width=\"100%\" border=\"0\" height=\"100%\" cellpadding=\"2\" cellspacing=\"1\" align=\"center\" bgcolor=\"#000000\">";
		 testoCompleto = testoCompleto + "<tr bgcolor=\"#FFFFFF\">";
		 testoCompleto = testoCompleto + "<td align=\"center\" valign=\"middle\" height=\"20\">";
		 testoCompleto = testoCompleto + "<font class=\"title01\">";
		 testoCompleto = testoCompleto + "<b>Codice Prodotto:</b>";
		 testoCompleto = testoCompleto + "</font>";	
		 testoCompleto = testoCompleto + "<font color=\"#000000\">";
		 testoCompleto = testoCompleto + "<b>" + testo1+ "</b>";
		 testoCompleto = testoCompleto + "</font>";
		 testoCompleto = testoCompleto + "</td>";
	 	 testoCompleto = testoCompleto + "</tr>";		 
		 testoCompleto = testoCompleto + "<tr bgcolor=\"#FFFFF\">";
		 testoCompleto = testoCompleto + "<td align=\"center\" valign=\"top\">";
		 testoCompleto = testoCompleto + "<font class=\"attributePopup\"><br><br>";
		 testoCompleto = testoCompleto +  testo2;
		 testoCompleto = testoCompleto + "</font>"; 
		 testoCompleto = testoCompleto + "</td>";		 
	 	 testoCompleto = testoCompleto + "</tr>";			 	 
		 testoCompleto = testoCompleto + "<tr bgcolor=\"#FFFFFF\">";
		 testoCompleto = testoCompleto + "<td align=\"center\" valign=\"middle\" height=\"10\">";
		 testoCompleto = testoCompleto + "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">";
		 testoCompleto = testoCompleto + "<a href=\"#\" OnClick=\"window.close();\">Chiudi</a>";
		 testoCompleto = testoCompleto + "</font>";	 
		 testoCompleto = testoCompleto + "</td>";		 
	 	 testoCompleto = testoCompleto + "</tr>";				 		 
		 testoCompleto = testoCompleto + "</table>";	 
 		 testoCompleto = testoCompleto + "</center>";
		 testoCompleto = testoCompleto + "</body>"; 		 
		 testoCompleto = testoCompleto + "</html>";
		 
		 aperta.document.write(testoCompleto);
		 aperta.document.close();
		 return false;
}

function finestraFamiglia(testo1, testo2, testo3, focus_p, params) {
		 if(aperta) aperta.window.close();

		 		 if (testo3.length > 1000){
		 		 	params = "menubar=no,location=no,status=no,scrollbars=no,directories=no,toolbar=no,reasizeable=yes,width=750,height=650";
		 		 }else{
		 		 	params = "menubar=no,location=no,status=no,scrollbars=no,directories=no,toolbar=no,reasizeable=yes,width=650,height=450";
		 		 }

		 var aperta = window.open("","popup_vuota",params);

		 if(focus_p) aperta.window.focus();

		 aperta.document.open();
		 
		 // Caratteri speciali: ' sostituito con \' o &#039;
		 var testoCompleto = "<html>";
		 testoCompleto = testoCompleto + "<head>";
		 testoCompleto = testoCompleto + "<link rel=\"stylesheet\" href=\"Resources/default_SNT Style Sheet 2 Look and feel 2.css\" />";
		 testoCompleto = testoCompleto + "</head>";
		 testoCompleto = testoCompleto + "<body bgcolor=\"#000000\"  leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">";	
		 testoCompleto = testoCompleto + "<center>";
		 testoCompleto = testoCompleto + "<table width=\"100%\" border=\"0\" height=\"100%\" cellpadding=\"2\" cellspacing=\"1\" align=\"center\" bgcolor=\"#000000\">";
		 testoCompleto = testoCompleto + "<tr bgcolor=\"#FFFFFF\">";
		 testoCompleto = testoCompleto + "<td align=\"center\" valign=\"middle\" height=\"20\">";
		 testoCompleto = testoCompleto + "<font class=\"title01\">";
		 testoCompleto = testoCompleto + "<b>Codice Prodotto:</b>";
		 testoCompleto = testoCompleto + "</font>";	
		 testoCompleto = testoCompleto + "<font color=\"#000000\">";
		 testoCompleto = testoCompleto + "<b>" + testo1+ "</b>";
		 testoCompleto = testoCompleto + "</font>";
		 testoCompleto = testoCompleto + "</td>";
	 	 testoCompleto = testoCompleto + "</tr>";		 
		 testoCompleto = testoCompleto + "<tr bgcolor=\"#FFFFF\">";
		 testoCompleto = testoCompleto + "<td align=\"center\" valign=\"top\">";
		 testoCompleto = testoCompleto + "<font class=\"attributePopup\"><br><br>";
		 testoCompleto = testoCompleto +  testo2;
		 testoCompleto = testoCompleto + "</font>";
		 testoCompleto = testoCompleto + "<font class=\"attributePopup\"><br><br>";
		 testoCompleto = testoCompleto +  testo3;
		 testoCompleto = testoCompleto + "</font>"; 
		 testoCompleto = testoCompleto + "</td>";		 
	 	 testoCompleto = testoCompleto + "</tr>";			 	 
		 testoCompleto = testoCompleto + "<tr bgcolor=\"#FFFFFF\">";
		 testoCompleto = testoCompleto + "<td align=\"center\" valign=\"middle\" height=\"10\">";
		 testoCompleto = testoCompleto + "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">";
		 testoCompleto = testoCompleto + "<a href=\"#\" OnClick=\"window.close();\">Chiudi</a>";
		 testoCompleto = testoCompleto + "</font>";	 
		 testoCompleto = testoCompleto + "</td>";		 
	 	 testoCompleto = testoCompleto + "</tr>";				 		 
		 testoCompleto = testoCompleto + "</table>";	 
 		 testoCompleto = testoCompleto + "</center>";
		 testoCompleto = testoCompleto + "</body>"; 		 
		 testoCompleto = testoCompleto + "</html>";
		 
		 aperta.document.write(testoCompleto);
		 aperta.document.close();
		 return false;
}

function finestraCorsi(testo1, testo2, testo3, focus_p, params) {
		 if(aperta) aperta.window.close();

		 var aperta = window.open("","popup_vuota",params);

		 if(focus_p) aperta.window.focus();

		 aperta.document.open();
		 
		 // Caratteri speciali: ' sostituito con \' o &#039;
		 
		 var testoCompleto = "<html>";
		 testoCompleto = testoCompleto + "<head>";
		 testoCompleto = testoCompleto + "<link rel=\"stylesheet\" href=\"Resources/default_SNT Style Sheet 2 Look and feel 2.css\" />";
		 testoCompleto = testoCompleto + "</head>";
		 testoCompleto = testoCompleto + "<body bgcolor=\"#FFFFFF\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">";	
		 testoCompleto = testoCompleto + "<center>";
		 testoCompleto = testoCompleto + "<table width=\"100%\" border=\"0\" height=\"100%\" cellpadding=\"2\" cellspacing=\"1\" align=\"center\" bgcolor=\"#000000\">";
		 testoCompleto = testoCompleto + "<tr bgcolor=\"#FFFFFF\">";
		 testoCompleto = testoCompleto + "<td align=\"center\" valign=\"middle\" height=\"20\">";
		 testoCompleto = testoCompleto + "<font class=\"title01\">";
		 testoCompleto = testoCompleto + "<b>Sede:</b>";
		 testoCompleto = testoCompleto + "</font>";	
		 testoCompleto = testoCompleto + "<font color=\"#000000\">";
		 testoCompleto = testoCompleto + "<b>" + testo1+ "</b>";
		 testoCompleto = testoCompleto + "</font>";
		 testoCompleto = testoCompleto + "</td>";
	 	 testoCompleto = testoCompleto + "</tr>";		 
		 testoCompleto = testoCompleto + "<tr bgcolor=\"#FFFFFF\">";
		 testoCompleto = testoCompleto + "<td align=\"center\" valign=\"middle\">";
		 testoCompleto = testoCompleto + "<font class=\"attributePopup\"><br><br>";
		 testoCompleto = testoCompleto +  testo2;
		 testoCompleto = testoCompleto + "</font>"; 
		 testoCompleto = testoCompleto + "</td>";		 
	 	 testoCompleto = testoCompleto + "</tr>";
		 if (testo3 != null) {
		 	if (testo3 != "") {
				testoCompleto = testoCompleto + "<tr bgcolor=\"#FFFFFF\">";
				testoCompleto = testoCompleto + "<td align=\"center\" valign=\"middle\">";
				testoCompleto = testoCompleto + "<font class=\"attributePopup\">";
				testoCompleto = testoCompleto + "<a href=" + testo3 + " target=\"_blank\">Come Arrivare</a>";
				testoCompleto = testoCompleto + "</font>";
				testoCompleto = testoCompleto + "</td>";
				testoCompleto = testoCompleto + "</tr>";
			}
		 }	 	 
		 testoCompleto = testoCompleto + "<tr bgcolor=\"#FFFFFF\">";
		 testoCompleto = testoCompleto + "<td align=\"center\" valign=\"middle\" height=\"10\">";
		 testoCompleto = testoCompleto + "<font class=\"attributePopup\">";
		 testoCompleto = testoCompleto + "<a href=\"#\" OnClick=\"window.close();\">Chiudi</a>";
		 testoCompleto = testoCompleto + "</font>";	 
		 testoCompleto = testoCompleto + "</td>";		 
	 	 testoCompleto = testoCompleto + "</tr>";				 		 
		 testoCompleto = testoCompleto + "</table>";	 
 		 testoCompleto = testoCompleto + "</center>";
		 testoCompleto = testoCompleto + "</body>"; 		 
		 testoCompleto = testoCompleto + "</html>";
		 
		 aperta.document.write(testoCompleto);
		 aperta.document.close();
		 return false;
}

function finestraPromo(codice, prezzoDealer, prezzoPromo, condizioni, validita, mostraPrezziPromo, focus_p, params) {
		 if(aperta) aperta.window.close();
		 
			// alert(mostraPrezziPromo);
		 params = "menubar=no,location=no,status=no,scrollbars=no,directories=no,toolbar=no,reasizeable=yes,width=600,height=150";

		 var aperta = window.open("","popup_vuota",params);

		 if(focus_p) aperta.window.focus();

		 aperta.document.open();
		 
		 // Caratteri speciali: ' sostituito con \' o &#039;
		 
		 var testoCompleto = "<html>";
		 testoCompleto = testoCompleto + "<head>";
		 testoCompleto = testoCompleto + "<link rel=\"stylesheet\" href=\"Resources/default_SNT Style Sheet 2 Look and feel 2.css\" />";
		 testoCompleto = testoCompleto + "</head>";
		 testoCompleto = testoCompleto + "<body bgcolor=\"#000000\"  leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">";	
		 testoCompleto = testoCompleto + "<center>";
		 testoCompleto = testoCompleto + "<table width=\"100%\" border=\"0\" height=\"100%\" cellpadding=\"2\" cellspacing=\"1\" align=\"center\" bgcolor=\"#000000\">";
		 testoCompleto = testoCompleto + "<tr bgcolor=\"#FFFFFF\">";
		 testoCompleto = testoCompleto + "<td align=\"center\" valign=\"middle\" height=\"20\" colspan=\"2\">";
		 testoCompleto = testoCompleto + "<font class=\"title01\">";
		 testoCompleto = testoCompleto + "<b>Codice Prodotto:</b>";
		 testoCompleto = testoCompleto + "</font>";	
		 testoCompleto = testoCompleto + "<font color=\"#000000\">";
		 testoCompleto = testoCompleto + "<b>" + codice + "</b>";
		 testoCompleto = testoCompleto + "</font>";
		 testoCompleto = testoCompleto + "</td>";
	 	 testoCompleto = testoCompleto + "</tr>";		 
		 testoCompleto = testoCompleto + "<tr bgcolor=\"#FFFFF\">";
		 if (mostraPrezziPromo) {
	  	    testoCompleto = testoCompleto + "<td align=\"center\" valign=\"top\" width=\"30%\">";
		 
		 	testoCompleto = testoCompleto + "<font class=\"attributePopup\">Prezzo Dealer:<br><b>";
		 	testoCompleto = testoCompleto + prezzoDealer.replace('.', ',');
		 	testoCompleto = testoCompleto + "</b> Euro</font>";
		
		 	testoCompleto = testoCompleto + "<br><br><font class=\"attributePopup\">Prezzo Promo:<br><b>";
		 	testoCompleto = testoCompleto +  prezzoPromo.replace('.',',');
		 	testoCompleto = testoCompleto + "</b> Euro</font></td>"; 
		 	testoCompleto = testoCompleto + "<td align=\"center\" valign=\"top\" width=\"70%\">";
		 }else{
		 	testoCompleto = testoCompleto + "<td align=\"center\" valign=\"top\" colspan=\"2\">";
		 }
		 
		 testoCompleto = testoCompleto + "<font class=\"attributePopup\">";
		 if(condizioni != null){
		 	testoCompleto = testoCompleto +  condizioni;
		 }
		 testoCompleto = testoCompleto + "</font>"; 
		 testoCompleto = testoCompleto + "<br><br><font class=\"attributePopup\">";
		 if(validita != null){
		 	testoCompleto = testoCompleto +  validita;
		 }
		 testoCompleto = testoCompleto + "</font>"; 
		 testoCompleto = testoCompleto + "</td>";		 
	 	 testoCompleto = testoCompleto + "</tr>";	 	 
		 testoCompleto = testoCompleto + "<tr bgcolor=\"#FFFFFF\">";
		 testoCompleto = testoCompleto + "<td align=\"center\" valign=\"middle\" height=\"10\" colspan=\"2\"  >";
		 testoCompleto = testoCompleto + "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">";
		 testoCompleto = testoCompleto + "<a href=\"#\" OnClick=\"window.close();\">Chiudi</a>";
		 testoCompleto = testoCompleto + "</font>";	 
		 testoCompleto = testoCompleto + "</td>";		 
	 	 testoCompleto = testoCompleto + "</tr>";				 		 
		 testoCompleto = testoCompleto + "</table>";	 
 		 testoCompleto = testoCompleto + "</center>";
		 testoCompleto = testoCompleto + "</body>"; 		 
		 testoCompleto = testoCompleto + "</html>";
		 
		 
		 aperta.document.write(testoCompleto);
		 aperta.document.close();
		 return false;
}
