'+(cla[j]=='num'?(''+(i+1)+''):(cla[j]=='txt'&&img?li[i].innerHTML.replace(/\
/i,img.alt)+''+img.getAttribute("text")+'
':(cla[j]=='thumb'&&img?'
':'')))+'')};
s.push('');
}; obj.innerHTML+=s.join('');
}
},
CSS={
style:function(o,attr){var v=(this.isIE?o.currentStyle:getComputedStyle(o,''))[attr],pv=parseFloat(v);return isNaN(pv)?v:pv;},
setOpa:function(o,val){o.style.filter = "alpha(opacity=" + val + ")",o.style.opacity = val/100;},
removeClass:function(o,name){var cla=o.className,reg="/\\s*"+name+"\\b/g";o.className=cla?cla.replace(eval(reg),''):''}
},
Anim={
animate:function(obj,attr,val,dur,type,fn){
var opa=attr==='opacity',F=this,opacity=F.setOpa,am=typeof val==='string',st=(new Date).getTime();
if(opa&&F.style(obj,'display')==='none') obj.style.display='block',opacity(obj,0);
var os=F.style(obj,attr),b=isNaN(os)?1:os,c=am?val/1:val-b,d=dur||800,e=F.easing[type||'easeOut'],m=c>0?'ceil':'floor';
if(obj[attr+'Timer']) clearInterval(obj[attr+'Timer']);
obj[attr+'Timer']=setInterval(function(){
var t=(new Date).getTime()-st;
if(tn-1&&!_tn&&!first) idx+=n;var next=idx!==undefined?idx:index+1;if("+fn2+")("+fn2+")();index=next;_tn=first=null;};run(index);if(_t&&par.auto)var auto=setInterval(function(){run()},_t);_F.addEvent(box,'mouseover',function(){if(auto)clearInterval(auto)});_F.addEvent(box,'mouseout',function(){if(auto)auto=setInterval(function(){run()},_t)});for(var i=0,_lk=_F.$$('a',box),_ln=_lk.length;i<_ln;i++) _lk[i].onfocus=function(){this.blur();}"
},
bind:function(arrStr,type,delay){
return "for (var j=0;j=n?next-n:next,scDur="+dur+"||500,scMax=scDis*(n-"+sn+"),scD=scDis*scIdx+scDir;if(scD>scDis*scN&&scIdx!==n-1) scPar["+dir+"]='-'+scDis;if(scD0?index-1:n-1);};"+next+".onclick=function(){_tn=2;var tIdx=index>=2*n-1?n-1:index;run(index==n-1&&!less?0:tIdx+1);}"},
alterSRC:function(o,name,del){var img=this.$$('img',o)[0];img.src=del?img.src.replace(eval("/"+name+"\\.(?=[^\\.]+$)/g"),'.'):img.src.replace(/\.(?=[^\.]+$)/g,name+'.')},
onloadIMG:function(box,wait,callback){
var img=this.$$('img',box),len=img.length,cont=0,ok=false;
for(var i=0;i= maxWidth / maxHeight) var M1='width',M2='height',MAX=maxWidth;
else var M1='height',M2='width',MAX=maxHeight;
var h=parseInt(imgs[i].style.height);
if(maxHeight>h){
imgs[i].style.marginTop=(maxHeight-h)/2+'px';//垂直居中
}
};
},
loadPattern:function(name,path,callback){
var js= document.createElement("script"),css=document.createElement("link"),src=path+name+'.js',href=path+name+'.css';
js.type = "text/javascript",js.src=src;
css.rel = "stylesheet",css.href=href;
this.$$('head')[0].appendChild(css);
this.$$('head')[0].appendChild(js);
if(this.isIE) {
js.onreadystatechange=function(){if(js.readyState=="loaded" || js.readyState=="complete") callback();}
}
else{js.onload=function(){callback();}}
js.onerror=function(){alert('Not Found (404): '+src)}//chrome
},
addEvent:function(obj,type,fn){var b=this.isIE,e=b?'attachEvent':'addEventListener',t=(b?'on':'')+type;obj[e](t,fn,false);}
};
mF.extend(mF,DOM,CSS,Anim,Init,Method);
mF.set.params=function(name,p){mF.pattern[name].cfg=p};
//防变量冲突处理
myFocus__AGENT__=mF;//引用
if(typeof myFocus==='undefined') myFocus=myFocus__AGENT__;
else alert('"myFocus" has been Defined, Please use "myFocus__AGENT__".');
//支持JQ
if(typeof jQuery!=='undefined'){
jQuery.fn.extend({
myFocus:function(p,fn){
if(!p) p={};
p.id=this[0].id;
if(!p.id) p.id=this[0].id='mF__NAME__';
myFocus__AGENT__.set(p,true,fn);
}
});
}
})();