// Common JavaScript functions

/////////////////////////////////////////////////////////////////////
function rnd() {
	rnd.today=new Date();
	rnd.seed=rnd.today.getTime();

    rnd.seed = (rnd.seed*9301+49297) % 233280;
    return rnd.seed/(233280.0);
};

function rand(number) {
    return Math.ceil(rnd()*number);
};

function randomNumber(limit){
  return Math.floor(Math.random()*limit);
}

function getRandom() {
    return Math.random()
}

/////////////////////////////////////////////////////////////////////
function DisplayHeader()
{
    document.open();
    document.writeln("<table border='0' width='100%' cellspacing='0' cellpadding='0' height='52' bgcolor='#FFFFFF' background='/img/g1.gif'>");
    document.writeln("      <tr>");
    document.writeln("        <td width='160' height='66' valign='top' align='center' nowrap bgcolor='#FFFFFF'>");
    document.writeln("        <p style='text-indent: 0; margin: 0'>");
    document.writeln("        <a href='/index.htm'><img border='0' src='/img/logo.png' alt='MicroMedia - Programmi e soluzioni per la gestione delle agenzie immobiliari'></a><a href='/prodotti.htm'><img border='0' src='/img/soluzioni 350.gif'  alt='MicroMedia - Programmi e soluzioni per la gestione delle agenzie immobiliari' hspace='3'></a><a href='index.htm/'><br>");
    document.writeln("        </a></p>");
    document.writeln("        </td>");
    document.writeln("        <td align='right'>");
    document.writeln("        <table border='0' cellpadding='0' cellspacing='0' width='100%'>");
    document.writeln("          <tr>");
    document.writeln("            <td height='64' align='right' style='PADDING-RIGHT: 10px;'><a href='/imbase.asp'><img src='/img/banner2.gif' alt='MicroMedia - Programmi e soluzioni per la gestione delle agenzie immobiliari' width='468' height='60' border='0'></a></td>");
    document.writeln("          </tr>");
    document.writeln("        </table>");
    document.writeln("        </td>");
    document.writeln("      </tr>");
    document.writeln("    </table>");
}

