$(function(){


    
    $(".breadcrumb").each(function(){
        var charReplace = $(this).html();
        charReplace = charReplace.replace("&gt;","<img src='http://staging.ph-creative.com/sites/cabfind/res/builtin/crumb.gif' width='7' height='7' style='border:0'/>");
        charReplace = charReplace.replace("&gt;","<img src='http://staging.ph-creative.com/sites/cabfind/res/builtin/crumb.gif' width='7' height='7' style='border:0'/>");
        charReplace = charReplace.replace("&gt;","<img src='http://staging.ph-creative.com/sites/cabfind/res/builtin/crumb.gif' width='7' height='7' style='border:0'/>");
        $(this).html(charReplace);
    });
    
    $(".paging a").each(function(){
        var getStyle = $(this).attr("style");
        if (getStyle=="font-weight: bold; text-decoration: underline;") {
            $(this).css("text-decoration","none").css("color","#ffab00");
        }
    });
    
    $(".paging a").each(function(){
        $(this).html($(this).html().replace("Next &gt;","&gt;").replace("&lt; Prev","&lt;"));
    });
    
    var pagingItems = Math.ceil(eval($(".case_study, .news").length-5)/5);
    var countItems = 1;
    $(".paging").append("<strong>Page:</strong> ");
    while (countItems<=pagingItems+1) {
        $(".paging").append("<span id=\""+countItems+"\">"+countItems+"</span>");
        countItems++;
    }
    
    $(".paging span").click(function(){
        $(".paging span").removeClass("active");
        $(this).addClass("active");
        var pageNumber=$(this).attr("id")-1;
        $(".holder .case_study, .holder .news").animate({"top":"-"+eval(pageNumber*615)+"px"});
    });  
    
    $(".popular li:nth-child(even)").attr("style","margin-left: 9px;");
    
    $(".coverage ul li ul").hide();
    $(".coverage ul li").hover(function(){
        if ($(this).children("ul").is(":visible")) {
            $(this).children("ul").slideUp().parent().removeClass("down");;
        } else {
            $(this).children("ul").slideDown().parent().addClass("down");
        }
    });
    

    
    $(".capture_form").hover(function(){
        $(this).stop().animate({ height:"250px" });
    },function(){
        $(this).stop().animate({ height:"75px" });
    });

    
    $(".capture_form .MMDataCaptureForm_LabelTD span:last").addClass("comment_label");
    
    $(".suppliers_form .MMDataCaptureForm_LabelTD span:last").addClass("last_label");

    

});