﻿// JScript File
function getId(x)
{
   return document.getElementById(x);
}
function pageWidth()
{
   return window.innerWidth != null ? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
}
function pageHeight()
{
   return window.innerHeight != null ? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null ? document.body.clientHeight : null;
}
function posLeft()
{
   return typeof window.pageXOffset != 'undefined' ? window.pageXOffset : document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;
}
function posTop()
{
   return typeof window.pageYOffset != 'undefined' ? window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;
}


function scrollFix()
{
   if(getId('ol'))
   { 
        var obol = getId('ol');
        obol.style.top = posTop() + 'px';
        obol.style.left = posLeft() + 'px'
   }
   
   if(getId('div_feedback_btn'))
   {
        var obFB = getId('div_feedback_btn');
        obFB.style.top = posTop() + 'px';
   }
   
}
function sizeFix()
{
   if(getId('ol'))
   {
        var obol = getId('ol');
        obol.style.height = pageHeight() + 'px';
        obol.style.width = pageWidth() + 'px';
   }
   if(getId('div_feedback_btn'))
   {
        var obFB = getId('div_feedback_btn');
        obFB.style.top = posTop() + 'px';
        var wd;
        if(navigator.appName == "Microsoft Internet Explorer")
            wd=pageWidth() - 73;
        else
            wd=pageWidth() - 90;
        
        obFB.style.left=wd+'px';
   }
}

/*function inf(h)
{
   tag = document.getElementsByTagName('select');
   for(i = tag.length - 1; i >= 0; i -- )tag[i].style.visibility = h;
   tag = document.getElementsByTagName('iframe');
   for(i = tag.length - 1; i >= 0; i -- )tag[i].style.visibility = h;
   tag = document.getElementsByTagName('object');
   for(i = tag.length - 1; i >= 0; i -- )tag[i].style.visibility = h;
}*/
    

function createLayer()
{    
     if(document.getElementById("ol"))
     {
        var d=document.getElementById("ol");
        document.body.removeChild(d);
     }
     var obld = document.createElement('div');
     obld.setAttribute('id', 'ol');
     //obld.style.display = 'none';
     obld.style.position = 'absolute';
     obld.style.top = posTop() + 'px';
     obld.style.left =  posLeft() + 'px'
     obld.style.zIndex = 998;
     obld.style.width = '100%';

     obld.innerHTML="<img id='overlay_img' src='/Images/website/overlay.png' height='100%' width='100%' border='0'>"
     
     var obbody = document.getElementsByTagName('body')[0];
     obbody.appendChild(obld);
     
     //alert(obld.innerHTML);
     
     window.onscroll = scrollFix;
     window.onresize = sizeFix;
   
}

function closeOverLay()
{
    removeElement("ol");
}
