﻿// JScript File
var HasChanges = false;

function deleteConfirmation()
    {   
        return confirm('Are you sure to delete?');
    }
    
function RowClick(index)
{
    if (HasChanges)
    {
    if ((this.Rows[index].ItemType == "Item" || this.Rows[index].ItemType == "AlternatingItem"))
    {
        alert('Hi');
    }
    }
}


function RowSelected(rowObject)
 { 
 //alert('hi');
//alert (RadGrid1.MasterTableView.Columns.length) 
//alert (RadGrid1.MasterTableView.Columns[RadGrid1.MasterTableView.Columns.length-1].UniqueName) 
//alert (RadGrid1.MasterTableView.SelectedRows[0].Control.className);

//alert (RadGrid1.MasterTableView.SelectedRows[0].Control);
//var vcell = RadGrid1.MasterTableView.GetCellByColumnUniqueName (rowObject,RadGrid1.MasterTableView.Columns[RadGrid1.MasterTableView.Columns.length-1].UniqueName);
var vcell = RadGrid1.MasterTableView.GetCellByColumnUniqueName (rowObject,RadGrid1.MasterTableView.Columns[0].UniqueName);
vcell.className='SeletedRow1';
 }
function RowDeselected(rowObject)
 { 
    var vcell = RadGrid1.MasterTableView.GetCellByColumnUniqueName (rowObject,RadGrid1.MasterTableView.Columns[0].UniqueName);
    vcell.className='';
 }
 
 
var RadGrid1=null;

function GetGridObject()
{
    RadGrid1 = this;    
    //alert('GetGridObject');    
}



function checkGridSelection(gridName,message)
{

var iSelRow = RadGrid1.MasterTableView.SelectedRows.length ;
//alert(iSelRow );
if (iSelRow ==0)
    {
        if(message == null)
            alert ("Please Select Row !");
        else
            alert(message);    
        return false;
    }
else
    {
        return  true;
    }        
    
}
 function trapKey(e,btnId)
    {
        var key = e.keyCode;        
        if(key== 13)
        {      
            document.getElementById(btnId).click();
            e.keyCode=0;d
        }
    }
    
    var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = window.open(URLStr, 'Popup', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function popupclose()
{
    window.close();
}

function CopyToClipBoard(obj)
{
    obj1=document.getElementById(obj);
    Copied = obj1.createTextRange();
    Copied.execCommand("Copy");
    return false;
}

 function CheckDate(FromDate,ToDate)
{
        var strFromDateId= FromDate + '_txtDateBox';
        var strToDateId= ToDate + '_txtDateBox';
        
        var obj1 = document.getElementById(strFromDateId);
        var obj2 = document.getElementById(strToDateId);

        if(obj1 != null && obj2 != null)
        {
            var Fromstr = obj1.value.split("/");
            var Tostr = obj2.value.split("/");
            
            var FromDate = new Date(Fromstr[2],Fromstr[1],Fromstr[0]);            
            var ToDate = new Date(Tostr[2],Tostr[1],Tostr[0]);
            
            //if(Date.parse(obj2.value).format("dd/m/yy") < Date.parse(obj1.value).format("dd/m/yy"))
            if(ToDate < FromDate)
            {
                alert('To Date Greater Than From Date');
                return false;
            }
//            else if(Date.parse(obj2.value) == Date.parse(obj1.value))
//            {
//                alert('To Date and From Date are identical');
//                return false;
//            }
            else                   
                return Page_ClientValidate();
        }        
}
    
function CheckExpireDate(ExpireDate,TodayDate)
{   
        var strId= ExpireDate + '_txtDateBox';
        //alert('1');
        var obj = document.getElementById(strId);
        if(obj != null)
        {
            if(Date.parse(obj.value) <= Date.parse(TodayDate))
            {
                alert('Select ExpiryDate Greater Than Current Date');
                return false;
            }
            else
                return Page_ClientValidate();
        }            
        else
            return Page_ClientValidate();
}


