﻿
//用于显示Flash的方法
//------------Flash路径，宽、高-----------
function FlashShow(SwfPath,Width,Height)
{
	var str="";
	SwfPath="images/index/"+SwfPath;
	str="<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" "+
		"codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\""+
        "width=\""+Width+"\" height=\""+Height+"\">"+
      	"<param name=\"movie\" value=\""+SwfPath+"\" />"+
      	"<param name=\"menu\" value=\"false\">"+
      	"<param name=\"wmode\" value=\"transparent\">"+
      	"<param name=\"quality\" value=\"high\" />"+
      	"<embed src=\""+SwfPath+"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\""+
        "type=\"application/x-shockwave-flash\" width=\""+Width+"\" height=\""+Height+"\"></embed>"+
    	"</object>";
	document.write(str);
}
//页面顶部搜索按钮的事件函数
//------------文本框的id,类型选择的下拉框id-----------
function search(objWord,objType)
{
    var page='/web/govOpen/search.aspx';
    var word=document.getElementById(objWord);
    var type=document.getElementById(objType);
    if(word.value=="")
    {
        alert("请输入要搜索的关键字！");
        word.focus();
        return false;
    }
    if(type.value=="")
    {
        alert("请选择分类！");
        type.focus();
        return false;
    }
	return true;
    //this.location.href=page+"?word="+encodeURIComponent(word.value)+"&type="+type.value
}
function jtrim(str){
	rvalue=str;	rl=rvalue.length;
	v_l=0;v_r=rl;

	for (i=0;i<rl;i++){
		if (rvalue.charAt(i)!="　"){	v_l=i;i=rl;}
	}

	for (i=(rl-1);i>=0;i--){
		if (rvalue.charAt(i)!="　"){	v_r=i;i=0;}
	}
	rvalue=rvalue.substr(v_l,(v_r-v_l)+1)
	if (rvalue.charAt(0)=="　"){
		rvalue=""
	}
	return rvalue

}  
function searchSub(objWord,objType)
{
    var page='/web/govOpen/search.aspx';
    var word=document.getElementById(objWord);
    var type=document.getElementById(objType);
    var search=word.value;
    search=search.replace(/(^\s*)|(\s*$)/g,""); 
    //search=search.replace(/(^\s*)|(\s*$)[　],""); 
    search=jtrim(search);
    if(search=="")
    {
        alert("请输入要搜索的关键字！");
        word.focus();
        return false;
    }
    if(type.value=="")
    {
        alert("请选择分类！");
        type.focus();
        return false;
    }
    this.location.href=page+"?word="+encodeURIComponent(word.value)+"&type="+type.value
}
//网上办事的界面切换
function OnlineShow(obj)
{
	//市民办事
    var polloi=document.getElementById("polloi");
	var btnP=document.getElementById("btnP");
	//企业办事
	var EnterPrise=document.getElementById("EnterPrise");
	var btnE=document.getElementById("btnE");
	//
	if(obj.id==btnP.id)
	{
		btnP.className="btn btn1";
		btnE.className="btn btn2";
		
		polloi.style.display="";
		EnterPrise.style.display="none";
	}
	if(obj.id==btnE.id)
	{
		btnE.className="btn btn1";
		btnP.className="btn btn2";
		
		polloi.style.display="none";
		EnterPrise.style.display="";
	}
}
//网站导航跳转
function MM_jumpMenu(selObj,restore){ //v3.0
    if(selObj.options[selObj.selectedIndex].value!="")
    {
	window.open(selObj.options[selObj.selectedIndex].value);
	}
  if (restore) selObj.selectedIndex=0;
}

//hnadlerArea，操作区域的ID；
//actionArea，被操作区域的id;
function mouseAction(VhandlerArea,Vnormal,Vaction,Vdefalut)
{
	//响应鼠标事件的区域
	this.handlerArea=VhandlerArea;
	//默认的css样式
	this.normal=Vnormal;
	//当鼠标悬停时的css样式
	this.action=Vaction;
	//默认选择
	this.def=Vdefalut!=null  ? Vdefalut : 1;
	this.start=function ()
	{		
		var tdList=document.getElementById(this.handlerArea).getElementsByTagName("td");
		for(var i=0;i<tdList.length;i++)
		{
			if(i==(this.def-1))continue;
			tdList[i].onmouseover=new Function("this.className='"+this.action+"'");
			tdList[i].onmouseout=new Function("this.className='"+this.normal+"'");
			tdList[i].className=this.normal;
		}		
		tdList[this.def-1].className=this.action;
	}
	
}

// 首页中间，选项卡切换效果
//hnadlerArea，操作区域的ID；
//actionArea，被操作区域的id;
function panelAction(VhandlerArea,VactionArea,Vnormal,Vaction,Vdefalut,Vexception)
{
	//响应鼠标事件的区域
	this.handlerArea=VhandlerArea;
	//要操作的区域
	this.actionArea=VactionArea;
	//默认的css样式
	this.normal=Vnormal;
	//当鼠标悬停时的css样式
	this.action=Vaction;
	//默认选择
	this.def=Vdefalut!=null  ? Vdefalut : 1;
	//除外的
	this.exception=Vexception;
	
	this.start=function ()
	{		
		var tdList=document.getElementById(this.handlerArea).getElementsByTagName("td");
		for(var i=0;i<tdList.length;i++)
		{
			if(this.exception-1==i)
			{
				tdList[i].setAttribute("valueName",-1);
				continue;
			}
			tdList[i].className=this.normal;
			tdList[i].setAttribute("valueName",i);
			tdList[i].onmouseover=new Function("mouseAc('"+this.normal+"','"+this.action+"',this.valueName,'"+this.handlerArea+"','"+this.actionArea+"');");	
			//alert(tdList[i].onmouseover);
		}
		tdList[this.def-1].className=this.action;
		//默认状态
		mouseAc(this.normal,this.action,this.def-1,this.handlerArea,this.actionArea);
	}	
}
function mouseAc(a,b,c,d,e)
{
	var tdList=document.getElementById(d).getElementsByTagName("td");
	var divList=document.getElementById(e).getElementsByTagName("div");
	//alert(e+":"+tdList[Number(c)].valueName);
	for(var i=0;i<tdList.length;i++)
	{
		var t=Number(tdList[i].getAttribute("valueName"));
		if(t<0)continue;
		tdList[i].className= t==Number(c) ? b : a;
		try{
		divList[i].style.display= i==Number(c) ? "" : "none";
		}catch(e){}
	}
}		

//获取元素的纵坐标
function getTop(e){
var offset=e.offsetTop;
if(e.offsetParent!=null) offset+=getTop(e.offsetParent);
return offset;
}
//获取元素的横坐标
function getLeft(e){
var offset=e.offsetLeft;
if(e.offsetParent!=null) offset+=getLeft(e.offsetParent);
return offset;
}