window.addEvent('domready', function() {     
	//document.body.addEvent('contextmenu',function(e) {  
    //    e.stop();
	//	alert('Copyright Al Musanna College of Technology 2009!');
	//});
	
	document.oncontextmenu=function()
	{ 
		// generate year
		var now = new Date();
		myYear = now.getFullYear();
		var msg = '<center>Copyright Al Musanna College of Technology (ACT) <br> &copy; 2008 - '+ myYear +'. All rights reserved.<center>';
		Sexy.alert('<h1>Alert - Copyright Notice!</h1><em><b>&nbsp;</b></em><br/><p><b><font color="#FF0000">' + msg +'</font></p>');
		return false; 
	}
	
	// new menu matic
	if ($('top_menu_container'))
	{
		var myMenu = new MenuMatic();
	}
	
	if ($('search_btn'))
	{
		$('search_btn').addEvent('click', function(e) {
		// e.stop();
		// validate search field
		if (($('search_text').get('value') == '') || ($('search_text').get('value') == 'Search ACT'))
		{
			//$('search_text').focus();
			var msg = '</b> To help us find what you are looking, please input <b><u>search keyword(s)</b></u>, then click <b>Search</b>. Thank you!';
			Sexy.alert('<h1>Alert - User Notice!</h1><em><b>&nbsp;</b></em><br/><p><b><font color="#FF0000">' + msg +'</p>');
			return false;
		}
		});
	}
	//handle webmail form
	if ($('mailForm'))
	{
		$('username').focus();
		$('submitbtn').addEvent('click', function(e) {
			if ($('username').get('value') == '')
			{
				alert('Username is empty!');
				$('username').focus();
				return false;
			}
			if ($('password').get('value') == '')
			{
				alert('Password is empty!');
				$('password').focus();
				return false;
			}
			
			var domain= 'ACTOMAN\\';
			var username = domain+$('username').get('value');
			$('username').value = username;
			$('mailForm').submit();
			
		});
	}
	
	// handle news slides
	if ($('box8'))
	{
		var nS8 = new noobSlide({
			box: $('box8'),
			items: $$('#box8 h3'),
			interval: 9000,
			size: 530,
			autoPlay: true,
			handles: $$('#handles8 span'),
			addButtons: {previous: $('prev8'), next: $('next8') }
		
		});
		//more "previous" and "next" buttons
		nS8.addActionButtons('previous',$$('#box8 .prev'));
		nS8.addActionButtons('next',$$('#box8 .next'));
		//walk to item 3 witouth fx
		//nS8.walk(3,false,true);
	}
	// end handle news slide
	
	if ($('SearchFrm'))
	{

		//hand search form of staff directory
		var myVerticalSlide = new Fx.Slide('vertical_slide');

		$('v_slidein').addEvent('click', function(e){
		   e.stop();
		   myVerticalSlide.slideIn();
		});

		$('v_slideout').addEvent('click', function(e){
		   e.stop();
		   myVerticalSlide.slideOut();
		});
	}
	
	//call mooCollapsibles
	if ($$('menu_container'))
	{
		var initCollapsibles = new mooCollapsibles({
			cllpsContainers: $$('.collapsible'),//passes content/contents to be collapsed
			cllpsHeaders: $$('.collapsible .header').reverse(),//the headers inside containers
			cllpsBodies: $$('.collapsible .body').reverse(),//the bodies inside containers
			buildToggler: false,//'expand all | collapse all' buttons will be generated if true
			expandDefault: true,//have the collapsibles open or closed by deafult
			accordionEffect: true,//will simulate MooTools Accordion
			showAlerts: false//display alerts to warn users cookies are disabled etc
		});
	}
	
	if ($('search_text'))
	{
		$('search_text').addEvent('click', function(e) {
			$('search_text').value = "";
		});
	}
	
	if ($('gallery_container'))
	{
	/* thumbnails example , links only */
	new SlideItMoo({itemsVisible:5, // the number of thumbnails that are visible
					currentElement: 5, // the current element. starts from 0. If you want to start the display with a specific thumbnail, change this
					autoSlide:5000,
					thumbsContainer: 'thumbs',
					elementScrolled: 'thumb_container',
					overallContainer: 'gallery_container'});
	}
	
	/* advertisement */
	/* banner rotator example */
	if ($('banners_container'))
	{
	new SlideItMoo({itemsVisible:1, // the number of thumbnails that are visible
					showControls:0, // show the next-previous buttons
					autoSlide:14000, // insert interval in milliseconds
					currentElement: 0, // the current element. starts from 0. If you want to start the display with a specific thumbnail, change this
					transition: Fx.Transitions.Bounce.easeOut,
					thumbsContainer: 'banners',
					elementScrolled: 'banner_container',
					overallContainer: 'banners_container'});
	}
	new SmoothScroll({ duration:700 }, window);
}); // end window.addEvent('domready', function()