//=====================================================//
var LoadReadyLocal = {
    slideShow: function(){
        $(function() {
            $('.anythingSlider').anythingSlider({
                 autoPlay: true
                ,easing: 'jswing'
                ,delay: 4000
                ,startStopped: false
                ,animationTime: 900
                ,hashTags: true
                ,buildNavigation: true
                ,pauseOnHover: true
            });
        });
        $(function() {
            $('#slider').easySlider({
                auto: false, 
                continuous: true,
                prevText: '',
                nextText: ''
            });
        });
    },

    registerForm: function(){
        $(function() {
            Member.setupRegisterForm();
        });
    },
    
    colorBox: function(){
        $(function() {
            $("a[rel='colorbox']").colorbox({
                 slideshow:true
                ,slideshowSpeed: 7000
                ,opacity: 0.50
                ,slideshowStart: ''
                ,slideshowStop: ''
                ,onClosed:function(){
                    $(this).colorbox.close();
                }
            });
        });
    },

    marquee: function(){
        $(function() {
            $('marquee').marquee('pointer');        
        });
    }
};

LoadReady = $.extend(LoadReady, LoadReadyLocal);


$(function() {
    $('.hlist li:last a').css({'border-right': 'none'});
    $('#nav .hlist li:last a').css({'padding-right': '0'});

    var settings = { 
        tl: { radius: 0 }, 
        tr: { radius: 0 },
        bl: { radius: 5 },  
        br: { radius: 5 }, 
        antiAlias: true 
    }; 
    
    //$('#topnav .hlist').each(function(rd) { curvyCorners(settings,rd); });
    $('#topnav .hlist').corner('bottom 5px');
    
    $('.hltOuterWrap .c33l:nth-child(3n)').css('margin-right', '0');

    $('.hltOuterWrap .c33l:nth-child(1) h4').css({'color': '#9CBEDE'});
    $('.hltOuterWrap .c33l:nth-child(2) h4').css({'color': '#F41C97'});
    $('.hltOuterWrap .c33l:nth-child(3) h4').css({'color': '#424542'});
    $('.hltOuterWrap .c33l:nth-child(4) h4').css({'color': '#428A84'});
    $('.hltOuterWrap .c33l:nth-child(5) h4').css({'color': '#9471F7'});
    $('.hltOuterWrap .c33l:nth-child(6) h4').css({'color': '#F78200'});

    $('.hltOuterWrap .c33l:nth-child(2) a.btn_more img').attr('src','/images/icons/read_btn2.gif');
    $('.hltOuterWrap .c33l:nth-child(3) a.btn_more img').attr('src','/images/icons/read_btn3.gif');
    $('.hltOuterWrap .c33l:nth-child(4) a.btn_more img').attr('src','/images/icons/read_btn4.gif');
    $('.hltOuterWrap .c33l:nth-child(5) a.btn_more img').attr('src','/images/icons/read_btn5.gif');
    $('.hltOuterWrap .c33l:nth-child(6) a.btn_more img').attr('src','/images/icons/read_btn6.gif');

    $('.vlist li:last a').css({'border-bottom': '0'});
    $('.thinList:last').css({'border-bottom': '0'});

    $('#tabs').tabs();

    $('form#editFormCommon').livequery (function(){
        var options = {
            success: function(json, statusText, jqFormObj) {
                extraPar = {}
                Validate.validateFormData(json, statusText, jqFormObj, extraPar);
                Util.hideProgressInd();
            },
            beforeSubmit: function() {
                Util.showProgressInd();
            },

            dataType: 'json'
        };

        $('#editFormCommon').ajaxForm(options);
    });

	$(".newsticker-jcarousellite").jCarouselLite({
		vertical: true,
		hoverPause:true,
		visible: 4,
		auto:500,
		speed:3000
	});

    $('.acknowledge a').click(function(e){
        e.preventDefault();
        Util.openDialogForLink.call(this, '', 600, 400);
    });

    $('marquee').marquee('pointer').mouseover(function () {
        $(this).trigger('stop');
    }).mouseout(function () {
        $(this).trigger('start');
    }).mousemove(function (event) {
        if ($(this).data('drag') == true) {
            this.scrollLeft = $(this).data('scrollX') + ($(this).data('x') - event.clientX);
        }
    }).mousedown(function (event) {
        $(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft);
    }).mouseup(function () {
        $(this).data('drag', false);
    });
    

        var dateObj = new Date();
        var currentYear = dateObj.getFullYear();
	    $("#fld_date_birth")
	    .datepicker( 
	        {
	            showOn: 'button',
	            buttonImage: '/images/icons/calendar_icon.gif',
	            dateFormat: 'yy-mm-dd',
	            buttonImageOnly: true,
	            changeYear: true,
	            yearRange: '1940:' + currentYear
            }
         )

	    $("#fld_date_training")
	    .datepicker( 
	        {
	            showOn: 'button',
	            buttonImage: '/images/icons/calendar_icon.gif',
	            dateFormat: 'yy-mm-dd',
	            buttonImageOnly: true,
	            changeYear: true,
	            yearRange: '1940:' + currentYear
            }
         )
	    .focus(function(){
            $(this).blur();
	    });

	    $('#ui-datepicker-div').draggable();

    $('.pointer > div').css('white-space', 'normal')
    
});


