//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function ReloadWindow() {
    window.location.href = window.location.href;    
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function CloseWindow() {
    window.close();    
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenWindow(url, name, width, height) {
    OpenWindow(url, name, height, width, false);
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenWindow(url, name, width, height, enableScrollbars) {
    OpenWindow(url, name, height, width, enableScrollbars, false);
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenWindow(url, name, width, height, enableScrollbars, resizable) {
	if(navigator.appName.indexOf("WebTV")!=-1)
		window.location.href=url;
	else
	{
		winhandle=window.open(url, name, "width=" + width + ",height=" + height + ",scrollbars=" + GetWindowBoolString(enableScrollbars) + ",resizable=" + GetWindowBoolString(enableScrollbars) + ",status=no,menubar=no");
		winhandle.focus();
	}
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function SetSelectOptions(select, selectedIndex, arrayText, arrayValues) {
    var text, value, option;
    if(select) {
        for(var i = 0; i < arrayText.length; i++) {
            value = "";
            text = arrayText[i];
            if(arrayValues) {
                if(i < arrayValues.length) {
                    value = arrayValues[i];
                }
            }
            if(value == "") {
                value = text;
            }
            option = new Option(text, value);
            if(i == selectedIndex) {
                option.selected = true;
            }
            select.options[i] = option;
        }
            
    }                    
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function ClearSelect(select) {
    if(select) {select.options.length = 0;}
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function GetWindowBoolString(value) {
    if(value) 
        return "yes";
    else
        return "no";   
}