
/*
var OldPrintSpacerWidth;
var OldFooterLeft;
function MoveContentsLeft()
{
   window.alert("ciao");
   OldPrintSpacerWidth = document.getElementById("printspacer").width;
   document.getElementById("printspacer").width = 0;
   OldFooterLeft = document.getElementById("FOOTER").style.left;
   document.getElementById("FOOTER").style.left = "0px";
   document.getElementById("LAYOUT").style.visibility = "hidden";
}
function MoveContentsBack()
{
   document.getElementById("printspacer").width = OldPrintSpacerWidth;
   document.getElementById("FOOTER").style.left = OldFooterLeft;
   document.getElementById("LAYOUT").style.visibility = "visible";
}
window.onbeforeprint = MoveContentsLeft;
window.onafterprint = MoveContentsBack;
*/

function returnfalse() { return false; }

/*************************************************************************************************/
function CreateLayout(LayoutModel, HeightPx)
{
   var layout = "";
   
   //document.body.style.backgroundColor = "#FDECCA";
   document.body.style.backgroundImage = "url(layout/bg.jpg)";
   document.body.style.backgroundRepeat = "repeat"; //no-repeat | repeat-x | repeat-y

   //In the lines below I can't call directly: "return false". I don't know why!
   document.oncontextmenu = returnfalse; //Disabling context menu.
   document.ondragstart = returnfalse; //Disabling pictures drag from browser area and drop outside the browser.
   //document.onselectstart = returnfalse; //Disabling text selection

   //HeightPx = 1400;

   if(LayoutModel == "blue")
   {
      layout = "<table border='0' id='RAYTOP' style='width: 100%; left: 0px; top: 0px; position: absolute;' cellpadding='0' cellspacing='0'>" +
                  "<tr>" +
                     "<td width='240'><img class='spacer' style='width: 240px;'></td>" +
                     "<td style='background-image: url(layout/raytopbg.jpg); background-repeat: repeat-x;'><img src='layout/raytop.jpg'><br><img class='spacer' style='width: 539px;'></td>" +
                  "</tr>" +
               "</table>" +

               "<table border='0' id='RAYLEFT' style='height: " + HeightPx + "px; left: 0px; top: 0px; background-image: url(layout/rayleftbg.jpg); background-repeat: repeat-y; position: absolute;' cellpadding='0' cellspacing='0'>" +
                  "<tr><td><img src='layout/corner.jpg'></td></tr>" +
               "</table>";

      document.getElementById("LAYOUT").innerHTML = layout;

      return;
   };

   if(LayoutModel == "green")
   {
      layout = "<table border='0' id='RAYTOP' style='width: 100%; left: 0px; top: 0px; position: absolute;' cellpadding='0' cellspacing='0'>" +
                  "<tr>" +
                     "<td width='240'><img class='spacer' style='width: 240px;'></td>" +
                     "<td style='background-image: url(layout/raytopbg-green.jpg); background-repeat: repeat-x;'><img src='layout/raytop-green.jpg'><br><img class='spacer' style='width: 539px;'></td>" +
                  "</tr>" +
               "</table>" +

               "<table border='0' id='RAYLEFT' style='height: " + HeightPx + "px; left: 0px; top: 0px; background-image: url(layout/rayleftbg-green.jpg); background-repeat: repeat-y; position: absolute;' cellpadding='0' cellspacing='0'>" +
                  "<tr><td valign='top'><img src='layout/corner-green.jpg'></td></tr>" +
               "</table>";

      document.getElementById("LAYOUT").innerHTML = layout;

      return;
   };

   if(LayoutModel == "orange")
   {
      layout = "<table border='0' id='RAYTOP' style='width: 100%; left: 0px; top: 0px; position: absolute;' cellpadding='0' cellspacing='0'>" +
                  "<tr>" +
                     "<td width='240'><img class='spacer' style='width: 240px;'></td>" +
                     "<td style='background-image: url(layout/raytopbg-orange.jpg); background-repeat: repeat-x;'><img src='layout/raytop-orange.jpg'><br><img class='spacer' style='width: 539px;'></td>" +
                  "</tr>" +
               "</table>" +

               "<table border='0' id='RAYLEFT' style='height: " + HeightPx + "px; left: 0px; top: 0px; background-image: url(layout/rayleftbg-orange.jpg); background-repeat: repeat-y; position: absolute;' cellpadding='0' cellspacing='0'>" +
                  "<tr><td valign='top'><img src='layout/corner-orange.jpg'></td></tr>" +
               "</table>";

      document.getElementById("LAYOUT").innerHTML = layout;

      return;
   };

   if(LayoutModel == "green-orange")
   {
      layout = "<table border='0' id='RAYTOP' style='width: 100%; left: 0px; top: 0px; position: absolute;' cellpadding='0' cellspacing='0'>" +
                  "<tr>" +
                     "<td width='240'><img class='spacer' style='width: 240px;'></td>" +
                     "<td style='background-image: url(layout/raytopbg-green.jpg); background-repeat: repeat-x;'><img src='layout/raytop-green.jpg'><br><img class='spacer' style='width: 539px;'></td>" +
                  "</tr>" +
               "</table>" +

               "<table border='0' id='RAYLEFT' style='height: " + HeightPx + "px; left: 0px; top: 0px; background-image: url(layout/rayleftbg-orange.jpg); background-repeat: repeat-y; position: absolute;' cellpadding='0' cellspacing='0'>" +
                  "<tr><td><img src='layout/corner-green-orange.jpg'></td></tr>" +
               "</table>";

      document.getElementById("LAYOUT").innerHTML = layout;

      return;
   };

}

