var mouse_over = false
$('document').ready(function(){
    $('ul.sf-menu').superfish();
    $(".date_picker").datepicker({
        dateFormat:'yy-mm-dd',
        showOn:'button',
        buttonImage:base_url+'images/calendar.gif',
        buttonImageOnly:true,
        changeYear:true
    });
   

    $(".date_picker2").datepicker({
        dateFormat:'dd-mm-yy',
        showOn:'both',
        /*buttonImage:base_url+'images/calendar.gif',*/
        buttonImageOnly:true,
        changeYear:true,
        yearRange: '1919:2011'
    });
    
    $("#editbox_search").click(function(){
        if($(this).val()=='Search our ste:'){
            $(this).val('');
        }
    });
    $("#editbox_search").blur(function(){
        if($(this).val()==''){
            $(this).val('Search our ste:');
        }
    });
    /*ddsmoothmenu.init({
        mainmenuid: "smoothmenu1", //menu DIV id
        orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
        classname: 'menu_nav', //class added to menu's outer DIV
        //customtheme: ["#1c5a80", "#18374a"],
        contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
    })*/

    //sort_data.init();
	
    //$j("ul.top_link").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled - Adds empty span tag after ul.subnav
    /*
    $j("ul.top_link li").mouseover(function(e) {
        //$j(this).siblings().children('ul.subnav').slideUp(400);
        $j(this).siblings().children('ul.subnav').fadeOut(400);
        
        //$j(this).find("ul.subnav").slideDown(600).show(); //Drop down the subnav on click
        $j(this).find("ul.subnav").fadeIn(700);
    },function(e){
        //$j(this).find("ul.subnav").slideUp(400);
        });
	
   
    $j(".head_link").mouseenter(function(){
        $j("ul.subnav").fadeOut(400);
    });
    $j(".middle_content").mouseenter(function(){
        $j("ul.subnav").fadeOut(400);
    });
    $j("ul.subnav").mouseleave(function(e){
        
        
        
        $j(this).fadeOut(400);
        
        mouse_over= false;
        
    });*/
    
    /*
    
    jQuery("a[rel=photo_group]").fancybox({
        'width'		: '800',
        'height'	: '600',
        'autoScale'	: true,
        'titleShow'	: true,
        'transitionIn'	: 'elastic',
        'transitionOut'	: 'elastic',
        'titlePosition' : 'over',
        'titleFormat'	: function(title, currentArray, currentIndex, currentOpts) {
            return '<span id="fancybox-title-over">Photo ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
        }
    });
	*/

    /*$(".newsticker-jcarousellite").jCarouselLite({
        vertical: true,
        hoverPause:true,
        visible: 1,
        auto:500,
        speed:1000
    });
*/
	
});

var sort_data={
    init:function(){
        $('.jsort_news').change(function(){
            sort_data.sort_news(this);
        });
        $('.jnwcat_id').change(function(){
            sort_data.archive_news();
        });
        $('.jnw_date').change(function(){
            sort_data.archive_news();
        });
    },
    sort_news:function(obj){
        var nwcat_id=$(obj).val();
        var page=$(obj).attr('title');
        if(page==''){
            page='index';
        }
        window.location=base_url+'news/'+page+'/'+nwcat_id;
    },
    archive_news:function(){
        var nwcat_id=$("select[name='jnwcat_id']").val();
        var nw_date=$("input[name='nw_date']").val();
        window.location=base_url+'news/archive/'+nw_date+'/'+nwcat_id;
    }
}

$('.change_status').click(function(){
    var answer = confirm('Are you sure want to change the status ?');
    return answer
	
});
