function setTips(){	

	jQuery('div.events-index span.index-event a[title]').qtip({
      position: {
         corner: { target: 'topRight', tooltip: 'bottomRight' }
      },
      style: {
		 color: '#2C4906',
		 backgroundColor : '#ffffff',
		 border: { radius: 5, width: 7, color: '#2C4906' }
       },
       tip: true
   });
   
   jQuery('div.events-index').each( function() {
		//console.log(jQuery(this).height());									 
		if (jQuery(this).height() > 100){
			var parentDiv = jQuery(this).parent()[0];
			jQuery(parentDiv).css("height","6em");
			var eventsButtonsDiv = document.createElement("div");
			eventsButtonsDiv.className = "cal-weeks-l-events-buttons";
			var downButtonImg = document.createElement("img");
			downButtonImg.src="/app/modules/calendar/images/down.gif";
			eventsButtonsDiv.appendChild(downButtonImg);
			jQuery(downButtonImg).click(
				function(e)
				{
					parentDiv.scrollTop += 14;
				}
			);
			var upButtonImg = document.createElement("img");
			upButtonImg.src="/app/modules/calendar/images/up.gif";
			eventsButtonsDiv.appendChild(upButtonImg);
			jQuery(upButtonImg).click(
				function(e)
				{
					parentDiv.scrollTop -= 14;
				}
			);
			var dayDiv = jQuery(this).parent().parent()[0];
			dayDiv.appendChild(eventsButtonsDiv);
		}
			
											 
	});
		
	//select all the a tag with name equal to modal
	jQuery('a[name=modal]').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		
		//Get the A tag
		var id = jQuery(this).attr('href');
	
		//Get the screen height and width
		var maskHeight = jQuery(document).height();
		var maskWidth = jQuery(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		jQuery('#mask').css({'width':maskWidth,'height':maskHeight,'opacity':0});
		
		//show the mask
		jQuery('#mask').show();
		
		//transition effect		
		jQuery('#mask').fadeTo("slow",0.8);	
	
		//Get the window height and width
		var winH = jQuery(window).height();
		var winW = jQuery(window).width();
				
		//Set the popup window to center
		jQuery(id).css('top',  winH/2-jQuery(id).height()/2);
		jQuery(id).css('left', winW/2-jQuery(id).width()/2);
	
		//transition effect
		jQuery(id).fadeIn("slow"); 
	
	});
	
	
	//if close button is clicked
	jQuery('.window .close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		
		jQuery('#mask').hide();
		jQuery('.window').hide();
	});		
	
	//if mask is clicked
	jQuery('#mask').click(function () {
		jQuery(this).hide();
		jQuery('.window').hide();
	});			
	
}

