/* -----------------------------------------------------------------

	In this file:
	
	1. Define windows
	
		var myWindow = function(){ 
			new MochaUI.Window({
				id: 'mywindow',
				title: 'My Window',
				loadMethod: 'xhr',
				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(){
	// TheCATLounge Windows
	
/* Music */
MochaUI.songzaWindow = function()
	{ 
		new MochaUI.Window
		({
			id: 'songza',
			title: 'Your Gateway To Music',
			type: 'window',
			loadMethod: 'iframe',
			contentURL: 'http://songza.com/',
			headerStartColor: [051, 153, 051],
			headerStopColor: [153, 051, 000],
			resizableColor: [153, 051, 000],
			width: 650,
			height: 400,
                        x: 350,
			y: 60
		});//MochaUI.Window
	}//MochaUI.songzaWindow	
	if ($('songzaWindowLink'))
	{ 
		$('songzaWindowLink').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.songzaWindow();
		});
	}

      /* Mayanagar */
	MochaUI.mayanagarWindow = function()
	{ 
		new MochaUI.Window
		({
			id: 'mayanagar',
			title: 'Mayanagar',
			loadMethod: 'iframe',
			contentURL: 'http://www.mayanagar.com/index.jsp',
			headerStartColor: [198, 083, 186],
			headerStopColor: [051, 153, 051],
			resizableColor: [153, 051, 000],
			width: 800,
			height: 450
		});//MochaUI.Window
	}//MochaUI.mayanagarWindow
	if ($('mayanagarWindowLink'))
	{ 
		$('mayanagarWindowLink').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.mayanagarWindow();
		});
	}

	<!-- Feedback Window -->
MochaUI.feedbackWindow = function()
	{ 
		new MochaUI.Window
		({
			id: 'feedback',
			title: 'Feedback',
			loadMethod: 'iframe',
			contentURL: 'feedback.php',
			headerStartColor: [051, 153, 051],
			headerStopColor: [153, 051, 000],
			resizableColor: [153, 051, 000],
			width: 600,
			height: 450
		});//MochaUI.Window
	}//MochaUI.uerProfileWindow	
	if ($('feedbackWindowLink'))
	{ 
		$('feedbackWindowLink').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.feedbackWindow();
		});
	}//if

 <!-- Wod Window -->
