/*

    Author: Jeffrey Gordillo
    Date: 12/20/2006
    Description: Functions required to control the top frame of the CMS

*/

function setActionButton(strButton, strLink) {
    var objWindow = parent.frames["topFrame"]
    
    if ( objWindow )  {
        var objElement;

        if (strButton) {
            objElement = objWindow.document.getElementById('ddlEditLinks');
            if ( objElement )
                objElement.options[0].selected = true;
            
            objElement = objWindow.document.getElementById("btnAction");
            if ( objElement ) {
                objElement.disabled = false;
                objElement.value = strButton;
                objElement.style.display = "inline";
                }

            objElement = objWindow.document.getElementById("btnLink");
            if ( objElement )
                objElement.value = strLink;
            }
        else {
            setButton(objWindow.document.getElementById("btnAction"), false)
//          objElement = objWindow.document.getElementById("btnAction");
            }
        }
    }

function goToURL(obj){
    var strURL = obj.options[obj.selectedIndex].value;
    if ((strURL != "") &&  (strURL != "Select")) {
    	setButton(document.getElementById('btnAction'), true);
    	top.document.getElementById('content_frame').src = strURL;
		}
	}

function goToButton (objButton, strURL) {
    setButton(document.getElementById('btnAction'), true);
    top.document.getElementById('content_frame').src = strURL;
    }

function openFrame(strURL) {
    top.document.getElementById('content_frame').src = strURL;
    }

function setButton(objButton, bDisplay) {
    if ( objButton ) {
        if ( bDisplay ) {
            objButton.style.display = 'inline';
            objButton.value = "...loading...";
            objButton.disabled = true;
            }
        else {
            objButton.style.display = 'none';
            }
    }
}

function resetDropdown() {
    var objWindow = parent.frames["topFrame"]
    
    if ( objWindow )  {
        var objElement;

        objElement = objWindow.document.getElementById('ddlEditLinks');
        if ( objElement )
            objElement.options[0].selected = true;

        setButton(objWindow.document.getElementById("btnAction"), true)
    }  
}