/*preventexecutionofjQueryifincludedmorethenonce*/
if(typeofwindow.jQuery=="undefined"){
/*
*jQuery1.0.2-NewWaveJavascript
*
*Copyright(c)2006JohnResig(jquery.com)
*DuallicensedundertheMIT(MIT-LICENSE.txt)
*andGPL(GPL-LICENSE.txt)licenses.
*
*$Date:2006-10-0920:23:18-0400(Mon,09Oct2006)$
*$Rev:413$
*/
//Globalundefinedvariable
window.undefined=window.undefined;
jQuery=function(a,c){
//Shortcutfordocumentready(because$(document).each()issilly)
if(a&&typeofa=="function"&&jQuery.fn.ready)
returnjQuery(document).ready(a);
//Makesurethataselectionwasprovided
a=a||jQuery.context||document;
//WatchforwhenajQueryobjectispassedastheselector
if(a.jquery)
returnjQuery(jQuery.merge(a,[]));
//WatchforwhenajQueryobjectispassedatthecontext
if(c&&c.jquery)
returnjQuery(c).find(a);
//Ifthecontextisglobal,returnanewobject
if(window==this)
returnnewjQuery(a,c);
//HandleHTMLstrings
varm=/^[^<]*(<.+>)[^>]*$/.exec(a);
if(m)a=jQuery.clean([m[1]]);
//Watchforwhenanarrayispassedin
this.get(a.constructor==Array||a.length&&!a.nodeType&&a[0]!=undefined&&a[0].nodeType?
//AssumethatitisanarrayofDOMElements
jQuery.merge(a,[]):
//Findthematchingelementsandsavethemforlater
jQuery.find(a,c));
//Seeifanextrafunctionwasprovided
varfn=arguments[arguments.length-1];
//Ifso,executeitincontext
if(fn&&typeoffn=="function")
this.each(fn);
};
//Mapoverthe$incaseofoverwrite
if(typeof$!="undefined")
jQuery._$=$;
//MapthejQuerynamespacetothe'$'one
var$=jQuery;
jQuery.fn=jQuery.prototype={
jquery:"1.0.2",
size:function(){
returnthis.length;
},
get:function(num){
//Watchforwhenanarray(ofelements)ispassedin
if(num&&num.constructor==Array){
//UseatrickyhacktomakethejQueryobject
//lookandfeellikeanarray
this.length=0;
[].push.apply(this,num);
returnthis;
}else
returnnum==undefined?
//Returna'clean'array
jQuery.merge(this,[]):
//Returnjusttheobject
this[num];
},
each:function(fn,args){
returnjQuery.each(this,fn,args);
},
index:function(obj){
varpos=-1;
this.each(function(i){
if(this==obj)pos=i;
});
returnpos;
},
attr:function(key,value,type){
//Checktoseeifwe'resettingstylevalues
returnkey.constructor!=String||value!=undefined?
this.each(function(){
//Seeifwe'resettingahashofstyles
if(value==undefined)
//Setallthestyles
for(varpropinkey)
jQuery.attr(
type?this.style:this,
prop,key[prop]
);
//Seeifwe'resettingasinglekey/valuestyle
else
jQuery.attr(
type?this.style:this,
key,value
);
}):
//Lookforthecasewherewe'reaccessingastylevalue
jQuery[type||"attr"](this[0],key);
},
css:function(key,value){
returnthis.attr(key,value,"curCSS");
},
text:function(e){
e=e||this;
vart="";
for(varj=0;j
for(vari=0;i
t+=r[i].nodeType!=1?
r[i].nodeValue:jQuery.fn.text([r[i]]);
}
returnt;
},
wrap:function(){
//Theelementstowrapthetargetaround
vara=jQuery.clean(arguments);
//Wrapeachofthematchedelementsindividually
returnthis.each(function(){
//Clonethestructurethatwe'reusingtowrap
varb=a[0].cloneNode(true);
//Insertitbeforetheelementtobewrapped
this.parentNode.insertBefore(b,this);
//Findthedeepestpointinthewrapstructure
while(b.firstChild)
b=b.firstChild;
//Movethematchedelementtowithinthewrapstructure
b.appendChild(this);
});
},
append:function(){
returnthis.domManip(arguments,true,1,function(a){
this.appendChild(a);
});
},
prepend:function(){
returnthis.domManip(arguments,true,-1,function(a){
this.insertBefore(a,this.firstChild);
});
},
before:function(){
returnthis.domManip(arguments,false,1,function(a){
this.parentNode.insertBefore(a,this);
});
},
after:function(){
returnthis.domManip(arguments,false,-1,function(a){
this.parentNode.insertBefore(a,this.nextSibling);
});
},
end:function(){
returnthis.get(this.stack.pop());
},
find:function(t){
returnthis.pushStack(jQuery.map(this,function(a){
returnjQuery.find(t,a);
}),arguments);
},
clone:function(deep){
returnthis.pushStack(jQuery.map(this,function(a){
returna.cloneNode(deep!=undefined?deep:true);
}),arguments);
},
filter:function(t){
returnthis.pushStack(
t.constructor==Array&&
jQuery.map(this,function(a){
for(vari=0;i
returna;
})||
t.constructor==Boolean&&
(t?this.get():[])||
typeoft=="function"&&
jQuery.grep(this,t)||
jQuery.filter(t,this).r,arguments);
},
not:function(t){
returnthis.pushStack(t.constructor==String?
jQuery.filter(t,this,false).r:
jQuery.grep(this,function(a){returna!=t;}),arguments);
},
add:function(t){
returnthis.pushStack(jQuery.merge(this,t.constructor==String?
jQuery.find(t):t.constructor==Array?t:[t]),arguments);
},
is:function(expr){
returnexpr?jQuery.filter(expr,this).r.length>0:false;
},
domManip:function(args,table,dir,fn){
varclone=this.size()>1;
vara=jQuery.clean(args);
returnthis.each(function(){
varobj=this;
if(table&&this.nodeName.toUpperCase()=="TABLE"&&a[0].nodeName.toUpperCase()!="THEAD"){
vartbody=this.getElementsByTagName("tbody");
if(!tbody.length){
obj=document.createElement("tbody");
this.appendChild(obj);
}else
obj=tbody[0];
}
for(vari=(dir<0?a.length-1:0);
i!=(dir<0?dir:a.length);i+=dir){
fn.apply(obj,[clone?a[i].cloneNode(true):a[i]]);
}
});
},
pushStack:function(a,args){
varfn=args&&args[args.length-1];
varfn2=args&&args[args.length-2];
if(fn&&fn.constructor!=Function)fn=null;
if(fn2&&fn2.constructor!=Function)fn2=null;
if(!fn){
if(!this.stack)this.stack=[];
this.stack.push(this.get());
this.get(a);
}else{
varold=this.get();
this.get(a);
if(fn2&&a.length||!fn2)
this.each(fn2||fn).get(old);
else
this.get(old).each(fn);
}
returnthis;
}
};
jQuery.extend=jQuery.fn.extend=function(obj,prop){
if(!prop){prop=obj;obj=this;}
for(variinprop)obj[i]=prop[i];
returnobj;
};
jQuery.extend({
init:function(){
jQuery.initDone=true;
jQuery.each(jQuery.macros.axis,function(i,n){
jQuery.fn[i]=function(a){
varret=jQuery.map(this,n);
if(a&&a.constructor==String)
ret=jQuery.filter(a,ret).r;
returnthis.pushStack(ret,arguments);
};
});
jQuery.each(jQuery.macros.to,function(i,n){
jQuery.fn[i]=function(){
vara=arguments;
returnthis.each(function(){
for(varj=0;j
});
};
});
jQuery.each(jQuery.macros.each,function(i,n){
jQuery.fn[i]=function(){
returnthis.each(n,arguments);
};
});
jQuery.each(jQuery.macros.filter,function(i,n){
jQuery.fn[n]=function(num,fn){
returnthis.filter(":"+n+"("+num+")",fn);
};
});
jQuery.each(jQuery.macros.attr,function(i,n){
n=n||i;
jQuery.fn[i]=function(h){
returnh==undefined?
this.length?this[0][n]:null:
this.attr(n,h);
};
});
jQuery.each(jQuery.macros.css,function(i,n){
jQuery.fn[n]=function(h){
returnh==undefined?
(this.length?jQuery.css(this[0],n):null):
this.css(n,h);
};
});
},
each:function(obj,fn,args){
if(obj.length==undefined)
for(variinobj)
fn.apply(obj[i],args||[i,obj[i]]);
else
for(vari=0;i
returnobj;
},
className:{
add:function(o,c){
if(jQuery.className.has(o,c))return;
o.className+=(o.className?"":"")+c;
},
remove:function(o,c){
if(!c){
o.className="";
}else{
varclasses=o.className.split("");
for(vari=0;i
classes.splice(i,1);
break;
}
}
o.className=classes.join('');
}
},
has:function(e,a){
if(e.className!=undefined)
e=e.className;
returnnewRegExp("(^|s)"+a+"(s|$)").test(e);
}
},
swap:function(e,o,f){
for(variino){
e.style["old"+i]=e.style[i];
e.style[i]=o[i];
}
f.apply(e,[]);
for(variino)
e.style[i]=e.style["old"+i];
},
css:function(e,p){
if(p=="height"||p=="width"){
varold={},oHeight,oWidth,d=["Top","Bottom","Right","Left"];
for(variind){
old["padding"+d[i]]=0;
old["border"+d[i]+"Width"]=0;
}
jQuery.swap(e,old,function(){
if(jQuery.css(e,"display")!="none"){
oHeight=e.offsetHeight;
oWidth=e.offsetWidth;
}else{
e=jQuery(e.cloneNode(true)).css({
visibility:"hidden",position:"absolute",display:"block",right:"0",left:"0"
}).appendTo(e.parentNode)[0];
varparPos=jQuery.css(e.parentNode,"position");
if(parPos==""||parPos=="static")
e.parentNode.style.position="relative";
oHeight=e.clientHeight;
oWidth=e.clientWidth;
if(parPos==""||parPos=="static")
e.parentNode.style.position="static";
e.parentNode.removeChild(e);
}
});
returnp=="height"?oHeight:oWidth;
}
returnjQuery.curCSS(e,p);
},
curCSS:function(elem,prop,force){
varret;
if(prop=='opacity'&&jQuery.browser.msie)
returnjQuery.attr(elem.style,'opacity');
if(!force&&elem.style[prop]){
ret=elem.style[prop];
}elseif(elem.currentStyle){
varnewProp=prop.replace(/-(w)/g,function(m,c){returnc.toUpperCase();});
ret=elem.currentStyle[prop]||elem.currentStyle[newProp];
}elseif(document.defaultView&&document.defaultView.getComputedStyle){
prop=prop.replace(/([A-Z])/g,"-$1").toLowerCase();
varcur=document.defaultView.getComputedStyle(elem,null);
if(cur)
ret=cur.getPropertyValue(prop);
elseif(prop=='display')
ret='none';
else
jQuery.swap(elem,{display:'block'},function(){
ret=document.defaultView.getComputedStyle(this,null).getPropertyValue(prop);
});
}
returnret;
},
clean:function(a){
varr=[];
for(vari=0;i
//trimwhitespace,otherwiseindexOfwon'tworkasexpected
a[i]=jQuery.trim(a[i]);
vartable="";
if(!a[i].indexOf("table="thead"; vardiv=document.createElement("div"); if(table){ for(varj=0;j expr:{ //ChildChecks //ParentChecks //TextCheck //Visibility //Formattributes //Formelements token:[ //Setthecorrectcontext(ifnoneisprovided) if(t.constructor!=String)return[t]; if(!t.indexOf("//")){ varret=[context]; while(t.length>0&&last!=t){ t=jQuery.trim(t).replace(/^///i,""); varfoundToken=false; for(vari=0;i varre=newRegExp("^("+jQuery.token[i]+")"); if(m){ if(!foundToken){ if(m[1]=="#"){ for(vari=0;i } if(t){ if(ret&&ret[0]==context)ret.shift(); returndone; getAll:function(o,r){ attr:function(elem,name,value){ //IEactuallyusesfiltersforopacity...elemisactuallyelem.style //Mozilladoesn'tplaywellwithopacity1 if(fix[name]){ //Theregularexpressionsthatpowertheparsingengine //Match:[div],[divp] //Match::contains('foo') //Match::even,:last-chlid filter:function(t,r,not){ while(t&&/^[a-z[({<*:.#]/i.test(t)){ varp=jQuery.parse; for(vari=0;i //Lookfor,andreplace,string-likesequences varm=re.exec(t); if(m){ //Removewhatwejustmatched break; //:not()isaspecialcasethatcanbeoptimizedby //Otherwise,findtheexpressiontoexecute //Buildacustommacrotoencloseit //Executeitagainstthecurrentfilter //Returnanarrayoffilteredelements(r) if(elem){ if(siblings[i].nodeType==1) returnjQuery.extend(elems,{ //Movebovertothenewarray(thishelpstoavoid //Nowcheckforduplicatesbetweenaandbandonly //Thecollision-checkingprocess //Iftheitemisunique,addit returnresult; varresult=[]; //Gothroughthearray,onlysavingtheitems returnresult; varresult=[]; //Gothroughthearray,translatingeachoftheitemstotheir if(val!==null&&val!=undefined){ returnresult; /* //Bindaneventtoanelement //MakesurethatthefunctionbeingexecutedhasauniqueID //Inittheelement'seventstructure //Getthecurrentlistoffunctionsboundtothisevent //Ifithasn'tbeeninitializedyet //Rememberanexistinghandler,ifit'salreadythere //Addthefunctiontotheelement'shandlerlist //Andbindtheglobaleventhandlertotheelement //Rememberthefunctioninagloballist(fortriggering) guid:1, //Detachaneventorsetofeventsfromanelement trigger:function(type,data,element){ //Handleaglobaltrigger //Handletriggeringasingleelement //Triggertheevent handle:function(event){ event=event||jQuery.event.fix(window.event); //Ifnocorrecteventwasfound,fail varreturnValue=true; varc=this.events[event.type]; varargs=[].slice.call(arguments,1); for(varjinc){ returnreturnValue; fix:function(event){ event.stopPropagation=function(){ returnevent; } //Figureoutwhatbrowserisbeingused //ChecktoseeiftheW3Cboxmodelisbeingused jQuery.macros={ css:"width,height,top,left,position,float,overflow,color,background".split(","), filter:["eq","lt","gt","contains"], attr:{ val:"value", html:"innerHTML", id:null, title:null, name:null, href:null, src:null, rel:null axis:{ parent:"a.parentNode", ancestors:jQuery.parents, parents:jQuery.parents, next:"jQuery.sibling(a).next", prev:"jQuery.sibling(a).prev", siblings:"jQuery.sibling(a,null,true)", children:"jQuery.sibling(a.firstChild)" each:{ remove:function(a){ unbind:function(type,fn){ jQuery.init(); //We'reoverridingtheoldtogglefunction,so //Makesurethatclicksstop //andexecutethefunction //Otherwise,executetheoldtogglefunction //Aprivatefunctionforhaandlingmouse'hovering' //Traverseupthetree //Ifweactuallyjustmousedontoasub-element,ignoreit //Executetherightfunction //Bindthefunctiontothetwoeventlisteners //Otherwise,rememberthefunctionforlater returnthis; jQuery.extend({ //HandlewhentheDOMisready //Iftherearefunctionsbound,toexecute //Resetthelistoffunctions newfunction(){ vare=("blur,focus,load,resize,scroll,unload,click,dblclick,"+ //Gothroughalltheeventnames,butmakesurethat varo=e[i]; //Handleeventbinding //Handleeventunbinding //Finally,handleeventsthatonlyfireonce varcount=0; //Addtheevent //Andexecutetheboundfunction }; //IfMozillaisused //IfIEisused,usetheexcellenthackbyMatthiasMiller //Onlyworksifyoudocument.write()it //Usethedeferscripthack //Clearfrommemory //IfSafariisused //Ifeitheronearefound,removethetimer //andexecuteanywaitingfunctions //Afallbacktowindow.onload,thatwillalwayswork }; //CleanupafterIEtoavoidmemoryleaks //overwritetheoldshowmethod show:function(speed,callback){ //Overwritetheoldhidemethod hide:function(speed,callback){ slideDown:function(speed,callback){ slideUp:function(speed,callback){ slideToggle:function(speed,callback){ fadeIn:function(speed,callback){ fadeOut:function(speed,callback){ fadeTo:function(speed,to,callback){ this.curAnim=prop; for(varpinprop){ }); returnthis.each(function(){ if(!this.queue[type]) this.queue[type].push(fn); if(this.queue[type].length==1) }); jQuery.extend({ setAuto:function(e,p){ if(p=="height"&&e.scrollHeight!=parseInt(jQuery.curCSS(e,p)))return; //Remembertheoriginalheight //Figureoutthesizeoftheheightrightnow if(p=="height"&&e.scrollHeight!=o|| //Settheheighttoauto //Seewhatthesizeof"auto"is //Revertbacktotheoriginalsize speed:function(s,o){ if(o.constructor==Function) varss={slow:600,fast:200}; //Queueing returno; queue:{}, dequeue:function(elem,type){ if(elem.queue&&elem.queue[type]){ //Getnextfunction if(f)f.apply(elem); /* fx:function(elem,options,prop){ varz=this; //Theusersoptions //Theelement //Thestyles //Simplefunctionforsettingastylevalue if(prop=="opacity") y.display="block"; //Figureoutthemaximumnumbertorunto //Getthecurrentsize //Startananimationfromonenumbertoanother z.timer=setInterval(function(){ //Simple'show'function //Rememberwherewestarted,sothatwecangobacktoitlater //Begintheanimation //StupidIE,lookwhatyoumademedo //Simple'hide'function //Rememberwherewestarted,sothatwecangobacktoitlater z.o.hide=true; //Begintheanimation //Remembertheoverflowoftheelement //Makesurethatnothingsneaksout //Eachstepofananimation if(t>z.o.duration+z.startTime){ z.now=lastNum; z.el.curAnim[prop]=true; vardone=true; if(done){ //Hidetheelementifthe"hide"operationwasdone //Resettheproperty,iftheitemhasbeenhidden //setitsheightand/orwidthtoauto //Ifacallbackwasprovided,executeit //Performthenextstepoftheanimation } }); callback=callback||function(){}; //DefaulttoaGETrequest //Ifthesecondparameterwasprovided //Otherwise,buildaparamstring varself=this; //Requesttheremotedocument if(status=="success"||!ifModified&&status=="notmodified"){ //Executeallthescriptsinsideofthenewly-injectedHTML },ifModified); returnthis; }); //IfIEisused,createawrapperfortheXMLHttpRequestobject //AttachabunchoffunctionsforhandlingcommonAJAXevents newfunction(){ for(vari=0;i jQuery.extend({ //append?+dataor&+data,incasetherearealreadyparams //BuildandstarttheHTTPRequest //timeout(ms) //Last-Modifiedheadercachefornextrequest //Watchforanewsetofrequests varrequestDone=false; //Createtherequestobject //Openthesocket //Setthecorrectheader,ifdataisbeingsent //SettheIf-Modified-Sinceheader,ififModifiedmode. //Setheadersothecalledscriptknowsthatit'sanXMLHttpRequest //Makesurethebrowsersendstherightcontentlength //Waitforaresponsetocomeback varstatus=jQuery.httpSuccess(xml)&&istimeout!="timeout"? //Makesurethattherequestwassuccessfulornotmodified if(ifModified&&modRes) //Ifalocalcallbackwasspecified,fireit //Firetheglobalcallback //Otherwise,therequestwasnotsuccessful //Firetheglobalcallback //Therequestwascompleted //HandletheglobalAJAXcounter //Processresult //Stopmemoryleaks } //Timeoutchecker if(!requestDone)onreadystatechange("timeout"); //Clearfrommemory //Sendthedata //Counterforholdingthenumberofactivequeries //DeterminesifanXMLHttpRequestwassuccessfulornot returnfalse;
a[i]=""+a[i]+"
";
}elseif(!a[i].indexOf("table="tr";
a[i]=""+a[i]+"
";
}elseif(!a[i].indexOf("table="td";
a[i]="
"; "+a[i]+"
}
div.innerHTML=a[i];
div=div.firstChild;
if(table!="thead")div=div.firstChild;
if(table=="td")div=div.firstChild;
}
}elseif(a[i].jquery||a[i].length&&!a[i].nodeType)
for(vark=0;kr.push(a[i][k]);
elseif(a[i]!==null)
r.push(a[i].nodeType?a[i]:document.createTextNode(a[i].toString()));
}
returnr;
},
"":"m[2]=='*'||a.nodeName.toUpperCase()==m[2].toUpperCase()",
"#":"a.getAttribute('id')&&a.getAttribute('id')==m[2]",
":":{
//PositionChecks
lt:"i
nth:"m[3]-0==i",
eq:"m[3]-0==i",
first:"i==0",
last:"i==r.length-1",
even:"i%2==0",
odd:"i%2",
"nth-child":"jQuery.sibling(a,m[3]).cur",
"first-child":"jQuery.sibling(a,0).cur",
"last-child":"jQuery.sibling(a,0).last",
"only-child":"jQuery.sibling(a).length==1",
parent:"a.childNodes.length",
empty:"!a.childNodes.length",
contains:"(a.innerText||a.innerHTML).indexOf(m[3])>=0",
visible:"a.type!='hidden'&&jQuery.css(a,'display')!='none'&&jQuery.css(a,'visibility')!='hidden'",
hidden:"a.type=='hidden'||jQuery.css(a,'display')=='none'||jQuery.css(a,'visibility')=='hidden'",
enabled:"!a.disabled",
disabled:"a.disabled",
checked:"a.checked",
selected:"a.selected||jQuery.attr(a,'selected')",
text:"a.type=='text'",
radio:"a.type=='radio'",
checkbox:"a.type=='checkbox'",
file:"a.type=='file'",
password:"a.type=='password'",
submit:"a.type=='submit'",
image:"a.type=='image'",
reset:"a.type=='reset'",
button:"a.type=='button'",
input:"a.nodeName.toLowerCase().match(/input|select|textarea|button/)"
},
".":"jQuery.className.has(a,m[2])",
"@":{
"=":"z==m[4]",
"!=":"z!=m[4]",
"^=":"z&&!z.indexOf(m[4])",
"$=":"z&&z.substr(z.length-m[4].length,m[4].length)==m[4]",
"*=":"z&&z.indexOf(m[4])>=0",
"":"z"
},
"[":"jQuery.find(m[2],a).length"
},
"..|/..","a.parentNode",
">|/","jQuery.sibling(a.firstChild)",
"+","jQuery.sibling(a).next",
"~",function(a){
varr=[];
vars=jQuery.sibling(a);
if(s.n>0)
for(vari=s.n;i
returnr;
}
],
find:function(t,context){
//MakesurethatthecontextisaDOMElement
if(context&&context.nodeType==undefined)
context=null;
context=context||jQuery.context||document;
context=context.documentElement;
t=t.substr(2,t.length);
}elseif(!t.indexOf("/")){
context=context.documentElement;
t=t.substr(1,t.length);
//FIXAssumetherootelementisright:(
if(t.indexOf("/")>=1)
t=t.substr(t.indexOf("/"),t.length);
}
vardone=[];
varlast=null;
varr=[];
last=t;
varm=re.exec(t);
r=ret=jQuery.map(ret,jQuery.token[i+1]);
t=jQuery.trim(t.replace(re,""));
foundToken=true;
}
}
if(!t.indexOf(",")||!t.indexOf("|")){
if(ret[0]==context)ret.shift();
done=jQuery.merge(done,ret);
r=ret=[context];
t=""+t.substr(1,t.length);
}else{
varre2=/^([#.]?)([a-z0-9*_-]*)/i;
varm=re2.exec(t);
//Ummm,shouldmakethisworkinallXMLdocs
varoid=document.getElementById(m[2]);
r=ret=oid?[oid]:[];
t=t.replace(re2,"");
}else{
if(!m[2]||m[1]==".")m[2]="*";
m[2]=="*"?
jQuery.getAll(ret[i]):
ret[i].getElementsByTagName(m[2])
);
}
}
varval=jQuery.filter(t,r);
ret=r=val.r;
t=jQuery.trim(val.t);
}
}
done=jQuery.merge(done,ret);
},
r=r||[];
vars=o.childNodes;
for(vari=0;i
r.push(s[i]);
jQuery.getAll(s[i],r);
}
returnr;
},
varfix={
"for":"htmlFor",
"class":"className",
"float":"cssFloat",
innerHTML:"innerHTML",
className:"className",
value:"value",
disabled:"disabled",
checked:"checked"
};
if(name=="opacity"&&jQuery.browser.msie&&value!=undefined){
//IEhastroublewithopacityifitdoesnothavelayout
//Wouldprefertocheckelement.hasLayoutfirstbutdon'thaveaccesstotheelementhere
elem['zoom']=1;
if(value==1)//RemovefiltertoavoidmoreIEweirdness
returnelem["filter"]=elem["filter"].replace(/alpha([^)]*)/gi,"");
else
returnelem["filter"]=elem["filter"].replace(/alpha([^)]*)/gi,"")+"alpha(opacity="+value*100+")";
}elseif(name=="opacity"&&jQuery.browser.msie){
returnelem["filter"]?parseFloat(elem["filter"].match(/alpha(opacity=(.*))/)[1])/100:1;
}
if(name=="opacity"&&jQuery.browser.mozilla&&value==1)value=0.9999;
if(value!=undefined)elem[fix[name]]=value;
returnelem[fix[name]];
}elseif(value==undefined&&jQuery.browser.msie&&elem.nodeName&&elem.nodeName.toUpperCase()=='FORM'&&(name=='action'||name=='method')){
returnelem.getAttributeNode(name).nodeValue;
}elseif(elem.getAttribute!=undefined){
if(value!=undefined)elem.setAttribute(name,value);
returnelem.getAttribute(name,2);
}else{
name=name.replace(/-([a-z])/ig,function(z,b){returnb.toUpperCase();});
if(value!=undefined)elem[name]=value;
returnelem[name];
}
},
parse:[
//Match:[@value='test'],[@foo]
"[*(@)S*([!*$^=]*)*('?"?)(.*?)4*]",
"([)s*(.*?)s*]",
"(:)S("?'?([^)]*?)"?'?)",
"([:.#]*)S"
],
//Figureoutifwe'redoingregular,orinverse,filtering
varg=not!==false?jQuery.grep:
function(a,f){returnjQuery.grep(a,f,true);};
//andfinallybuildaregexpoutofit
varre=newRegExp(
"^"+p[i].replace("S","([a-z*_-][a-z0-9_-]*)"),"i");
//Re-organizethefirstmatch
if(!i)
m=["",m[1],m[3],m[2],m[5]];
t=t.replace(re,"");
}
}
//keepingitoutoftheexpressionlist
if(m[1]==":"&&m[2]=="not")
r=jQuery.filter(m[3],r,false).r;
else{
varf=jQuery.expr[m[1]];
if(f.constructor!=String)
f=jQuery.expr[m[1]][m[2]];
eval("f=function(a,i){"+
(m[1]=="@"?"z=jQuery.attr(a,m[3]);":"")+
"return"+f+"}");
r=g(r,f);
}
}
//andthemodifiedexpressionstring(t)
return{r:r,t:t};
},
trim:function(t){
returnt.replace(/^s+|s+$/g,"");
},
parents:function(elem){
varmatched=[];
varcur=elem.parentNode;
while(cur&&cur!=document){
matched.push(cur);
cur=cur.parentNode;
}
returnmatched;
},
sibling:function(elem,pos,not){
varelems=[];
varsiblings=elem.parentNode.childNodes;
for(vari=0;i
elems.push(siblings[i]);
if(siblings[i]==elem)
elems.n=elems.length-1;
}
}
last:elems.n==elems.length-1,
cur:pos=="even"&&elems.n%2==0||pos=="odd"&&elems.n%2||elems[pos]==elem,
prev:elems[elems.n-1],
next:elems[elems.n+1]
});
},
merge:function(first,second){
varresult=[];
//StaticNodeListinstances)
for(vark=0;k
//addtheuniqueitems
for(vari=0;i
for(varj=0;j
noCollision=false;
if(noCollision)
result.push(second[i]);
}
},
grep:function(elems,fn,inv){
//Ifastringispassedinforthefunction,makeafunction
//forit(ahandyshortcut)
if(fn.constructor==String)
fn=newFunction("a","i","return"+fn);
//thatpassthevalidatorfunction
for(vari=0;i
result.push(elems[i]);
},
map:function(elems,fn){
//Ifastringispassedinforthefunction,makeafunction
//forit(ahandyshortcut)
if(fn.constructor==String)
fn=newFunction("a","return"+fn);
//newvalue(orvalues).
for(vari=0;i
if(val.constructor!=Array)val=[val];
result=jQuery.merge(result,val);
}
}
},
*Anumberofhelperfunctionsusedformanagingevents.
*ManyoftheideasbehindthiscodeorignatedfromDeanEdwards'addEventlibrary.
*/
event:{
//OriginalbyDeanEdwards
add:function(element,type,handler){
//Forwhateverreason,IEhastroublepassingthewindowobject
//around,causingittobeclonedintheprocess
if(jQuery.browser.msie&&element.setInterval!=undefined)
element=window;
if(!handler.guid)
handler.guid=this.guid++;
if(!element.events)
element.events={};
varhandlers=element.events[type];
if(!handlers){
//Inittheeventhandlerqueue
handlers=element.events[type]={};
if(element["on"+type])
handlers[0]=element["on"+type];
}
handlers[handler.guid]=handler;
element["on"+type]=this.handle;
if(!this.global[type])
this.global[type]=[];
this.global[type].push(element);
},
global:{},
remove:function(element,type,handler){
if(element.events)
if(type&&element.events[type])
if(handler)
deleteelement.events[type][handler.guid];
else
for(variinelement.events[type])
deleteelement.events[type][i];
else
for(varjinelement.events)
this.remove(element,j);
},
//Touchuptheincomingdata
data=data||[];
if(!element){
varg=this.global[type];
if(g)
for(vari=0;i
}elseif(element["on"+type]){
//Passalongafakeevent
data.unshift(this.fix({type:type,target:element}));
element["on"+type].apply(element,data);
}
},
if(typeofjQuery=="undefined")return;
if(!event)return;
args.unshift(event);
if(c[j].apply(this,args)===false){
event.preventDefault();
event.stopPropagation();
returnValue=false;
}
}
},
if(event){
event.preventDefault=function(){
this.returnValue=false;
};
this.cancelBubble=true;
};
}
}
});
newfunction(){
varb=navigator.userAgent.toLowerCase();
jQuery.browser={
safari:/webkit/.test(b),
opera:/opera/.test(b),
msie:/msie/.test(b)&&!/opera/.test(b),
mozilla:/mozilla/.test(b)&&!/(compatible|webkit)/.test(b)
};
jQuery.boxModel=!jQuery.browser.msie||document.compatMode=="CSS1Compat";
};
to:{
appendTo:"append",
prependTo:"prepend",
insertBefore:"before",
insertAfter:"after"
},
},
},
removeAttr:function(key){
this.removeAttribute(key);
},
show:function(){
this.style.display=this.oldblock?this.oldblock:"";
if(jQuery.css(this,"display")=="none")
this.style.display="block";
},
hide:function(){
this.oldblock=this.oldblock||jQuery.css(this,"display");
if(this.oldblock=="none")
this.oldblock="block";
this.style.display="none";
},
toggle:function(){
jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"].apply(jQuery(this),arguments);
},
addClass:function(c){
jQuery.className.add(this,c);
},
removeClass:function(c){
jQuery.className.remove(this,c);
},
toggleClass:function(c){
jQuery.className[jQuery.className.has(this,c)?"remove":"add"](this,c);
},
if(!a||jQuery.filter(a,[this]).r)
this.parentNode.removeChild(this);
},
empty:function(){
while(this.firstChild)
this.removeChild(this.firstChild);
},
bind:function(type,fn){
if(fn.constructor==String)
fn=newFunction("e",(!fn.indexOf(".")?"jQuery(this)":"return")+fn);
jQuery.event.add(this,type,fn);
},
jQuery.event.remove(this,type,fn);
},
trigger:function(type,data){
jQuery.event.trigger(type,data,this);
}
}
};
jQuery.fn.extend({
//rememberitforlater
_toggle:jQuery.fn.toggle,
toggle:function(a,b){
//Iftwofunctionsarepassedin,we're
//togglingonaclick
returna&&b&&a.constructor==Function&&b.constructor==Function?this.click(function(e){
//Figureoutwhichfunctiontoexecute
this.last=this.last==a?b:a;
e.preventDefault();
returnthis.last.apply(this,[e])||false;
}):
this._toggle.apply(this,arguments);
},
hover:function(f,g){
functionhandleHover(e){
//Checkifmouse(over|out)arestillwithinthesameparentelement
varp=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;
while(p&&p!=this)try{p=p.parentNode}catch(e){p=this;};
if(p==this)returnfalse;
return(e.type=="mouseover"?f:g).apply(this,[e]);
}
returnthis.mouseover(handleHover).mouseout(handleHover);
},
ready:function(f){
//IftheDOMisalreadyready
if(jQuery.isReady)
//Executethefunctionimmediately
f.apply(document);
else{
//Addthefunctiontothewaitlist
jQuery.readyList.push(f);
}
}
});
/*
*AllthecodethatmakesDOMReadyworknicely.
*/
isReady:false,
readyList:[],
ready:function(){
//MakesurethattheDOMisnotalreadyloaded
if(!jQuery.isReady){
//RememberthattheDOMisready
jQuery.isReady=true;
if(jQuery.readyList){
//Executeallofthem
for(vari=0;i
jQuery.readyList=null;
}
//Removeeventlisentertoavoidmemoryleak
if(jQuery.browser.mozilla||jQuery.browser.opera)
document.removeEventListener("DOMContentLoaded",jQuery.ready,false);
}
}
});
"mousedown,mouseup,mousemove,mouseover,mouseout,change,reset,select,"+
"submit,keydown,keypress,keyup,error").split(",");
//itisenclosedproperly
for(vari=0;i
jQuery.fn[o]=function(f){
returnf?this.bind(o,f):this.trigger(o);
};
jQuery.fn["un"+o]=function(f){returnthis.unbind(o,f);};
jQuery.fn["one"+o]=function(f){
//Attachtheeventlistener
returnthis.each(function(){
jQuery.event.add(this,o,function(e){
//Ifthisfunctionhasalreadybeenexecuted,stop
if(count++)return;
returnf.apply(this,[e]);
});
});
};
if(jQuery.browser.mozilla||jQuery.browser.opera){
//Usethehandyeventcallback
document.addEventListener("DOMContentLoaded",jQuery.ready,false);
//http://www.outofhanwell.com/blog/index.php?title=the_window_onload_problem_revisited
}elseif(jQuery.browser.msie){
document.write("
varscript=document.getElementById("__ie_init");
script.onreadystatechange=function(){
if(this.readyState!="complete")return;
this.parentNode.removeChild(this);
jQuery.ready();
};
script=null;
}elseif(jQuery.browser.safari){
//Continuallychecktoseeifthedocument.readyStateisvalid
jQuery.safariTimer=setInterval(function(){
//loadedandcompletearebothvalidstates
if(document.readyState=="loaded"||
document.readyState=="complete"){
clearInterval(jQuery.safariTimer);
jQuery.safariTimer=null;
jQuery.ready();
}
},10);
}
jQuery.event.add(window,"load",jQuery.ready);
if(jQuery.browser.msie)jQuery(window).unload(function(){
varevent=jQuery.event,global=event.global;
for(vartypeinglobal){
varels=global[type],i=els.length;
if(i>0)doif(type!='unload')event.remove(els[i-1],type);while(--i);
}
});
jQuery.fn.extend({
_show:jQuery.fn.show,
returnspeed?this.animate({
height:"show",width:"show",opacity:"show"
},speed,callback):this._show();
},
_hide:jQuery.fn.hide,
returnspeed?this.animate({
height:"hide",width:"hide",opacity:"hide"
},speed,callback):this._hide();
},
returnthis.animate({height:"show"},speed,callback);
},
returnthis.animate({height:"hide"},speed,callback);
},
returnthis.each(function(){
varstate=jQuery(this).is(":hidden")?"show":"hide";
jQuery(this).animate({height:state},speed,callback);
});
},
returnthis.animate({opacity:"show"},speed,callback);
},
returnthis.animate({opacity:"hide"},speed,callback);
},
returnthis.animate({opacity:to},speed,callback);
},
animate:function(prop,speed,callback){
returnthis.queue(function(){
vare=newjQuery.fx(this,jQuery.speed(speed,callback),p);
if(prop[p].constructor==Number)
e.custom(e.cur(),prop[p]);
else
e[prop[p]](prop);
}
},
queue:function(type,fn){
if(!fn){
fn=type;
type="fx";
}
if(!this.queue)
this.queue={};
this.queue[type]=[];
fn.apply(this);
});
}
if(e.notAuto)return;
if(p=="width"&&e.scrollWidth!=parseInt(jQuery.curCSS(e,p)))return;
vara=e.style[p];
varo=jQuery.curCSS(e,p,1);
p=="width"&&e.scrollWidth!=o)return;
e.style[p]=e.currentStyle?"":"auto";
varn=jQuery.curCSS(e,p,1);
if(o!=n&&n!="auto"){
e.style[p]=a;
e.notAuto=true;
}
},
o=o||{};
o={complete:o};
o.duration=(s&&s.constructor==Number?s:ss[s])||400;
o.oldComplete=o.complete;
o.complete=function(){
jQuery.dequeue(this,"fx");
if(o.oldComplete&&o.oldComplete.constructor==Function)
o.oldComplete.apply(this);
};
},
type=type||"fx";
//Removeself
elem.queue[type].shift();
varf=elem.queue[type][0];
}
},
*Ioriginallywrotefx()asacloneofmoo.fxandintheprocess
*ofmakingitsmallinsizethecodebecameillegibletosane
*people.You'vebeenwarned.
*/
z.o={
duration:options.duration||400,
complete:options.complete,
step:options.step
};
z.el=elem;
vary=z.el.style;
z.a=function(){
if(options.step)
options.step.apply(elem,[z.now]);
jQuery.attr(y,"opacity",z.now);//Letattrhandleopacity
elseif(parseInt(z.now))//MyhateforIEwillneverdie
y[prop]=parseInt(z.now)+"px";
};
z.max=function(){
returnparseFloat(jQuery.css(z.el,prop));
};
z.cur=function(){
varr=parseFloat(jQuery.curCSS(z.el,prop));
returnr&&r>-10000?r:z.max();
};
z.custom=function(from,to){
z.startTime=(newDate()).getTime();
z.now=from;
z.a();
z.step(from,to);
},13);
};
z.show=function(p){
if(!z.el.orig)z.el.orig={};
z.el.orig[prop]=this.cur();
if(prop=="opacity")
z.custom(z.el.orig[prop],1);
else
z.custom(0,z.el.orig[prop]);
if(prop!="opacity")
y[prop]="1px";
};
z.hide=function(){
if(!z.el.orig)z.el.orig={};
z.el.orig[prop]=this.cur();
z.custom(z.el.orig[prop],0);
};
if(!z.el.oldOverlay)
z.el.oldOverflow=jQuery.css(z.el,"overflow");
y.overflow="hidden";
z.step=function(firstNum,lastNum){
vart=(newDate()).getTime();
//Stopthetimer
clearInterval(z.timer);
z.timer=null;
z.a();
for(variinz.el.curAnim)
if(z.el.curAnim[i]!==true)
done=false;
//Resettheoverflow
y.overflow=z.el.oldOverflow;
if(z.o.hide)
y.display='none';
if(z.o.hide){
for(varpinz.el.curAnim){
if(p=="opacity"&&jQuery.browser.msie)
jQuery.attr(y,p,z.el.orig[p]);
else
y[p]=z.el.orig[p]+"px";
if(p=='height'||p=='width')
jQuery.setAuto(z.el,p);
}
}
}
if(done&&z.o.complete&&z.o.complete.constructor==Function)
//Executethecompletefunction
z.o.complete.apply(z.el);
}else{
//Figureoutwhereintheanimationweareandsetthenumber
varp=(t-this.startTime)/z.o.duration;
z.now=((-Math.cos(p*Math.PI)/2)+0.5)*(lastNum-firstNum)+firstNum;
z.a();
}
};
jQuery.fn.extend({
loadIfModified:function(url,params,callback){
this.load(url,params,callback,1);
},
load:function(url,params,callback,ifModified){
if(url.constructor==Function)
returnthis.bind("load",url);
vartype="GET";
if(params){
//Ifit'safunction
if(params.constructor==Function){
//Weassumethatit'sthecallback
callback=params;
params=null;
}else{
params=jQuery.param(params);
type="POST";
}
}
jQuery.ajax(type,url,params,function(res,status){
//InjecttheHTMLintoallthematchedelements
self.html(res.responseText).each(callback,[res.responseText,status]);
jQuery("script",self).each(function(){
if(this.src)
jQuery.getScript(this.src);
else
eval.call(window,this.text||this.textContent||this.innerHTML||"");
});
}else
callback.apply(self,[res.responseText,status]);
},
serialize:function(){
returnjQuery.param(this);
}
if(jQuery.browser.msie&&typeofXMLHttpRequest=="undefined")
XMLHttpRequest=function(){
returnnewActiveXObject(
navigator.userAgent.indexOf("MSIE5")>=0?
"Microsoft.XMLHTTP":"Msxml2.XMLHTTP"
);
};
vare="ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess".split(",");
jQuery.fn[o]=function(f){
returnthis.bind(o,f);
};
};
};
get:function(url,data,callback,type,ifModified){
if(data.constructor==Function){
type=callback;
callback=data;
data=null;
}
if(data)url+=((url.indexOf("?")>-1)?"&":"?")+jQuery.param(data);
jQuery.ajax("GET",url,null,function(r,status){
if(callback)callback(jQuery.httpData(r,type),status);
},ifModified);
},
getIfModified:function(url,data,callback,type){
jQuery.get(url,data,callback,type,1);
},
getScript:function(url,callback){
jQuery.get(url,callback,"script");
},
getJSON:function(url,data,callback){
if(callback)
jQuery.get(url,data,callback,"json");
else{
jQuery.get(url,data,"json");
}
},
post:function(url,data,callback,type){
//BuildandstarttheHTTPRequest
jQuery.ajax("POST",url,jQuery.param(data),function(r,status){
if(callback)callback(jQuery.httpData(r,type),status);
});
},
timeout:0,
ajaxTimeout:function(timeout){
jQuery.timeout=timeout;
},
lastModified:{},
ajax:function(type,url,data,ret,ifModified){
//Ifonlyasingleargumentwaspassedin,
//assumethatitisaobjectofkey/valuepairs
if(!url){
ret=type.complete;
varsuccess=type.success;
varerror=type.error;
vardataType=type.dataType;
varglobal=typeoftype.global=="boolean"?type.global:true;
vartimeout=typeoftype.timeout=="number"?type.timeout:jQuery.timeout;
varifModified=type.ifModified||false;
data=type.data;
url=type.url;
type=type.type;
}
if(global&&!jQuery.active++)
jQuery.event.trigger("ajaxStart");
varxml=newXMLHttpRequest();
xml.open(type||"GET",url,true);
if(data)
xml.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
if(ifModified)
xml.setRequestHeader("If-Modified-Since",
jQuery.lastModified[url]||"Thu,01Jan197000:00:00GMT");
xml.setRequestHeader("X-Requested-With","XMLHttpRequest");
if(xml.overrideMimeType)
xml.setRequestHeader("Connection","close");
varonreadystatechange=function(istimeout){
//Thetransferiscompleteandthedataisavailable,ortherequesttimedout
if(xml&&(xml.readyState==4||istimeout=="timeout")){
requestDone=true;
ifModified&&jQuery.httpNotModified(xml,url)?"notmodified":"success":"error";
if(status!="error"){
//CacheLast-Modifiedheader,ififModifiedmode.
varmodRes;
try{
modRes=xml.getResponseHeader("Last-Modified");
}catch(e){}//swallowexceptionthrownbyFFifheaderisnotavailable
jQuery.lastModified[url]=modRes;
if(success)
success(jQuery.httpData(xml,dataType),status);
if(global)
jQuery.event.trigger("ajaxSuccess");
}else{
//Ifalocalcallbackwasspecified,fireit
if(error)error(xml,status);
if(global)
jQuery.event.trigger("ajaxError");
}
if(global)
jQuery.event.trigger("ajaxComplete");
if(global&&!--jQuery.active)
jQuery.event.trigger("ajaxStop");
if(ret)ret(xml,status);
xml.onreadystatechange=function(){};
xml=null;
};
xml.onreadystatechange=onreadystatechange;
if(timeout>0)
setTimeout(function(){
//Checktoseeiftherequestisstillhappening
if(xml){
//Canceltherequest
xml.abort();
xml=null;
}
},timeout);
xml.send(data);
},
active:0,
httpSuccess:function(r){
try{
return!r.status&&location.protocol=="file:"||
(r.status>=200&&r.status<300)||r.status==304||
jQuery.browser.safari&&r.status==undefined;
}catch(e){}
相关推荐