MochaUI.wodWindow = function()
	{ 
		new MochaUI.Window
		({
			id: 'wod',
			title: 'Word of the day',
			loadMethod: 'iframe',
			contentURL: 'WoD.php',
			headerStartColor: [051, 153, 051],
			headerStopColor: [153, 051, 000],
			resizableColor: [153, 051, 000],
			width: 300,
			height: 175,
                        x: 300,
                        y: 250
		});//MochaUI.Window
	}//MochaUI.wodWindow
	if ($('wodWindowLink'))
	{ 
		$('wodWindowLink').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.wodWindow();
		});
	}


	MochaUI.democlassWindow = function()
	{ 
		new MochaUI.Window
		({
			id: 'democlass',
			title: 'demo class query',
			loadMethod: 'iframe',
			contentURL: 'democlassQuery.php',
			headerStartColor: [051, 153, 051],
			headerStopColor: [153, 051, 000],
			resizableColor: [153, 051, 000],
			width: 600,
			height: 300
		});//MochaUI.Window
	}//MochaUI.uerProfileWindow	
	if ($('democlassWindowLink'))
	{ 
		$('democlassWindowLink').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.democlassWindow();
		});
	}
	
	<!-- TheCatlounge Faq's -->
	MochaUI.catfaqWindow = function(){ 
		new MochaUI.Window({
			id: 'catfaq',
			loadMethod: 'iframe',
			title: 'Faq of THECatlounge',
			contentURL: 'faq.php',
			headerStartColor: [051, 153, 051],
			headerStopColor: [153, 051, 000],
			resizableColor: [153, 051, 000],
			width: 550,
			height: 500
		});
	}	
	if ($('catfaqWindowLink')){ 
		$('catfaqWindowLink').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.catfaqWindow();
		});
	}	
	
	<!-- TheCatlounge about us -->
	MochaUI.cataboutusWindow = function(){ 
		new MochaUI.Window({
			id: 'cataboutus',
			loadMethod: 'iframe',
			title: 'About THECatlounge',
			contentURL: 'aboutus.php',
			headerStartColor: [051, 153, 051],
			headerStopColor: [153, 051, 000],
			resizableColor: [153, 051, 000],
			width: 550,
			height: 500
		});
	}	
	if ($('cataboutusWindowLink')){ 
		$('cataboutusWindowLink').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.cataboutusWindow();
		});
	}	
	
	<!-- TheCatlounge contact us -->
	MochaUI.catcontactusWindow = function(){ 
		new MochaUI.Window({
			id: 'catcontactus',
			loadMethod: 'iframe',
			title: 'About THECatlounge',
			contentURL: 'contactus.php',
			headerStartColor: [051, 153, 051],
			headerStopColor: [153, 051, 000],
			resizableColor: [153, 051, 000],
			width: 550,
			height: 500
		});
	}	
	if ($('catcontactusWindowLink')){ 
		$('catcontactusWindowLink').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.catcontactusWindow();
		});
	}	
	
	
	<!-- TheCatlounge Registration -->
	MochaUI.registrationWindow = function(){ 
		new MochaUI.Window({
			id: 'registration',
			loadMethod: 'iframe',
			title: 'Register to Open New Gateways of your Life',
			contentURL: 'registration.php',
			headerStartColor: [051, 153, 051],
			headerStopColor: [153, 051, 000],
			resizableColor: [153, 051, 000],
			width: 550,
			height: 500,
			onBeforeBuild: onRegFire()
		});
	}	
	if ($('registrationWindowLink')){ 
		$('registrationWindowLink').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.registrationWindow();
		});
	}	
	
	
	<!-- TheCatlounge Registration -->
	MochaUI.forgotpwdWindow = function(){ 
		new MochaUI.Window({
			id: 'forgotpwd',
			loadMethod: 'iframe',
			title: 'Forgot Pasword? Don\'t worry we will mail you',
			contentURL: 'forgotPassword.php',
			headerStartColor: [051, 153, 051],
			headerStopColor: [153, 051, 000],
			resizableColor: [153, 051, 000],
			width: 400,
			height: 300,
			onBeforeBuild: onRegFire()
		});
	}	
	if ($('forgotpwdWindowLink')){ 
		$('forgotpwdWindowLink').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.forgotpwdWindow();
		});
	}	
	/* flash based doodles */
	MochaUI.cooldrawingWindow = function()
	{ 
		new MochaUI.Window
		({
			id: 'cooldrawing',
			title: 'Cool Drawing',
			loadMethod: 'iframe',
			contentURL: 'http://www.mattfacer.com/doodle/',
			resizable: false,
			scrollbars: false,
			headerStartColor: [051, 153, 051],
			headerStopColor: [153, 051, 000],
			resizableColor: [153, 051, 000],
			width: 600,
			height: 475
		});//MochaUI.Window
	}	
	if ($('cooldrawingWindowLink'))
	{ 
		$('cooldrawingWindowLink').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.cooldrawingWindow();
		});
	}//if

	
	<!-- User Profile Window -->
	MochaUI.userprofileWindow = function()
	{ 
		new MochaUI.Window
		({
			id: 'userprofile',
			title: 'Profile',
			loadMethod: 'xhr',
			contentURL: 'userProfile.php',
			headerStartColor: [051, 153, 051],
			headerStopColor: [153, 051, 000],
			resizableColor: [153, 051, 000],
			width: 600,
			height: 450
		});//MochaUI.Window
	}	
	if ($('userprofileWindowLink'))
	{ 
		$('userprofileWindowLink').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.userprofileWindow();
		});
	}//if
	
	<!-- Problem Session Window -->
	MochaUI.problemSessionWindow = function()
	{ 
		new MochaUI.Window
		({
			id: 'problemSession',
			title: 'Problem Session',
			loadMethod: 'iframe',
			contentURL: 'problemsession.php',
			headerStartColor: [051, 153, 051],
			headerStopColor: [153, 051, 000],
			resizableColor: [153, 051, 000],
			width: 600,
			height: 450
		});//MochaUI.Window
	}//MochaUI.uerProfileWindow	
	if ($('problemSessionWindowLink'))
	{ 
		$('problemSessionWindowLink').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.problemSessionWindow();
		});
	}//if
	
	<!-- Rapid Fire Window -->
	MochaUI.rapidfireWindow = function()
	{ 
		new MochaUI.Window
		({
			id: 'rapidfire',
			title: 'Rapid Fire.. Please have patience as it will take time to load',
			loadMethod: 'iframe',
			contentURL: '../demos/flashCards/demo.html',
			headerStartColor: [051, 153, 051],
			headerStopColor: [153, 051, 000],
			resizableColor: [153, 051, 000],
			width: 600,
			height: 450
		});//MochaUI.Window
	}
	if ($('rapidfireWindowLink'))
	{ 
		$('rapidfireWindowLink').addEvent('click', function(e){	
			MochaUI.notification('Rapid Fire');
			new Event(e).stop();
			MochaUI.rapidfireWindow();
		});
	}//if
	
	<!-- Yahoo Messenger Window -->
	MochaUI.yahoomessengerWindow = function()
	{ 
		new MochaUI.Window
		({
			id: 'yahoomessengerWindow',
			title: 'Yahoo Messenger',
			loadMethod: 'iframe',
			contentURL: 'http://webmessenger.yahoo.com/',
			headerStartColor: [051, 153, 051],
			headerStopColor: [153, 051, 000],
			resizableColor: [153, 051, 000],
			width: 850,
			height: 450
		});//MochaUI.Window
	}
	if ($('yahoomessengerWindowLink'))
	{ 
		$('yahoomessengerWindowLink').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.yahoomessengerWindow();
		});
	}//if
	
	<!-- TheCatlounge Articles -->
	MochaUI.articleWindow = function(){ 
		new MochaUI.Window({
			id: 'article',
			loadMethod: 'xhr',
			title: 'Amazing Articles',
			contentURL: 'article.php',
			headerStartColor: [051, 153, 051],
			headerStopColor: [153, 051, 000],
			resizableColor: [153, 051, 000],
			width: 450,
			height: 300
		});
	}	
	if ($('articleWindowLink')){ 
		$('articleWindowLink').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.articleWindow();
		});
	}	
	
	<!--  TheCatlounge problem sample -->
	MochaUI.problemsampleWindow = function(){ 
		new MochaUI.Window({
			id: 'problemsample',
			loadMethod: 'iframe',
			title: 'Problem Samples',
			contentURL: 'probsample.php',
			headerStartColor: [051, 153, 051],
			headerStopColor: [153, 051, 000],
			resizableColor: [153, 051, 000],
			width: 450,
			height: 300
		});
	}	
	if ($('problemsampleWindowLink')){ 
		$('problemsampleWindowLink').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.problemsampleWindow();
		});
	}	
	
	<!--  TheCatlounge offerings page -->
	MochaUI.catofferingsWindow = function(){ 
		new MochaUI.Window({
			id: 'catofferings',
			title: 'TheCATLounge Offerings',
			loadMethod: 'iframe',
			contentURL: 'http://www.thecatlounge.com/offerings.php',
			headerStartColor: [051, 153, 051],
			headerStopColor: [153, 051, 000],
			resizableColor: [153, 051, 000],
			width: 900,
			height: 500,
			x: 100,
			y: 60 
		});
	}	
	if ($('catofferingsWindowLink'))
	{ 
		$('catofferingsWindowLink').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.catofferingsWindow();
		});
	}	
	
	<!--  TheCatlounge News & Latest Happening page -->
	MochaUI.catnewsWindow = function(){ 
		new MochaUI.Window({
			id: 'catnews',
			title: 'TheCATLounge Tid-bits',
			loadMethod: 'iframe',
			contentURL: '../ModuleNews/catNews.php',
			headerStartColor: [051, 153, 051],
			headerStopColor: [153, 051, 000],
			resizableColor: [153, 051, 000],
			width: 300,
			height: 175,
			x: 300,
			y: 15 
		});
	}	
	if ($('catnewsWindowLink'))
	{ 
		$('catnewsWindowLink').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.catnewsWindow();
		});
	}

	<!--  TheCatlounge Gaming page -->
	MochaUI.catgameWindow = function(){ 
		new MochaUI.Window({
			id: 'catgame',
			title: 'The CATLounge Gaming Zone',
			loadMethod: 'iframe',
			contentURL: 'catGame.php',
			headerStartColor: [051, 153, 051],
			headerStopColor: [153, 051, 000],
			resizableColor: [153, 051, 000],
			width: 600,
			height: 450,
			x: 400,
			y: 70 
		});
	}	
	if ($('catgameWindowLink'))
	{ 
		$('catgameWindowLink').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.catgameWindow();
		});
	}

		<!--  TheCatlounge Qod page -->
	MochaUI.qodWindow = function(){ 
		new MochaUI.Window({
			id: 'qod',
			title: 'Question of the day',
			loadMethod: 'iframe',
			contentURL: '../qod/qod1.php',
			headerStartColor: [051, 153, 051],
			headerStopColor: [153, 051, 000],
			resizableColor: [153, 051, 000],
			width: 350,
			height: 425,
                        x: 675,
                        y: 20
			
		});
	}	
	if ($('qodWindowLink'))
	{ 
		$('qodWindowLink').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.qodWindow();
		});
	}
	
	<!--  catlounge youtube page -->
	MochaUI.catyoutubeWindow = function(){ 
		new MochaUI.Window({
			id: 'catyoutube',
			title: 'TheCATLounge In Action:TheCATLounge Channel',
			loadMethod: 'iframe',
			//contentURL: 'http://www.youtube.com/thecatlounge',
			contentURL: 'http://www.thecatlounge.com/youtube.php',
			headerStartColor: [051, 153, 051],
			headerStopColor: [153, 051, 000],
			resizableColor: [153, 051, 000],
			width: 1000,
			height: 450,
			x: 150,
			y: 50 
		});
	}	
	if ($('catyoutubeWindowLink')) {
		$('catyoutubeWindowLink').addEvent('click', function(e){
		new Event(e).stop();
			MochaUI.catyoutubeWindow();
		});
	}
	
		/* Fire Two windows together
	// catlounge youtube page
	MochaUI.youtubeWindow = function(){ 
		new MochaUI.Window({
			id: 'cat_offerings',
			title: 'YouTube in Iframe',
			loadMethod: 'iframe',
			contentURL: '../pages/youtube.html',
			width: 340,
			height: 280,
			resizeLimit:  {'x': [330, 2500], 'y': [250, 2000]},
			toolbar: true,
			toolbarURL: '../pages/youtube-tabs.html',
			contentBgColor: '#000'
		});
	}	
	if ($('cat_offeringsLinkCheck')) {
		$('cat_offeringsLinkCheck').addEvent('click', function(e){
		new Event(e).stop();
			MochaUI.youtubeWindow();
		});
	}
	
	
	// thecatlounge youtube in tabs
	MochaUI.catyoutubeWindow = function(){ 
		new MochaUI.Window({
			id: 'catyoutube',
			title: 'YouTube in Iframe',
			loadMethod: 'iframe',
			contentURL: '../pages/youtube.html',
			width: 300,
			height: 170,
			resizeLimit:  {'x': [330, 2500], 'y': [250, 2000]},
			toolbar: true,
			toolbarURL: '../pages/youtube-tabs.html',
			contentBgColor: '#000',
			x: 900,
			y: 170 
		});
	}	
	if ($('catyoutubeWindowLink')) {
		$('catyoutubeWindowLink').addEvent('click', function(e){
		new Event(e).stop();
			MochaUI.catyoutubeWindow();
		});
	}
	*/
	
		
	MochaUI.ajaxpageWindow = function(){ 
		new MochaUI.Window({
			id: 'ajaxpage',
			loadMethod: 'xhr',
			contentURL: '../pages/lipsum.html',
			width: 340,
			height: 150
		});
	}	
	if ($('ajaxpageLinkCheck')){ 
		$('ajaxpageLinkCheck').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.ajaxpageWindow();
		});
	}	
	
	
	MochaUI.jsonWindows = function(){
		var url = '../data/json-windows-data.js';
		var request = new Request.JSON({
			url: url,
			method: 'get',
			onComplete: function(properties) {
				MochaUI.newWindowsFromJSON(properties.windows);
			}
		}).send();
	}
	if ($('jsonLink')){
		$('jsonLink').addEvent('click', function(e) {
			new Event(e).stop();
			MochaUI.jsonWindows();
		});
	}

	/*MochaUI.youtubeWindow = function(){
		new MochaUI.Window({
			id: 'youtube',
			title: 'YouTube in Iframe',
			loadMethod: 'iframe',
			contentURL: '../pages/youtube.html',
			width: 340,
			height: 280,
			resizeLimit:  {'x': [330, 2500], 'y': [250, 2000]},
			toolbar: true,
			toolbarURL: '../pages/youtube-tabs.html',
			contentBgColor: '#000'
		});
	}	
	if ($('youtubeLinkCheck')) {
		$('youtubeLinkCheck').addEvent('click', function(e){
		new Event(e).stop();
			MochaUI.youtubeWindow();
		});
	}
	*/
	MochaUI.slideshareWindow = function(){
		new MochaUI.Window({
			id: 'slideshare',
			title: 'Slideshare in Iframe',
			loadMethod: 'iframe',
			contentURL: '../pages/slideshare.html',
			width: 415,
			height: 355,
			resizeLimit:  {'x': [330, 2500], 'y': [250, 2000]},
			contentBgColor: '#000'			
		});
	}
	if ($('slideshareLinkCheck')) {
		$('slideshareLinkCheck').addEvent('click', function(e){
		new Event(e).stop();
			MochaUI.slideshareWindow();
		});
	}	

	MochaUI.parametricsWindow = function(){	
		new MochaUI.Window({
			id: 'parametrics',
			title: 'Window Parametrics',
			loadMethod: 'xhr',
			contentURL: '../plugins/parametrics/index.html',
			onContentLoaded: function(){
				if ( !MochaUI.parametricsScript == true ){
					new Request({
						url: '../plugins/parametrics/scripts/parametrics.js',
						method: 'get',
						onSuccess: function() {
							MochaUI.addRadiusSlider.delay(10); // Delay is for IE6
							MochaUI.addShadowSlider.delay(10); // Delay is for IE6
							MochaUI.parametricsScript = true;
						}.bind(this)
					}).send();
				}
				else {
					MochaUI.addRadiusSlider.delay(10); // Delay is for IE6
					MochaUI.addShadowSlider.delay(10); // Delay is for IE6
				}
			},
			width: 305,
			height: 110,
			x: 230,
			y: 180,
			padding: { top: 12, right: 12, bottom: 10, left: 12 },
			resizable: false,
			maximizable: false,
			contentBgColor: '#fff'
		});
	}
	if ($('parametricsLinkCheck')){
		$('parametricsLinkCheck').addEvent('click', function(e){
			new Event(e).stop();
			MochaUI.parametricsWindow();
		});
	}

	MochaUI.clockWindow = function(){	
		new MochaUI.Window({
			id: 'clock',
			title: 'Canvas Clock',
			addClass: 'transparent',
			loadMethod: 'xhr',
			contentURL: '../plugins/coolclock/index.html?t=' + new Date().getTime(),
			onContentLoaded: function(){
				if ( !MochaUI.clockScript == true ){
					new Request({
						url: '../plugins/coolclock/scripts/coolclock.js?t=' + new Date().getTime(),
						method: 'get',
						onSuccess: function() {
							if (Browser.Engine.trident) {	
								myClockInit = function(){
									CoolClock.findAndCreateClocks();
								};
								window.addEvent('domready', function(){
									myClockInit.delay(10); // Delay is for IE
								});
								MochaUI.clockScript = true;
							}
							else {
								CoolClock.findAndCreateClocks();
							}
						}.bind(this)
					}).send();
				}
				else {
					if (Browser.Engine.trident) {
						myClockInit = function(){
							CoolClock.findAndCreateClocks();
						};
						window.addEvent('domready', function(){
							myClockInit.delay(10); // Delay is for IE
						});
						MochaUI.clockScript = true;
					}
					else {
						CoolClock.findAndCreateClocks();
					}
				}
			},
			shape: 'gauge',
			headerHeight: 30,
			width: 160,
			height: 160,
			x: 1020,
			y: 80,
			padding: { top: 0, right: 0, bottom: 0, left: 0 },
			bodyBgColor: [250,250,250]
		});	
	}
	if ($('clockLinkCheck')){
		$('clockLinkCheck').addEvent('click', function(e){
			new Event(e).stop();
			MochaUI.clockWindow();
		});
	}

	// Examples > Tests
	MochaUI.eventsWindow = function(){	
		new MochaUI.Window({
			id: 'windowevents',
			title: 'Window Events',
			loadMethod: 'xhr',
			contentURL: '../pages/events.html',
			onContentLoaded: function(windowEl){
				MochaUI.notification('Window content was loaded.');
			},
			onCloseComplete: function(){
				MochaUI.notification('The window is closed.');
			},
			onMinimize: function(windowEl){
				MochaUI.notification('Window was minimized.');
			},
			onMaximize: function(windowEl){
				MochaUI.notification('Window was maximized.');
			},
			onRestore: function(windowEl){
				MochaUI.notification('Window was restored.');
			},
			onResize: function(windowEl){
				MochaUI.notification('Window was resized.');
			},
			onFocus: function(windowEl){
				MochaUI.notification('Window was focused.');
			},
			onBlur: function(windowEl){
				MochaUI.notification('Window lost focus.');
			},
			width: 340,
			height: 250
		});
	}	
	if ($('windoweventsLinkCheck')){
		$('windoweventsLinkCheck').addEvent('click', function(e){
			new Event(e).stop();
			MochaUI.eventsWindow();
		});
	}

	MochaUI.containertestWindow = function(){ 
		new MochaUI.Window({
			id: 'containertest',
			title: 'Container Test',
			loadMethod: 'xhr',
			contentURL: '../pages/lipsum.html',
			container: 'pageWrapper',
			width: 340,
			height: 150,
			x: 100,
			y: 100
		});
	}
	if ($('containertestLinkCheck')){ 
		$('containertestLinkCheck').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.containertestWindow();
		});
	}

	MochaUI.iframetestWindow = function(){
		new MochaUI.Window({
			id: 'iframetest',
			title: 'Iframe Tests',
			loadMethod: 'iframe',
			contentURL: '../pages/iframetest.html'
		});
	}
	if ($('iframetestLinkCheck')) {
		$('iframetestLinkCheck').addEvent('click', function(e){
		new Event(e).stop();
			MochaUI.iframetestWindow();
		});
	}

	MochaUI.accordiantestWindow = function(){
		var id = 'accordiantest';
		new MochaUI.Window({
			id: id,
			title: 'Accordian',
			loadMethod: 'xhr',
			contentURL: '../pages/accordian-demo.html',
			width: 300,
			height: 200,
			scrollbars: false,
			resizable: false,
			maximizable: false,
			padding: { top: 0, right: 0, bottom: 0, left: 0 },
			onContentLoaded: function(windowEl){
				this.windowEl = windowEl;
				var accordianDelay = function(){
					new Accordion('#' + id + ' h3.accordianToggler', "#" + id + ' div.accordianElement', {
					//	start: 'all-closed',
						opacity: false,
						alwaysHide: true,
						onActive: function(toggler, element){
								toggler.addClass('open');
						},
						onBackground: function(toggler, element){
								toggler.removeClass('open');
						},							
						onStart: function(toggler, element){
							this.windowEl.accordianResize = function(){
								MochaUI.dynamicResize($(id));
							}
							this.windowEl.accordianTimer = this.windowEl.accordianResize.periodical(10);
						}.bind(this),
						onComplete: function(){
							this.windowEl.accordianTimer = $clear(this.windowEl.accordianTimer);
							MochaUI.dynamicResize($(id)) // once more for good measure
						}.bind(this)
					}, $(id));
				}.bind(this)
				accordianDelay.delay(10, this); // Delay is a fix for IE
			}
		});
	}	
	if ($('accordiantestLinkCheck')){ 
		$('accordiantestLinkCheck').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.accordiantestWindow();
		});
	}
	
	MochaUI.noCanvasWindow = function(){
		new MochaUI.Window({
			id: 'nocanvas',
			title: 'No Canvas',
			loadMethod: 'xhr',
			contentURL: '../pages/lipsum.html',
			addClass: 'no-canvas',
			width: 305,
			height: 175,
			shadowBlur: 0,
			resizeLimit: {'x': [275, 2500], 'y': [125, 2000]},
			useCanvas: false
		});
	}
	if ($('noCanvasLinkCheck')){
		$('noCanvasLinkCheck').addEvent('click', function(e){
			new Event(e).stop();
			MochaUI.noCanvasWindow();
		});
	}

	// View
	if ($('sidebarLinkCheck')){
		$('sidebarLinkCheck').addEvent('click', function(e){
			new Event(e).stop();
			MochaUI.Desktop.sidebarToggle();
		});
	}

	if ($('cascadeLink')){
		$('cascadeLink').addEvent('click', function(e){
			new Event(e).stop();
			MochaUI.arrangeCascade();
		});
	}

	if ($('tileLink')){
		$('tileLink').addEvent('click', function(e){
			new Event(e).stop();
			MochaUI.arrangeTile();
		});
	}

	if ($('closeLink')){
		$('closeLink').addEvent('click', function(e){
			new Event(e).stop();
			MochaUI.closeAll();
		});
	}

	if ($('minimizeLink')){
		$('minimizeLink').addEvent('click', function(e){
			new Event(e).stop();
			MochaUI.minimizeAll();
		});
	}

	// Tools
	MochaUI.builderWindow = function(){	
		new MochaUI.Window({
			id: 'builder',
			title: 'Window Builder',
			icon: '../images/icons/page.gif',
			loadMethod: 'xhr',
			contentURL: '../plugins/windowform/',
			onContentLoaded: function(){
				if ( !MochaUI.windowformScript == true ){
					new Request({
						url: '../plugins/windowform/scripts/Window-from-form.js',
						method: 'get',
						onSuccess: function() {
							$('newWindowSubmit').addEvent('click', function(e){
								new Event(e).stop();
								new MochaUI.WindowForm();
							});
							MochaUI.windowformScript = true;
						}.bind(this)
					}).send();
				}
			},
			width: 370,
			height: 410,
			headerStartColor: [051, 153, 051],
			headerStopColor: [153, 051, 000],
			resizableColor: [153, 051, 000],
			maximizable: false,
			resizable: false,
			scrollbars: false
		});
	}
	if ($('builderWindowLink')){
		$('builderWindowLink').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.builderWindow();
		});
	}	

	// Todo: Add menu check mark functionality for workspaces.

	// Workspaces

	if ($('saveWorkspaceLink')){
		$('saveWorkspaceLink').addEvent('click', function(e){
			new Event(e).stop();
			MochaUI.saveWorkspace();
		});
	}
	
	if ($('loadWorkspaceLink')){
		$('loadWorkspaceLink').addEvent('click', function(e){
			new Event(e).stop();
			MochaUI.loadWorkspace();
		});
	}

	// Help	
	MochaUI.featuresWindow = function(){
		new MochaUI.Window({
			id: 'features',
			title: 'Features',
			loadMethod: 'xhr',
			contentURL: '../pages/features-layout.html',
			width: 305,
			height: 175,
			resizeLimit: {'x': [275, 2500], 'y': [125, 2000]},
			toolbar: true,
			toolbarURL: '../pages/features-tabs.html'
		});
	}
	if ($('featuresLinkCheck')){
		$('featuresLinkCheck').addEvent('click', function(e){
			new Event(e).stop();
			MochaUI.featuresWindow();
		});
	}

	MochaUI.faqWindow = function(){
			new MochaUI.Window({
				id: 'faq',
				title: 'FAQ',
				loadMethod: 'xhr',
				contentURL: '../pages/faq.html',
				width: 750,
				height: 350
			});
	}
	if ($('faqLinkCheck')){
		$('faqLinkCheck').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.faqWindow();
		});
	}	

	MochaUI.docsWindow = function(){
			new MochaUI.Window({
				id: 'docs',
				title: 'Documentation',
				loadMethod: 'xhr',
				contentURL: '../pages/docs.html',
				width: 750,
				height: 350,
				padding: [10,10,10,10,10]
			});
	}
	if ($('docsLinkCheck')){
		$('docsLinkCheck').addEvent('click', function(e){
			new Event(e).stop();
			MochaUI.docsWindow();
		});
	}	

	MochaUI.resourcesWindow = function(){
			new MochaUI.Window({
				id: 'resources',
				title: 'Resources',
				loadMethod: 'xhr',
				contentURL: '../pages/resources.html',
				width: 300,
				height: 275,
				x: 20,
				y: 90 
			});
	}
	if ($('resourcesLinkCheck')){
		$('resourcesLinkCheck').addEvent('click', function(e){
			new Event(e).stop();
			MochaUI.resourcesWindow();
		});
	}

	MochaUI.helpWindow = function(){
			new MochaUI.Window({
				id: 'help',
				title: 'Support',
				loadMethod: 'xhr',
				contentURL: '../pages/support.html',
				width: 320,
				height: 320,
				x: 20,
				y: 90 
			});
	}
	if ($('helpLinkCheck')){
		$('helpLinkCheck').addEvent('click', function(e){
			new Event(e).stop();
			MochaUI.helpWindow();
		});
	}	

	MochaUI.contributeWindow = function(){
		new MochaUI.Window({
			id: 'contribute',
			title: 'Contribute',
			loadMethod: 'xhr',
			contentURL: '../pages/contribute.html',
			width: 320,
			height: 320,
			x: 20,
			y: 90 
		});
	}
	if ($('contributeLinkCheck')){
		$('contributeLinkCheck').addEvent('click', function(e){
			new Event(e).stop();
			MochaUI.contributeWindow();
		});
	}

	MochaUI.aboutWindow = function(){
		new MochaUI.Window({
			id: 'about',
			title: 'MochaUI',
			loadMethod: 'xhr',
			contentURL: '../pages/about.html',
			type: 'modal2',
			width: 350,
			height: 195,
			contentBgColor: '#e5e5e5 url(images/logo2.gif) left 3px no-repeat',
			padding: { top: 43, right: 12, bottom: 10, left: 12 },
			scrollbars:  false
		});
	}
	if ($('aboutLink')){
		$('aboutLink').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.aboutWindow();
		});
	}

	// Deactivate menu header links
	$$('a.returnFalse').each(function(el){
		el.addEvent('click', function(e){
			new Event(e).stop();
		});
	});

	// Build windows onDomReady
	MochaUI.wodWindow();
        MochaUI.catnewsWindow();
        MochaUI.qodWindow();
	/*MochaUI.catnewsWindow();
	if (!Browser.Engine.trident) {
		MochaUI.clockWindow();
	}
	else {
		MochaUI.clockWindow.delay(500);	
	}*/
	
}

