/* 

	In this file we setup our Windows, Columns and Panels,
	and then inititialize MUI.
	
	At the bottom of Core.js you can setup lazy loading for your
	own plugins.

*/

/*
  
INITIALIZE WINDOWS

	1. Define windows
	
		var myWindow = function(){ 
			new MUI.Window({
				id: 'mywindow',
				title: 'My Window',
				contentURL: 'pages/lipsum.html',
				width: 340,
				height: 150
			});
		}

	2. Build windows on onDomReady
	
		myWindow();
	
	3. Add link events to build future windows
	
		if ($('myWindowLink')){
			$('myWindowLink').addEvent('click', function(e) {
				new Event(e).stop();
				jsonWindows();
			});
		}

		Note: If your link is in the top menu, it opens only a single window, and you would
		like a check mark next to it when it's window is open, format the link name as follows:

		window.id + LinkCheck, e.g., mywindowLinkCheck

		Otherwise it is suggested you just use mywindowLink

	Associated HTML for link event above:

		<a id="myWindowLink" href="pages/lipsum.html">My Window</a>	


	Notes:
		If you need to add link events to links within windows you are creating, do
		it in the onContentLoaded function of the new window. 
 
-------------------------------------------------------------------- */

initializeWindows = function(){
	$$('a.returnFalse').each(function(el) {
		el.addEvent('click', function(e) {
			new Event(e).stop();
		});
	});
	
	MUI.loginWindow= function(){
		new MochaUI.Modal({
			id: 'modalLogin',
			loadMethod: 'xhr', 
			contentURL: 'logininner.php',
			addClass : 'loginform',
			headerHeight: 0,
			footerHeight: 0,

			scrollbars : false,
			toolbar : false,
			toolbarPosition : 'top',
			toolbarHeight : 45,
			toolbarURL : 'powerby.html',
			width: 400,
			height: 220

				
		
			/*onContentLoaded: function(){ 
			
				if($('loginbtn')){
					
			 		$('loginbtn').addEvent('click',function(){ 

					
						var req = new Request.HTML({
				  		url: 'logininner.php',
				   		method: 'get',
			

						
               			});

				 	if(req)
				 		{
							
							($('modalDemo')).setStyle('height', 500);
							($('modalDemo_contentWrapper')).setStyle('height', '');
						}
					
					});
					
				}
			}*/
	});
	}
	if ($('loginModalLink')){
		$('loginModalLink').addEvent('click', function(e){
			new Event(e).stop();
			MUI.loginWindow();
		});
	}
	

	
	MUI.myChain.callChain();
};
/*
INITIALIZE COLUMNS AND PANELS  

	Creating a Column and Panel Layout:
	 
	 - If you are not using panels then these columns are not required.
	 - If you do use panels, the main column is required. The side columns are optional.
	 
	 Columns
	 - Create your columns from left to right.
	 - One column should not have it's width set. This column will have a fluid width.
	 
	 Panels
	 - After creating Columns, create your panels from top to bottom, left to right.
	 - One panel in each column should not have it's height set. This panel will have a fluid height.	 
	 - New Panels are inserted at the bottom of their column. 
 
-------------------------------------------------------------------- */

// Initialize MochaUI when the DOM is ready
window.addEvent('load', function(){ //using load instead of domready for IE8
	MUI.myChain = new Chain();
	MUI.myChain.chain(
			
	function(){initializeWindows();}		
	).callChain();	
});

