/********************************************************************************************
                                    Utility
 ********************************************************************************************/


/*-----------------------------------------------------------------------------
 * Function FormatHeaderNew
 *  	This function formats the comprehensive header of menus.
 *
 */
function FormattaIntestazioneNew(bSecondoLivello)
{
  var str = "";
  
  /* The Function of Format is recalled in a sub-directory */
  var strSecondoLivello = ""; 

  if(bSecondoLivello == true)
  {
    strSecondoLivello = "../";
  }
  else
  {
    strSecondoLivello = "";
  }

  str ='<a href="'+ strSecondoLivello +'index.htm">Home</a><font color="#000000"> | </font>\
        <a href="'+ strSecondoLivello +'Galleria.htm">Portolio Fotografico</a><font color="#000000"> | </font>\
        <a href="'+ strSecondoLivello +'Web.htm">Web Design</a><font color="#000000"> | </font>\
        <a href="'+ strSecondoLivello +'Studio.htm">Studio</a><font color="#000000"> | </font>\
        <a href="'+ strSecondoLivello +'Contatti.htm">Contatti</a>';

  document.write(str);

  return; 
}



function Begin_FormattaCornice(bSecondoLivello)
{
  
  var str = "";

  /* The Function of Format is recalled in a sub-directory */
  var strSecondoLivello = ""; 

  if(bSecondoLivello == true)
  {
    strSecondoLivello = "../";
  }
  else
  {
    strSecondoLivello = "";
  }
  
  str = '<table border="0" cellspacing="0" cellpadding="0">\
         <tr>\
           <td background="'+ strSecondoLivello +'img/AngoloAltoSinistro.gif" width="26" height="26"></td>\
           <td background="'+ strSecondoLivello +'img/CorniceAlta.gif"                   height="26"></td>\
           <td background="'+ strSecondoLivello +'img/AngoloAltoDestro.gif"   width="26" height="26"></td>\
         </tr>\
         <tr>\
           <td background="'+ strSecondoLivello +'img/CorniceSinistra.gif"    width="26" ></td>\
           <td>';

  document.write(str);
  return;
}

function End_FormattaCornice(bSecondoLivello)
{
  
  var str = "";

  /* The Function of Format is recalled in a sub-directory */
  var strSecondoLivello = ""; 

  if(bSecondoLivello == true)
  {
    strSecondoLivello = "../";
  }
  else
  {
    strSecondoLivello = "";
  }

  str = ' </td>\
          <td background="'+ strSecondoLivello +'img/CorniceDestra.gif"       width="26" >&nbsp;</td>\
        </tr>\
        <tr>\
          <td background="'+ strSecondoLivello +'img/AngoloBassoSinistro.gif" width="26" height="26"></td>\
          <td background="'+ strSecondoLivello +'img/CorniceBassa.gif"                   height="26"></td>\
          <td background="'+ strSecondoLivello +'img/AngoloBassoDestro.gif"   width="26" height="26"></td>\
        </tr>\
      </table>';

  document.write(str);
  return;
}




function Begin_FormattaCorniceSmall(bSecondoLivello)
{
  
  var str = "";

  /* The Function of Format is recalled in a sub-directory */
  var strSecondoLivello = ""; 

  if(bSecondoLivello == true)
  {
    strSecondoLivello = "../";
  }
  else
  {
    strSecondoLivello = "";
  }
  
  str = '<table border="0" cellspacing="0" cellpadding="0">\
         <tr>\
           <td background="'+ strSecondoLivello +'img/AngoloAltoSinistroSmall.gif" width="12" height="12"></td>\
           <td background="'+ strSecondoLivello +'img/CorniceAltaSmall.gif"                   height="12"></td>\
           <td background="'+ strSecondoLivello +'img/AngoloAltoDestroSmall.gif"   width="12" height="12"></td>\
         </tr>\
         <tr>\
           <td background="'+ strSecondoLivello +'img/CorniceSinistraSmall.gif"    width="12" ></td>\
           <td>';

  document.write(str);
  return;
}

function End_FormattaCorniceSmall(bSecondoLivello)
{
  
  var str = "";

  /* The Function of Format is recalled in a sub-directory */
  var strSecondoLivello = ""; 

  if(bSecondoLivello == true)
  {
    strSecondoLivello = "../";
  }
  else
  {
    strSecondoLivello = "";
  }

  str = ' </td>\
          <td background="'+ strSecondoLivello +'img/CorniceDestraSmall.gif"       width="12" ></td>\
        </tr>\
        <tr>\
          <td background="'+ strSecondoLivello +'img/AngoloBassoSinistroSmall.gif" width="12" height="12"></td>\
          <td background="'+ strSecondoLivello +'img/CorniceBassaSmall.gif"                   height="12"></td>\
          <td background="'+ strSecondoLivello +'img/AngoloBassoDestroSmall.gif"   width="12" height="12"></td>\
        </tr>\
      </table>';

  document.write(str);
  return;
}


/* This Function inserts complete with zeros the name of a file. For Istance foto1.jpg will be converted into  foto 001.jpg if the number of the photos (maximum) is a cypher of length 3*/

function FormattaConZeri(num,max)
{

  var str = "";

  var numLen = String(num).length;

  var maxLen = String(max).length;


  for(i=numLen ;i<maxLen;i++)
  {
    str +="0";
  }

  str += num;

  return  str;
}


