﻿var win; 
var varSchedule;

document.oncontextmenu = new Function ("return false");
document.ondragstart = new Function ("return false");
document.onselectstart = new Function ("return false");
if(document.layers) {
    window.captureEvents(Event.MOUSEDOWN);
}

function listMembers(id,iDay)
{
  document.getElementById("hdnDay").value = iDay; 
  __doPostBack(id,'');
}

function listEvents(id,iDay)
{
  document.getElementById("hdnEvent").value = iDay;
  __doPostBack(id,'');
}

function SaveSchedule(id,schedule)
{
    var ctrl = document.getElementById('hdnSchedule');
    var idctrl = document.getElementById(id);
    ctrl.value = schedule;
    __doPostBack(idctrl,ctrl.value);
}

function isNumberKey(evt)
{
     var charCode = (evt.which) ? evt.which : event.keyCode
     if (charCode > 31 && (charCode < 48 || charCode > 57))
        return false;

     return true;
}

function isCharacterKey(evt)
{
 var charCode = (evt.which) ? evt.which : event.keyCode
 if (charCode > 31 && (charCode < 65 || charCode > 90) && (charCode < 97 || charCode > 122))
    return false;

 return true;
}

function isCharacterWithSpaceKey(evt)
{
 var charCode = (evt.which) ? evt.which : event.keyCode
 if (charCode > 31 && (charCode < 65 || charCode > 90) && (charCode < 97 || charCode > 122))
 {
    if(charCode != 32)
        return false;
 }

 return true;
}

function isCharNumKey(evt)
{
 var charCode = (evt.which) ? evt.which : event.keyCode
 if (charCode > 31 && (charCode < 48 || charCode > 57) && (charCode < 65 || charCode > 90) && (charCode < 97 || charCode > 122))
    return false;

 return true;
}

function doSearch()
{
  var btn = document.getElementById('btnSearch');  
  var txtval = document.getElementById('txtSearchValue').value;
  if(event.keyCode == 13)
  {
       if(txtval != ""){        
         document.getElementById('btnSearch').click();
         }
  }
}

function showWindow() {
if (window.showModalDialog) {
    win=window.showModalDialog("Parish_NewComersResourcePool.aspx","win","dialogWidth:730px;dialogHeight:480px");
} else {
    win=window.open('Parish_NewComersResourcePool.aspx','win','height=480,width=730,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no ,modal=yes');
  }
} 

function clearSearch(){
    if(document.getElementById('txtSearchValue')!=null){
        document.getElementById('txtSearchValue').value='';
    }
}

function showVBSWindow() {
if (window.showModalDialog) {
    win=window.showModalDialog("VBSStudent.aspx","win","dialogWidth:1020px;dialogHeight:800px;resizable:yes;status:no;center:yes;");
} else {
    win=window.open('VBSStudent.aspx','win','height=800,width=1020,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,modal=yes');
  }
} 

function showChoirFestivalWindow() {
if (window.showModalDialog) {
    win=window.showModalDialog("ChoirFestival.aspx","win","dialogWidth:1020px;dialogHeight:800px;resizable:no;status:no;center:yes;");
} else {
    win=window.open('ChoirFestival.aspx','win','height=800,width=1020,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,modal=yes');
  }
} 

function showPopup(id,selDate)
{
    var modalDialog = $find(id); 
    if(modalDialog!=null){        
        var lblDt = document.getElementById("bkReq_lblBookingDate");
        var hdnDt = document.getElementById("bkReq_hdnBookingDate");
        var msg = document.getElementById("bkReq_lblConfirmation");
        if(lblDt != null)
        {
            lblDt.innerText = selDate;
            hdnDt.value = selDate;
        }
        if(msg != null)
        {            
          msg.innerText = "";
          msg.style.visibility = "hidden";
        }
        modalDialog.show();        
    }
}

function showConfirmationMsg()
{
    var msg = document.getElementById("bkReq_lblConfirmation");
    if(msg!=null)
    {
        msg.innerText = "Thank you for the request. Someone will contact you shortly!!";
        msg.style.visibility = "visible";
    }
}    
