$(function() {
    
    $(".footer_icon:last").css("margin-right","0px");
    
    
    var COOKIE_NAME = 'lightswitch';

    if ($.cookie(COOKIE_NAME)=="on") {
         $(".switchon").hide();
         $(".switchoff").show();
         $("#CSS_7").removeAttr("href");
         $(".footer_icon, .ph_logo, .phuse_logo, .accreditations, .contact_form .MMDataCaptureForm_Table, .map, .img_padding_left, .img_padding_right").css("opacity","1");
         $(".day").show();
         $(".night").hide();

    } else if ($.cookie(COOKIE_NAME)=="off") {
         $(".switchon").show();
         $(".switchoff").hide();
         $("#CSS_7").attr("href","http://www.eco-environments.co.uk/res/css/Dark.css");
         $(".footer_icon, .ph_logo, .phuse_logo, .accreditations, .contact_form .MMDataCaptureForm_Table, .map, .img_padding_left, .img_padding_right").css("opacity","0.2");
         $(".day").hide();
         $(".night").show();
    }
    
    $(".MMDataCaptureForm_ErrorTD span").attr("style","");
 
    $(".paging a").each(function(){
        var getStyle = $(this).attr("style");
        if (getStyle=="font-weight: bold; text-decoration: underline;") {
            $(this).css("text-decoration","none");
        }
    });
    
    $(".paging a").each(function(){
        $(this).html($(this).html().replace("Next &gt;","&gt;").replace("&lt; Prev","&lt;"));
    });

    
    var blogContent = $(".blogFeed").html();
    $("#blogFeed").html(blogContent);
    $("#blogFeed li:nth-child(1)").addClass("first_blog");
    $("#blogFeed li:last").css("border","none");

    $(".popup").hide();
    $(".footer_icon").hover(function(){
        $(this).parent().children(".popup").fadeIn("fast");
    },function(){
        $(this).parent().children(".popup").hide();
    });
    
    var urltopnav = window.location;
    $(".top_nav a[href$="+urltopnav+"]").parent().addClass("active_tab");
    
    $(".NavigationMenu td:nth-child(1) .divide").hide();
    $(".NavigationMenu td:nth-child(1)").css("background","none");
    
    $("textarea").attr("style","");
   
    
    
    if (($.browser.ie6)) {
        $(".footer_mid").css("margin","19px 0 1px 0px");
        $(".divide").css("display","none");
    }
    
    $(".switchoff").click(function(){
    $.cookie(COOKIE_NAME, 'off', { path: '/', expires: 1 });
        $(".switchon").show();
         $(".switchoff").hide();
         $("#CSS_7").attr("href","http://www.eco-environments.co.uk/res/css/Dark.css");
         $(".footer_icon, .ph_logo, .phuse_logo, .accreditations, .contact_form .MMDataCaptureForm_Table, .map, .img_padding_left, .img_padding_right").css("opacity","0.2");
         $(".day").hide();
         $(".night").show();
    });
    
    $(".switchon").click(function(){
    $.cookie(COOKIE_NAME, 'on', { path: '/', expires: 1 });
        $(".switchon").hide();
         $(".switchoff").show();
         $("#CSS_7").removeAttr("href");
         $(".footer_icon, .ph_logo, .phuse_logo, .accreditations, .contact_form .MMDataCaptureForm_Table, .map, .img_padding_left, .img_padding_right").css("opacity","1");
         $(".day").show();
         $(".night").hide();
    });

    if ($(".login_panel").is(":visible")) {
        $("html, body").animate({ scrollTop: 250}, "slow");
    }

    /* $(document).mousemove(function(e) {
        if ($(".switchoff").is(":visible")) {
            mouseX = e.pageX;
            mouseY = e.pageY;
            if ((mouseX > eval($(document).width()-10000))&&(mouseY < 15)) {
                $(".warning").fadeIn();
            } else {
                $(".warning").fadeOut();
            }
        }
    }); */
});

function CheckMultiple100(frm, name) {
    for (var i=0; i < frm.length; i++) {
        fldObj = frm.elements[i];
        fldId = fldObj.id;
        if (fldId) {
            var fieldnamecheck=fldObj.id.indexOf(name);
            if (fieldnamecheck != -1) {
                if (fldObj.checked) {
                    return true;
                }
            }
        }
    }
    return false;
}
function CheckForm100(f) {
    var email_re = /[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i;
    if (!email_re.test(f.email.value)) {
        alert("Please enter your email address.");
        f.email.focus();
        return false;
    }
    return true;
}