﻿function openPopupWindow(url) {
    popupWin = window.open(url, 'new_page', 'width=320,height=525,scrollbars=yes,toolbars=yes,menubar=yes,resizable=yes')
}
function openPopupWindow2(url) {
	popupWin = window.open(url,'new_page','width=500,height=450,scrollbars=yes')
}
function openPopupWindow3(url) {
    popupWin = window.open(url, 'new_page', 'width=800,height=450,scrollbars=yes')
}
function openChatWindow(url) {
    mainWin = window.open("/", 'mainWin', 'width=' + (screen.width-375) +',height=' + screen.height + ',scrollbars=yes,resizable=yes,toolbar=yes,menubar=yes,location=yes,top=0,left=0');
    //alert('width=340,height=' + screen.height + ',scrollbars=yes,resizable=yes,top=0,left=' + (screen.width - 340));//
    chatWin = window.open(url, 'chatWin', 'width=340,height=' + screen.height + ',scrollbars=yes,resizable=yes,top=0,left=' + (screen.width - 340));
    if (chatWin == null || typeof (chatWin) == 'undefined') {
        mainWin.close();
        alert('To use chatterbox you will need to update your popup blocker to allow popups on this site. You should see instructions at the top of this page. Click OK, then enable popups for this site and click the chatterbox link again.'); 
     }
    else
    {chatWin.focus();}
}
function addLoadEventHandler(func) {
    var previous_handler = window.onload;
    if (typeof window.onload != "function") window.onload = func;
    else window.onload = function() {
        previous_handler();
        func();
    }
}
function focusButton(e,buttonid) {
    document.getElementById(buttonid).focus();
}