/////////////////////////////////////////////////////////////////////
function DisplayNavBar()
{
    document.open();
    document.writeln("<table border='0' width='100%' cellspacing='0' cellpadding='0'>");
    document.writeln("<tr>");
    document.writeln("<td background='/img/bk1.gif'>");
    document.writeln("<div align='center'>");
    document.writeln("<center>");
    document.writeln("<script type='text/javascript' language='JavaScript1.2'>");
    document.writeln("<!--");
    document.writeln("stm_bm(['mainmenu',430,'','/img/sp.gif',0,'','',1,0,0,0,50,1,0,0,'','',0],this);");
    document.writeln("stm_bp('p0',[0,4,0,0,3,0,15,0,100,'progid:DXImageTransform.Microsoft.Fade(overlap=.5,enabled=0,Duration=0.20)',-2,'',-2,90,0,0,'#7f7f7f','#000000','/img/bk1.gif',3,0,0,'#000000']);");
    document.writeln("stm_ai('p0i0',[6,16,'transparent','/img/d2.gif',2,15,0]);");
    document.writeln("stm_ai('p0i1',[0,'Prodotti','','',-1,-1,0,'/prodotti.htm','_self','','','','',0,0,0,'','',-1,-1,0,0,1,'#f0f0f0',1,'#f0f0f0',1,'','',0,3,0,0,'#ffffff','#ffffff','#333333','#cc0000','bold 8pt Verdana','bold 8pt Verdana',0,0]);");
    document.writeln("stm_bp('p1',[1,4,-10,4,0,3,7,0,100,'',-2,'',-2,90,0,0,'#cccccc','transparent','',3,1,1,'#808080']);");
    document.writeln("stm_aix('p1i0','p0i1',[0,'ImBase   ','','',-1,-1,0,'/imbase.asp','_self','','','/img/a1.gif','/img/a1.gif',7,7,0,'','',0,0,0,0,1,'#f0f0f0',0,'#969696',0,'','',3,3,0,0,'#ffffff','#ffffff','#505050','#ffffff','11px Verdana','11px Verdana']);");
    document.writeln("stm_aix('p1i1','p0i0',[6,1,'#cccccc','',-1,-1]);");
    document.writeln("stm_aix('p1i2','p1i0',[0,'Spring','','',-1,-1,0,'/spring.htm']);");
    document.writeln("stm_aix('p1i3','p1i1',[]);");
    document.writeln("stm_aix('p1i4','p1i0',[0,'ImBase NET','','',-1,-1,0,'/imbasenet.htm']);");
    document.writeln("stm_aix('p1i5','p1i1',[]);");
    document.writeln("stm_aix('p1i6','p1i0',[0,'ImBase PALM','','',-1,-1,0,'/imbasepalm.htm']);");
    document.writeln("stm_aix('p1i5','p1i1',[]);");
    document.writeln("stm_aix('p1i6','p1i0',[0,'Realizzazione siti immobiliari','','',-1,-1,0,'/siti.htm']);");
    document.writeln("stm_aix('p1i7','p1i1',[]);");
    document.writeln("stm_aix('p1i8','p1i0',[0,'Assistenza Tecnica','','',-1,-1,0,'/Assistenza_tecnica.htm']);");
    document.writeln("stm_aix('p1i9','p1i1',[]);");
    document.writeln("stm_aix('p1i10','p1i0',[0,'FAQ sui prodotti','','',-1,-1,0,'/faq_prodotto.htm']);");
    document.writeln("stm_aix('p1i11','p1i1',[]);");
    document.writeln("stm_aix('p1i12','p1i0',[0,'Manuali','','',-1,-1,0,'/manuali.htm']);");
    document.writeln("stm_aix('p1i13','p1i1',[]);");
    document.writeln("stm_aix('p1i14','p1i0',[0,'Registrazione Clienti','','',-1,-1,0,'/servizio_clienti.htm']);");
    document.writeln("stm_ep();");
    document.writeln("stm_aix('p0i2','p0i0',[]);");
    document.writeln("stm_aix('p0i3','p0i1',[0,'Dimostrativi','','',-1,-1,0,'/dimostrativi.htm']);");
    document.writeln("stm_bpx('p2','p1',[1,4,-10,4,0,3,7,7]);");
    document.writeln("stm_aix('p2i0','p0i1',[0,'Richiedi i dimostrativi  ','','',-1,-1,0,'/dimostrativi.htm','_self','','','/img/a1.gif','/img/a1.gif',0,0,0,'/img/a2.gif','/img/a2.gif',7,7,0,0,1,'#f0f0f0',0,'#969696',0,'','',3,3,0,0,'#ffffff','#ffffff','#505050','#ffffff','bold 11px Verdana','bold 11px Verdana']);");
    document.writeln("stm_ep();");
    document.writeln("stm_aix('p0i4','p0i0',[]);");
    document.writeln("stm_aix('p0i5','p0i1',[0,' Listino Prezzi','','',-1,-1,0,'/listino.htm','_self','','','/img/c2.gif','/img/c2.gif',15,12]);");
    document.writeln("stm_bpx('p4','p1',[]);");
    document.writeln("stm_aix('p4i0','p2i0',[0,'Listino prezzi dei prodotti','','',-1,-1,0,'/listino.htm','_self','','','/img/a1.gif','/img/a1.gif',7,7,0,'','',0,0]);");
    document.writeln("stm_aix('p4i1','p1i1',[]);");
    document.writeln("stm_aix('p4i2','p1i0',[0,'Offerta Rottamazione','','',-1,-1,0,'/rottamazione.htm']);");
    document.writeln("stm_aix('p4i3','p1i1',[]);");
    document.writeln("stm_aix('p4i2','p1i0',[0,'Come acquistare i prodotti','','',-1,-1,0,'/listino.htm#domande']);");
    document.writeln("stm_aix('p4i3','p1i1',[]);");
    document.writeln("stm_aix('p4i4','p1i0',[0,'Ordini via telefono/fax/email','','',-1,-1,0,'/listino.htm#ordini']);");
    document.writeln("stm_aix('p4i5','p1i1',[]);");
    document.writeln("stm_aix('p4i6','p1i0',[0,'Condizioni di vendita','','',-1,-1,0,'/condizioni_vendita.htm']);");
    document.writeln("stm_aix('p4i7','p1i1',[]);");
    document.writeln("stm_aix('p4i10','p1i0',[0,'FAQ sugli ordini','','',-1,-1,0,'/faq_clienti.htm']);");
    document.writeln("stm_aix('p4i11','p1i1',[]);");
    document.writeln("stm_aix('p4i12','p1i0',[0,'Servizio Clienti','','',-1,-1,0,'/servizio_clienti.htm']);");
    document.writeln("stm_ep();");
    document.writeln("stm_aix('p0i6','p0i0',[]);");
    document.writeln("stm_aix('p0i7','p0i1',[0,'Supporto','','',-1,-1,0,'/supporto_tecnico.htm']);");
    document.writeln("stm_bpx('p5','p1',[]);");
    document.writeln("stm_aix('p5i0','p1i0',[0,'Supporto Tecnico  ','','',-1,-1,0,'/supporto_tecnico.htm']);");
    document.writeln("stm_aix('p5i1','p1i1',[]);");
    document.writeln("stm_aix('p5i0','p1i0',[0,'Assistenza Tecnica  ','','',-1,-1,0,'/assistenza_tecnica.htm']);");
    document.writeln("stm_aix('p5i1','p1i1',[]);");
    document.writeln("stm_aix('p5i2','p1i0',[0,'FAQ sui prodotti','','',-1,-1,0,'/faq_prodotto.htm']);");
    document.writeln("stm_aix('p5i3','p1i1',[]);");
    document.writeln("stm_aix('p5i4','p1i0',[0,'FAQ Clienti','','',-1,-1,0,'/faq_clienti.htm']);");
    document.writeln("stm_aix('p5i5','p1i1',[]);");
    document.writeln("stm_aix('p5i6','p1i0',[0,'Forum','','',-1,-1,0,'/forum','_top']);");
    document.writeln("stm_aix('p5i7','p1i1',[]);");
    document.writeln("stm_aix('p5i8','p1i0',[0,'Come contattare MicroMedia  ','','',-1,-1,0,'/contatti.htm']);");
    document.writeln("stm_aix('p5i9','p1i1',[]);");
    document.writeln("stm_aix('p5i10','p1i0',[0,'Servizio Clienti','','',-1,-1,0,'/servizio_clienti.htm']);");
    document.writeln("stm_aix('p5i9','p1i1',[]);");
    document.writeln("stm_aix('p5i10','p1i0',[0,'Diventare Rivenditori','','',-1,-1,0,'/diventa_rivenditore.htm']);");
    document.writeln("stm_ep();");
    document.writeln("stm_aix('p0i8','p0i0',[]);");
    document.writeln("stm_aix('p0i9','p0i1',[0,'Manuali','','',-1,-1,0,'/manuali.htm']);");
    document.writeln("stm_bpx('p6','p1',[]);");
    document.writeln("stm_aix('p6i0','p1i0',[0,'Manuale di ImBase  ','','',-1,-1,0,'/manuali.htm']);");
    document.writeln("stm_ep();");
    document.writeln("stm_aix('p0i10','p0i0',[]);");
    document.writeln("stm_aix('p0i11','p0i9',[0,'MicroMedia','','',-1,-1,0,'/profilo_aziendale.htm']);");
    document.writeln("stm_bpx('p7','p1',[]);");
    document.writeln("stm_aix('p7i0','p1i0',[0,'Chi siamo','','',-1,-1,0,'/profilo_aziendale.htm']);");
    document.writeln("stm_aix('p7i1','p1i1',[]);");
    document.writeln("stm_aix('p7i2','p1i0',[0,'Contatti','','',-1,-1,0,'/contatti.htm']);");
    document.writeln("stm_aix('p5i9','p1i1',[]);");
    document.writeln("stm_aix('p5i10','p1i0',[0,'Diventare Rivenditori','','',-1,-1,0,'/diventa_rivenditore.htm']);");
    document.writeln("stm_aix('p7i1','p1i1',[]);");
    document.writeln("stm_aix('p7i2','p1i0',[0,'Privacy','','',-1,-1,0,'/privacy.htm']);");
    document.writeln("stm_ep();");
    document.writeln("stm_aix('p0i12','p0i0',[]);");
    document.writeln("stm_ep();");
    document.writeln("stm_em();");
    document.writeln("//-->");
    document.writeln("</script>");
    document.writeln("</center>");
    document.writeln("</div>");
    document.writeln("</td>");
    document.writeln("</tr>");
    document.writeln("</table>");

}