/*************************************************************************************************/
function SetContentsPositionAndHeight()
{
   /* This might be very usuful! Let's say for instance that your customer asked you to place the
      graphic layout header down of 100px, if you have this function you can set once for all also the contents of every page to
      be placed down of 100px, otherwise you would need to re-edit all the pages and place by yourself any single element of the page
      down of 100px, then you woul have to publish agian all the pages. */

  /* Basicaly, thsi function should modify the only the posistion style of the element id="CONTENTS" tag */
}

/*************************************************************************************************/
function CreateFooter(language)
{

   /* The footer positon must not be set here, because the top position of the footer is probably different in every page therefor the footer
      must be left free to be moved by the WebSiteBuilder.
      Here we add anyway a reference to it to quickly solve those type of situations where can become necessary to push down/up of a certain
      amount of bits all the footers of all the pages.
   */

   footerPosition = document.getElementById("FOOTER");

   footerContents = document.getElementById("FOOTER_CONTENTS");
   var footer = "<div id='0' class='DefaultTextColor' style='font-size: 10px; font-family: Tahoma, Arial; text-align: center; width: 529px; left: 150px; top: 0px; position: absolute;'>" +
                "DATALOGIC AUTOMATION s.r.l. - Via San Vitalino 13, 40012 Lippo di Calderara di Reno, Bologna - Italy<br>" +
                "C.F., Partita I.V.A. e Registro Imprese 02729801205 - REA Bologna 462538 - Capitale Sociale 10.000.000,00 euro (i.v.)<br>" + 
                "&copy; Copyright Datalogic 2005-2009. All Rights Reserved. <a target='_blank' class='DefaultLinkStyle' href='LEGAL_NOTES.pdf'>Legal notes</a>" + 
                "</div>" +
                "<div class='DefaultTextColor' id='signature' style='font-size: 9px; font-family: Tahoma, Arial; font-weight: normal; width: 70px; left: 690px; top: 50px; position: absolute; '>" +
                "<a target='_blank' class='SignatureLinkStyle' href='http://www.vanylla.it'>credits...</a><br><br><br></div>";

   footerContents.innerHTML = footer;
}

/*************************************************************************************************/
function CreateFormFooter()
{

   /* The footer positon must not be set here, because the top position of the footer is probably different in every page therefor the footer
      must be left free to be moved by the WebSiteBuilder.
      Here we add anyway a reference to it to quickly solve those type of situations where can become necessary to push down/up of a certain
      amount of bits all the footers of all the pages.
   */

   footerPosition = document.getElementById("FOOTER");

   footerContents = document.getElementById("FOOTER_CONTENTS");
   var footer = "<div id='0' class='DefaultTextColor' style='font-size: 10px; font-family: Tahoma, Arial; text-align: center; width: 529px; left: 0px; top: 0px; position: absolute;'>" +
                "DATALOGIC AUTOMATION s.r.l. - Via San Vitalino 13, 40012 Lippo di Calderara di Reno, Bologna - Italy<br>" +
                "C.F., Partita I.V.A. e Registro Imprese 02729801205 - REA Bologna 462538 - Capitale Sociale 10.000.000,00 euro (i.v.)<br>" + 
                "&copy; Copyright Datalogic 2005-2009. All Rights Reserved. <a target='_blank' class='DefaultLinkStyle' href='LEGAL_NOTES.pdf'>Legal notes</a>" + 
                "<br><br><br></div>";
                
   footerContents.innerHTML = footer;
}