function copyCode(o){o.select();var js=o.createTextRange();js.execCommand("Copy");alert("复制成功！");}

function g(url){var url;location.href=url;}
function viewopen(url){
	window.open(url,"","")
}

/**   
 *    
 * @param {} sURL 收藏链接地址   
 * @param {} sTitle 收藏标题   
 */   
function AddFavorite(sURL, sTitle) {   
    try {   
        window.external.addFavorite(sURL, sTitle);   
    } catch (e) {   
        try {   
            window.sidebar.addPanel(sTitle, sURL, "");   
        } catch (e) {   
            alert("加入收藏失败，请使用Ctrl+D进行添加");   
        }   
    }   
}   
/**   
 *    
 * @param {} obj 当前对象，一般是使用this引用。   
 * @param {} vrl 主页URL   
 */   
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 myitemclick(){
   var _item_link = document.getElementById("_item_link");
   if(!_item_link.click) {
       window.location = _item_link.href;
   }else{
       _item_link.click();
   }
}

$=function(e){return document.getElementById(e);}


function ReImgSize(){ 
for (i=0;i<document.images.length;i++) 
{ 
if (document.all){ 
if (document.images[i].width>500) 
{ 
var oWidth=document.images[i].width; 
var oHeight=document.images[i].height; 
document.images[i].width="500"; 
document.images[i].height=oHeight*500/oWidth; 
//document.images[i].outerHTML='<a href="'+document.images[i].src+'" target="_blank" title="在新窗口打开图片">'+document.images[i].outerHTML+'</a>' 
} 
} 
else{ 
if (document.images[i].width>500) { 
var oWidth=document.images[i].width; 
var oHeight=document.images[i].height; 
document.images[i].width="500"; 
document.images[i].height=oHeight*500/oWidth; 
//document.images[i].title="在新窗口打开图片"; 
//document.images[i].style.cursor="pointer" 
//document.images[i].onclick=function(e){window.open(this.src)} 
} 
} 
} 
}
 
//el 当前事件dom
//s 区别于其他tab组的标识前缀，固定模式：标识+"_tabC"+数字
//i 触发数字
//n 总数量
function fastTab(el,s,i,n){
	for(var j = 1;j<=n;j++){
		var domT = document.getElementById(s+"_tabT_"+j);
		var domC = document.getElementById(s+"_tabC_"+j);
			domT.className = "";
			domC.className = "show0";
	}
	el.className = "commHover";
	document.getElementById(s+"_tabC_"+i).className = "show1";
}
//网站搜索JS
function searchfromcheck(){
	var s=document.searchform.s.value;
	if ((s!=1)&&(s!=2)){
		alert("请选择准确的选择类别");
		document.searchform.s.focus();
		return false;
	}
	var keyword=document.searchform.keyword.value;
	if (keyword.length < 2){
		alert("关键词不能少于2个字符");
		document.searchform.keyword.focus();
		return false;
	}

}

function swf_obj(src,w,h,swfid){
	swf_html = '';
	swf_html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+w+'" height="'+h+'" id="'+swfid+'" align="middle">';
	swf_html += '<param name="allowScriptAccess" value="always">';
	swf_html += '<param name="movie" value="'+src+'">';
	swf_html += '<param name="quality" value="high">';
	swf_html += '<param name="bgcolor" value="#FFFFFF">';
	swf_html += '<PARAM NAME="wmode" value="transparent">';
	swf_html += '<embed src="'+src+'" quality="high" bgcolor="#FFFFFF" width="'+w+'" height="'+h+'" name="'+swfid+'" align="middle" allowScriptAccess="always" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">';
	swf_html += '</object>';
	document.write(swf_html);
}

//高亮
function highlight(key) {
 var key = key.split('|');
 for (var i=0; i<key.length; i++) {
  var rng = document.body.createTextRange(); //创建一个textRange对象
  while (rng.findText(key[i]))
  rng.pasteHTML(rng.text.fontcolor('red'));
  //rng.pasteHTML('<em class="highlight">' + rng.text + '</em>'); //
 }
}
