lEnabled=false

function Generic(tcLink)
{
   lEnabled=true
   document.getElementById("IFrameGeneric").src = "DataEntrySpanit2.aspx?Session="+tcLink
}

function DisplayPhoto(tcLink)
{
   lEnabled=true
   document.getElementById("IFrameDisplayPhoto").src = "DataEntrySpanit2.aspx?Session="+tcLink
}

function GenericOnLoad()
{
   if (lEnabled)
   {
      lEnabled=false
      lcDiv = document.getElementById("Generic")

      if (document.getElementById("IFrameGeneric").contentWindow.document)
      {
         lcIFrame = document.getElementById("IFrameGeneric").contentWindow.document.body.innerHTML
      }

      lcDiv.innerHTML = lcIFrame
   }
}

function DisplayPhotoOnLoad()
{
   if (lEnabled)
   {
      lEnabled=false
      lcDiv = document.getElementById("GenericPhoto")

      if (document.getElementById("IFrameDisplayPhoto").contentWindow.document)
      {
         lcIFrame = document.getElementById("IFrameDisplayPhoto").contentWindow.document.body.innerHTML
      }

      lcDiv.innerHTML = lcIFrame

   }
}

function Widget(tcFrame,tcDiv,tcBackground)
{
   loFrame = document.getElementById(tcFrame)
   loDiv = document.getElementById(tcDiv)
   loFrame.contentWindow.document.write(loDiv.innerHTML)
   loFrame.contentWindow.document.close()
   loFrame.contentWindow.document.body.style.backgroundColor=tcBackground
}

function IFrame(parentElement)
{

   // Create the iframe which will be returned  
   var iframe = document.createElement("iframe")

   // If no parent element is specified then use body as the parent element  
   if (parentElement == null)  
   {
      parentElement = document.body;  
   }

   // This is necessary in order to initialize the document inside the iframe  
   parentElement.appendChild(iframe)

   // Initiate the iframe's document to null  
   iframe.doc = null

   // Depending on browser platform get the iframe's document, this is only  
   // available if the iframe has already been appended to an element which  
   // has been added to the document  

   // Firefox, Opera  
   if (iframe.contentDocument)  
   {
      iframe.doc = iframe.contentDocument
   }
   else
   {

      // Internet Explorer  
      if (iframe.contentWindow)
      {
         iframe.doc = iframe.contentWindow.document
      }

      else
      {

         // Others?  
         if (iframe.document)  
         {
            iframe.doc = iframe.document
         }

      }

   }

   // If we did not succeed in finding the document then throw an exception  
   if (iframe.doc == null)  
   {
      throw "Document not found, append the parent element to the DOM before creating the IFrame";  
   }

   // Create the script inside the iframe's document which will call the  
   iframe.doc.open()

   iframe.doc.close()

   // Return the iframe, now with an extra property iframe.doc containing the  
   // iframe's document  

   return iframe
}
