$(function() {
    if ($(".MMDataCaptureForm_ErrorTD span").text()!="") {
        $(".MMDataCaptureForm_Table").css("background-image","url(res/builtin/contact_form_bg_error.png)");
            $(".MMDataCaptureForm_ErrorTD").addClass("activeError");
        if ($.browser.msie) {
            $(".MMDataCaptureForm_SubmitButton").css("margin-top","3px");
            $(".MMDataCaptureForm_ErrorTD").css("padding-bottom","5px");
        } else {
            $(".MMDataCaptureForm_SubmitButton").css("margin-top","3px");
        }
    } else {
        if ($.browser.msie) {
            $(".MMDataCaptureForm_Table tr").css("position","relative").css("top","8px");
            $(".MMDataCaptureForm_ErrorTD").css("display","none");
        }
    }
    
    if ($("#contact_form .MMDataCaptureForm_ErrorTD span").text()!="") {
        $("#contact_form .MMDataCaptureForm_Table").css("background-image","url(res/builtin/contact_form_bg_error.png)");
        $("#contact_form .MMDataCaptureForm_SubmitButton").css("margin-top","10px");
        $("#contact_form .MMDataCaptureForm_ErrorTD").addClass("activeError");
    }
    
    $(".breadcrumb").each(function(){
        $(this).html($(this).html().replace("&gt;","|"));
    });

    var urlsubnav = window.location;
    $("#sub_nav a[href$="+urlsubnav+"]").parent().addClass("active_tab");
    
    var urlsidenav = window.location;
    $(".right_mid .Phuse_SiteMap_LI a[href$="+urlsidenav+"]").parent().addClass("active_right").css("color","#fff");

    var urlnewsnav = window.location;
    $(".feed_link a[href$="+urlnewsnav+"]").parent().addClass("active_right").removeClass("feed_link").css("color","#fff");

    var url = window.location.pathname;
    if (url=="/admin/cm/sites/129/default.phuse") {
        } else {
        $("#list").wrapInner("<select id=\"links\"></select>");
        $("#list a").each(function(){
            var link = $(this).attr("href");
            var text = $(this).text();
            $("#links").append("<option value=\""+link+"\">"+text+"</option>\n");
        }).hide();
        
        $("#links").change(function() {
            var newLocation = $("#links option:selected").val();
            window.location=newLocation;
        });
        $("#list p").hide();
    }

    $(".MMDataCaptureForm_Table td span:first").attr("style","color: #e8f4fa;");
    $(".MainMenuItem_Normal:first").attr("style","background: none;");
    
    $("textarea").attr("style","height: 99px;");
    
    $(".right_mid:last, .right_top:last, .right_btm:last").hide();
    
   
    if ($(".poll_results").is(":visible")) {
            $(".OpinionPollVoteButton").hide();
            $(".home_right h2").slideUp();
            $(".poll").css("position","relative").css("top","-10px");
            $(".poll").css("position","relative").css("top","-10px");
            $(".MMDataCaptureForm_Table tr").css("position","relative").css("top","0px");
    }
    
    $(".paging a").each(function(){
        var getStyle = $(this).attr("style");
        if (getStyle=="font-weight: bold; text-decoration: underline;") {
            $(this).css("background","#ccc").css("color","#333").css("text-decoration","none");
        }
    });
    
    $(".paging a").each(function(){
        $(this).html($(this).html().replace("Next &gt;","Next").replace("&lt; Prev","Prev"));
    });
    
    if (($.browser.safari)) {
        $("#navigation a").css("font-weight","normal");
        $(".poll_title strong").css("font-weight","normal");
    }
    
    var blogContent = $(".feed").html();
    $("#feed").html(blogContent);
    $("#feed li:nth-child(1)").addClass("first_feed");
    $("#feed li:last").css("border","none");
    
    $("img.homeIntro").click(function(){
	    $(this).hide();
	    $("div.homeIntro").show();
	    var timeout = setTimeout(function() {
            $("div.homeIntro").hide()
            $("img.homeIntro").fadeIn("slow")
        }, 54000);
	}).hover(function(){
	    $(this).css("cursor","pointer");
	}, function() {
	    $(this).css("cursor","default");
	});

        $("div.homeIntro").show();
        $("img.homeIntro").hide();
        var timeout = setTimeout(function() {
            $("div.homeIntro").hide()
            $("img.homeIntro").fadeIn("slow")
        }, 54000);
    
});