/////////////////////////////////////////////////////////////////////
function DisplayNavShade()
{
    document.open();
    document.writeln("<table border='0' width='100%' cellspacing='0' cellpadding='0'>");
    document.writeln("  <tr>");
    document.writeln("    <td WIDTH='100%' background='/img/s1.gif'>");
    document.writeln("    <img SRC='/img/sp.gif' width='8' HEIGHT='8' ALT BORDER='0'></td>");
    document.writeln("  </tr>");
    document.writeln("</table>");
}

/////////////////////////////////////////////////////////////////////
function DisplayStatus()
{
    document.open();
    document.writeln("<table CELLPADDING='0' CELLSPACING='0' WIDTH='100%' BORDER='0' >");
    document.writeln("  <tr>");
    document.writeln("    <td bgcolor='#FCFCFC'><font size=1>");
    document.writeln("    <img border='0' src='/img/sp.gif' width='1' height='1'></font></td>");
    document.writeln("  </tr>");
    document.writeln("  <tr>");
    document.writeln("    <td align='center' VALIGN='BOTTOM' bgcolor='#E0E0E0'>");
    document.writeln("      <p align='center' style='margin-top: 8pt; margin-bottom: 2pt; margin-left: 8pt'>        ");
    document.writeln("  	  <a href='/mappa_sito.htm' class='sHeadLink'>mappa del sito</a><span class='style2'> | </span>");
    document.writeln("  	  <a href='/termini_uso.htm' class='sHeadLink'>termini d'uso</a><span class='style2'> | </span>");
    document.writeln("	      <a href='/privacy.htm' class='sHeadLink'>privacy</a><span class='style2'> | </span>");
    document.writeln("	      <a href='/licenza_uso.htm' class='sHeadLink'>licenza d'uso</a><span class='style2'> | </span>");
    document.writeln("	      <a href='/profilo_aziendale.htm' class='sHeadLink'>chi siamo</a><span class='style2'> | </span>");
    document.writeln("	      <a href='/contatti.htm' class='sHeadLink'>contatti</a> </p>");
    document.writeln("        <table width='350' border='0' style='margin-bottom: 8pt'>");
    document.writeln("        <tr>");
    document.writeln("          <td width='32'><a href='index.htm'><img border='0' src='/img/micromedia_icon_gray.gif'  width='32' height='32'  hspace='1' vspace='1' align='bottom'></a></td>");
    document.writeln("          <td width='318'><font size=1>Copyright © 2009 MicroMedia. Tutti i diritti riservati.");
    document.writeln("            </font>");
    document.writeln("		  </td>");
    document.writeln("        </tr>");
    document.writeln("      </table>");
    document.writeln("	</td>");
    document.writeln("  </tr>");
    document.writeln("</table>");
}

