$(document).ready(
    function(){    
        var siteUrl = "http://jamestrusler.co.uk/wp-content/themes/jamestrusler/";

        $("li[class*='current_page_item']").css('color','E9387D');
        $("li[class*='current_page_item'] a").unbind('hover');
        $("li[class*='current_page_item'] a").css('color','#E9387D'); 
        
        $('.universalButton').hover(
            function(){
                $(this).css('background-image',"url('" + siteUrl + "images/universalButtonO.png')");
                $(this).css('color','#434343;');
            },
            function(){
                $(this).css('background-image',"url('" + siteUrl + "images/universalButton.png')");
                $(this).css('color','#ffffff;');
            }
        ); 
        
        /* SEARCH BUTTON STUFF */
        
        $('#sideIcon').hover(
            function(){
                $(this).css('background-image',"url('" + siteUrl + "images/searchIconO.png')");
            },
            function(){           
                $(this).css('background-image',"url('" + siteUrl + "images/searchIcon.png')");
            }
        );
        
        $('#sideIcon').toggle(
            function(){  
                $('#searchForm').fadeIn();
                $('#searchForm').animate({
                        width: '319px'
                    }, 200, function() {
                        $('#searchButton').fadeIn(); 
                        $('.searchInputField').css('display', 'block');
                    }
                );
            },
            function(){           
                $('#searchButton').fadeOut(); 
                $('.searchInputField').css('display', 'none');
                $('#searchForm').animate({
                        width: '0px'
                    }, 200, function() {
                        $('#searchForm').fadeOut;
                    }
                );
            }
        );
        
        $('#searchButton').hover(
            function(){
                $(this).css('background-image', "url('" + siteUrl + "images/searchButtonO.png')");
            },
            function(){           
                $(this).css('background-image', "url('" + siteUrl + "images/searchButton.png')");
            }
        );
        
        //BOTTOM BAR
                               
        $('#bottomBar #bottomBarToggle').toggle(
            function(){
                $(this).animate({
                    bottom: '-5px'
                }, 200, function(){
                        $(this).css('background-image',"url('" + siteUrl + "images/bottomBarShow.png')"); 
                    }
                );
                $('#bottomBar').animate({
                    bottom: '-46px'
                }, 200);
                                
                $.cookie("bottomBarStatus", "hidden", {   
                    path: '/', 
                    expires: 1
                });         
            },
            function(){ 
                $(this).animate({
                    bottom: '41px'
                }, 200, function(){
                        $(this).css('background-image',"url('" + siteUrl + "images/bottomBarHide.png')"); 
                    }
                );
                $('#bottomBar').animate({
                    bottom: '0px'
                }, 200);
                
                
                $.cookie("bottomBarStatus", "show", {   
                    path: '/', 
                    expires: 1
                });
            }
        );       
         
        if ($.cookie("bottomBarStatus") == "show" || $.cookie("bottomBarStatus") == null){
        }else{
            $('#bottomBar #bottomBarToggle').trigger('click');
        }        
        
        
    }   
);

//OPEN NEW WINDOW

var newwindow;
function pop(url)
{
 newwindow=window.open(url,'name','height=430,width=590, scrollbars=no');
 if (window.focus) {newwindow.focus()}
}


