$(function(){

    $("#breadcrumb").each(function(){
        var charReplace = $(this).html();
        charReplace = charReplace.replace("&gt;","|");
        charReplace = charReplace.replace("&gt;","|");
        charReplace = charReplace.replace("&gt;","|");
        charReplace = charReplace.replace("&gt;","|");
       $(this).html(charReplace);
    });
    
    var blogFeed = $(".liverpoolFeed").html();
        $("#liverpoolFeed").html(blogFeed);
        
    var blogFeed = $(".manchesterFeed").html();
        $("#manchesterFeed").html(blogFeed);
    
    var blogFeed = $(".nottinghamFeed").html();
        $("#nottinghamFeed").html(blogFeed);
    
    var blogFeed = $(".osloFeed").html();
        $("#osloFeed").html(blogFeed);
        
    var blogFeed = $(".marbellaFeed").html();
        $("#marbellaFeed").html(blogFeed);
        
    $(".site_links li span:first").css("border-left","none");
    $(".site_links li span:last").css("border-right","none");

    $(".liverpool").hover(function(){
           $("#manchesterFeed, #nottinghamFeed, #osloFeed, #marbellaFeed").hide();
           $(".manchester, .nottingham, .oslo, .marbella").removeClass("arrow_on");
           $("#liverpoolFeed").show();
           $(".liverpool").addClass("arrow_on");
        },function(){
    });  
    $(".manchester").hover(function(){
           $("#liverpoolFeed, #nottinghamFeed, #osloFeed, #marbellaFeed").hide();
           $(".liverpool, .nottingham, .oslo, .marbella").removeClass("arrow_on");
           $("#manchesterFeed,").show();
           $(".manchester").addClass("arrow_on");
        },function(){ 
    });
    $(".nottingham").hover(function(){
           $("#liverpoolFeed, #manchesterFeed, #osloFeed, #marbellaFeed").hide();
           $(".liverpool, .manchester, .oslo, .marbella").removeClass("arrow_on");
           $("#nottinghamFeed,").show();
           $(".nottingham").addClass("arrow_on");
        },function(){
    });
    $(".oslo").hover(function(){
           $("#liverpoolFeed, #manchesterFeed, #nottinghamFeed, #marbellaFeed").hide();
           $(".liverpool, .manchester, .nottingham, .marbella").removeClass("arrow_on");
           $("#osloFeed,").show();
           $(".oslo").addClass("arrow_on");
        },function(){
    });
    
    $(".marbella").hover(function(){
           $("#liverpoolFeed, #manchesterFeed, #nottinghamFeed, #osloFeed").hide();
           $(".liverpool, .manchester, .nottingham, .oslo").removeClass("arrow_on");
           $("#marbellaFeed,").show();
           $(".marbella").addClass("arrow_on");
        },function(){
    });
    
    $(".mm_form table tr").each(function(){
		$("td:first",this).addClass("label");
		$("td:last",this).addClass("input").children().addClass("textbox");
	});   
    $(".mm_form table .label").each(function(){
		var thisLabel = $(this);
		$("span",thisLabel).remove();
		var thisText = thisLabel.text();
		var newText = thisText.replace(/^\s+|\s+$/g, '');
		thisLabel.text(newText);
	}).wrapInner("<div></div>");
	
	$(".mm_form").each(function(){
        $("table input:last",this).addClass("SubmitButton").val("");
        $("table textarea",this).parent().addClass("textareaTD");
        $("table tr:last",this).addClass("SubmitButtonTR");
        $("table td:last",this).addClass("SubmitButtonTD");
    });
    
    $(".content_right .news h2").not("#home .content_right .news h2").html("<b>Also</b> in the News");
    $(".news_feed, .events_feed").not(".content_right .news_feed").pagination();
    $(".news_item, .events_item, .site_feeds .item, .search_result_item").fullLink();
    
    $("#contact .MMDataCaptureForm_Table").each(function(){
		var thisTable = $(this);
		thisTable.hide().after('<div class="mm_form"></div>');
		var inputs = new Array();
		var labels = new Array();
		for (var i=0;i<$(".MMDataCaptureForm_LabelTD",thisTable).length;i++) {
			labels[i] = "<div class=\"MMDataCaptureForm_LabelTD\">"+$(".MMDataCaptureForm_LabelTD:eq("+i+")",thisTable).html()+"</div>";
		}
		for (var i=0;i<$(".MMDataCaptureForm_FieldTD",thisTable).length;i++) {
			inputs[i] = "<div class=\"MMDataCaptureForm_FieldTD\">"+labels[i]+""+$(".MMDataCaptureForm_FieldTD:eq("+i+")",thisTable).html()+"</div>";
		}
		var result = inputs.toString().replace(",","").replace(",","").replace(",","").replace(",","").replace(",","");
		$(".mm_form").html(result+" "+$(".MMDataCaptureForm_ButtonTD",thisTable).html());
		thisTable.remove();
	});
	
	$('#defaultCountdown').countdown({ 
    until: new Date(2011, 8 - 1, 25), timezone: +11});    
     
    $('#removeCountdown').toggle(function() { 
            $(this).text('Re-attach'); 
            $('#defaultCountdown').countdown('destroy'); 
        }, 
        function() { 
            $(this).text('Remove'); 
            $('#defaultCountdown').countdown({until: newYear}); 
        } 
    );
    
        $(".pages a").each(function(){
        var getStyle = $(this).attr("style");
        if (getStyle=="font-weight: bold; text-decoration: underline;") {
            $(this).css("text-decoration","none").css("color","#333333").css("background","#d8d8d8");
        }
    });
    
    $(".pages a").each(function(){
        $(this).html($(this).html().replace("Next &gt;","&gt;").replace("&lt; Prev","&lt;"));
    });
    
    $(".gallery_item a").attr("target","_blank");
    

});

