$(document).ready(function() {
	//ajax调出用户登录表单	
	$("#UserLoginStrTop").load("../../HdApp/HdBas/HdAjaxGetData.asp?ac=UserLoginStr&ComUrl=<%=ComUrl%>");

	//计算访问量
	$("#sysAlert").load("../../HdApp/HdBas/HdAjaxGetData.asp?ac=VisitCount")
		
	$('a,input[type="button"],input[type="submit"]').bind('focus',function(){ if(this.blur){ this.blur(); }; });
	
	var dates = $( "#schDate1, #schDate2" ).datepicker({
			defaultDate: "+1w",
			//showButtonPanel: true,
			changeMonth: true,
			changeYear: true,
			numberOfMonths: 1,
			onSelect: function( selectedDate ) {
				var option = this.id == "schDate1" ? "minDate" : "maxDate",
					instance = $( this ).data( "datepicker" ),
					date = $.datepicker.parseDate(
						instance.settings.dateFormat ||
						$.datepicker._defaults.dateFormat,
						selectedDate, instance.settings );
				dates.not( this ).datepicker( "option", option, date );
			}
		});
		var dates = $( "#MeAge" ).datepicker({
			defaultDate: "+1w",
			//showButtonPanel: true,
			changeMonth: true,
			changeYear: true,
			yearRange:"1900:2100",
			numberOfMonths: 1,
			onSelect: function( selectedDate ) {
				var option = this.id == "MeAge" ? "minDate" : "maxDate",
					instance = $( this ).data( "datepicker" ),
					date = $.datepicker.parseDate(
						instance.settings.dateFormat ||
						$.datepicker._defaults.dateFormat,
						selectedDate, instance.settings );
				dates.not( this ).datepicker( "option", option, date );
			}
		});

});
	
function openclose(divid){ 
	var get_char = divid.charAt(0);
	if (get_char != "."){
		$("#"+divid).toggle()
	}
	else{
		$(divid).toggle()
	}
}

//弹出警告（alertIfRefresh为1时关闭后刷新页面）
function openAlert(alertTitle,alertContent,alertWidth,alertHeight,alertIfRefresh){
	 $("#sysAlert").html(alertContent);
	 $("#sysAlert").dialog({
		 title: alertTitle,
		 modal: true,
		 width:alertWidth,
		 height: alertHeight,
		 buttons: {
			 	关闭: function(){
					$(this).dialog("close");
					if(alertIfRefresh==1){
					history.go(0);
					}
				}
		 }
	});
	 
}



//弹出确认 
function openConfirm(cTitle,cUrl,cWidth,cHeight,cForm){
	 $("#sysConfirm").load(cUrl);
	 $("#sysConfirm").dialog({
		 title:cTitle,
		 width:cWidth,
		 height:cHeight,
		 modal: true,
		 buttons: {
				"确定吗？": function() {
					$("#"+cForm).submit();
				},
				取消: function() {
					$( this ).dialog( "close" );
				}
			}
		 });
	 }	 
	 
//弹出 
function openWin(WinTitle,WinUrl,WinWidth,WinHeight,WinIfRefresh){
	 $("#sysWin").load(WinUrl);
	 $("#sysWin").dialog({
		 title:WinTitle,
		 width:WinWidth,
		 height:WinHeight,
		 modal: true,
		 buttons: {
			 	关闭: function(){
					$(this).dialog("close");
						if(WinIfRefresh != 1){
						history.go(0);
						}
				}
		 }
		 
		 });
	 }
function refreshVCode(vc,vurl){
	$("#"+vc).attr("src",vurl+"&"+Math.random());
}

function nav2menu(mnid,mnopenorclose){
	if(mnopenorclose==1){
		$("#menu"+mnid).show();
	}else{
		$("#menu"+mnid).hide();
	}
}

function navmenu(mnid,mncount){

	$("#menu"+mnid).toggle();
	for(i=1;i<=mncount;i++){
		if(i != mnid){
		$("#menu"+i).hide();
		}
	}
}

function LabChange(DivId,Nowid,AllCount){
	for(i=1;i<=AllCount;i++){
		$("#"+DivId+i).hide();
	}
	$("#"+DivId+Nowid).show();
}