/**
 * Javascript functions for IgnitionWeb Administration Site
 *
 * This file may be included by a front-end
 */

function iw_open_window(link, window_name, width, height, resizable, scrollbars) 
{ 
    // if the link is relative, make it absolute
    // 'https://www.unisource.ca' should be 'pushed' from PHP!
    if('undefined' != typeof('https://www.unisource.ca') && 0 == link.indexOf('/')){
        link = 'https://www.unisource.ca' + link;
    }
    
	return window.open(link, window_name,'toolbar=no,location=no,status=no,menubar=0,scrollbars='+scrollbars+',resizable='+resizable+',height='+height+',width='+width+',top='+(screen.height-height)/2+',left='+(screen.width-width)/2+',copyhistory=no');
}

var rib_window;
var mcb_window;
function close_browsers()
{
    // close RIB window if it's open; usually used as onunload handler
    if (typeof(rib_window) != 'undefined' && !rib_window.closed) {
        rib_window.close();
    }
    if (typeof(mcb_window) != 'undefined' && !mcb_window.closed) {
        mcb_window.close();
    }
}



function iw_close_window(){
    window.open('','_self');
    window.close();
}



function MM_preloadImages() { //v3.0
    var d = document;
    if(d.images){
        if(!d.MM_p)
            d.MM_p = new Array();
    var i, j = d.MM_p.length, a = MM_preloadImages.arguments;
    for(i=0; i<a.length; i++)
        if (a[i].indexOf("#") != 0){
            d.MM_p[j] = new Image;
            d.MM_p[j++].src=a[i];
        }
    }
}

