﻿var d = new Date();
var ID = d.getDate()+""+d.getMonth() + 1+""+d.getFullYear()+""+d.getHours()+""+d.getMinutes()+""+d.getSeconds();

        
        function launchWindow(url, height, width)
        {		

            var left = (screen.availWidth - width)/2;
            var top = (screen.availHeight - height)/2;
            if (window.showModalDialog)
            {
                var _R = window.showModalDialog(url, window, "dialogWidth=" + width + "px;dialogHeight=" + height + "px;scroll=no;status=no;");
            }		
            else	//NS			
            {  	
                var left = (screen.width-width)/2;
                var top = (screen.height-height)/2;
                winHandle = window.open(url, ID, "modal,toolbar=false,location=false,directories=false,status=false,menubar=false,scrollbars=no,resizable=no,left="+left+",top="+top+",width="+width+",height="+height);
                winHandle.focus();
            }
            return false;
        }

//function launchWindow(url,height,width)
//{		
//    //var height = 350;
//    //var width = 450;
//    var left = (screen.availWidth - width)/2;
//    var top = (screen.availHeight - height)/2;
//    if (window.showModalDialog)
//    {
//       // var dialogArguments = new Object();
//        //var _R = window.showModalDialog(url, dialogArguments, "dialogWidth=450px;dialogHeight=350px;scroll=no;status=no;");
//       var dialogArguments = new Object();
//        var _R = window.showModalDialog(url, window);

////	        if ("undefined" != typeof(_R))
////	        {
////		        SetName(_R.strName);	
////	        }
//    }		
//    else	//NS			
//    {  	
//        var left = (screen.width-width)/2;
//        var top = (screen.height-height)/2;
//        winHandle = window.open(url, ID, "modal,toolbar=false,location=false,directories=false,status=false,menubar=false,scrollbars=no,resizable=no,left="+left+",top="+top+",width="+width+",height="+height);
//        winHandle.focus();
//    }
//    return false;
//}


function SetName(strName)
{
    document.Form1.txtName.value = strName;
}


// <summary>
// <ProjectInformation>JDMsite</ProjectInformation>
// <Name>OpenEditWindow</Name>
// <Author>Rohit Chauhan/Software Engineer</Author>
// <CreatedDate>12 September 2006</CreatedDate>
// <Purpose></Purpose>	
// <Description>For opening the Department,created, Reportee edit Window</Description>
// <ModificationHistory>
// <Version></Version>
// <Date>14-Sep-2006</Date>
// <Author>Rajiv Gupta</Author>
// <ChangeDescription>Added another parameter ControlID which will contain control clientID</ChangeDescription>
// </ModificationHistory> 
// <param name="VarOption">tells Department/ReportsTo/CreatedBy</param>
// <param name="ControlID">Listbox control clientID</param>
// <returns></returns>
// </summary>

function OpenEditWindow(VarOption,ControlID)
    {   
        if(VarOption=="Department")
        {
//        var obj = document.getElementById(ControlID);
//        var addIndex =obj.selectedIndex;
//        if(addIndex<0)
//        {
//            alert(SELECT_ATLEAST_ONE_DEPARTMENT);
//            obj.focus();
//            return false;
//        }
//        var lstSelectedValue = obj.item(obj.selectedIndex).value;
//        var lstSelectedText = obj.item(obj.selectedIndex).text;
        showModalDHTMLWin("/JDM/Settings/edit_dept.aspx?EntityId=88","smallFrame");
        }
        
        return false;
    }
// <summary>
// <ProjectInformation>JDMsite</ProjectInformation>
// <Name>OpenEditWindow</Name>
// <Author>Rohit Chauhan/Software Engineer</Author>
// <CreatedDate>12 September 2006</CreatedDate>
// <Purpose></Purpose>	
// <Description>For opening the Department,created, Reportee new Window</Description>
// <ModificationHistory>
// <Version></Version>
// <Date></Date>
// <Author></Author>
// <ChangeDescription></ChangeDescription>
// </ModificationHistory> 
// <param name=""></param>
// <param name=""></param>
// <returns></returns>
// </summary>
    function OpenNewWindow(VarOption)
    {
        if(VarOption=="Department")
        {
            showModalDHTMLWin("new_dept.aspx?Target=1", "smallFrame");
        }
        
        if(VarOption=="CreatedBy")
        {
            showModalDHTMLWin("new_create.aspx?Target=1","smallFrame");           
        }
        if(VarOption=="ReportsTo")
        {
           
            showModalDHTMLWin("new_reports.aspx?Target=1","smallFrame");           
            
        }
        return false;
    }
// <summary>
// <ProjectInformation>JDMsite</ProjectInformation>
// <Name>OpenEditWindow</Name>
// <Author>Rohit Chauhan/Software Engineer</Author>
// <CreatedDate>12 September 2006</CreatedDate>
// <Purpose></Purpose>	
// <Description>For opening the Department,created, Reportee Delete Window</Description>
// <ModificationHistory>
// <Version></Version>
// <Date>14-Sep-2006</Date>
// <Author>Rohit Chauhan</Author>
// <ChangeDescription>Added another parameter ControlID which will contain control clientID</ChangeDescription>
// </ModificationHistory> 
// <param name="VarOption">tells Department/ReportsTo/CreatedBy</param>
// <param name="ControlID">Listbox control clientID</param>
// <returns></returns>
// </summary>
    function OpenDeleteWindow(VarOption,ControlID)
    {
        if(VarOption=="Department")
        {
        var obj = document.getElementById(ControlID);
        var addIndex =obj.selectedIndex;
        if(addIndex<0)
        {
            alert(SELECT_ATLEAST_ONE_DEPARTMENT);
            obj.focus();
            return false;
        }
        var lstSelectedValue = obj.item(obj.selectedIndex).value;
        var lstSelectedText = obj.item(obj.selectedIndex).text;
        showModalDHTMLWin("delete_dept.aspx?EntityId=" + lstSelectedValue,"smallFrame");
       
        }
        if(VarOption=="CreatedBy")
        {
        var obj = document.getElementById(ControlID);
        var addIndex =obj.selectedIndex;
        if(addIndex<0)
        {
            alert(SELECT_ATLEAST_ONE_CREATEDBY);
            obj.focus();
            return false;
        }
        var lstSelectedValue = obj.item(obj.selectedIndex).value;
        var lstSelectedText = obj.item(obj.selectedIndex).text;
        showModalDHTMLWin("delete_create.aspx?EntityId=" + lstSelectedValue,"smallFrame")
        }
        
        if(VarOption=="ReportsTo")
        {
        var obj = document.getElementById(ControlID);
        var addIndex =obj.selectedIndex;
        if(addIndex<0)
        {
            alert(SELECT_ATLEAST_ONE_REPORTSTO);
            obj.focus();
            return false;
        }
        var lstSelectedValue = obj.item(obj.selectedIndex).value;
        var lstSelectedText = obj.item(obj.selectedIndex).text;
        showModalDHTMLWin("delete_reports.aspx?EntityId=" + lstSelectedValue,"smallFrame");
        }
        return false;
    }