//----------------------------------------------------------------
function ShowPicker(element)
{
	var obj;
	if(document.all)
		obj = document.all[element];
    else if(document.getElementById)
		obj = document.getElementById(element);
    //alert('document.all[element] : '+element);
    vle = obj.value;
    obj.style.backgroundColor="#dddddd";
    //alert('value from Form: '+vle); 
    var cSearchValue = showModalDialog("../../Script/calendar.asp?vle="+vle,0,"dialogwidth=210px;dialogheight=240px;status=no;scrollbar=no");
	//alert('value of showModalDialog: '+cSearchValue);
    if (cSearchValue != -1 && cSearchValue != null && cSearchValue != "")
    {
    	obj.value = cSearchValue;
    }
    else if(cSearchValue==0)
    {
		obj.value = "";
    }
		
    obj.style.backgroundColor="#ffffff";
}
//'----------------------------------------------------------------------    
function isDate(str)
{
		id   = str.indexOf("/");
		im   = str.lastIndexOf("/");
		
		dd   = str.substr(0,id);
		mm   = str.substr(id+1,im-id-1);
		yyyy = str.substr(im+1);
		
	templ = "dd/mm/yyyy";
	
	if(isNaN(dd)||isNaN(mm)||isNaN(yyyy))
	{
	  ms = Date.parse(str);
		  
	  if(isNaN(ms)) return templ;
	                return templ;
    }
    else
    {
        if(dd   <1    || dd > 31)              return templ;
        if(mm   <1    || mm   > 12)            return templ;
        if(yyyy <2000 || yyyy > 3000)          return templ;
        if(yyyy%4==0 & mm==2 & dd>29)          return templ;
        if(yyyy%4!=0 & mm==2 & dd>28)          return templ;
        if((mm==4||mm==6||mm==9||mm==11)&dd>30)return templ;
    }
                                               return str;
}
//'----------------------------------------------------------------------    
function nowToString()
{
		       objDate = new Date ();
		       
		dd   = objDate.getDate();       if (dd<10) dd = "0" + dd;
		mm   = objDate.getMonth() + 1;  if (mm<10) mm = "0" + mm;
		yyyy = objDate.getFullYear();

		mmddyyyy = dd + "/"+ mm + "/" + yyyy;

    return mmddyyyy;		
}
//----------------------------------------------

