$(function(){
		//get url for redirect
		var host = jQuery.url.attr("host");
		var path = jQuery.url.attr("path");
		//alert(host + path);
		//TABS
		//hide the tab panes if javascript is enabled
						$("div.panes > div:first-child").css('display','none');
						//make the tabs
						$("ul.tabs").tabs("div.panes > div",{
										  
										  });
		//Overlay					
      $("a.trigger").overlay({expose:'#4F0000'});//makes any link with a class of trigger call an overlay
	  
	   //Image Cycle
	   //id of container for images to be cycled
						$("#cycle").cycle({
										  timeout: 4500, //4 and a half seconds delay until it changes to next image
										  speed: 1000 // 1 second to change to the next image in the cycle 
										  });
		//Tooltip
		$('a.triggers').tooltip({
													
													position: 'center left', // top,right,left,bottom,center 
													//offset: [-20,-5], //offset in pixels from [top, left] of tooltip
													relative:true,
													effect: 'slide',//fade or slide up
													events: {
													def: 'click,mouseout'	
													}
													});
		
		//make the directors webapp atack up nicely
		$("div#directors div.span-9:odd").addClass('last');
		
		//login zone
		$("#leaders, #members").css('display','none');
		$("select#zone").change(function(){
								selectedVal = $(this).val();
								
								if (selectedVal == 'members'){
								$("#members").show('fast');
								$("#leaders").hide();
								}
								if (selectedVal == 'leaders'){
								$("#leaders").show('fast');
								$("#members").hide();
								}
								else
								$("#leaders, #members").hide();
								
								});
		//remove the relevant buttons in the members area
		$(".zoneSubscriptions li a:contains('Members')").each(function(){
		
										$("li.leadersLink").remove();
															 });
									 
		$(".zoneSubscriptions li a:contains('Leadership')").each(function(){
									
										$("li.membersLink").remove();	 
									 });
		$("li.price:contains('&pound;0.00')").each(function(){
													  $(this).html('<p><strong style="color:#FF0000; background:#FFEFEF; border:1px dotted #B22B2B; padding:0.3em; display:block; text-align:center;">FREE</strong></p>')
													  });
		$("li.bniPrice:contains('&pound;0.00')").each(function(){
													  $(this).css('visibility','hidden')
													  });
		//change the cart link to work with logged in users
		
		cartLink = $("td.cartSummaryItem a").attr('href');
		
		//alert(cartLink);
		$("div#addedToCart a.buttonRight").css('background','#ff9900').attr('href',cartLink);
		
		//make successnet divs stack up nicley
		$("div.successNet:odd").addClass('last')
		//make colorbox links
		$("a[rel=colorbox]").colorbox({
								 iframe: true,
								 width:780,
								 height:720
								 });
		//add class of groupHeight to elements if they need to be the same size
		//make all a elements with class of .groupHeight the same height as the biggest

    $(".groupHeight").height(max); 
	
	var max = 0
	$(".groupHeight").each(function(){
        if ($(this).height() > max)
            max = $(this).height();   
    });
    $(".groupHeight").height(max);
		//make the training items big targets

	
	
 });