// Initialize MochaUI when the DOM is ready
window.addEvent('domready', function(){
	MochaUI.Desktop = new MochaUI.Desktop();
	MochaUI.Dock = new MochaUI.Dock({
		dockPosition: 'bottom'
	});
	MochaUI.Modal = new MochaUI.Modal();
	
	MochaUI.Desktop.desktop.setStyles({
		'background': '#fff',
		'visibility': 'visible'
	});
	
	initializeWindows();
});

// This is just for the demo. Running it onload gives pngFix time to replace the pngs in IE6.
 /*window.addEvent('load', function(){
	$$('.desktopIcon').addEvent('click', function(){
		MochaUI.notification('TheCatlounge Desktop');
	});
});
*/
/*
window.addEvent('load', function(){
	$$('.desktopIcon').addEvent('click', function(){
		
		MochaUI.ajaxpageWindow = function(){ 
		new MochaUI.Window({
			id: 'cat_globe',
			loadMethod: 'xhr',
			contentURL: 'pages/lipsum.html',
			width: 340,
			height: 150
		});
	}	
	if ($('cat_globeLinkCheck')){ 
		$('cat_globeLinkCheck').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.ajaxpageWindow();
		});
	}	
	
	});
});
*/


window.addEvent('unload', function(){
	if (MochaUI) MochaUI.garbageCleanUp();
});






