//	Project:资源下载,Author:Clover,Date:2008-12-15,URI:http://resource.ciwong.com
function $(id){if(document.getElementById(id))return document.getElementById(id);else return false;};function getByClass(c){var a=[];var o=$('container').getElementsByTagName('*');var olen=o.length;for(var i=0;i<olen;i++){if(o[i].nodeType==1){if(o[i].className.indexOf(c)>=0){a[a.length]=o[i];}}};return a.length>0?a:null;};var sas={};sas.FlashObject=function (swf,id,w,h,ver,c,useExpressInstall,quality,xiRedirectUrl,redirectUrl,detectKey){if(!document.createElement||!document.getElementById)return ;this.DETECT_KEY=detectKey?detectKey:'detectflash';this.skipDetect=sas.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();this.useExpressInstall=useExpressInstall;if(swf)this.setAttribute('swf',swf);if(id)this.setAttribute('id',id);if(w)this.setAttribute('width',w);if(h)this.setAttribute('height',h);if(ver)this.setAttribute('version',new sas.PlayerVersion(ver.toString ().split(".")));this.installedVer=sas.getPlayerVersion(this.getAttribute('version'),useExpressInstall);if(c)this.addParam('bgcolor',c);var q=quality?quality:'high';this.addParam('quality',q);var xir=(xiRedirectUrl)?xiRedirectUrl:window.location;this.setAttribute('xiRedirectUrl',xir);this.setAttribute('redirectUrl','');if(redirectUrl)this.setAttribute('redirectUrl',redirectUrl)};sas.FlashObject.prototype={setAttribute:function (name,value){this.attributes[name]=value},getAttribute:function (name){return this.attributes[name]},addParam:function (name,value){this.params[name]=value},getParams:function (){return this.params},addVariable:function (name,value){this.variables[name]=value},getVariable:function (name){return this.variables[name]},getVariables:function (){return this.variables},createParamTag:function (n,v){var p=document.createElement('param');p.setAttribute('name',n);p.setAttribute('value',v);return p;},getVariablePairs:function (){var variablePairs=new Array();var key;var variables=this.getVariables();for(key in variables){variablePairs.push(key+"="+variables[key])};return variablePairs;},getFlashHTML:function (){var flashNode="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall"))this.addVariable("MMplayerType","PlugIn");flashNode='<embed type="application/x-shockwave-flash" src="'+this.getAttribute('swf')+'" width="'+this.getAttribute('width')+'" height="'+this.getAttribute('height')+'"';flashNode+=' id="'+this.getAttribute('id')+'" name="'+this.getAttribute('id')+'" ';var params=this.getParams();for(var key in params){flashNode+=[key]+'="'+params[key]+'" '};var pairs=this.getVariablePairs().join("&");if(pairs.length>0){flashNode+='flashvars="'+pairs+'"'};flashNode+='/>'}else {if(this.getAttribute("doExpressInstall"))this.addVariable("MMplayerType","ActiveX");flashNode='<object id="'+this.getAttribute('id')+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+this.getAttribute('width')+'" height="'+this.getAttribute('height')+'">';flashNode+='<param name="movie" value="'+this.getAttribute('swf')+'" />';var params=this.getParams();for(var key in params){flashNode+='<param name="'+key+'" value="'+params[key]+'" />'};var pairs=this.getVariablePairs().join("&");if(pairs.length>0){flashNode+='<param name="flashvars" value="'+pairs+'" />'};flashNode+="</object>"};return flashNode;},write:function (elementId){if(this.useExpressInstall){var expressInstallReqVer=new sas.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(expressInstallReqVer)&&!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)}}else {this.setAttribute('doExpressInstall',false)};if(this.skipDetect||this.getAttribute('doExpressInstall')||this.installedVer.versionIsValid(this.getAttribute('version'))){var n=(typeof elementId=='string')?document.getElementById(elementId):elementId;n.innerHTML=this.getFlashHTML()}else {if(this.getAttribute('redirectUrl')!=""){document.location.replace(this.getAttribute('redirectUrl'))}}}};sas.getPlayerVersion=function (reqVer,xiInstall){var PlayerVersion=new sas.PlayerVersion(0,0,0);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){PlayerVersion=new sas.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."))}}else {try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");for(var i=3;axo!=null;i++){axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);PlayerVersion=new sas.PlayerVersion([i,0,0])}}catch(e){};if(reqVer&&PlayerVersion.major>reqVer.major)return PlayerVersion;if(!reqVer||((reqVer.minor!=0||reqVer.rev!=0)&&PlayerVersion.major==reqVer.major)||PlayerVersion.major!=6||xiInstall){try{PlayerVersion=new sas.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","))}catch(e){}}};return PlayerVersion};sas.PlayerVersion=function (arrVersion){this.major=parseInt(arrVersion[0])||0;this.minor=parseInt(arrVersion[1])||0;this.rev=parseInt(arrVersion[2])||0};sas.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};sas.util={getRequestParameter:function (param){var q=document.location.search||document.location.href.hash;if(q){var startIndex=q.indexOf(param+"=");var endIndex=(q.indexOf("&",startIndex)>-1)?q.indexOf("&",startIndex):q.length;if(q.length>1&&startIndex>-1){return q.substring(q.indexOf("=",startIndex)+1,endIndex)}};return ""}};function Tab(obj){this.u=obj.getElementsByTagName('ul')[0];this.uli=this.u.getElementsByTagName('li');this.o=obj.getElementsByTagName('ol');var self=this;var k=0;var ulilen=this.uli.length;for(var i=0;i<ulilen;i++){this.uli[i].I=i;this.uli[i].onclick=function (){self.uli[k].className=self.uli[k].className.replace(/on/,'');self.o[k].className=self.o[k].className.replace(/on/,'');k=this.I;this.className+=' on';self.o[this.I].className+=' on';return false;}}};function checkForm(){if(!this.zyname.value){alert('资源名称不能为空!');this.zyname.focus();return false;};if(!$('lw').checked){if(!this.grade.value){alert('请选择年级!');this.grade.focus();return false;};if(!this.kemu.value){alert('请选择科目!');this.kemu.focus();return false;};if(!this.ver.value){alert('请选择版本!');this.ver.focus();return false;}}else {if(!this.lwclass.value){alert('请选择论文类型!');this.lwclass.focus();return false;}};if(!this.fileup.value){alert('请选择要上传文件!');this.fileup.focus();return false;}};function tips(){if(!this.value){$(this.name+'_e').className+=' on';}else {$(this.name+'_e').className=$(this.name+'_e').className.replace(/on/,'');}};function checkValue(){if(this.value){$(this.name+'_e').className=$(this.name+'_e').className.replace(/on/,'');}};window.onload=function (){if(getByClass('tab')){var tab=getByClass('tab');var tablen=tab.length;for(var i=0;i<tablen;i++){new Tab(tab[i]);}};if($('list')){var otr=$('list').getElementsByTagName('tr');var otrlen=otr.length;for(var i=1;i<otrlen;i+=2){otr[i].className+=' odd';}};if($('loginfm')){$('loginfm').onsubmit=function (){if(!this.userid.value){alert('请输入您的帐号!');return false;};if(!this.pw.value){alert('请输入密码!');return false;}}};if($('fm1')){$('lw').onclick=function (){$('fm1').className='cla3';};$('kj').onclick=$('st').onclick=$('ja').onclick=function (){$('fm1').className='cla1';};if($('lw').checked){$('fm1').className='cla3';};if($('fm1').intro.value=='请输入简单的资源介绍'){$('fm1').intro.style.color='#aaa';};$('fm1').intro.onclick=function (){if(this.value=='请输入简单的资源介绍'){this.value='';$('fm1').intro.style.color='#333';}};$('fm1').zyname.onkeydown=$('fm1').grade.onchange=$('fm1').kemu.onchange=$('fm1').ver.onchange=$('fm1').lwclass.onchange=checkValue;$('fm1').zyname.onblur=$('fm1').grade.onblur=$('fm1').kemu.onblur=$('fm1').ver.onblur=$('fm1').lwclass.onblur=tips;$('fm1').onsubmit=checkForm;};if($('fm2')){$('save').onclick=$('saves').onclick=function (){if(!$('fm2').sname.value){alert('请输入搜索器名称!');return false;}}}};