function elcSendURL( url ) {
    location.replace(wsmlMakeWebServiceHref(url));
}
function sendURL(targetURI) {
    window.location = wsmlMakeWebServiceHref(targetURI);
}
function elcGotoURL( url ) {
    if (url != null && url != '') {
        self.location.href = wsmlMakeWebServiceHref(url);
    }
}

// global utility functions
/*
function popWindow(w,h,x,y) {
var subwindow = window.open('','subWindow_name','toolbar=no,menubar=no,location=no,scrollbars=yes,width='+w+',height='+h+',left='+x+',top='+y);
subwindow.resizeTo(w,h);
subwindow.moveTo(x,y);
subwindow.focus();
}

function popWindow_noscroll(w,h,x,y) {
var subwindow_noscroll = window.open('','subWindow_noscroll_name','toolbar=no,menubar=no,location=no,scrollbars=no,width='+w+',height='+h+',left='+x+',top='+y);
subwindow_noscroll.resizeTo(w,h);
subwindow_noscroll.moveTo(x,y);
subwindow_noscroll.focus();
}
*/

function popWindow(w,h,x,y) {
    properWindowOpener( '', w, h, 'yes', 'yes', 'subWindow_name');
}

function popWindow_noscroll(w,h,x,y) {
    properWindowOpener( '', w, h, 'no', 'yes', 'subWindow_noscroll_name' );
}

function properWindowOpener(url, w, h, scroll, resize, windowName) {
    var windowWidth  = w;
    var windowHeight = h;

    if (!windowName || windowName == null) {
        windowName = "subWindow_name";
    }

    if (scroll != null) {
        windowWidth += 15;
    }

    //find out how big the screen is
    var screenWidth  = screen.availWidth;
    var screenHeight = screen.availHeight;

    //get the left position - which is half the screen width minus half the window width
    var leftPoint = parseInt(screenWidth/2) - parseInt(windowWidth/2);

    //get the top position - which is half the screen height minus half the window height
    var topPoint  = parseInt(screenHeight/2) - parseInt(windowHeight/2);
  
    //var winprops = 'height='+h+', left='+leftPoint+', top='+topPoint+', width='+w+',scrollbars=1 ,resizable=1'
    var winprops = 'height='+h+', left='+leftPoint+', top='+topPoint+', width='+w+', resizable=1, scrollbars='+scroll;

    var win = window.open( url, windowName, winprops);

    //return win;
    if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function locatorOnChangeHandler( element ) {
    var url = element[element.selectedIndex].value;
    elcGotoURL( url );
}