/////////////////////////////////////////////////////////////////////
function DisplayStatusShade()
{
    document.open();
    document.writeln("<table border='0' width='100%' cellspacing='0' cellpadding='0'>");
    document.writeln("  <tr>");
    document.writeln("    <td WIDTH='100%' background='/img/s2.gif'>");
    document.writeln("    <img SRC='/img/sp.gif' width='8' HEIGHT='8' ALT BORDER='0'></td>");
    document.writeln("  </tr>");
    document.writeln("</table>");
}

/////////////////////////////////////////////////////////////////////
function openPopup(url,x,y){
  if (!x){x=760;};
  if (!y){y=630;};
  window.open(url,null,'toolbar=yes,menubar=no,resizable=yes,scrollbars=yes,width='+x+',height='+y)
}

/////////////////////////////////////////////////////////////////////
function openPopupFixed(url,x,y){
  if (!x){x=760;};
  if (!y){y=630;};
  window.open(url,null,'toolbar=no,status=no,menubar=no,resizable=yes,scrollbars=no,width='+x+',height='+y)
}

/////////////////////////////////////////////////////////////////////
function checkEMail(inEmail) {
	var locAt;
	var locPeriod;
	var okEmail;

	locAt = inEmail.indexOf("@");
	okEmail = ((locAt != -1) && 
			   (locAt != 0) &&
			   (locAt != (inEmail.length - 1)) &&
			   (inEmail.indexOf("@", locAt + 1) == -1)
			  );
	if (okEmail) {
		// so far, so good
		locPeriod = inEmail.indexOf(".");
		okEmail = ((locPeriod != -1) && (locPeriod != (inEmail.length - 1)) );
	}
	
	return okEmail;
}

/////////////////////////////////////////////////////////////////////

