﻿
// JScript File

// ******************************
// LAUNCH WINDOW FUNCTIONS
// ******************************

// launchRemote function launches a new window with specific attributes. launch function supports.
function Launch(newURL, newName, newFeatures) {
	var remote = open(newURL, newName, newFeatures);
	if (remote.opener == null)
		remote.opener = window;
	return remote;
}

function LaunchHelp(pageName, uniqueName, winHeight, winWidth, isModalMode) {
    if(isModalMode && window.showModalDialog)//checks for showModalDialog support in browser
    {
        window.showModalDialog(pageName,this,'dialogWidth:' + winWidth + 'px; dialogHeight:' + winHeight + 'px; status:no; center:yes')
    }
    else
    {
	    myRemote = Launch(pageName, uniqueName, "height=" + winHeight + ",width=" + winWidth +",screenX=100,left=100,screenY=100,top=100,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0");
	    myRemote.focus();
    }
    return;
}



function SetVisible(val, isVisible, cont) 
{
    //alert("here");
    var control = document.getElementById(val);
    if (control != null)   
    {
        if (isVisible)
        {
            control.style.display='inline';
            //alert("inline");
        }
        else
        {
            control.style.display='none';
            //alert("None");
        }
            
    }
    else
    {
      //alert("Not found");
    }
    return cont;
}

function EnableValidator(val, enable)
{
    var control = document.getElementById(val);
    if (control != null)   
    {
        if (enable)
            control.ValidEmpty="false";
        else
            control.ValidEmpty="true";
    }
    
    return true;
}


function OpenWindow(url, height, width)
{
	var myshow;
	myshow = window.open(url,'showcase', 'resizable=no,height=' + height + ',width=' + width + ',scrollbars=no');
	myshow.focus();
}





	function toggleCheckboxes(checkBoxClicked)
	{
		checkBoxClicked.Checked = !checkBoxClicked.Checked;
		var checked = checkBoxClicked.Checked;
	
		if(checked)
		{
			selectAllMessages();
		}
		else
		{
			deselectAllMessages();		
		}	
	}


	
	function selectAllMessages()
	{		
		
		setAllCheckboxes(true);
	} 
	
	
	function deselectAllMessages()
	{
		
		setAllCheckboxes(false);
	}
	
	/* Sets all checkboxes in a form to checked if true, unchecked if false.*/
    function setAllCheckboxes(vChecked)
    {
        var elm=document.forms[0].elements;
        for(i=0;i<elm.length;i++)
        if(elm[i].type=="checkbox")
        {
            elm[i].checked = vChecked;
        }
     }

