function confirmDelete() 
{ 
	if (confirm("Are you sure you want to delete this record?")==true) 
		return true; 
	else 
		return false; 
}

function fnTrapKD(btn){
    if (document.all){
		if (event.keyCode == 13)
		{ 
			event.returnValue=false;
			event.cancel = true;
			btn.click();
		} 
    } 
}

function closeWindow(val)
{
	//set return value of the dialog box or dialog result
	top.returnValue=val;

	//close the dialog window
	window.close();
}


function GetDate(url, CtrlName)   
 {   
	/****************************************************      
	Use Javascript method (window.open) to PopUp a new window    
	which contain a Calendar Control. In the meantime, we'll    
	pass the Parent Form Name and Request Control Name in the QueryString!      
	*****************************************************/        
	ChildWindow = window.open('Calendar.aspx?FormName=' + document.forms[0].name + '&CtrlName=' + CtrlName, "PopUpCalendar", "width=270,height=300,top=200,left=200,toolbars=no,scrollbars=no,status=no,resizable=no");    
}   
	
function CheckWindow()   
{      
	ChildWindow.close();   
}

var ModalDialogWindow;
var ModalDialogInterval;
var ModalDialog = new Object;

ModalDialog.value = '';
ModalDialog.eventhandler = '';

function ModalDialogMaintainFocus()
{
  try
  {
    if (ModalDialogWindow.closed)
     {
        window.clearInterval(ModalDialogInterval);
        eval(ModalDialog.eventhandler);       
        return;
     }
    ModalDialogWindow.focus(); 
  }
  catch (everything) {   }
}
        

function doDialog(theURL, controlId, winheight, winwidth)
{
	//declare a string variable
	ModalDialogRemoveWatch();
    ModalDialog.eventhandler = 'YesNoMaybeReturnMethod()';
   
	//var x="";
	//x=showModalDialog(theURL,'popup','dialogWidth:' + winwidth + 'px;dialogHeight:' + winheight + 'px;dialogTop:250px;dialogLeft:250px;center:Yes;status:no;resizable:no;scrollbars:yes;menubar:no');
	//if(x!="" && x!=null)
	//{
		//fill the textbox with selected value
	//	document.getElementById(controlId).value=x;
	//}
	
	ModalDialogWindow = window.open(theURL,'popup','toolbar=0,location=0,width=' + winwidth + ',height=' + winheight + ',top=250,left=250,center=1,status=0,resizable=0,scrollbars=1,menubar=0');
	ModalDialogWindow.focus(); 
    ModalDialogInterval = window.setInterval("ModalDialogMaintainFocus()",5);
}

 function ModalDialogRemoveWatch()
 {
    ModalDialog.value = '';
    ModalDialog.eventhandler = '';
 }
 
 function YesNoMaybeReturnMethod()
{
    //document.getElementById('modalreturn2').value = ModalDialog.value;
    ModalDialogRemoveWatch();
}
