// JScript File
var isIE = (document.all) ? true : false;
var isNAV4 = (document.layers) ? true : false;

var PopUpWin;

//Norton Internet Security workaround - reclaim control over windows.open       
var SymRealWinOpen;
if(SymRealWinOpen) window.open = SymRealWinOpen ;   

/******************************************
 Create and open general pupose popup window
*******************************************/
function PopUpWindow(page, wWidth, wHeight, wScroll){

    HideCoverApp();

    if (null != PopUpWin)
	{	
		if (!PopUpWin.closed)
			PopUpWin.close();
	}

	if (wWidth == null){ wWidth = 350;}
	if (wHeight == null){wHeight = 500;}
	if (wScroll == true){wScroll = '1';}

	attribs = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=" + wScroll + ",resizable=yes,height=" + wHeight + ",width=" + wWidth
	//attribs = "";
	
	PopUpWin=open(page,"PopUpWin",attribs);

	if (!PopUpWin.opener)
		PopUpWin.opener = top;
}

function PopUpWindow2(page, name, height, width, scrollbars, resizable ){
    HideCoverApp();

	if (width == null){ width = 400;}
	if (height == null){height = 600;}
	if (scrollbars == true) { scrollbars = '1'; } else { scrollbars = '0'; }
	if (resizable == true) { resizable = '1'; } else { resizable = '0'; }
	if (name == null){ name = 'PopUpWin' + new Date().getTime();}

	attribs = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+scrollbars+",resizable="+resizable+",height="+height+",width="+width
	
	window.open(page ,name, attribs);
}

/******************************************
 Set cssClass on arbitrary control
*******************************************/
function setClassName(ctrl, className) {
	if(ctrl!=null){
		ctrl.className=className;
	} 
}

function SelectRow(rowId)
{
    var row = document.getElementById(rowId);
    
    if (row.className == "cssGWSelectedRow")
    {
        setClassName(row, "cssGWRow");
    }
    else
    {
        setClassName(row, "cssGWSelectedRow");
    }
}


function OpenRow(rowId, img)
{
     object = document.getElementById(rowId);

     if (object.style.display=="")
     {
         object.style.display = "none";
         img.src = "Images/open.gif";
     }
     else
     {
          object.style.display = "";
          img.src = "Images/close.gif";
     }
}


function HideCoverApp() {

    if (isIE) {
        layerCoverApp.style.visibility = "hidden";
    } else if (isNAV4) {
        document.layerCoverApp.visibility = "hide";
    } else {
        document.getElementById("layerCoverApp").style.visibility = "hidden";
    }
}

function displayLoadingImage() {
    if (isIE) {
        layerCoverApp.style.visibility = "visible";
    } else if (isNAV4) {
        document.layerCoverApp.visibility = "show";
    } else {
        document.getElementById("layerCoverApp").style.visibility = "visible";
   }
}


function GetInputValue(inputControlId, message, defaultString) {
    var ctrl = document.getElementById(inputControlId);
    if (ctrl != null)
        ctrl.value = prompt(message, defaultString )
    else {
        var ctrls = document.getElementsByName(inputControlId);
        ctrls[0].value = prompt(message, defaultString)
    }
}

/* Was used for activity cue for AJAX actions 

function beginWait ()
{ 
//document.documentElement.className = 'waitCursor'; 
window.status = "Grouping - Please wait...";
document.body.style.cursor = "wait";    
}

function endWait(sender, args)
{
//alert("end");
window.status = "Done";
document.body.style.cursor = "default";
}

*/

function disableButton(buttonId, textBoxId) {
    if (document    .all) {
        var btn = document.all[buttonId];
        var txt = document.all[textBoxId];
    }
    else {
        var btn = document.getElementById(buttonId);
        var txt = document.getElementById(textBoxId);
        btn.disabled = 'true';
    }

    if (btn != null && txt != null) {
        if (txt.value.length > 0) {
            btn.disabled = '';
        }
        else {
            btn.disabled = 'true';
        }
    }


}

