/* * jQuery 1.2.6 - New Wave Javascript * * Copyright (c) 2008 John Resig (jquery.com) * Dual licensed under the MIT (MIT-LICENSE.txt) * and GPL (GPL-LICENSE.txt) licenses. * * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $ * $Rev: 5685 $ */ (function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("",""]||!tags.indexOf("",""]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!tags.indexOf("",""]||(!tags.indexOf("",""]||!tags.indexOf("",""]||jQuery.browser.msie&&[1,"div
","
"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf(""&&tags.indexOf("=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&¬xml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&¬xml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&¬xml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return im[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("
").append(res.responseText.replace(//g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;ithis.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})(); /** * Flash (http://jquery.lukelutman.com/plugins/flash) * A jQuery plugin for embedding Flash movies. * * Version 1.0 * November 9th, 2006 * * Copyright (c) 2006 Luke Lutman (http://www.lukelutman.com) * Dual licensed under the MIT and GPL licenses. * http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/gpl-license.php * * Inspired by: * SWFObject (http://blog.deconcept.com/swfobject/) * UFO (http://www.bobbyvandersluis.com/ufo/) * sIFR (http://www.mikeindustries.com/sifr/) * * IMPORTANT: * The packed version of jQuery breaks ActiveX control * activation in Internet Explorer. Use JSMin to minifiy * jQuery (see: http://jquery.lukelutman.com/plugins/flash#activex). * **/ ;(function(){ var $$; /** * * @desc Replace matching elements with a flash movie. * @author Luke Lutman * @version 1.0.1 * * @name flash * @param Hash htmlOptions Options for the embed/object tag. * @param Hash pluginOptions Options for detecting/updating the Flash plugin (optional). * @param Function replace Custom block called for each matched element if flash is installed (optional). * @param Function update Custom block called for each matched if flash isn't installed (optional). * @type jQuery * * @cat plugins/flash * * @example $('#hello').flash({ src: 'hello.swf' }); * @desc Embed a Flash movie. * * @example $('#hello').flash({ src: 'hello.swf' }, { version: 8 }); * @desc Embed a Flash 8 movie. * * @example $('#hello').flash({ src: 'hello.swf' }, { expressInstall: true }); * @desc Embed a Flash movie using Express Install if flash isn't installed. * * @example $('#hello').flash({ src: 'hello.swf' }, { update: false }); * @desc Embed a Flash movie, don't show an update message if Flash isn't installed. * **/ $$ = jQuery.fn.flash = function(htmlOptions, pluginOptions, replace, update) { // Set the default block. var block = replace || $$.replace; // Merge the default and passed plugin options. pluginOptions = $$.copy($$.pluginOptions, pluginOptions); // Detect Flash. if(!$$.hasFlash(pluginOptions.version)) { // Use Express Install (if specified and Flash plugin 6,0,65 or higher is installed). if(pluginOptions.expressInstall && $$.hasFlash(6,0,65)) { // Add the necessary flashvars (merged later). var expressInstallOptions = { flashvars: { MMredirectURL: location, MMplayerType: 'PlugIn', MMdoctitle: jQuery('title').text() } }; // Ask the user to update (if specified). } else if (pluginOptions.update) { // Change the block to insert the update message instead of the flash movie. block = update || $$.update; // Fail } else { // The required version of flash isn't installed. // Express Install is turned off, or flash 6,0,65 isn't installed. // Update is turned off. // Return without doing anything. return this; } } // Merge the default, express install and passed html options. htmlOptions = $$.copy($$.htmlOptions, expressInstallOptions, htmlOptions); // Invoke $block (with a copy of the merged html options) for each element. return this.each(function(){ block.call(this, $$.copy(htmlOptions)); }); }; /** * * @name flash.copy * @desc Copy an arbitrary number of objects into a new object. * @type Object * * @example $$.copy({ foo: 1 }, { bar: 2 }); * @result { foo: 1, bar: 2 }; * **/ $$.copy = function() { var options = {}, flashvars = {}; for(var i = 0; i < arguments.length; i++) { var arg = arguments[i]; if(arg == undefined) continue; jQuery.extend(options, arg); // don't clobber one flash vars object with another // merge them instead if(arg.flashvars == undefined) continue; jQuery.extend(flashvars, arg.flashvars); } options.flashvars = flashvars; return options; }; /* * @name flash.hasFlash * @desc Check if a specific version of the Flash plugin is installed * @type Boolean * **/ $$.hasFlash = function() { // look for a flag in the query string to bypass flash detection if(/hasFlash\=true/.test(location)) return true; if(/hasFlash\=false/.test(location)) return false; var pv = $$.hasFlash.playerVersion().match(/\d+/g); var rv = String([arguments[0], arguments[1], arguments[2]]).match(/\d+/g) || String($$.pluginOptions.version).match(/\d+/g); for(var i = 0; i < 3; i++) { pv[i] = parseInt(pv[i] || 0); rv[i] = parseInt(rv[i] || 0); // player is less than required if(pv[i] < rv[i]) return false; // player is greater than required if(pv[i] > rv[i]) return true; } // major version, minor version and revision match exactly return true; }; /** * * @name flash.hasFlash.playerVersion * @desc Get the version of the installed Flash plugin. * @type String * **/ $$.hasFlash.playerVersion = function() { // ie try { try { // avoid fp6 minor version lookup issues // see: http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/ var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6'); try { axo.AllowScriptAccess = 'always'; } catch(e) { return '6,0,0'; } } catch(e) {} return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1]; // other browsers } catch(e) { try { if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){ return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1]; } } catch(e) {} } return '0,0,0'; }; /** * * @name flash.htmlOptions * @desc The default set of options for the object or embed tag. * **/ $$.htmlOptions = { height: 240, flashvars: {}, pluginspage: 'http://www.adobe.com/go/getflashplayer', src: '#', type: 'application/x-shockwave-flash', width: 320 }; /** * * @name flash.pluginOptions * @desc The default set of options for checking/updating the flash Plugin. * **/ $$.pluginOptions = { expressInstall: false, update: true, version: '6.0.65' }; /** * * @name flash.replace * @desc The default method for replacing an element with a Flash movie. * **/ $$.replace = function(htmlOptions) { this.innerHTML = '
'+this.innerHTML+'
'; jQuery(this) .addClass('flash-replaced') .prepend($$.transform(htmlOptions)); }; /** * * @name flash.update * @desc The default method for replacing an element with an update message. * **/ $$.update = function(htmlOptions) { var url = String(location).split('?'); url.splice(1,0,'?hasFlash=true&'); url = url.join(''); var msg = '

This content requires the Flash Player. Download Flash Player. Already have Flash Player? Click here.

'; this.innerHTML = ''+this.innerHTML+''; jQuery(this) .addClass('flash-update') .prepend(msg); }; /** * * @desc Convert a hash of html options to a string of attributes, using Function.apply(). * @example toAttributeString.apply(htmlOptions) * @result foo="bar" foo="bar" * **/ function toAttributeString() { var s = ''; for(var key in this) if(typeof this[key] != 'function') s += key+'="'+this[key]+'" '; return s; }; /** * * @desc Convert a hash of flashvars to a url-encoded string, using Function.apply(). * @example toFlashvarsString.apply(flashvarsObject) * @result foo=bar&foo=bar * **/ function toFlashvarsString() { var s = ''; for(var key in this) if(typeof this[key] != 'function') s += key+'='+encodeURIComponent(this[key])+'&'; return s.replace(/&$/, ''); }; /** * * @name flash.transform * @desc Transform a set of html options into an embed tag. * @type String * * @example $$.transform(htmlOptions) * @result * * Note: The embed tag is NOT standards-compliant, but it * works in all current browsers. flash.transform can be * overwritten with a custom function to generate more * standards-compliant markup. * **/ $$.transform = function(htmlOptions) { htmlOptions.toString = toAttributeString; if(htmlOptions.flashvars) htmlOptions.flashvars.toString = toFlashvarsString; return ''; }; /** * * Flash Player 9 Fix (http://blog.deconcept.com/2006/07/28/swfobject-143-released/) * **/ if (window.attachEvent) { window.attachEvent("onbeforeunload", function(){ __flash_unloadHandler = function() {}; __flash_savedUnloadHandler = function() {}; }); } })(); ;(function(){ var $$; $$ = jQuery.fn.calendar = function(calendarOpties){ this.each(function(){ var obj = this; sendRequest(obj,calendarOpties); }); }; function init_calendar(obj,calendarOpties,data) { jQuery(obj).html(jQuery(data).find('calendar_html').text()); jQuery(obj).find('tbody td').click(function(){ var id = jQuery(this).attr('id') var date = id.replace('calendarday_',''); calendarOpties.selected_date = date; calendarOpties.selected_month = ''; sendRequest(obj,calendarOpties); }); jQuery(obj).find('.vorige_maand, .volgende_maand').click(function(){ var id = jQuery(this).attr('id'); var date = id.replace('maand_',''); calendarOpties.selected_date = date; if(calendarOpties.month_can_select == 1) calendarOpties.selected_month = getYearMonthFromDate(date); else calendarOpties.selected_month = ''; sendRequest(obj,calendarOpties); }); jQuery(obj).find('.maand').click(function(){ var id = jQuery(this).attr('id'); var date = id.replace('maand_',''); if(calendarOpties.month_can_select == 1) { calendarOpties.selected_month = date; sendRequest(obj,calendarOpties); } }); if (calendarOpties.onselect) calendarOpties.onselect(data); } function sendRequest(obj, calendarOpties) { $$.calendarOpties = $$.copy($$.calendarOpties, calendarOpties); calendarOpties = $$.calendarOpties; if (calendarOpties.selected_date=='') calendarOpties.selected_date = getCurrentDate(); // google analytics var path = window.location.pathname; if (path.substring(path.length-1) != '/') path = path+'/'; if (calendarOpties.selected_month != '') pageTracker._trackPageview(path+calendarOpties.selected_month); else pageTracker._trackPageview(path+calendarOpties.selected_date); var sendOptions = {selected_date : calendarOpties.selected_date, selected_month : calendarOpties.selected_month} jQuery.post(calendarOpties.ajax_calendar_path,sendOptions,function(data){ init_calendar(obj,calendarOpties,data); },'xml'); } function trim(value) { value = value.replace(/^\s+/,''); value = value.replace(/\s+$/,''); return value; } function getCurrentDate() { ct = new Date(); var m = ct.getMonth()+1; return ct.getFullYear()+'-'+m+'-'+ct.getDate(); } function getYearMonthFromDate(date) { if (date != null) { var t = date.split('-'); return t[0]+'-'+t[1]; } } $$.calendarOpties = { selected_date: getCurrentDate(), selected_month: '', onselect: '', ajax_calendar_path: '' }; $$.copy = function() { var options = {}, flashvars = {}; for(var i = 0; i < arguments.length; i++) { var arg = arguments[i]; if(arg == undefined) continue; jQuery.extend(options, arg); } return options; }; })(); jQuery.extend({ htmlbox: function(options){ getPageScroll = function(){ var xScroll, yScroll; if (self.pageYOffset) { yScroll = self.pageYOffset; xScroll = self.pageXOffset; } else if (document.documentElement && document.documentElement.scrollTop){ // Explorer 6 Strict yScroll = document.documentElement.scrollTop; xScroll = document.documentElement.scrollLeft; } else if (document.body) {// all other Explorers yScroll = document.body.scrollTop; xScroll = document.body.scrollLeft; } var arrayPageScroll = new Array(xScroll,yScroll); return arrayPageScroll; }; getPageSize = function(){ var xScroll, yScroll; if (window.innerHeight && window.scrollMaxY) { xScroll = window.innerWidth + window.scrollMaxX; yScroll = window.innerHeight + window.scrollMaxY; } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac xScroll = document.body.scrollWidth; yScroll = document.body.scrollHeight; } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari xScroll = document.body.offsetWidth; yScroll = document.body.offsetHeight; } var windowWidth, windowHeight; if (self.innerHeight) { // all except Explorer if(document.documentElement.clientWidth){ windowWidth = document.documentElement.clientWidth; } else { windowWidth = self.innerWidth; } windowHeight = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } else if (document.body) { // other Explorers windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; } // for small pages with total height less then height of the viewport if(yScroll < windowHeight){ pageHeight = windowHeight; } else { pageHeight = yScroll; } // for small pages with total width less then width of the viewport if(xScroll < windowWidth){ pageWidth = xScroll; } else { pageWidth = windowWidth; } var arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight); return arrayPageSize; }; endHtmlbox = function(){ $('#htmlbox').hide(); $('#overlay_htmlbox').fadeOut(); $('select, object, embed').show(); }; var defaults = { overlayOpacity : 0.8, borderSize : 10, inprogress : false, widthCurrent: 500, heightCurrent: 10, xScale : 1, yScale : 1, content: '' } options = jQuery.extend({},defaults, options); $('#overlay_htmlbox').remove(); $('#htmlbox').remove(); //opts.inprogress = false; var string = '
'+ '
'+ '
'+options.content+'
'+ '
'; $("body").append(string); $("select, embed, object").hide(); var arrayPageSize = getPageSize(); $("#overlay_htmlbox").hide().css({width: '100%', height: arrayPageSize[1]+'px', opacity : options.overlayOpacity}).fadeIn(); // calculate top and left offset for the htmlbox var arrayPageScroll = getPageScroll(); var htmlboxTop = arrayPageScroll[1] + (arrayPageSize[3] / 10); var htmlboxLeft = arrayPageScroll[0]; $('#htmlbox').css({top: htmlboxTop+'px', left: htmlboxLeft+'px'}).show(); var padding_top = $('#htmlContainer').css('padding-top'); var padding_bottom = $('#htmlContainer').css('padding-bottom'); var newHeight = arrayPageSize[3] - (htmlboxTop*2) - parseInt(padding_top) - parseInt(padding_bottom); if (parseInt($('#htmlContainer').css('height'))>newHeight) { $('#htmlContainer').css('height',newHeight); } else { var windowHeight = parseInt($('#htmlContainer').css('height')) + parseInt(padding_top) + parseInt(padding_bottom); var newTop = ((arrayPageSize[3]/2) - (windowHeight/2)) $('#htmlbox').css('top',newTop); } $("#overlay_htmlbox").click(function(){ endHtmlbox() }); $("#htmlbox").click(function(){ endHtmlbox() }); $('#htmlContainer').width(options.widthCurrent); } }); /* * ContextMenu - jQuery plugin for right-click context menus * * Author: Chris Domigan * Contributors: Dan G. Switzer, II * Parts of this plugin are inspired by Joern Zaefferer's Tooltip plugin * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * * Version: r2 * Date: 16 July 2007 * * For documentation visit http://www.trendskitchens.co.nz/jquery/contextmenu/ * */ (function($) { var menu, shadow, trigger, content, hash, currentTarget; var defaults = { menuStyle: { listStyle: 'none', padding: '1px', margin: '0px', backgroundColor: '#fff', border: '1px solid #999', width: '100px' }, itemStyle: { margin: '0px', color: '#000', display: 'block', cursor: 'default', padding: '3px', border: '1px solid #fff', backgroundColor: 'transparent' }, itemHoverStyle: { border: '1px solid #0a246a', backgroundColor: '#b6bdd2' }, eventPosX: 'pageX', eventPosY: 'pageY', shadow : true, onContextMenu: null, onShowMenu: null }; $.fn.contextMenu = function(id, options) { if (!menu) { // Create singleton menu menu = $('
') .hide() .css({position:'absolute', zIndex:'500'}) .appendTo('body') .bind('click', function(e) { e.stopPropagation(); }); } if (!shadow) { shadow = $('
') .css({backgroundColor:'#000',position:'absolute',opacity:0.2,zIndex:499}) .appendTo('body') .hide(); } hash = hash || []; hash.push({ id : id, menuStyle: $.extend({}, defaults.menuStyle, options.menuStyle || {}), itemStyle: $.extend({}, defaults.itemStyle, options.itemStyle || {}), itemHoverStyle: $.extend({}, defaults.itemHoverStyle, options.itemHoverStyle || {}), bindings: options.bindings || {}, shadow: options.shadow || options.shadow === false ? options.shadow : defaults.shadow, onContextMenu: options.onContextMenu || defaults.onContextMenu, onShowMenu: options.onShowMenu || defaults.onShowMenu, eventPosX: options.eventPosX || defaults.eventPosX, eventPosY: options.eventPosY || defaults.eventPosY }); var index = hash.length - 1; $(this).bind('contextmenu', function(e) { // Check if onContextMenu() defined var bShowContext = (!!hash[index].onContextMenu) ? hash[index].onContextMenu(e) : true; if (bShowContext) display(index, this, e, options); return false; }); return this; }; function display(index, trigger, e, options) { var cur = hash[index]; content = $('#'+cur.id).find('ul:first').clone(true); content.css(cur.menuStyle).find('li').css(cur.itemStyle).hover( function() { $(this).css(cur.itemHoverStyle); }, function(){ $(this).css(cur.itemStyle); } ).find('img').css({verticalAlign:'middle',paddingRight:'2px'}); // Send the content to the menu menu.html(content); // if there's an onShowMenu, run it now -- must run after content has been added // if you try to alter the content variable before the menu.html(), IE6 has issues // updating the content if (!!cur.onShowMenu) menu = cur.onShowMenu(e, menu); $.each(cur.bindings, function(id, func) { $('#'+id, menu).bind('click', function(e) { hide(); func(trigger, currentTarget); }); }); menu.css({'left':e[cur.eventPosX],'top':e[cur.eventPosY]}).show(); if (cur.shadow) shadow.css({width:menu.width(),height:menu.height(),left:e.pageX+2,top:e.pageY+2}).show(); $(document).one('click', hide); } function hide() { menu.hide(); shadow.hide(); } // Apply defaults $.contextMenu = { defaults : function(userDefaults) { $.each(userDefaults, function(i, val) { if (typeof val == 'object' && defaults[i]) { $.extend(defaults[i], val); } else defaults[i] = val; }); } }; })(jQuery); $(function() { $('div.contextMenu').hide(); }); //array van maanden (wordt bijv. gebruikt in het arrangementen scherm var maanden = new Array(12); maanden[0]="Januari"; maanden[1]="Februari"; maanden[2]="Maart"; maanden[3]="April"; maanden[4]="Mei"; maanden[5]="Juni"; maanden[6]="Juli"; maanden[7]="Augustus"; maanden[8]="September"; maanden[9]="Oktober"; maanden[10]="November"; maanden[11]="December"; $(document).ready( function() { var clienttime = new Date().getTime(); $("#clienttime").val(clienttime); } ); //global functions function setupCalendar(inputField, inputFormat, inputButton, showTime, onUpdateCallback) { if (!onUpdateCallback) onUpdateCallback = null; Calendar.setup({ inputField : inputField, //"datum", // id of the input field ifFormat : inputFormat, //"%d-%m-%Y", // format of the input field button : inputButton, //"i_datum", // trigger for the calendar (button ID) showsTime : showTime, onUpdate : onUpdateCallback, singleClick : true }); } //function download(location, filename) //{ // myTempWindow = window.open(location,'','left=10000,screenX=10000'); // myTempWindow.document.execCommand('SaveAs','null',filename); // myTempWindow.close(); //} function display_eurowaarde(waarde) { eurowaarde = "\u20AC "+display_bedrag(waarde); return eurowaarde; } function display_bedrag(waarde) { // return the total rounded to two decimal places stringbedrag = waarde.toString(); stringbedrag = stringbedrag.replace(/\,/, "."); bedrag = round_decimals(stringbedrag, 2); stringbedrag = bedrag.toString(); stringbedrag = stringbedrag.replace(/\./, ","); return stringbedrag; } function round_decimals(original_number, decimals) { var result1 = original_number * Math.pow(10, decimals) var result2 = Math.round(result1) var result3 = result2 / Math.pow(10, decimals) return pad_with_zeros(result3, decimals) } function pad_with_zeros(rounded_value, decimal_places) { // Convert the number to a string var value_string = rounded_value.toString() // Locate the decimal point var decimal_location = value_string.indexOf(".") // Is there a decimal point? if (decimal_location == -1) { // If no, then all decimal places will be padded with 0s decimal_part_length = 0 // If decimal_places is greater than zero, tack on a decimal point value_string += decimal_places > 0 ? "." : "" } else { // If yes, then only the extra decimal places will be padded with 0s decimal_part_length = value_string.length - decimal_location - 1 } // Calculate the number of decimal places that need to be padded with 0s var pad_total = decimal_places - decimal_part_length if (pad_total > 0) { // Pad the string with 0s for (var counter = 1; counter <= pad_total; counter++) value_string += "0" } return value_string } function flashupload(status,data) { if (status==1) { var arrData = data.split('||'); if (arrData[0] == 'error') { alert(arrData[1]) } else if (arrData[0] == 'pasfoto') { $('#window_medewerker_'+arrData[1]+' .foto').css('background-image',"url('/tmp/"+arrData[2]+"?t="+Math.random()+"')"); $('#medewerker_'+arrData[1]+'_pasfoto').val(arrData[2]); } } else alert(data); } function rawurlencode (str) { // URL-encodes string // // version: 911.718 // discuss at: http://phpjs.org/functions/rawurlencode // + original by: Brett Zamir (http://brett-zamir.me) // + input by: travc // + input by: Brett Zamir (http://brett-zamir.me) // + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + input by: Michael Grier // + bugfixed by: Brett Zamir (http://brett-zamir.me) // + input by: Ratheous // + reimplemented by: Brett Zamir (http://brett-zamir.me) // + bugfixed by: Joris // + reimplemented by: Brett Zamir (http://brett-zamir.me) // % note 1: This reflects PHP 5.3/6.0+ behavior // % note 2: Please be aware that this function expects to encode into UTF-8 encoded strings, as found on // % note 2: pages served as UTF-8 // * example 1: rawurlencode('Kevin van Zonneveld!'); // * returns 1: 'Kevin%20van%20Zonneveld%21' // * example 2: rawurlencode('http://kevin.vanzonneveld.net/'); // * returns 2: 'http%3A%2F%2Fkevin.vanzonneveld.net%2F' // * example 3: rawurlencode('http://www.google.nl/search?q=php.js&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a'); // * returns 3: 'http%3A%2F%2Fwww.google.nl%2Fsearch%3Fq%3Dphp.js%26ie%3Dutf-8%26oe%3Dutf-8%26aq%3Dt%26rls%3Dcom.ubuntu%3Aen-US%3Aunofficial%26client%3Dfirefox-a' str = (str+'').toString(); // Tilde should be allowed unescaped in future versions of PHP (as reflected below), but if you want to reflect current // PHP behavior, you would need to add ".replace(/~/g, '%7E');" to the following. return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28'). replace(/\)/g, '%29').replace(/\*/g, '%2A'); } /** * Log something to the firebug or chrome console * * @param {Object} data */ function clog(data) { if (console && typeof console.log == 'function') console.log(data) } if(typeof jQuery=="undefined"){throw"Unable to load Shadowbox, jQuery library not found"}var Shadowbox={};Shadowbox.lib={adapter:"jquery",getStyle:function(B,A){return jQuery(B).css(A)},setStyle:function(C,B,D){if(typeof B!="object"){var A={};A[B]=D;B=A}jQuery(C).css(B)},get:function(A){return(typeof A=="string")?document.getElementById(A):A},remove:function(A){jQuery(A).remove()},getTarget:function(A){return A.target},getPageXY:function(A){return[A.pageX,A.pageY]},preventDefault:function(A){A.preventDefault()},keyCode:function(A){return A.keyCode},addEvent:function(C,A,B){jQuery(C).bind(A,B)},removeEvent:function(C,A,B){jQuery(C).unbind(A,B)},append:function(B,A){jQuery(B).append(A)}};(function(A){A.fn.shadowbox=function(B){return this.each(function(){var E=A(this);var D=A.extend({},B||{},A.metadata?E.metadata():A.meta?E.data():{});var C=this.className||"";D.width=parseInt((C.match(/w:(\d+)/)||[])[1])||D.width;D.height=parseInt((C.match(/h:(\d+)/)||[])[1])||D.height;Shadowbox.setup(E,D)})}})(jQuery); /** * The Shadowbox class. * * This file is part of Shadowbox. * * Shadowbox is an online media viewer application that supports all of the * web's most popular media publishing formats. Shadowbox is written entirely * in JavaScript and CSS and is highly customizable. Using Shadowbox, website * authors can showcase a wide assortment of media in all major browsers without * navigating users away from the linking page. * * Shadowbox is released under version 3.0 of the Creative Commons Attribution- * Noncommercial-Share Alike license. This means that it is absolutely free * for personal, noncommercial use provided that you 1) make attribution to the * author and 2) release any derivative work under the same or a similar * license. * * If you wish to use Shadowbox for commercial purposes, licensing information * can be found at http://mjijackson.com/shadowbox/. * * @author Michael J. I. Jackson * @copyright 2007-2008 Michael J. I. Jackson * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ * @version SVN: $Id: shadowbox.js 108 2008-07-11 04:19:01Z mjijackson $ */ if(typeof Shadowbox == 'undefined'){ throw 'Unable to load Shadowbox, no base library adapter found'; } /** * The Shadowbox class. Used to display different media on a web page using a * Lightbox-like effect. * * Useful resources: * * - http://www.alistapart.com/articles/byebyeembed * - http://www.w3.org/TR/html401/struct/objects.html * - http://www.dyn-web.com/dhtml/iframes/ * - http://www.apple.com/quicktime/player/specs.html * - http://www.apple.com/quicktime/tutorials/embed2.html * - http://www.howtocreate.co.uk/wrongWithIE/?chapter=navigator.plugins * - http://msdn.microsoft.com/en-us/library/ms532969.aspx * - http://support.microsoft.com/kb/316992 * * @class Shadowbox * @author Michael J. I. Jackson * @singleton */ (function(){ /** * The current version of Shadowbox. * * @var String * @private */ var version = '2.0'; /** * Contains the default options for Shadowbox. * * @var Object * @private */ var options = { /** * Enable all animations besides fades. * * @var Boolean */ animate: true, /** * Enable fade animations. * * @var Boolean */ animateFade: true, /** * Specifies the sequence of the height and width animations. May be * 'wh' (width then height), 'hw' (height then width), or 'sync' (both * at the same time). Of course this will only work if animate is true. * * @var String */ animSequence: 'wh', /** * The path to flvplayer.swf. * * @var String */ flvPlayer: 'flvplayer.swf', /** * Listen to the overlay for clicks. If the user clicks the overlay, * it will trigger Shadowbox.close(). * * @var Boolean */ modal: false, /** * The color to use for the modal overlay (in hex). * * @var String */ overlayColor: '#bf0a0a', /** * The opacity to use for the modal overlay. * * @var Number */ overlayOpacity: 0.8, /** * The default background color to use for Flash movies (in hex). * * @var String */ flashBgColor: '#000000', /** * Automatically play movies. * * @var Boolean */ autoplayMovies: true, /** * Enable movie controllers on movie players. * * @var Boolean */ showMovieControls: true, /** * A delay (in seconds) to use for slideshows. If set to anything other * than 0, this value determines an interval at which Shadowbox will * automatically proceed to the next piece in the gallery. * * @var Number */ slideshowDelay: 0, /** * The duration of the resizing animations (in seconds). * * @var Number */ resizeDuration: 0.55, /** * The duration of the fading animations (in seconds). * * @var Number */ fadeDuration: 0.35, /** * Show the navigation controls. * * @var Boolean */ displayNav: true, /** * Enable continuous galleries. When this is true, users will be able * to skip to the first gallery image from the last using next and vice * versa. * * @var Boolean */ continuous: true, /** * Display the gallery counter. * * @var Boolean */ displayCounter: true, /** * This option may be either 'default' or 'skip'. The default counter is * a simple '1 of 5' message. The skip counter displays a link for each * piece in the gallery that enables a user to skip directly to any * piece. * * @var String */ counterType: 'default', /** * Limits the number of counter links that will be displayed in a "skip" * style counter. If the actual number of gallery elements is greater * than this value, the counter will be restrained to the elements * immediately preceeding and following the current element. * * @var Number */ counterLimit: 10, /** * The amount of padding to maintain around the viewport edge (in * pixels). This only applies when the image is very large and takes up * the entire viewport. * * @var Number */ viewportPadding: 20, /** * How to handle content that is too large to display in its entirety * (and is resizable). A value of 'resize' will resize the content while * preserving aspect ratio and display it at the smaller resolution. If * the content is an image, a value of 'drag' will display the image at * its original resolution but it will be draggable within Shadowbox. A * value of 'none' will display the content at its original resolution * but it may be cropped. * * @var String */ handleOversize: 'resize', /** * An exception handling function that will be called whenever * Shadowbox should throw an exception. Will be passed the error * message as its first argument. * * @var Function */ handleException: null, /** * The mode to use when handling unsupported media. May be either * 'remove' or 'link'. If it is 'remove', the unsupported gallery item * will merely be removed from the gallery. If it is the only item in * the gallery, the link will simply be followed. If it is 'link', a * link will be provided to the appropriate plugin page in place of the * gallery element. * * @var String */ handleUnsupported: 'link', /** * The initial height of Shadowbox (in pixels). * * @var Number */ initialHeight: 160, /** * The initial width of Shadowbox (in pixels). * * @var Number */ initialWidth: 320, /** * Enable keyboard control. * * @var Boolean */ enableKeys: false, /** * A hook function to be fired when Shadowbox opens. The single argument * will be the current gallery element. * * @var Function */ onOpen: null, /** * A hook function to be fired when Shadowbox finishes loading its * content. The single argument will be the current gallery element on * display. * * @var Function */ onFinish: null, /** * A hook function to be fired when Shadowbox changes from one gallery * element to the next. The single argument will be the current gallery * element that is about to be displayed. * * @var Function */ onChange: null, /** * A hook function that will be fired when Shadowbox closes. The single * argument will be the gallery element most recently displayed. * * @var Function */ onClose: null, /** * Skips calling Shadowbox.setup() in init(). This means that it must * be called later manually. * * @var Boolean */ skipSetup: false, /** * An object containing names of plugins and links to their respective * download pages. * * @var Object */ errors: { fla: { name: 'Flash', url: 'http://www.adobe.com/products/flashplayer/' }, qt: { name: 'QuickTime', url: 'http://www.apple.com/quicktime/download/' }, wmp: { name: 'Windows Media Player', url: 'http://www.microsoft.com/windows/windowsmedia/' }, f4m: { name: 'Flip4Mac', url: 'http://www.flip4mac.com/wmv_download.htm' } }, /** * A map of players to the file extensions they support. Each member of * this object is the name of a player (with one exception), whose value * is an array of file extensions that player will "play". The one * exception to this rule is the "qtwmp" member, which contains extensions * that may be played using either QuickTime or Windows Media Player. * * - img: Image file extensions * - swf: Flash SWF file extensions * - flv: Flash video file extensions (will be played by JW FLV player) * - qt: Movie file extensions supported by QuickTime * - wmp: Movie file extensions supported by Windows Media Player * - qtwmp: Movie file extensions supported by both QuickTime and Windows Media Player * - iframe: File extensions that will be display in an iframe * * IMPORTANT: If this object is to be modified, it must be copied in its * entirety and tweaked because it is not merged recursively with the * default. Also, any modifications must be passed into Shadowbox.init * for speed reasons. * * @var Object ext */ ext: { img: ['png', 'jpg', 'jpeg', 'gif', 'bmp'], swf: ['swf'], flv: ['flv'], qt: ['dv', 'mov', 'moov', 'movie', 'mp4'], wmp: ['asf', 'wm', 'wmv'], qtwmp: ['avi', 'mpg', 'mpeg'], iframe: ['asp', 'aspx', 'cgi', 'cfm', 'htm', 'html', 'pl', 'php', 'php3', 'php4', 'php5', 'phtml', 'rb', 'rhtml', 'shtml', 'txt', 'vbs'] } }; // shorthand var SB = Shadowbox; var SL = SB.lib; /** * Stores the default set of options in case a custom set of options is used * on a link-by-link basis so we can restore them later. * * @var Object * @private */ var default_options; /** * An object containing some regular expressions we'll need later. Compiled * up front for speed. * * @var Object * @private */ var RE = { domain: /:\/\/(.*?)[:\/]/, // domain prefix inline: /#(.+)$/, // inline element id rel: /^(light|shadow)box/i, // rel attribute format gallery: /^(light|shadow)box\[(.*?)\]/i, // rel attribute format for gallery link unsupported: /^unsupported-(\w+)/, // unsupported media type param: /\s*([a-z_]*?)\s*=\s*(.+)\s*/, // rel string parameter empty: /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i // elements that don't have children }; /** * A cache of options for links that have been set up for use with * Shadowbox. * * @var Array * @private */ var cache = []; /** * An array containing the gallery objects currently being viewed. In the * case of non-gallery items, this will only hold one object. * * @var Array * @private */ var gallery; /** * The array index of the current gallery that is currently being viewed. * * @var Number * @private */ var current; /** * The current content object. * * @var Object * @private */ var content; /** * The id to use for content objects. * * @var String * @private */ var content_id = 'shadowbox_content'; /** * Holds the current dimensions of Shadowbox as calculated by * setDimensions(). Contains the following properties: * * - height: The total height of #shadowbox * - width: The total width of #shadowbox * - inner_h: The height of #shadowbox_body * - inner_w: The width of #shadowbox_body * - top: The top to use for #shadowbox * - resize_h: The height to use for resizable content * - resize_w: The width to use for resizable content * - drag: True if dragging should be enabled (oversized image) * * @var Object * @private */ var dims; /** * Keeps track of whether or not Shadowbox has been initialized. We never * want to initialize twice. * * @var Boolean * @private */ var initialized = false; /** * Keeps track of whether or not Shadowbox is activated. * * @var Boolean * @private */ var activated = false; /** * The timeout id for the slideshow transition function. * * @var Number * @private */ var slide_timer; /** * Keeps track of the time at which the current slideshow frame was * displayed. * * @var Number * @private */ var slide_start; /** * The delay on which the next slide will display. * * @var Number * @private */ var slide_delay = 0; /** * These parameters for simple browser detection. Adapted from Ext.js. * * @var Object * @private */ var ua = navigator.userAgent.toLowerCase(); var client = { isStrict: document.compatMode == 'CSS1Compat', isOpera: ua.indexOf('opera') > -1, isIE: ua.indexOf('msie') > -1, isIE7: ua.indexOf('msie 7') > -1, isSafari: /webkit|khtml/.test(ua), isWindows: ua.indexOf('windows') != -1 || ua.indexOf('win32') != -1, isMac: ua.indexOf('macintosh') != -1 || ua.indexOf('mac os x') != -1, isLinux: ua.indexOf('linux') != -1 }; client.isBorderBox = client.isIE && !client.isStrict; client.isSafari3 = client.isSafari && !!(document.evaluate); client.isGecko = ua.indexOf('gecko') != -1 && !client.isSafari; /** * You're not sill using IE6 are you? * * @var Boolean * @private */ var ltIE7 = client.isIE && !client.isIE7; /** * Contains plugin support information. Each property of this object is a * boolean indicating whether that plugin is supported. * * - fla: Flash player * - qt: QuickTime player * - wmp: Windows Media player * - f4m: Flip4Mac plugin * * @var Object * @private */ var plugins; // detect plugin support if(navigator.plugins && navigator.plugins.length){ var detectPlugin = function(plugin_name){ var detected = false; for (var i = 0, len = navigator.plugins.length; i < len; ++i){ if(navigator.plugins[i].name.indexOf(plugin_name) > -1){ detected = true; break; } } return detected; }; var f4m = detectPlugin('Flip4Mac'); plugins = { fla: detectPlugin('Shockwave Flash'), qt: detectPlugin('QuickTime'), wmp: !f4m && detectPlugin('Windows Media'), // if it's Flip4Mac, it's not really WMP f4m: f4m }; }else{ var detectPlugin = function(plugin_name){ var detected = false; try{ var axo = new ActiveXObject(plugin_name); if(axo) detected = true; }catch(e){} return detected; }; plugins = { fla: detectPlugin('ShockwaveFlash.ShockwaveFlash'), qt: detectPlugin('QuickTime.QuickTime'), wmp: detectPlugin('wmplayer.ocx'), f4m: false }; } /** * Applies all properties of e to o. * * @param Object o The original object * @param Object e The extension object * @return Object The original object with all properties * of the extension object applied * @private */ var apply = function(o, e){ for(var p in e) o[p] = e[p]; return o; }; /** * Determines if the given object is an anchor/area element. * * @param mixed el The object to check * @return Boolean True if the object is a link element * @private */ var isLink = function(el){ return el && typeof el.tagName == 'string' && (el.tagName.toUpperCase() == 'A' || el.tagName.toUpperCase() == 'AREA'); }; /** * Gets the height of the viewport in pixels. Note: This function includes * scrollbars in Safari 3. * * @return Number The height of the viewport * @public * @static */ SL.getViewportHeight = function(){ var h = window.innerHeight; // Safari var mode = document.compatMode; if((mode || client.isIE) && !client.isOpera){ h = client.isStrict ? document.documentElement.clientHeight : document.body.clientHeight; } return h; }; /** * Gets the width of the viewport in pixels. Note: This function includes * scrollbars in Safari 3. * * @return Number The width of the viewport * @public * @static */ SL.getViewportWidth = function(){ var w = window.innerWidth; // Safari var mode = document.compatMode; if(mode || client.isIE){ w = client.isStrict ? document.documentElement.clientWidth : document.body.clientWidth; } return w; }; /** * Creates an HTML string from an object representing HTML elements. Based * on Ext.DomHelper's createHtml. * * @param Object obj The HTML definition object * @return String An HTML string * @public * @static */ SL.createHTML = function(obj){ var html = '<' + obj.tag; for(var attr in obj){ if(attr == 'tag' || attr == 'html' || attr == 'children') continue; if(attr == 'cls'){ html += ' class="' + obj['cls'] + '"'; }else{ html += ' ' + attr + '="' + obj[attr] + '"'; } } if(RE.empty.test(obj.tag)){ html += '/>'; }else{ html += '>'; var cn = obj.children; if(cn){ for(var i = 0, len = cn.length; i < len; ++i){ html += this.createHTML(cn[i]); } } if(obj.html) html += obj.html; html += ''; } return html; }; /** * Easing function used for animations. Based on a cubic polynomial. * * @param Number x The state of the animation (% complete) * @return Number The adjusted easing value * @private * @static */ var ease = function(x){ return 1 + Math.pow(x - 1, 3); }; /** * Animates any numeric (not color) style of the given element from its * current state to the given value. Defaults to using pixel-based * measurements. * * @param HTMLElement el The DOM element to animate * @param String p The property to animate (in camelCase) * @param mixed to The value to animate to * @param Number d The duration of the animation (in * seconds) * @param Function cb A callback function to call when the * animation completes * @return void * @private * @static */ var animate = function(el, p, to, d, cb){ var from = parseFloat(SL.getStyle(el, p)); if(isNaN(from)) from = 0; if(from == to){ if(typeof cb == 'function') cb(); return; // nothing to animate } var delta = to - from; var op = p == 'opacity'; var unit = op ? '' : 'px'; // default unit is px var fn = function(ease){ SL.setStyle(el, p, from + ease * delta + unit); }; // cancel the animation here if set in the options if(!options.animate && !op || op && !options.animateFade){ fn(1); if(typeof cb == 'function') cb(); return; } d *= 1000; // convert to milliseconds var begin = new Date().getTime(); var end = begin + d; var timer = setInterval(function(){ var time = new Date().getTime(); if(time >= end){ // end of animation clearInterval(timer); fn(1); if(typeof cb == 'function') cb(); }else{ fn(ease((time - begin) / d)); } }, 10); // 10 ms interval is minimum on WebKit }; /** * A utility function used by the fade functions to clear the opacity * style setting of the given element. Required in some cases for IE. * * @param HTMLElement el The DOM element * @return void * @private */ var clearOpacity = function(el){ var s = el.style; if(client.isIE){ if(typeof s.filter == 'string' && (/alpha/i).test(s.filter)){ // careful not to overwrite other filters! s.filter = s.filter.replace(/[\w\.]*alpha\(.*?\);?/i, ''); } }else{ s.opacity = ''; s['-moz-opacity'] = ''; s['-khtml-opacity'] = ''; } }; /** * Gets the computed height of the given element, including padding and * borders. * * @param HTMLElement el The element * @return Number The computed height of the element * @private */ var getComputedHeight = function(el){ var h = Math.max(el.offsetHeight, el.clientHeight); if(!h){ h = parseInt(SL.getStyle(el, 'height'), 10) || 0; if(!client.isBorderBox){ h += parseInt(SL.getStyle(el, 'padding-top'), 10) + parseInt(SL.getStyle(el, 'padding-bottom'), 10) + parseInt(SL.getStyle(el, 'border-top-width'), 10) + parseInt(SL.getStyle(el, 'border-bottom-width'), 10); } } return h; }; /** * Determines the player needed to display the file at the given URL. If * the file type is not supported, the return value will be 'unsupported'. * If the file type is not supported but the correct player can be * determined, the return value will be 'unsupported-*' where * will be the * player abbreviation (e.g. 'qt' = QuickTime). * * @param String url The url of the file * @return String The name of the player to use * @private */ var getPlayer = function(url){ var m = url.match(RE.domain); var d = m && document.domain == m[1]; // same domain if(url.indexOf('#') > -1 && d) return 'inline'; var q = url.indexOf('?'); if(q > -1) url = url.substring(0, q); // strip query string for player detection purposes if(RE.img.test(url)) return 'img'; if(RE.swf.test(url)) return plugins.fla ? 'swf' : 'unsupported-swf'; if(RE.flv.test(url)) return plugins.fla ? 'flv' : 'unsupported-flv'; if(RE.qt.test(url)) return plugins.qt ? 'qt' : 'unsupported-qt'; if(RE.wmp.test(url)){ if(plugins.wmp) return 'wmp'; if(plugins.f4m) return 'qt'; if(client.isMac) return plugins.qt ? 'unsupported-f4m' : 'unsupported-qtf4m'; return 'unsupported-wmp'; }else if(RE.qtwmp.test(url)){ if(plugins.qt) return 'qt'; if(plugins.wmp) return 'wmp'; return client.isMac ? 'unsupported-qt' : 'unsupported-qtwmp'; }else if(!d || RE.iframe.test(url)){ return 'iframe'; } return 'unsupported'; // same domain, not supported }; /** * Handles all clicks on links that have been set up to work with Shadowbox * and cancels the default event behavior when appropriate. * * @param {Event} ev The click event object * @return void * @private */ var handleClick = function(ev){ // get anchor/area element var link; if(isLink(this)){ link = this; // jQuery, Prototype, YUI }else{ link = SL.getTarget(ev); // Ext, standalone while(!isLink(link) && link.parentNode){ link = link.parentNode; } } //SL.preventDefault(ev); // good for debugging if(link){ SB.open(link); if(gallery.length) SL.preventDefault(ev); // stop event } }; /** * Toggles the display of the nav control with the given id on and off. * * @param String id The id of the navigation control * @param Boolean on True to toggle on, false to toggle off * @return void * @private */ var toggleNav = function(id, on){ var el = SL.get('shadowbox_nav_' + id); if(el) el.style.display = on ? '' : 'none'; }; /** * Builds the content for the title and information bars. * * @param Function cb A callback function to execute after the * bars are built * @return void * @private */ var buildBars = function(cb){ var obj = gallery[current]; var title_i = SL.get('shadowbox_title_inner'); // build the title title_i.innerHTML = obj.title || ''; // build the nav var nav = SL.get('shadowbox_nav'); if(nav){ var c, n, pl, pa, p; // need to build the nav? if(options.displayNav){ c = true; // next & previous links var len = gallery.length; if(len > 1){ if(options.continuous){ n = p = true; // show both }else{ n = (len - 1) > current; // not last in gallery, show next p = current > 0; // not first in gallery, show previous } } // in a slideshow? if(options.slideshowDelay > 0 && hasNext()){ pa = slide_timer != 'paused'; pl = !pa; } }else{ c = n = pl = pa = p = false; } toggleNav('close', c); toggleNav('next', n); toggleNav('play', pl); toggleNav('pause', pa); toggleNav('previous', p); } // build the counter var counter = SL.get('shadowbox_counter'); if(counter){ var co = ''; // need to build the counter? if(options.displayCounter && gallery.length > 1){ if(options.counterType == 'skip'){ // limit the counter? var i = 0, len = gallery.length, end = len; var limit = parseInt(options.counterLimit); if(limit < len){ // support large galleries var h = Math.round(limit / 2); i = current - h; if(i < 0) i += len; end = current + (limit - h); if(end > len) end -= len; } while(i != end){ if(i == len) i = 0; co += ''; } }else{ // default co = (current + 1) + ' ' + SB.LANG.of + ' ' + len; } } counter.innerHTML = co; } cb(); }; /** * Hides the title and info bars. * * @param Boolean anim True to animate the transition * @param Function cb A callback function to execute after the * animation completes * @return void * @private */ var hideBars = function(anim, cb){ var obj = gallery[current]; var title = SL.get('shadowbox_title'); var info = SL.get('shadowbox_info'); var title_i = SL.get('shadowbox_title_inner'); var info_i = SL.get('shadowbox_info_inner'); // build bars after they are hidden var fn = function(){ buildBars(cb); }; var title_h = getComputedHeight(title); var info_h = getComputedHeight(info) * -1; if(anim){ // animate the transition animate(title_i, 'margin-top', title_h, 0.35); animate(info_i, 'margin-top', info_h, 0.35, fn); }else{ SL.setStyle(title_i, 'margin-top', title_h + 'px'); SL.setStyle(info_i, 'margin-top', info_h + 'px'); fn(); } }; /** * Shows the title and info bars. * * @param Function cb A callback function to execute after the * animation completes * @return void * @private */ var showBars = function(cb){ var title_i = SL.get('shadowbox_title_inner'); var info_i = SL.get('shadowbox_info_inner'); var t = title_i.innerHTML != ''; // is there a title to display? if(t) animate(title_i, 'margin-top', 0, 0.35); animate(info_i, 'margin-top', 0, 0.35, cb); }; /** * Loads the Shadowbox with the current piece. * * @return void * @private */ var loadContent = function(){ var obj = gallery[current]; if(!obj) return; // invalid var changing = false; if(content){ content.remove(); // remove old content first changing = true; // changing from some previous content } // determine player, inline is really just HTML var p = obj.player == 'inline' ? 'html' : obj.player; // make sure player is loaded if(typeof SB[p] != 'function'){ SB.raise('Unknown player ' + obj.player); } content = new SB[p](content_id, obj); // instantiate new content object listenKeys(false); // disable the keyboard temporarily toggleLoading(true); hideBars(changing, function(){ // if changing, animate the bars transition if(!content) return; // if opening, clear #shadowbox display if(!changing){ SL.get('shadowbox').style.display = ''; } var fn = function(){ resizeContent(function(){ if(!content) return; showBars(function(){ if(!content) return; // append content just before hiding the loading layer SL.get('shadowbox_body_inner').innerHTML = SL.createHTML(content.markup(dims)); toggleLoading(false, function(){ if(!content) return; if(typeof content.onLoad == 'function'){ content.onLoad(); // call onLoad callback if present } if(options.onFinish && typeof options.onFinish == 'function'){ options.onFinish(gallery[current]); // fire onFinish handler } if(slide_timer != 'paused'){ SB.play(); // kick off next slide } listenKeys(true); // re-enable the keyboard }); }); }); }; if(typeof content.ready != 'undefined'){ // does the object have a ready property? var id = setInterval(function(){ // if so, wait for the object to be ready if(content){ if(content.ready){ clearInterval(id); // clean up id = null; fn(); } }else{ // content has been removed clearInterval(id); id = null; } }, 100); }else{ fn(); } }); // preload neighboring gallery images if(gallery.length > 1){ var next = gallery[current + 1] || gallery[0]; if(next.player == 'img'){ var a = new Image(); a.src = next.content; } var prev = gallery[current - 1] || gallery[gallery.length - 1]; if(prev.player == 'img'){ var b = new Image(); b.src = prev.content; } } }; /** * Calculates the dimensions for Shadowbox, taking into account the borders * and surrounding elements of the shadowbox_body. If the height/width * combination is too large for Shadowbox and handleOversize option is set * to 'resize', the resized dimensions will be returned (preserving the * original aspect ratio). Otherwise, the originally calculated dimensions * will be used. Stores all dimensions in the private dims variable. * * @param Number height The content player height * @param Number width The content player width * @param Boolean resizable True if the content is able to be * resized. Defaults to false. * @return void * @private */ var setDimensions = function(height, width, resizable){ resizable = resizable || false; var sb = SL.get('shadowbox_body'); var h = height = parseInt(height); var w = width = parseInt(width); var view_h = SL.getViewportHeight(); var view_w = SL.getViewportWidth(); // calculate the max width var border_w = parseInt(SL.getStyle(sb, 'border-left-width'), 10) + parseInt(SL.getStyle(sb, 'border-right-width'), 10); var extra_w = border_w + 2 * options.viewportPadding; if(w + extra_w >= view_w){ w = view_w - extra_w; } // calculate the max height var border_h = parseInt(SL.getStyle(sb, 'border-top-width'), 10) + parseInt(SL.getStyle(sb, 'border-bottom-width'), 10); var bar_h = getComputedHeight(SL.get('shadowbox_title')) + getComputedHeight(SL.get('shadowbox_info')); var extra_h = border_h + 2 * options.viewportPadding + bar_h; if(h + extra_h >= view_h){ h = view_h - extra_h; } // handle oversized content var drag = false; var resize_h = height; var resize_w = width; var handle = options.handleOversize; if(resizable && (handle == 'resize' || handle == 'drag')){ var change_h = (height - h) / height; var change_w = (width - w) / width; if(handle == 'resize'){ if(change_h > change_w){ w = Math.round((width / height) * h); }else if(change_w > change_h){ h = Math.round((height / width) * w); } // adjust resized height or width accordingly resize_w = w; resize_h = h; }else{ // drag on oversized images only var link = gallery[current]; if(link) drag = link.player == 'img' && (change_h > 0 || change_w > 0); } } // update dims dims = { height: h + border_h + bar_h, width: w + border_w, inner_h: h, inner_w: w, top: (view_h - (h + extra_h)) / 2 + options.viewportPadding, resize_h: resize_h, resize_w: resize_w, drag: drag }; }; /** * Resizes Shadowbox to the given height and width. If the callback * parameter is given, the transition will be animated and the callback * function will be called when the animation completes. Note: The private * content variable must be updated before calling this function. * * @param Function cb A callback function to execute after the * content has been resized * @return void * @private */ var resizeContent = function(cb){ if(!content) return; // no content // set new dimensions setDimensions(content.height, content.width, content.resizable); if(cb){ switch(options.animSequence){ case 'hw': adjustHeight(dims.inner_h, dims.top, true, function(){ adjustWidth(dims.width, true, cb); }); break; case 'wh': adjustWidth(dims.width, true, function(){ adjustHeight(dims.inner_h, dims.top, true, cb); }); break; case 'sync': default: adjustWidth(dims.width, true); adjustHeight(dims.inner_h, dims.top, true, cb); } }else{ // window resize adjustWidth(dims.width, false); adjustHeight(dims.inner_h, dims.top, false); var c = SL.get(content_id); if(c){ // resize resizable content when in resize mode if(content.resizable && options.handleOversize == 'resize'){ c.height = dims.resize_h; c.width = dims.resize_w; } // fix draggable positioning if enlarging viewport if(gallery[current].player == 'img' && options.handleOversize == 'drag'){ var top = parseInt(SL.getStyle(c, 'top')); if(top + content.height < dims.inner_h){ SL.setStyle(c, 'top', dims.inner_h - content.height + 'px'); } var left = parseInt(SL.getStyle(c, 'left')); if(left + content.width < dims.inner_w){ SL.setStyle(c, 'left', dims.inner_w - content.width + 'px'); } } } } }; /** * Adjusts the height of #shadowbox_body and centers #shadowbox vertically * in the viewport. * * @param Number height The height to use for #shadowbox_body * @param Number top The top to use for #shadowbox * @param Boolean anim True to animate the transition * @param Function cb A callback to use when the animation * completes * @return void * @private */ var adjustHeight = function(height, top, anim, cb){ height = parseInt(height); // adjust the height var sb = SL.get('shadowbox_body'); if(anim){ animate(sb, 'height', height, options.resizeDuration); }else{ SL.setStyle(sb, 'height', height + 'px'); } // adjust the top var s = SL.get('shadowbox'); if(anim){ animate(s, 'top', top, options.resizeDuration, cb); }else{ SL.setStyle(s, 'top', top + 'px'); if(typeof cb == 'function') cb(); } }; /** * Adjusts the width of #shadowbox. * * @param Number width The width to use for #shadowbox * @param Boolean anim True to animate the transition * @param Function cb A callback to use when the animation * completes * @return void * @private */ var adjustWidth = function(width, anim, cb){ width = parseInt(width); // adjust the width var s = SL.get('shadowbox'); if(anim){ animate(s, 'width', width, options.resizeDuration, cb); }else{ SL.setStyle(s, 'width', width + 'px'); if(typeof cb == 'function') cb(); } }; /** * Sets up a listener on the document for keystrokes. * * @param Boolean on True to enable the listener, false to turn * it off * @return void * @private */ var listenKeys = function(on){ if(!options.enableKeys) return; SL[(on ? 'add' : 'remove') + 'Event'](document, 'keydown', handleKey); }; /** * A listener function that is fired when a key is pressed. * * @param mixed e The event object * @return void * @private */ var handleKey = function(e){ var code = SL.keyCode(e); // attempt to prevent default key action SL.preventDefault(e); if(code == 81 || code == 88 || code == 27){ // q, x, or esc SB.close(); }else if(code == 37){ // left arrow SB.previous(); }else if(code == 39){ // right arrow SB.next(); }else if(code == 32){ // space bar SB[(typeof slide_timer == 'number' ? 'pause' : 'play')](); } }; /** * Toggles the visibility of the "loading" layer. * * @param Boolean on True to toggle on, false to toggle off * @param Function cb The callback function to call when toggling * completes * @return void * @private */ var toggleLoading = function(on, cb){ var loading = SL.get('shadowbox_loading'); if(on){ loading.style.display = ''; if(typeof cb == 'function') cb(); }else{ var p = gallery[current].player; var anim = (p == 'img' || p == 'html'); // fade on images & html var fn = function(){ loading.style.display = 'none'; clearOpacity(loading); if(typeof cb == 'function') cb(); }; if(anim){ animate(loading, 'opacity', 0, options.fadeDuration, fn); }else{ fn(); } } }; /** * Sets the top of the container element. This is only necessary in IE6 * where the container uses absolute positioning instead of fixed. * * @return void * @private */ var fixTop = function(){ SL.get('shadowbox_container').style.top = document.documentElement.scrollTop + 'px'; }; /** * Sets the height of the overlay element to the full viewport height. This * is only necessary in IE6 where the container uses absolute positioning * instead of fixed, thus restricting the size of the overlay element. * * @return void * @private */ var fixHeight = function(){ SL.get('shadowbox_overlay').style.height = SL.getViewportHeight() + 'px'; }; /** * Determines if there is a next piece to display in the current gallery. * * @return bool True if there is another piece, false otherwise * @private */ var hasNext = function(){ return gallery.length > 1 && (current != gallery.length - 1 || options.continuous); }; /** * Toggles the visibility of #shadowbox_container and sets its size (if on * IE6). Also toggles the visibility of elements ( elements, while Firefox has trouble with * s. * * @param Function cb A callback to call after toggling on, absent * when toggling off * @return void * @private */ var toggleVisible = function(cb){ var els, v = (cb) ? 'hidden' : 'visible'; if (navigator.appName == 'Microsoft Internet Explorer') { var ua = navigator.userAgent; var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); if (re.exec(ua) != null) var ver = parseFloat( RegExp.$1 ); } if(ver == 6) var hide = ['select']; // tags to hide else var hide = ['']; // tags to hide for(var i = 0; i < hide.length; ++i){ els = document.getElementsByTagName(hide[i]); for(var j = 0, len = els.length; j < len; ++j){ els[j].style.visibility = v; } } // resize & show container var so = SL.get('shadowbox_overlay'); var sc = SL.get('shadowbox_container'); var sb = SL.get('shadowbox'); if(cb){ // set overlay color/opacity SL.setStyle(so, { backgroundColor: options.overlayColor, opacity: 0 }); if(!options.modal) SL.addEvent(so, 'click', SB.close); if(ltIE7){ // fix container top & overlay height before showing fixTop(); fixHeight(); SL.addEvent(window, 'scroll', fixTop); } // fade in animation sb.style.display = 'none'; // will be cleared in loadContent() sc.style.visibility = 'visible'; animate(so, 'opacity', parseFloat(options.overlayOpacity), options.fadeDuration, cb); }else{ SL.removeEvent(so, 'click', SB.close); if(ltIE7) SL.removeEvent(window, 'scroll', fixTop); // fade out effect sb.style.display = 'none'; animate(so, 'opacity', 0, options.fadeDuration, function(){ sc.style.visibility = 'hidden'; sb.style.display = ''; clearOpacity(so); }); } }; /** * Initializes the Shadowbox environment. Loads the skin (if necessary), * compiles the player matching regular expressions, and sets up the * window resize listener. * * @param Object opts (optional) The default options to use * @return void * @public * @static */ Shadowbox.init = function(opts){ // don't initialize twice if(initialized) return; // make sure language is loaded if(typeof SB.LANG == 'undefined'){ SB.raise('No Shadowbox language loaded'); return; } // make sure skin is loaded if(typeof SB.SKIN == 'undefined'){ SB.raise('No Shadowbox skin loaded'); return; } // apply custom options apply(options, opts || {}); // add markup var markup = SB.SKIN.markup.replace(/\{(\w+)\}/g, function(m, p){ return SB.LANG[p]; }); var bd = document.body || document.documentElement; SL.append(bd, markup); // several fixes for IE6 if(ltIE7){ // give the container absolute positioning SL.setStyle(SL.get('shadowbox_container'), 'position', 'absolute'); // give shadowbox_body "layout"...whatever that is SL.get('shadowbox_body').style.zoom = 1; // use AlphaImageLoader for transparent PNG support var png = SB.SKIN.png_fix; if(png && png.constructor == Array){ for(var i = 0; i < png.length; ++i){ var el = SL.get(png[i]); if(el){ var match = SL.getStyle(el, 'background-image').match(/url\("(.*\.png)"\)/); if(match){ SL.setStyle(el, { backgroundImage: 'none', filter: 'progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,src=' + match[1] + ',sizingMethod=scale);' }); } } } } } // compile file type regular expressions here for speed for(var e in options.ext){ RE[e] = new RegExp('\.(' + options.ext[e].join('|') + ')\s*$', 'i'); } // set up window resize event handler var id; SL.addEvent(window, 'resize', function(){ // use 50 ms event buffering to prevent jerky window resizing if(id){ clearTimeout(id); id = null; } id = setTimeout(function(){ if(ltIE7) fixHeight(); resizeContent(); }, 50); }); if(!options.skipSetup) SB.setup(); initialized = true; }; /** * Dynamically loads the specified skin for use with Shadowbox. If the skin * is included already in the page via the appropriate