var zoom;

var win;

function detOpen(id_info)
{
         win=window.open("../template/popup.phtml?idPic="+id_info,"Particolari","Location=0,Menubar=0,height=450,width=475");
}

function apriSalva(id,micro)
{
         var tab;

         if(micro)
            tab="IDMicro";
         else
            tab="IDMacro";

         win=window.open('save.phtml?'+tab+'='+id,'salva','Location=0,Menubar=0,resizable=0,height=401,width=300,scrollbars=0');
}

function openPopupWindow(url, width, height, scrolling) { //v2.0
    if (!width) width = 350;
    if (!height) height = 350;
    if (!scrolling) scrolling = "no";
    features = "width="+width+","
             + "height="+height+","
             + "toolbar=no,"
             + "location=no,"
             + "status=no,"
             + "menubar=no,"
             + "scrollbars="+scrolling+","
             + "top="+(window.screen.height-height)/2+","
             + "left="+(window.screen.width-width)/2;
    win = window.open(url,null,features);
}

function dimenticata()
{
   if(document.registrazione.mail.value.length>0)
       win=window.open("dimenticata.phtml?mail="+document.registrazione.mail.value,"dimenticata","width=300,height=201,location=0,menubar=0,scrollbars=0,resizable=0");
   else
       alert("Inserisci l'email prima...");
}

function trim(strText) {
    // this will get rid of leading spaces
    while (strText.substring(0,1) == ' ')
        strText = strText.substring(1, strText.length);

    // this will get rid of trailing spaces
    while (strText.substring(strText.length-1,strText.length) == ' ')
        strText = strText.substring(0, strText.length-1);

   return strText;
}

//form di invio email a RDB
//*

function chkForm()
{
         var msg=new String("");

         if(trim(document.frmEmail.txtSubj.value).length<1)
            msg="Inserite un soggetto";
         else if(trim(document.frmEmail.areaMex.value).length<1)
            msg="Impossibile inviare un messaggio vuoto";
         else if(trim(document.frmEmail.txtFrom.value).length<1)
            msg="Inserite il mittente";

         if(msg.length>0)
         {
            alert(msg);
            return false;
         }

         return true;
}

function chkFormRete()
{
         var msg=new String("");

if(trim(document.formRDB.sLocalita.value).length<1 && trim(document.formRDB.sNome.value).length<3)
{
    alert("Selezionare una provincia ed un comune o compilare il campo agente/ufficio vendita");
            return false;
}
	else
         return true;
}


function stampa(sURL)
{
         openPopupWindow('printPDF.phtml?toprint=' + sURL, 600, 500, 1);

}

function stampaDoppioUrl(sURL1,sURL2)
{
         openPopupWindow('printPDF.phtml?toprint=' + sURL1 + '&nextLink=' + sURL2, 600, 500, 1);
}

//*/
