var popWin='';
//		<SCRIPT language="JavaScript" src="~/class/JScript1.js"></SCRIPT>;
function ConfirmationWindow()
{
    var alertWin=null;
    alertWin = confirm("Are you sure"); 
    if(alertWin){ alert('You selected YES');}
    else{alert('You selected NO');}
}

function openModalWindow(jURL,xmlFile,ret1,ret2,pBack,iText)
{
    if(pBack==null){pBack=false;}
    if(iText==null){iText=true;}
    var iURL=jURL+"?pStr="+xmlFile+"&retVal="+ret1+"&retVal2="+ret2+"&pBack="+pBack+"&iTxt="+iText;
    if (popWin && popWin.open && !popWin.closed) {popWin.focus();return;} 
    if(window.showModalDialog){
        popWin=window.showModalDialog(iURL, self, "status:no;dialogWidth:510px;dialogHeight:420px;dialogHide:true;help:no;scroll:yes");
    }else {	popWin = window.open(iURL,"","width=510, height=420, top=300, left=500, toolbar=0, menubar=0, location=0, resizable=1,scrollbars=yes");}
    if((popWin != null) && (popWin.opener==null)){popWin.opener = self;	popWin.focus;}
    //    if (strReturn != null) document.getElementById(cName).value=strReturn;
}

function sendVal(valStr,ctlName)
{
	//Script passing data to main page
	var Script = "";
	if(window.opener && !window.opener.closed) {window.opener.document.getElementById('"+ctlName+"').value = '"+valStr+"'; }
	//	Script += " else {alert('cannot find object: "+ctlName+"'); }\n";
	//			Script += "window.opener.addOption('" + data + "');";
	self.close();			
}

function sendVal4Modal(valStr,ctlName)
{
	//Script passing data to main page
	var opener = window.dialogArguments;
	if(window.opener && !window.opener.closed) {window.opener.document.getElementById('"+ctlName+"').value = '"+valStr+"'; }
	//	Script += " else {alert('cannot find object: "+ctlName+"'); }\n";
	//			Script += "window.opener.addOption('" + data + "');";
	self.close();		
	//Check wether it is already registerd.
}

function setfocus ()
{
    setInterval('window.focus()',2000);
}

function SelectAllCheckboxes(spanChk){
    // Added as ASPX uses SPAN for checkbox
    var oItem = spanChk.children;
    var theBox=(spanChk.type=="checkbox")?spanChk:spanChk.children.item[0];
    xState=theBox.checked;
    elm=theBox.form.elements;
    for(i=0;i<elm.length;i++)
    if(elm[i].type=="checkbox" && elm[i].id!=theBox.id)
    {
        //elm[i].click();
        if(elm[i].checked!=xState)
        elm[i].click();
        //elm[i].checked=xState;
    }
}

function GetServerData1(msg) //this function name has to be referenced in the server site code of GetCallbackEventReference
 {
    //    alert(msg);
    // Set the new image
    var id = "_ctl0_cph1_Notes";
    var msgID="_ctl0_cph1_myMsg";
    var btnsend ="_ctl0_cph1_btnSend";
    var img = document.getElementById(id);
    // Set the new image
    img.innerHTML = msg;
    //           alert(url);
 }
 /* This is the code for traping a key press event.
document.onkeypress=function CheckKeyPress(event)
{
//  if(!e) e=window.event;
  var key = event.keycode ? event.keycode : event.which;
  if(key==13) txtMsg_onclick();
}
*/
