//flash幻灯广告
var getFlashAdvs = function(xml,w,h,ofocus){
	var focus_width=w; //图片框的宽度 
	var focus_height=h; //图片框的高度 
	
	html = "";
	html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '
	html += ' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"';
	html += ' width="'+ focus_width +'" height="'+ focus_height +'">'; 
	html += '<param name="allowscriptAccess" value="sameDomain"><param name="movie" value="'+ofocus+'">';
	html += '<param name="quality" value="high"><param name="bgcolor" value="#F2F2F2">'; 
	html += '<param name="menu" value="false"><param name=wmode value="opaque">'; 
	html += '<param name="FlashVars" value="bcastr_xml_url='+xml+'">'; 
	html += '<embed src="'+ofocus+'" wmode="opaque" FlashVars="bcastr_xml_url='+xml+'" menu="false"';
	html += ' bgcolor="#F2F2F2" quality="high" width="'+ focus_width +'" height="'+ focus_height +'"'
	html += 'allowscriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
	return html;
}
//FLASH播放javascript
function getFlash(setWidth,setHeight,setUrl){
	if(parseInt(setHeight)<1){
		setHeight = "100%";	
	}
	if(parseInt(setWidth)<1){
		setWidth = "100%";	
	}
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width='+setWidth+' height='+setHeight+'>')
	document.write('<param name="movie" value='+setUrl+'>')
	document.write('<param name="quality" value="high">')
	document.write('<param name="wmode" value="transparent" /> ')
	document.write('<embed src='+setUrl+' quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width='+setWidth+' height='+setHeight+' wmode="transparent"></embed></object>')
}
//音频播放
function getPlay(setid,setUrl,setWidth,setHeight){
	var strText="<object title=\"贵州便民网\" align=\"middle\" classid=\"CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95\" class=\"object\" id=\"MediaPlayer\" width="+setWidth+" height="+setHeight+">";
	strText = strText+"<param name=\"AUTOSTART\" value=\"true\"/>";
	strText = strText+"<param name=\"ShowStatusBar\" value=\"-1\"/>";
	strText = strText+"<param name=\"Filename\" value="+setUrl+">";
	strText = strText+"<param name=\"DisplaySize\" value=\"0\"> ";
	strText = strText+"<embed title=\"贵州便民网\" type=\"application/x-oleobject\" codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701\" flename=\"mp\" src="+setUrl+" >";
	strText = strText+"</embed>";
	strText = strText+"</object>";
	$(setid).html(strText);
}
//标签切换
function nTabs(tabObj,obj){
	var tabList = document.getElementById(tabObj).getElementsByTagName("li");
	for(i=0; i <tabList.length; i++){
		if (tabList[i].id == obj.id){
			document.getElementById(tabObj+"_te_"+i).className = "sli"; 
    		document.getElementById(tabObj+"_co_"+i).style.display = "block";
		}else{
			document.getElementById(tabObj+"_te_"+i).className = ""; 
			document.getElementById(tabObj+"_co_"+i).style.display = "none";
		}
	} 
}
//分类信息地区切换
function setZone(obj){
	id = obj.value;
	url = PUBLIC+"/setZone";
	$.post(url,"zoneId="+id,function(jsons){zoneAlert(jsons);},'json');
}
function zoneAlert(jsons){
	if(jsons.status==1){
		alert("已经切换到 ["+jsons.info+"] 地区");
		location.reload();
	}else{
		alert("地区切换失败，请重新试一下！");	
	}
}

//加入收藏
function AddFavorite(sURL,sTitle){
	try{
		window.external.addFavorite(sURL, sTitle);
	}catch (e){
		try
	{
		window.sidebar.addPanel(sTitle, sURL, "");
	}catch (e){
		alert("加入收藏失败，请使用Ctrl+D进行添加");
		}
	}
}
//设为首页
function SetHome(obj,vrl){
	try{
		obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl);
	}catch(e){
		if(window.netscape){
			try{
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
			}catch (e){
				alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。");
			}
			var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
			prefs.setCharPref('browser.startup.homepage',vrl);
		}
	}
}
//复制
function copyText(id){
	try{
		var targetText = document.getElementById(id);
		targetText.focus();
		targetText.select();
		var clipeText = targetText.createTextRange();
		clipeText.execCommand("Copy");
		alert("复制成功！");
	}catch(e){}
}