$(document).ready(function(){
	/*** tab click ***/
	$('#function_panel .fun_tab').click(function(){
		if($('#function_panel .fun_tab:eq(0)').get(0) == (this)){
			$('#function_panel .wrapper:eq(0)').show();
			$('#function_panel .wrapper:eq(1)').hide();
		}else{
			$('#function_panel .wrapper:eq(0)').hide();
			$('#function_panel .wrapper:eq(1)').show();		
		}		
		if($(this).hasClass('normal')){
			$(this).children().each(function(){
				classes = $(this).attr('class');
				$(this).attr('class',classes.replace('normal','active'));
			});
			$('#function_panel .fun_tab.active').removeClass('active').addClass('normal').children().each(function(){
				classes = $(this).attr('class');
				$(this).attr('class',classes.replace('active','normal'));
			});
			$(this).removeClass('normal').addClass('active');
		}else
			return;
	});	
	
	/*** fancy box display ***/
	$('#fancybox_trlAct').fancybox({
		'padding'			: 5,
		'hideOnContentClick': false,
		//'showCloseButton'	: false,
		'titleShow'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe',
		'autoDimensions' 	: false,
		'width'				: 620,
		'height'			: 530	
	});
	
	$("#fancybox_2").fancybox({
		'padding'			: 5,
		'hideOnContentClick': false,
		//'showCloseButton'	: false,
		'titleShow'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe',
		'autoDimensions' 	: false,
		'width'				: 600,
		'height'			: 420
	});
	
	$('#fancybox_fp').fancybox({
		'padding'			: 5,
		'hideOnContentClick': false,
		//'showCloseButton'	: false,
		'titleShow'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe',
		'autoDimensions' 	: false,
		'width'				: 400,
		'height'			: 250	
	});
	
	$('#fancybox_chk').fancybox({
		'padding'			: 5,
		'hideOnContentClick': false,
		//'showCloseButton'	: false,
		'titleShow'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe',
		'autoDimensions' 	: false,
		'width'				: 400,
		'height'			: 250	
	});	
    
    $("input[name='pwd']").change(function(){
        $("input[name='mdpwd']").val('');
        $('form[name="Form1"]').attr('autocomplete', 'on');//修改了密码表单，此时肯定要打开自动完成
    });
    
    $('.tip').hover(function(e){
    	this.myTitle = this.title;
    	this.title = "";
    	if ($("#tooltip").length == 0){
    		var $tooltip = '<div id="tooltip" style="position:absolute;border:1px solid #FCD647;background:#FCFEC0;color:#666;display:none;padding: 3px 6px;z-index: 10000;">' + this.myTitle + '</div>';
    		$('body').append($tooltip);
    	}else{
    		$('#tooltip').html(this.myTitle);
    	}
    	$('#tooltip').css({
    		'top' : (e.pageY + 10) + 'px',
    		'left' : (e.pageX + 13) + 'px'
    	}).show(); 
    },function(){
    	this.title = this.myTitle;
    	$('#tooltip').hide();
    }).mousemove(function(e){
    	$('#tooltip').css({
    		'top' : (e.pageY + 10) + 'px',
    		'left' : (e.pageX + 13) + 'px'
    	});
    });
    
    //add by robot.zhang用户勾选了记住密码，则设置form的autocomplete="off"否则设置成on,以免记住的密码错误  
    setAutocomplete($(':checkbox[name="saveflag"]')); 
    $(':checkbox[name="saveflag"]').click(function(){
        setAutocomplete(this);
    });
    //设置登陆表单自动完成
    function setAutocomplete(obj)
    {
        //如果勾选了记住密码或者隐藏的cookie密码存在
        if ($(obj).attr('checked') == true || $("input[name='mdpwd']").val() != '') {
            $('form[name="Form1"]').attr('autocomplete', 'off');//关闭自动完成
        } else {//否则开启自动完成
            $('form[name="Form1"]').attr('autocomplete', 'on');
        }
    }
    //end add by robot.zhang

});
