﻿// JScript File    

function Browser() {

  var ua, s, i;

  this.isIE    = false;
  this.isNS    = false;
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

var browser = new Browser();

function SizeIFrame(div,iframe) 
{    
    if(div)
    {
        var layer = div; 
        if (browser.isIE) {              
            iframe.style.width = layer.offsetWidth;      
            iframe.style.height = layer.offsetHeight;   
            layer.style.top = layer.style.posTop + document.body.scrollTop; 
            layer.style.left = layer.style.posLeft + document.body.scrollLeft; 
            iframe.style.left = layer.style.left;       
            iframe.style.top = layer.style.top;         
            iframe.style.visibility = 'visible';                     
        } else {
            iframe.style.visibility = 'hidden';                                         
            layer.style.top = parseInt(layer.style.top.replace('px','')) + window.scrollY + 'px'; 
            layer.style.left = parseInt(layer.style.left.replace('px','')) + window.scrollX + 'px'; 
        }
     }
}

function Hide(iframe){
    if(iframe){
        iframe.style.visibility = 'hidden';
    }
}

function Cover(bottom, top, ignoreSize) {
    var location = Sys.UI.DomElement.getLocation(bottom);
    top.style.position = 'absolute';
    top.style.top = location.y + 20 + 'px';
    top.style.left = ((location.x-bottom.offsetWidth) - 50) + 'px';
    
    if (!ignoreSize) {
        top.style.height = bottom.offsetHeight + 'px';
        top.style.width = bottom.offsetWidth + 'px';
    }            
}

       