function about(){
	alert("AD Group Online Management 1.0.2.0.\nRelease date 11/01/2007.\n \251 2004 - 2007 All rights reserved.");
}

function logout(){
	if(confirm('This will log you out.')){
		javascript:location.href = '../index.php?action=logout';
	}
}

function BrowserInfo()
{
  this.name = navigator.appName;
  this.codename = navigator.appCodeName;
  this.version = navigator.appVersion.substring(0,4);
  this.platform = navigator.platform;
  this.javaEnabled = navigator.javaEnabled();
  this.screenWidth = screen.width;
  this.screenHeight = screen.height;
}

var b = new BrowserInfo();

// GENERIC POPUP SCRIPT WITH scroll,width,height PARAMETERS
//----------------------------------------------------------
function popup(url, name, width, height, scroll, menu, tools){

	// center the window
	var toppos = (screen.availHeight-height)/2;
	var leftpos = (screen.availWidth-width)/2;
	
	// where to position the window
	// var toppos = scrheight * 0.1;
	// var leftpos = scrwidth * 0.1;
	
	// screen resolution
	var scrheight = screen.availHeight;
	var scrwidth = screen.availWidth;
	
	// create the window command
	command = "aWindow=window.open('" + url + "', '" + name +"', 'width=" + width + ",height=" + height + ",scrollbars=" + scroll + ",toolbar="+tools+",menubar="+menu+",top=" + toppos +",left="+ leftpos +",screenX="+ toppos +",screenY="+ leftpos +",resizable=yes')";
	// execute the command
	eval(command);

}

function open_calendar(field){

	field_name = field.name
	
	// alert(field_name);
	
	var day, month, year, parts;
	var str = field.value;
	
	if(str != ''){
		
		bits = str.split('/');

		day = bits[0];
		month = bits[1];
		year = bits[2];
		
	}else{
		day = '';
		month = '';
		year = '';
	}
	
	// alert(b.name);
	
	if(b.name == 'Netscape'){
		/**
			*@ todo get the form reference from the field and pass it to the window.
			*/
		parts = window.open("calendar.php?field_name="+field_name+"&day="+day+"&month="+month+"&year="+year, "calendar", "width=290,height=290,resizable,scrollbars=yes,status=1,modal");
		
	}else{

		parts = window.showModalDialog("calendar.php?field_name="+field_name+"&day="+day+"&month="+month+"&year="+year,"args","dialogHeight: 290px; dialogWidth: 290px; dialogTop: px; dialogLeft: px; edge: Raised; center: Yes; help: No; resizable: Yes; status: No;");
		
		if(parts != null){

			day = parts[0];
			month = parts[1];
			year = parts[2];
			
			field.value = day+"/"+month+"/"+year;
			
		}
	}
}

function test_function(msg){
	alert(msg);
}

// The delete warning popup

function del_att(id) {
	var answer = confirm("Are you sure you wish to delete this attendee?")
     if (answer){
	 	window.location="engine.php?model=attendee&view=delete&attendee_id="+id;
     }
     else{
         alert("Delete cancelled.")
     }	
}

function del_con(id) {
	var answer = confirm("Are you sure you wish to delete this event?")
     if (answer){
	 	window.location="engine.php?model=event&view=delete&event_id="+id;
         alert("Event deleted");
     }
     else{
         alert("Delete cancelled.")
     }
	
}
