/*
公共函数
*/
function init_image_switch()
{
	$.each($("img[type=switch]"),function(i,n){
		$($("img[type=switch]")[i]).mouseover(function(){
			$(this).attr("src1",$(this).attr("src"));
			$(this).attr("src",$(this).attr("src2"));
		});
		$($("img[type=switch]")[i]).mouseout(function(){
			$(this).attr("src",$(this).attr("src1"));
		})
	});
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

/*
'**************************************************
'Function		去空格


'Author			Peace
'Create	Date	2004-09-09
'Parameter		Str				需要去空格的字符串
'**************************************************
*/
function KillSpace(Str,list){
		if(typeof(list) == 'undefined')
			list = ' ';
		while((Str.length>0) && list.indexOf(Str.charAt(0))!=-1 )
			 Str = Str.substring(1,Str.length);
		while((Str.length>0) && list.indexOf(Str.charAt(Str.length-1))!=-1)
		     Str = Str.substring(0,Str.length-1);
		
        return Str;
}
/*
'**************************************************
'Function		判断FORM TEXT输入是否正确
'Author			Peace
'Create	Date	2004-09-09
'Parameter		Obj				Form object
'				TypeValue		检测类型


'				Msg				提示信息
'**************************************************
*/
function CheckTextB(Obj,TypeValue,Msg)
{
	switch (TypeValue)
	{
		case 2:
			res=/^\d+$/
			$(Obj).val(KillSpace($(Obj).val()));
			if (res.exec($(Obj).val()))
			{	
				alert(Msg);
				Obj.focus();
				Obj.select();
			}
			else
			{
				return true;
			}
			break;
		case 8:
			$(Obj).val(KillSpace($(Obj).val()));
			if ($(Obj).val().length==0)
			{
				alert(Msg);
				$(Obj).focus();
				$(Obj).select();
				return false;
			}
			else
			{
				return true;
			}
			break;
	}
}

function addBookmark(title,url) 
{
	url = 'http://www.njylsj.com/';
	if (window.sidebar) 
	{ 
		window.sidebar.addPanel(title, window.location.href,""); 
	} 
	else if( document.all ) 
	{
		window.external.AddFavorite( window.location.href, title);
	} else if( window.opera && window.print ) 
	{
		return true;
	}
}
function setHomepage(domain)
{
	domain = 'http://www.njylsj.com/';
	if (document.all)
	{
		try
		{
			document.body.style.behavior='url(#default#homepage)';
			document.body.setHomePage(domain);
		}
		catch(e)
		{}
	}
	else if (window.sidebar)
	{
		if(window.netscape)
		{
			try
			{  
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
			}  
			catch (e)  
			{  
				alert( "该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true" );  
			}
		} 
		var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
		prefs.setCharPref('browser.startup.homepage',domain);
	}
}

function click(str){
			for(i=0;i<2;i++)
			{
				try
				{
					document.getElementById('jiao' + i).style.display = 'none';
					
					document.getElementById('j' + i).style.background='url(images/index_bg01.jpg) ';
					document.getElementById('c' + i).style.color='#000';
				
				}
				catch (e)
				{
				}
					document.getElementById('jiao' + str).style.display = 'block';
					document.getElementById('j' + str).style.background='url(images/index_bg02.jpg) ';
					
					document.getElementById('c' + str).style.color='#005DB3';
					document.getElementById('more').href='news.php?about='+str;		
			}
		}
function li(str){
			for(i=2;i<4;i++)
			{
				try
				{
					document.getElementById('jiao' + i).style.display = 'none';
					document.getElementById('j' + i).style.background='url(images/index_bg01.jpg) ';
					document.getElementById('c' + i).style.color='#000';
				
				}
				catch (e)
				{
				}
					document.getElementById('jiao' + str).style.display = 'block';
						document.getElementById('j' + str).style.background='url(images/index_bg02.jpg) ';
					document.getElementById('c' + str).style.color='#005DB3';
					document.getElementById('more1').href='news.php?about='+str;
			}
		}

function play_flash(focus_width,focus_height,text_height,pics,links,texts){
	var swf_height = focus_height+text_height;
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
	document.write('<param name="allowscriptAccess" value="sameDomain"><param name="movie" value="/images/play.swf"><param name="quality" value="high"><param name="bgcolor" value="#ffffff">');
	document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
	document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
	document.write('<embed src="/images/play.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#ffffff" quality="high" width="'+ focus_width +'" height="'+ focus_height +'" allowscriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}