		function closeAndReturn(frm){ // this form!
			var selID; // holds the selected ID
			var callerControl; //holds the caller control ID
			selID=document.forms[0]['tSelectedID'].value;
			if (selID != 'tSelectedID') {
				callerControl=document.forms[0]['tCallerControl'].value;
				var arr = new Array(2);
				arr[0]=callerControl;
				arr[1]=selID;
				window.opener.receiveResult(arr);
			}
			window.close();
		}
		

		function openSearch(who,whom){ //who: ideally should be the name of the dropdown list which must be submitted
			//var id;
			//id=document.forms[0]['id_ID'].value;
			//window.open(whom + '?callerControl='+who+'id='+id.toString());
			windowname = "search";
			windowoptions = "status=yes,location=false,width=600,scrollbars=yes";
			window.open(whom + '?callerControl='+who, windowname, windowoptions);
		}

		function receiveResult(arr){ // x is the array (with data in 0, 1 and 2 pos.) which is "returned" by the Callee
			var a, b;
			a=arr[0]; b=arr[1]; //c=arr[2];
			document.forms[0].receiveText.value= a.toString()+';'+b.toString()//+';'+c.toString(); 
			document.forms[0].submit();
		}
		function clearDropdownResult(who){ //who: ideally should be the name of the dropdown list which must be submitte
			var arr = new Array(2);
			arr[0]=who;
			arr[1]=-1;
			receiveResult(arr);
		}
		function toggleLayer(whichLayer){var style2 = document.getElementById(whichLayer).style;
			style2.display = style2.display? "":"block";
		}

		function isDate(x)
		{
			var year, month, day, maxDays;
			var year1, month1, day1;
			arr=x.split("/");
			if (arr.length!=3)
			{
				return false;
			}
			day1 = Number(arr[0]);
			month1 = Number(arr[1]);
			year1 = Number(arr[2]);
			if (isNaN(day1) || isNaN(month1) || isNaN(year1)) {return false;}
			day = parseInt(day1);
			month = parseInt(month1);
			year = parseInt(year1);
			if ( (day != day1) || (month !=month1) || (year != year1) )
			{
				return false;
			}
			if (year < 1450 || year > 2100){ return false;}
			if (month < 1 || month > 12) {return false;}
			
			switch (month)
			{
				case 1:
				case 3:
				case 5:
				case 7:
				case 8:
				case 10:
				case 12:
					maxDays = 31;
					break;
				case 4:
				case 6:
				case 9:
				case 11:
					maxDays = 30;
					break;
				case 2:
					maxDays = 28;
					if ( ((year % 4) == 0 ) && ( ((year % 100) != 0 ) || ( (year % 400) == 0) ) )
					{ maxDays = 29; }
					break;
				default:
					return false;
			}
			if (day < 1 || day > maxDays) {return false;}
			
			return true;
		}
	  
  		function validateDate(osrc, args){
  			if (isDate(args.Value)==false){
				args.IsValid = false;
				return;
			}
			return true;
		}
		
		function upload( field, path)
		{
		  windowname = "upload";
			windowoptions = "width=400,height=150,status=yes";
			uploadfile = "upload.asp?field=" + field;
			//alert(document.title);
			path = '/photos/' + document.title;
			uploadfile += "&path=" + path
			//alert(path);
			window.open( uploadfile, windowname, windowoptions ); 
		}

		function kaka(){
			window.alert('pipi');
		}
