$(function() {
    $(".MMDataCaptureForm_ErrorTD span").css("color","#a2d921");
    var rightContent = $(".BodyContentTop .Right").text();
    if (rightContent=="") {
        $(".BodyContentTop .Right").hide();
    }
    $(".FullNewsFeed .Item:gt(0) p,.FullNewsFeed .Item:gt(0) p img,.FullNewsFeed .Item:gt(0) a").hide();
    $(".FullNewsFeed .Item:first").css("border-bottom","1px dotted #666").css("margin-right","20px").css("padding-bottom","10px");
    $(".FullNewsFeed .Item:first h3").css("border-bottom","none").css("padding-bottom","0px").css("font-size","20px").css("font-weight","normal");
    $(".FullNewsFeed .Item h3 a").show();
    $(".MMDataCaptureForm_SubmitButton").attr("value","");
    if ($.cookie('phcontrol')=="close") {
        $(".ExtraLinks,.Links,.ClientLogin,.Links .backgroundCurve").hide();
        $(".ExtraLinksControl .Control").html("<img src=\"/images/open.gif\" /> Açik").css("cursor","pointer");
    } else {
        $(".ExtraLinks").show();
        $(".ExtraLinksControl .Control").html("<img src=\"/images/close.gif\" /> Kapali").css("cursor","pointer");
    }
	
	var activeLink = window.location;
	$(".ExtraLinks .Links a[href$="+activeLink+"]").css("color","#fff");
	$(".TopCol a[href$="+activeLink+"]").css("font-weight","bold");
	$(".PhUniversity .Phuse_SiteMap_UL .Phuse_SiteMap_LI a[href$="+activeLink+"]").addClass("active_tab");
	$(".PhUniversityLinks .Hyperlink a[href$="+activeLink+"]").addClass("active_tab2");
    
    $(".UsernameCSS, .PasswordCSS, .LoginFormUsername").wrap("<div class=\"backgroundCurve\"></div>").css("padding","0px").css("border","none").focus(function(){
        $(this).css("outline","none");
    });
    
    $(".ContactForm input.MMDataCaptureForm_Input,.TopCol input.MMDataCaptureForm_Input,.MainContent input.MMDataCaptureForm_Input,.signupform .TextBoxCSS, .signupform .PostCodeCSS,.signupform .captcha input").wrap("<div class=\"backgroundCurve\"></div>").css("padding","0px").css("border","none").focus(function(){
        $(this).css("outline","none");
    });
    
    $(".ContactForm textarea.MMDataCaptureForm_Input,.TopCol textarea.MMDataCaptureForm_Input,.MainContent textarea.MMDataCaptureForm_Input").wrap("<div class=\"backgroundCurve\" style=\"height:100px;\"></div>").css("padding","0px").css("border","none").focus(function(){
        $(this).css("outline","none");
    });
    
    $(".backgroundCurve:not(:nth-child(2))").css("margin-bottom","10px");
    $(".RecentWork .GreenBlock").corner({
		tl: { radius: 4 },
		tr: { radius: 4 },
		bl: { radius: 0 },
		br: { radius: 0 }
	});
    $(".backgroundCurve,.GreenBlock,.OrangeBlock,.WhiteBox,.ThinBorder").corner({
		tl: { radius: 4 },
		tr: { radius: 4 },
		bl: { radius: 4 },
		br: { radius: 4 }
	});

    $(".ExtraLinksControl .Control").addClass("cursor").click(function() {
	    if ($(".ExtraLinks").is(":visible")) {
		    $(".ExtraLinks").slideUp();
		    $(".Links,.ClientLogin,.Links .backgroundCurve").fadeOut();
		    $(".ExtraLinksControl .Control").html("<img src=\"/images/open.gif\" /> Açik").css("cursor","pointer");
		    $.cookie('phcontrol', 'close', { path: '/', expires: 30 });
	    } else {
		    $(".ExtraLinks").slideDown();
		    $(".Links,.ClientLogin,.Links .backgroundCurve").fadeIn();
		    $(".ExtraLinksControl .Control").html("<img src=\"/images/close.gif\" /> Kapali").css("cursor","pointer");
		    $.cookie('phcontrol', 'open', { path: '/', expires: 30 });
	    }
    });
    
    $(".Manchester,.London,.NewYork").hide();
    $("#Liverpool").css("background","url(images/Liverpool-lozenge.gif) repeat-x #ededed");
    $(".Contacts p.Location").click(function() {
        $(".Contacts p.Location").css("background","none");
        var contact = $(this).attr("id");
        $(this).css("background","url(images/"+contact+"-lozenge.gif) repeat-x #ededed");
        if ($(".Contacts ."+contact+"").is(":hidden")) {
            $(".Contacts div.hideLocation").hide();
            $(".Contacts ."+contact+"").fadeIn();
        }
    }).hover(function(){
        var contact = $(this).attr("id");
        $(this).css("background","url(images/"+contact+"-lozenge.gif) repeat-x #ededed");
    },function(){
        var contact = $(this).attr("id");
        if ($(".Contacts ."+contact+"").is(":hidden")) {
            $(this).css("background","");
        } else {
        var contact = $(this).attr("id");
        $(this).css("background","url(images/"+contact+"-lozenge.gif) repeat-x #ededed");
        }
    });
    
    $i=0;
    while ($i < 20) {
    $("#scrollable .NormalPanel div:nth-child("+$i+")").addClass("scroll");
    $i++;
    }
    $("#scrollable .NormalPanel div.scroll div").removeClass("scroll");
    $("#scrollable .NormalPanel div.scroll").attr("style","");
    $("#scrollable").scrollable();
    $(".ContactForm img:first").addClass("firstImage");
    var blogContent = $(".blogFeed").html();
    $("#blogFeed").html(blogContent);
    $(".BodyContentTop .BottomContent:nth-child(even) ul li:nth-child(1)").append("");
    $(".BodyContentTop .BottomContent:nth-child(5) ul li").append("");
    $(".BodyContentTop .BottomContent:nth-child(5) ul li:has(a[href*='phuniversity']) img").css("display","none");
    
    /*$(".MMDataCaptureForm_ButtonTD").prepend("<img src=\"/images/contactform-submit.gif\" />");
    $(".MMDataCaptureForm_SubmitButton").hide();
    $(".MMDataCaptureForm_ButtonTD img").click(function(){
        var inputFields = $(".MMDataCaptureForm_Input").size();
        $i=1;
        while ($i <= inputFields) {
            var inputValue = $(".MMDataCaptureForm_Input:nth-child("+$i+")").attr("value");
            alert(inputValue);
            $i++;
        }
        //$(".MMDataCaptureForm_SubmitButton").click();
    });*/ //Form validation
});