/*Remember this code use mootools as framework */



window.addEvent('domready', function() {



try{

	

//Seting up the scroller

if($('innerContent'))
{

var the_content= $('overflowContainer');

var the_scrollbar= $('scrollbar');

var the_handle = $('handle') ;

var the_internalContent =$('innerContent');



//  vertical scrollbar --

makeScrollbar(the_content ,the_scrollbar ,the_handle,the_internalContent,500);

}



//Sliding links

/*if($$('activity'))
{
initializeLinks('activity','secondheaderlinksActivity');
}
*/

//clear on focus


clearOnFocus($('password_L'));
clearOnFocus($('username_L'));
//Tips

new Tips('.readmore');



}catch(e){/*console.log(e);*/}





});





/*Function*/

function clearOnFocus(el){
	
	el.addEvent('focus',function(){
								 this.set('value','');
								 });
	
	
	}

function Validate(theForm){
      
	if(theForm.get('name')=="formLogin")  {

	if ($('username').value == ''){

		$('errorBoxLogin').set('text', 'Please enter a valid user name.');

		return false;

	}//end if

	if ($('userPassword').value == ''){

		$('errorBoxLogin').set('text', 'Please enter a valid user password.');

		return (false);

	}//end if


	}
	return true;

}//end function


function Submit(theForm){

	

		theForm.submit();



}//en dfunction
function initializeLinks(listClass,targetID){

	

	 var slide;

	$$('.'+listClass).each(function(item,index){

										item.removeProperty('href');

									   slide =new Fx.Slide($(targetID), {duration: 500, mode:'vertical'}).hide()

									   item.addEvent('click', function(event) {

											

										slide.toggle();

										});

									   

									   });

	

	}





/*Personalised scrollbar function*/

function makeScrollbar(content,scrollbar,handle,the_internalContent,minimum,horizontal,ignoreMouse){

			if(the_internalContent.getStyle('height').toInt()>minimum){

				scrollbar.setStyle('display','block');

				var steps = (horizontal?(content.getScrollSize().x - content.getSize().x):(content.getScrollSize().y - content.getSize().y))

				

				var slider = new Slider(scrollbar, handle, {	

					steps: steps,

					mode: (horizontal?'horizontal':'vertical'),

					onChange: function(step){

						// Scrolls the content element in x or y direction.

						var x = (horizontal?step:0);

						var y = (horizontal?0:step);

						content.scrollTo(x,y);

					}

				}).set(0);

				if( !(ignoreMouse) ){

					// Scroll the content element when the mousewheel is used within the 

					// content or the scrollbar element.

					$$(content, scrollbar).addEvent('mousewheel', function(e){	

						e = new Event(e).stop();

						var step = slider.step - e.wheel * 30;	

						slider.set(step);					

					});

				}

				// Stops the handle dragging process when the mouse leaves the document body.

				$(document.body).addEvent('mouseleave',function(){slider.drag.stop()});

			}

		}