﻿// JScript File

//新开窗口
function openWin(sUrl,iWidth,iHeight,bolClose) 
{ 
    /* 给参数bolClose设置默认值 */
    if (arguments.length<4){bolClose=false};
    /* winparms是打开窗口的一些相关属性设置 */ 
    var winparms = "height="+ iHeight +","; 
    winparms+= "width="+ iWidth +","; 
    winparms+="left="+ (screen.width-parseInt(iWidth))/2 +",";  
    winparms+="top="+ (screen.height-parseInt(iHeight))/2 +","; 
    winparms+= "toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no"; 
    /* oModal是用来监测是否被IE阻止了弹出窗口的 */ 
    var oModal = window.open(sUrl,"_blank", winparms); 
    //当oModal==undefined时，说明IE弹出窗口被阻止 
    if (oModal!=undefined) 
    { 
        oModal.focus();
        if (bolClose==true){
            //成功打开，则关闭登陆窗口，使opener为null，调用close时不提示是否关闭窗口的信息 
            window.top.opener=null;
            window.top.close();
        }
    }else{ 
        alert("您的浏览器阻止了弹出窗口。为了能够正常使用，请允许本站点的弹出窗口！谢谢！"); 
    } 
}

/*
作用：显示详细内容框
conw：宽度
conh：高度
str：内容
*/
function OpenViewWin(conw,conh,str){
	var s=document.getElementById('conDiv');
	if (s == null){
		var bordercolor; 
		bordercolor='#336699'; 
			            
		var sWidth,sHeight; 
		sWidth=document.body.offsetWidth; 
		sHeight=document.body.offsetHeight; 
        
		var x,y;												//获得鼠标当前X,Y坐标
		if(!document.all){
			x=pageX;
			y=pageY;
		}else{
			x=document.body.scrollLeft+event.clientX;			//鼠标X轴的值
			y=document.body.scrollTop+event.clientY;			//鼠标Y轴的值
		}
		var sH = document.body.scrollHeight;					//窗口的高度
		var sW = document.body.scrollWidth;						//窗口的宽度
		if((x + conw) >= sW){									//当鼠标点击时的x坐标的值加上div的宽度大于窗口的宽度
			x = x - conw;
		}
		y += 8;
		
		var conObj=document.createElement('div');
		conObj.setAttribute('id','conDiv'); 
		conObj.style.position = 'absolute'; 
		conObj.style.background = 'white'; 
		conObj.style.font = '12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif'; 
		conObj.style.border = '1px solid ' + bordercolor; 
		conObj.style.zIndex = "10000";
		conObj.style.width = conw + 'px'; 
		conObj.style.height = conh + 'px'; 
		conObj.style.top = y + 'px'; 
		conObj.style.left = x + 'px'; 
		
		var tips=document.createElement('h4'); 
		tips.setAttribute('id','msgTitle'); 
		tips.setAttribute('align','right'); 
		tips.style.margin = '0'; 
		tips.style.padding = '3px'; 
		tips.style.background = bordercolor; 
		tips.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100)'; 
		tips.style.opacity = '0.75'; 
		tips.style.border = '1px solid ' + bordercolor; 
		tips.style.height = '18px'; 
		tips.style.font = '12px Verdana, Geneva, Arial, Helvetica, sans-serif'; 
		tips.style.color = 'white'; 
		tips.style.cursor = 'pointer'; 
		tips.innerHTML = '<span style="width:16px;font-family:webdings;">r</span>'; 
		tips.onclick=function(){ 
			document.getElementById('conDiv').removeChild(tips); 
			document.body.removeChild(conObj); 
		} 
		document.body.appendChild(conObj); 
		document.getElementById('conDiv').appendChild(tips);	
		var txt = document.createElement('font'); 
		txt.style.margin='1em 0'; 
		txt.setAttribute('id','conTxt'); 
		txt.innerHTML = str; 
		document.getElementById('conDiv').appendChild(txt);
	}
}
//自动截取搜索字符
    function GetByteOfNum(val, num){ 
        var ch,bytenum=0; 
        var rs = ""; 
        var pt = /[^\x00-\xff]/; 
        for (var i=0; i < num; i++){ 
            ch = val.substr(i, 1); 
            if (ch.match(pt)){ 
                bytenum += 2; 
                if (bytenum > num) 
                { 
                    return rs; 
                } 
            }else 
            { 
                bytenum += 1; 
            } 
                rs += ch; 
                if (bytenum == num) 
                { 
                    return rs; 
                } 
            } 
            return rs; 
    } 
    function MaxLength(v,len) 
    {    
        var ascLen = v.value.replace(/[^\x00-\xff]/g,"**").length; 
        if(ascLen > len) 
        {    
            v.value = GetByteOfNum(v.value,len); 
        }
    } 
//判断搜索字符的长度
    function FocusTest(n,len){ 
        var txtobj = document.getElementById("txtTag"); 
        var Tlen = txtobj.value.length;
        if(Tlen>len){ 
            MaxLength(txtobj,25);
        }
    } 

//搜索
function Search()
{
    var txtobj = document.getElementById("txtTag"); 
	location="/Search/result.aspx?tags="+escape(txtobj.value);
}

//首页 当鼠标滑过时改变当前网址
function MoveUrl(sUrl)
{
    location.href=sUrl;
}

//图片按比例缩放
function ImgSize(img,iwidth,iheight,bolborder,bordercolor){
    var MaxWidth;
    var MaxHeight;
    var ipw;
	var iph;
	if(img.readyState!="complete") return false;//确保图片完全加载
    if (iwidth==null){MaxWidth=500;}else{MaxWidth=iwidth;}//设置图片宽度界限
    if (iheight==null){MaxHeight=400;}else{MaxHeight=iheight;}//设置图片高度界限
	var HeightWidth=img.offsetHeight/img.offsetWidth;//设置高宽比 
	var WidthHeight=img.offsetWidth/img.offsetHeight;//设置宽高比 
	if(img.offsetWidth>MaxWidth){
		img.width=MaxWidth;
		img.height=MaxWidth*HeightWidth;
		ipw=Math.floor((iwidth-MaxWidth)/2);
		iph=Math.floor((iheight-MaxWidth*HeightWidth)/2);
	} 
	if(img.offsetHeight>MaxHeight){
		img.height=MaxHeight;
		img.width=MaxHeight*WidthHeight;
		ipw=Math.floor((iwidth-MaxHeight*WidthHeight)/2);
		iph=Math.floor((iheight-MaxHeight)/2);
	}
	if(img.offsetHeight<MaxHeight && img.offsetWidth<MaxWidth){
	    ipw=Math.floor((iwidth-img.scrollWidth)/2);
	    iph=Math.floor((iheight-img.scrollHeight)/2);
	}
	var bolside;
	if (bolborder==null){bolside=true;}else{bolside=bolborder;}
	var bcolor;
	if (bordercolor == null){bcolor="#cccccc";}else{bcolor=bordercolor;}
	if (bolside==true){
	    img.style.border="solid 1px " + bcolor;
	    img.style.padding=iph + "px " + ipw + "px " + iph + "px " + ipw + "px";
	}    
}

/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;

//消除Flash在IE的虚线框
function showfalsh(surl,sname,iwidth,iheight,scolor){
	var so = new SWFObject(surl, sname, iwidth, iheight, "9", scolor);
	so.write(sname);
}

