﻿function ShowCalculator(root){
    var view = window.open(root + 'cost-savings-calculator.aspx','CostSavingsCalculator','width=715,height=500,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,titlebar=true,toolbar=false');
    view.focus();
}
function ShowNewsletterSignUp(url){
    var view = window.open(url,'NewsletterSignUpWindow','width=700,height=500,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,titlebar=true,toolbar=false');
    view.focus();
}
function ShowClientPortal(url){
    var view = window.open(url,'ClientPortalWindow');
    view.focus();
}
function ShowRemoteDesktop(url){
    var view = window.open(url,'RemoteDesktopWindow');
    view.focus();
}
waitForGaq = function(fn, attemptsLeft) {
    var tick = attemptsLeft || 30; 

    if ($('#_opt1').length == 0) {
        if (tick > 1) {
            setTimeout(function() {
                waitForGaq(fn, tick - 1);
            }, 100)
        }
        else {
            log('failed to load window.gaq');
        }
    }
    else {
        fn();
    }
}
