var md =  {
	
	/*lastContent: null,*/
	
	
	defaultAnimationSpeed: 2,
	
	updater:null,
	
	
	
	loadContent: function(id)
	{
		this.cancelUpdate();
		this.showProgress();
		this.updater=new Ajax.Updater("innercontent","loadContent.php?id="+id,
						 {
						 	onSuccess : this.hideProgress.bindAsEventListener(this),
						 	evalScripts: true
						 	
						 });
		
		
	},
	
	cancelUpdate: function()
	{
		if (this.updater!=null)
		{
			this.updater.transport.abort();
			updater=null;
		}
	
	},
	
	
	showProgress: function()
	{
		var wait = $("Wait");
		var d = $("innercontent").getDimensions();
		wait.style.left="300px";
		wait.style.top="196px";
		wait.style.width = d.width+"px";
		wait.style.height = d.height+"px";
		wait.style.lineHeight = wait.style.height;
		wait.show();
		$('innercontent').style.opacity='0';
	},
	
	hideProgress: function()
	{
		$("Wait").hide();	
		new Effect.Morph('innercontent',
		{
			style:'opacity:1.0;',
			queue : {scope:'md'},
			duration: this.defaultAnimationSpeed,
			afterFinish: this.cleanUpFade.bind(this)		
		});
			
		
	},
	
	cleanUpFade: function()
	{
		$("innercontent").style.opacity = '1.0';
	},
	
	showSection: function(source, id, changesectionshot)
	{
		$$("#page-nav A").each (function(item)
								{
									if (item==source)
										item.addClassName("selected");
									else
										item.removeClassName("selected");
								}
								);
		
		$$(".section").each(function(item) 
								{
									if (item.id==id)
										item.show();
									else
										item.hide(); 
								});		
								
		if (changesectionshot)
		{
			$("sectionshot").src = "/content/images/"+id+".jpg";
		}
	},
	
	submitForm: function()
	{
		
		var params = Form.serialize('contactform');
		this.updater=new Ajax.Updater("innercontent","contactSubmit.php",
						 {
						 	method: 'POST',
						 	parameters: params,
						 	onSuccess : this.showContactResult.bindAsEventListener(this),
						 	evalScripts: true
						 	
						 	
						 });
		return false;
	
	},
	
	showContactResult: function()
	{
		
	},
	
	__end__:function(){}
	
}
