$(function() {

	// setup overlay actions to buttons
	$("a[rel]").overlay({
		
		// setup exposing (optional operation);
		onBeforeLoad: function() {
			this.expose();
		},				

		onLoad: function(content) {
			// find the player contained inside this overlay and load it
				// alert (document.contact_us_form.video.value)

				if (this.getContent().find("a.player").flowplayer(0) == undefined) {
					// do nothing, this is for calling the email link overlay

				} else {
					// go ahead and load that video for the user!
						this.getContent().find("a.player").flowplayer(0).load();

						// log the event
						$.get("videostats.php?clip=" + document.contact_us_form.video.value) ;
				}
		},
		
		onClose: function(content) {
			$f().unload();
			
			// close exposing
			$.expose.close();

		}
	});				
	
	// install flowplayers
	$("a.player").flowplayer("/video/flash/flowplayer-3.0.7.swf"); 
});