﻿// Dom Work
function NewWindow(mypage,myname,w,h,scroll)
{    
    var win = null;
    LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;    
    TopPosition = (screen.height) ? (screen.height-h)/2 : 0;    
    settings='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable';
    win = window.open(mypage,myname,settings);    
    if(win.window.focus){win.window.focus();}  
}

function Cover(bottom, top, ignoreSize) {
    var location = Sys.UI.DomElement.getLocation(bottom);
    top.style.position = 'absolute';
    top.style.top = location.y + 'px';
    top.style.left = location.x + 'px';
    if (!ignoreSize) {
        top.style.height = bottom.offsetHeight + 'px';
        top.style.width = bottom.offsetWidth + 'px';
    }
}

// Bookmarklet
function bookmarksite(title, url){
    if (document.all)
        window.external.AddFavorite(url, title);
    else if (window.sidebar)
        window.sidebar.addPanel(title, url, "")
}

function showBranch(branch) {
    var objBranch = document.getElementById(branch);
	
    if (objBranch != null) {
	    if(objBranch.style.display == 'block')
		    objBranch.style.display = 'none';
	    else 
		    objBranch.style.display = 'block';
    }
}

function clickButton(e, buttonid){
    var evt = e ? e : window.event;
    var bt = document.getElementById(buttonid);

    if (bt){
        if (evt.keyCode == 13){
            bt.click();
            return false;
        }
    }
}
