// JavaScript Document
//页头
$(document).ready
(
	function()
	{
		//设置搜索框焦点时清空内容
		$("#search_key").focus
		(
			function ()
			{				
				$(this).val('');
			}
		)		
		//页头搜索按钮
		$("#btn_search").css("cursor","pointer"); 
		$("#btn_search").click(home_search);

		//页头日期	
		$("#bar_date").append(G_GetDate2011());
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
	}
)

function MyAjaxGet()
{	
	var g_val = "";
	var g_opt_url = "/plus/ajaxopt.php";
	this.ExeAjax = function(data)
		{							
					$.ajax
					({
						type:"GET",
						url:g_opt_url,
						data:data,
						success:function(msg){ g_val=msg;},
						error:function(msg){alert("错误:"+msg);},
						global:false,
						async:false
					});	
		};
		
	this.MyGetVal = function()
		{				
			return g_val;
		};
}

//页头搜索判断
function home_search()
{
    var val = $("#search_key").val();
	var option_text = $("#search_type").val();
	val = val.replace(/\s/ig,"");
	val = val.replace("请输入关键字","");
	val = val.replace("开放档案快速检索","");	
	val = encodeURI(val);
	if(val.length == 0 && option_text != "0" )
	{	
		window.open("/redirect.php?tn="+ encodeURI(option_text));
	}
	else if(val.length > 0)
	{
		//进入搜索
		window.open("/redirect.php?op=search&keyword="+val+"&tn="+ encodeURI(option_text));
	}
	else
	{
		alert("请输入关键字或选择一个分类");	
		return false;
	}
	return false;
}
var header_index_date = "";
//页头日期
function G_GetDate()
{
		todayDate = new Date();
		date = todayDate.getDate();
		month= todayDate.getMonth() +1;
		year= todayDate.getFullYear();
		var t = "今天是";
		
		/*
		if(navigator.appName == "Netscape")
		{
			t = (1900+year);
			t += ("年");
			t += (month);
			t += ("月");
			t += (date);
			t += ("日");		
		}
		else if(navigator.appVersion.indexOf("MSIE") != -1)
		{
			t += (year);
			t += ("年");
			t += (month);
			t += ("月");
			t += (date);
			t += ("日");	
		}
		else
		{
			t += (year);
			t += ("年");
			t += (month);
			t += ("月");
			t += (date);
			t += ("日");	
		}
		*/
		$.ajax({
		 type: "GET",
		 url: "/plus/getdate.php",
		 data:   "",
		 global: false,
		 async: false,
		 success: function(msg){ header_index_date=msg;} 
		});
		t += header_index_date;
		return t;
}

//页头日期
function G_GetDate2011()
{
		var t="";
		$.ajax({
		 type: "GET",
		 url: "/plus/getdate.php?sel=3",
		 data:   "",
		 global: false,
		 async: false,
		 success: function(msg){ header_index_date=msg;} 
		});
		t += header_index_date;
		return t;
}
