﻿// JScript File
// Radio Button Validation
// copyright Stephen Chapman, 15th Nov 2004,14th Sep 2005
// you may copy this function but please keep the copyright notice with it
function valButton(btn) {
    var cnt = -1;
    alert(btn.length);
    for (var i=btn.length-1; i > -1; i--) {
        if (btn[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return btn[cnt].value;
    else return null;
}

function validateRdoGroup(group, mess)
{
    var btn = valButton(group);
    if (btn == null)
    {
        alert(mess);
        return false;
    }
    else return true;
}

function returnRefresh(returnVal) {            
    window.location.reload( true );          
}

function ShowModalPopup(id) 
{            
    $find(id).show(); 
}

function HideModalPopup(id) 
{
    $find(id).hide(); 
}

function checkdate(txt0, txt1, txt2)
{
    var selectedDate0 = new Date(txt0);
    var selectedDate1 = new Date(txt1);
    var selectedDate2 = new Date(txt2.value);
    selectedDate0.setHours(0,0,0,0);
    selectedDate1.setHours(0,0,0,0);
    selectedDate2.setHours(0,0,0,0);
  
    if (selectedDate2 < selectedDate0)
    {
	    alert('Select a date bigger than that!     ');
	    txt2.value = txt1;
    }
}
