// JScript File
function new_window(url) 
{ 
    link = window.open(url,"Link","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=800,height=600,left=50,top=50"); 
    return false;
} 
function CheckUserID()
{
    
}

function CheckCheckBoxStatus(id) 
{
    var frm = document.forms[0];
    var cnt=0;
    for (i=0;i<frm.elements.length;i++) 
    {
        var idX=frm.elements[i].id;
        if (frm.elements[i].type == "checkbox" && idX.indexOf(id)>-1) 
        {
            cnt++;
            if(!frm.elements[i].checked)
            {
                alert("Check Rule:"+cnt);
                return false;
            }
        }
    }
}  

function IsCheckBoxSelected(gridView)
{
    if(gridView != null)
	{
	    var chkBoxes = gridView.getElementsByTagName("input");
		for(i=0; i<chkBoxes.length; i++)
		{
		    if(chkBoxes[i].type == "checkbox" || chkBoxes[i].type == "CHECKBOX")
			{
			    if(chkBoxes[i].checked == true)
				{
				    return true;
				}
		    }
		}
		alert("Atleast one Checkbox needs to be selected!");
		return false;
	}
}
    


 function SelectRow(CurrentRow, RowIndex)
    {        
        if(SelectedRow == CurrentRow || RowIndex > UpperBound || RowIndex < LowerBound) return;
         
        if(SelectedRow != null)
        {
            SelectedRow.style.backgroundColor = SelectedRow.originalBackgroundColor;
            SelectedRow.style.color = SelectedRow.originalForeColor;
        }
        
        if(CurrentRow != null)
        {
            CurrentRow.originalBackgroundColor = CurrentRow.style.backgroundColor;
            CurrentRow.originalForeColor = CurrentRow.style.color;
            CurrentRow.style.backgroundColor = '#DCFC5C';
            CurrentRow.style.color = 'Black';
        } 
        
        SelectedRow = CurrentRow;
        SelectedRowIndex = RowIndex;
        setTimeout("SelectedRow.focus();",0); 
    }
    
    function SelectSibling(e)
    { 
        var e = e ? e : window.event;
        var KeyCode = e.which ? e.which : e.keyCode;
        
        if(KeyCode == 40)
            SelectRow(SelectedRow.nextSibling, SelectedRowIndex + 1);
        else if(KeyCode == 38)
            SelectRow(SelectedRow.previousSibling, SelectedRowIndex - 1);
            
        return false;
    }


var g_windowReference = null;

function openWindow2(windowUrl)
{
//alert('i am openwinow');
 closeWindow2();

 var windowId = 'ModalPopUp_' + new Date().getTime();
 var windowFeatures = 'left=0,top=0,width=400px,height=200px';
 windowFeatures = 'height=325, width=800, resizable=yes, scrollbars=no';

 g_windowReference = window.open(windowUrl, windowId, windowFeatures);

 g_windowReference.focus();
}
function closeWindow2()
{
 if ( (g_windowReference != null) && (g_windowReference.closed == false) )
 {
  g_windowReference.close();
 }

 g_windowReference = null;
}

