$(document).ready(
	function()
	{	

  

		
	$('body.shows').each(function(i)
	{
		$(document).styleCalendarForIE();

		$('.shows #col_upper').css({height:'auto'});

		$('.shows #col_upper .slides ul').css({height:'253px'});

		//$('#big-image').cycle('fade');
		
	});
		tooltip_active = false;

		$('.col-2 input, .col-2 textarea').focus(
			function(){
				if(!tooltip_active)
				{
				tooltip_active = true;	
				var title = $(this).attr('title');
				if(this.tagName == "INPUT")
				{
					$(this).after("<div id='tooltip_wrapper' style='display:none;'><div id='tooltip_inner'>" + title + "</div></div>");				
				}else if(this.tagName == "TEXTAREA")
				{
					$(this).after("<div id='tooltip_wrapper' class='textarea' style='display:none;'><div id='tooltip_inner'>" + title + "</div></div>");					
				}
				$(this).next().fadeIn(200);			
				}
		});
		
		$('.col-2 input, .col-2 textarea').blur(
			function(){
				if(tooltip_active)
				{
				tooltip_active = false;	
				$(this).next().fadeOut(200);
				$(this).next().remove()
				}
			});
			
		$('.col-1 tr:odd').addClass('odd');

		$('.history .col-1 table td').each(
			function(i)
			{
				if(i % 3 == 0)
				{
					$(this).addClass('td_begin');
				}
				if(i % 3 == 2)
				{
					$(this).addClass('td_end');
				}
			});

		$('.technical-detail .col-1 td').each(
			function(i)
			{	
				if(($(this).attr('colspan') == 2))
				{
					$(this).addClass('heading');
				}
			});
		
		
		if($.cookie('text_only') == 'true')
		{
			$('#text_only').text('Full Version');
			$('#text_only').before('|&nbsp;');
			
		}else
		{
			$('#text_only').before('|&nbsp;');
			$('#text_only').text('Text-only Version');
		}
		
		
		$('#text_only').click(function(i)
		{   
			if(($.cookie('text_only') == 'true'))
			{
				$(this).text('Text-only Version');
				replaceLinkTags();
				$.cookie('text_only', 'false');
			}else{
				$(this).text('Full version');
				$.cookie('text_only', 'true');
				removeLinkTags();
				if(navigator.appName == "Microsoft Internet Explorer")
				{
					window.location.reload();
				}
			}

		});	
		
		function replaceLinkTags()
		{
			for(var i=0; i<stylesArray.length; i++)
			{
				$('title').after(stylesArray[i]);
			}
			replaceFonts();

		}
		
		$('.contact .lead-image').cycle('fade');
		$('.theatre-of-comedy .lead-image').cycle('fade');
		
	
});


jQuery.fn.styleCalendarForIE = function()
{	
	var table_array = new Array();
	var rows = $('#blog_cal tr').size();

	$('#blog_cal tr').eq(rows-1).addClass('last');
	
	$('#blog_cal tr th').each(
	
		function(j)
		{
			if(j % 3 == 0)
			{
				//alert(table_values_to_add_class[j]);
				$('#blog_cal tr th').eq(j).addClass('end_th_left');

			}
		
			if(j % 3 == 2)
			{
				//alert(table_values_to_add_class[j]);
				$('#blog_cal tr th').eq(j).addClass('end_th_right');

			}
		}
	);

	$('#blog_cal tr td').each(
	
		function(i)
		{
			if(i % 7 == 0)
			{
				//alert(table_values_to_add_class[j]);
				$('#blog_cal tr td').eq(i).addClass('end_td_left');

			}
		
			if(i % 7 == 6)
			{
				//alert(table_values_to_add_class[j]);
				$('#blog_cal tr td').eq(i).addClass('end_td_right');

			}
		}
	
		);
	$('#bloc_calendar').css({display:'block'});
	}	
	
	
	function recordOutboundLink(link, category, action) {
	    try {
	        var pageTracker = _gat._getTracker("UA-8789767-1");
	        pageTracker._trackEvent(category, action);
	        //setTimeout('document.location = "' + link.href + '"', 100)
	    } catch (err) { }
	}
