/*
 * jQuery JavaScript Library v1.3.2
 * http://jquery.com/
 *
 * Copyright (c) 2009 John Resig
 * Dual licensed under the MIT and GPL licenses.
 * http://docs.jquery.com/License
 *
 * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
 * Revision: 6246
 */
(function(){var window=this,undefined,_jQuery=window.jQuery,_$=window.$,jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context)
},quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,isSimple=/^.[^:#\[\.,]*$/;
jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;
if(selector.nodeType){this[0]=selector;
this.length=1;
this.context=selector;
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&&elem.id!=match[3]){return jQuery().find(selector)
}var ret=jQuery(elem||[]);
ret.context=document;
ret.selector=selector;
return ret
}}else{return jQuery(context).find(selector)
}}else{if(jQuery.isFunction(selector)){return jQuery(document).ready(selector)
}}if(selector.selector&&selector.context){this.selector=selector.selector;
this.context=selector.context
}return this.setArray(jQuery.isArray(selector)?selector:jQuery.makeArray(selector))
},selector:"",jquery:"1.3.2",size:function(){return this.length
},get:function(num){return num===undefined?Array.prototype.slice.call(this):this[num]
},pushStack:function(elems,name,selector){var ret=jQuery(elems);
ret.prevObject=this;
ret.context=this.context;
if(name==="find"){ret.selector=this.selector+(this.selector?" ":"")+selector
}else{if(name){ret.selector=this.selector+"."+name+"("+selector+")"
}}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){return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this)
},attr:function(name,value,type){var options=name;
if(typeof name==="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]){var wrap=jQuery(html,this[0].ownerDocument).clone();
if(this[0].parentNode){wrap.insertBefore(this[0])
}wrap.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,function(elem){if(this.nodeType==1){this.appendChild(elem)
}})
},prepend:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType==1){this.insertBefore(elem,this.firstChild)
}})
},before:function(){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this)
})
},after:function(){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this.nextSibling)
})
},end:function(){return this.prevObject||jQuery([])
},push:[].push,sort:[].sort,splice:[].splice,find:function(selector){if(this.length===1){var ret=this.pushStack([],"find",selector);
ret.length=0;
jQuery.find(selector,this[0],ret);
return ret
}else{return this.pushStack(jQuery.unique(jQuery.map(this,function(elem){return jQuery.find(selector,elem)
})),"find",selector)
}},clone:function(events){var ret=this.map(function(){if(!jQuery.support.noCloneEvent&&!jQuery.isXMLDoc(this)){var html=this.outerHTML;
if(!html){var div=this.ownerDocument.createElement("div");
div.appendChild(this.cloneNode(true));
html=div.innerHTML
}return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]
}else{return this.cloneNode(true)
}});
if(events===true){var orig=this.find("*").andSelf(),i=0;
ret.find("*").andSelf().each(function(){if(this.nodeName!==orig[i].nodeName){return 
}var events=jQuery.data(orig[i],"events");
for(var type in events){for(var handler in events[type]){jQuery.event.add(this,type,events[type][handler],events[type][handler].data)
}}i++
})
}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,jQuery.grep(this,function(elem){return elem.nodeType===1
})),"filter",selector)
},closest:function(selector){var pos=jQuery.expr.match.POS.test(selector)?jQuery(selector):null,closer=0;
return this.map(function(){var cur=this;
while(cur&&cur.ownerDocument){if(pos?pos.index(cur)>-1:jQuery(cur).is(selector)){jQuery.data(cur,"closest",closer);
return cur
}cur=cur.parentNode;
closer++
}})
},not:function(selector){if(typeof selector==="string"){if(isSimple.test(selector)){return this.pushStack(jQuery.multiFilter(selector,this,true),"not",selector)
}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 !!selector&&this.is("."+selector)
},val:function(value){if(value===undefined){var elem=this[0];
if(elem){if(jQuery.nodeName(elem,"option")){return(elem.attributes.value||{}).specified?elem.value:elem.text
}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<max;
i++){var option=options[i];
if(option.selected){value=jQuery(option).val();
if(one){return value
}values.push(value)
}}return values
}return(elem.value||"").replace(/\r/g,"")
}return undefined
}if(typeof value==="number"){value+=""
}return this.each(function(){if(this.nodeType!=1){return 
}if(jQuery.isArray(value)&&/radio|checkbox/.test(this.type)){this.checked=(jQuery.inArray(this.value,value)>=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.replace(/ jQuery\d+="(?:\d+|null)"/g,""):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),"slice",Array.prototype.slice.call(arguments).join(","))
},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)
},domManip:function(args,table,callback){if(this[0]){var fragment=(this[0].ownerDocument||this[0]).createDocumentFragment(),scripts=jQuery.clean(args,(this[0].ownerDocument||this[0]),fragment),first=fragment.firstChild;
if(first){for(var i=0,l=this.length;
i<l;
i++){callback.call(root(this[i],first),this.length>1||i>0?fragment.cloneNode(true):fragment)
}}if(scripts){jQuery.each(scripts,evalScript)
}}return this;
function root(elem,cur){return table&&jQuery.nodeName(elem,"table")&&jQuery.nodeName(cur,"tr")?(elem.getElementsByTagName("tbody")[0]||elem.appendChild(elem.ownerDocument.createElement("tbody"))):elem
}}};
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(typeof target==="boolean"){deep=target;
target=arguments[1]||{};
i=2
}if(typeof target!=="object"&&!jQuery.isFunction(target)){target={}
}if(length==i){target=this;
--i
}for(;
i<length;
i++){if((options=arguments[i])!=null){for(var name in options){var src=target[name],copy=options[name];
if(target===copy){continue
}if(deep&&copy&&typeof copy==="object"&&!copy.nodeType){target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy)
}else{if(copy!==undefined){target[name]=copy
}}}}}return target
};
var exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{},toString=Object.prototype.toString;
jQuery.extend({noConflict:function(deep){window.$=_$;
if(deep){window.jQuery=_jQuery
}return jQuery
},isFunction:function(obj){return toString.call(obj)==="[object Function]"
},isArray:function(obj){return toString.call(obj)==="[object Array]"
},isXMLDoc:function(elem){return elem.nodeType===9&&elem.documentElement.nodeName!=="HTML"||!!elem.ownerDocument&&jQuery.isXMLDoc(elem.ownerDocument)
},globalEval:function(data){if(data&&/\S/.test(data)){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");
script.type="text/javascript";
if(jQuery.support.scriptEval){script.appendChild(document.createTextNode(data))
}else{script.text=data
}head.insertBefore(script,head.firstChild);
head.removeChild(script)
}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase()
},each:function(object,callback,args){var name,i=0,length=object.length;
if(args){if(length===undefined){for(name in object){if(callback.apply(object[name],args)===false){break
}}}else{for(;
i<length;
){if(callback.apply(object[i++],args)===false){break
}}}}else{if(length===undefined){for(name in object){if(callback.call(object[name],name,object[name])===false){break
}}}else{for(var value=object[0];
i<length&&callback.call(value,i,value)!==false;
value=object[++i]){}}}return object
},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value)){value=value.call(elem,i)
}return typeof value==="number"&&type=="curCSS"&&!exclude.test(name)?value+"px":value
},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className)){elem.className+=(elem.className?" ":"")+className
}})
},remove:function(elem,classNames){if(elem.nodeType==1){elem.className=classNames!==undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return !jQuery.className.has(classNames,className)
}).join(" "):""
}},has:function(elem,className){return elem&&jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-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,extra){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;
if(extra==="border"){return 
}jQuery.each(which,function(){if(!extra){val-=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0
}if(extra==="margin"){val+=parseFloat(jQuery.curCSS(elem,"margin"+this,true))||0
}else{val-=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0
}})
}if(elem.offsetWidth!==0){getWH()
}else{jQuery.swap(elem,props,getWH)
}return Math.max(0,Math.round(val))
}return jQuery.curCSS(elem,name,force)
},curCSS:function(elem,name,force){var ret,style=elem.style;
if(name=="opacity"&&!jQuery.support.opacity){ret=jQuery.attr(style,"opacity");
return ret==""?"1":ret
}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){ret=computedStyle.getPropertyValue(name)
}if(name=="opacity"&&ret==""){ret="1"
}}else{if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase()
});
ret=elem.currentStyle[name]||elem.currentStyle[camelCase];
if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;
elem.runtimeStyle.left=elem.currentStyle.left;
style.left=ret||0;
ret=style.pixelLeft+"px";
style.left=left;
elem.runtimeStyle.left=rsLeft
}}}}return ret
},clean:function(elems,context,fragment){context=context||document;
if(typeof context.createElement==="undefined"){context=context.ownerDocument||context[0]&&context[0].ownerDocument||document
}if(!fragment&&elems.length===1&&typeof elems[0]==="string"){var match=/^<(\w+)\s*\/?>$/.exec(elems[0]);
if(match){return[context.createElement(match[1])]
}}var ret=[],scripts=[],div=context.createElement("div");
jQuery.each(elems,function(i,elem){if(typeof elem==="number"){elem+=""
}if(!elem){return 
}if(typeof elem==="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">"
});
var tags=elem.replace(/^\s+/,"").substring(0,10).toLowerCase();
var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!jQuery.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];
div.innerHTML=wrap[1]+elem+wrap[2];
while(wrap[0]--){div=div.lastChild
}if(!jQuery.support.tbody){var hasBody=/<tbody/i.test(elem),tbody=!tags.indexOf("<table")&&!hasBody?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&!hasBody?div.childNodes:[];
for(var j=tbody.length-1;
j>=0;
--j){if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length){tbody[j].parentNode.removeChild(tbody[j])
}}}if(!jQuery.support.leadingWhitespace&&/^\s/.test(elem)){div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild)
}elem=jQuery.makeArray(div.childNodes)
}if(elem.nodeType){ret.push(elem)
}else{ret=jQuery.merge(ret,elem)
}});
if(fragment){for(var i=0;
ret[i];
i++){if(jQuery.nodeName(ret[i],"script")&&(!ret[i].type||ret[i].type.toLowerCase()==="text/javascript")){scripts.push(ret[i].parentNode?ret[i].parentNode.removeChild(ret[i]):ret[i])
}else{if(ret[i].nodeType===1){ret.splice.apply(ret,[i+1,0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))))
}fragment.appendChild(ret[i])
}}return scripts
}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;
name=notxml&&jQuery.props[name]||name;
if(elem.tagName){var special=/href|src|style/.test(name);
if(name=="selected"&&elem.parentNode){elem.parentNode.selectedIndex
}if(name in elem&&notxml&&!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
}if(name=="tabIndex"){var attributeNode=elem.getAttributeNode("tabIndex");
return attributeNode&&attributeNode.specified?attributeNode.value:elem.nodeName.match(/(button|input|object|select|textarea)/i)?0:elem.nodeName.match(/^(a|area)$/i)&&elem.href?0:undefined
}return elem[name]
}if(!jQuery.support.style&&notxml&&name=="style"){return jQuery.attr(elem.style,"cssText",value)
}if(set){elem.setAttribute(name,""+value)
}var attr=!jQuery.support.hrefNormalized&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);
return attr===null?undefined:attr
}if(!jQuery.support.opacity&&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||typeof array==="string"||jQuery.isFunction(array)||array.setInterval){ret[0]=array
}else{while(i){ret[--i]=array[i]
}}}return ret
},inArray:function(elem,array){for(var i=0,length=array.length;
i<length;
i++){if(array[i]===elem){return i
}}return -1
},merge:function(first,second){var i=0,elem,pos=first.length;
if(!jQuery.support.getAll){while((elem=second[i++])!=null){if(elem.nodeType!=8){first[pos++]=elem
}}}else{while((elem=second[i++])!=null){first[pos++]=elem
}}return first
},unique:function(array){var ret=[],done={};
try{for(var i=0,length=array.length;
i<length;
i++){var id=jQuery.data(array[i]);
if(!done[id]){done[id]=true;
ret.push(array[i])
}}}catch(e){ret=array
}return ret
},grep:function(elems,callback,inv){var ret=[];
for(var i=0,length=elems.length;
i<length;
i++){if(!inv!=!callback(elems[i],i)){ret.push(elems[i])
}}return ret
},map:function(elems,callback){var ret=[];
for(var i=0,length=elems.length;
i<length;
i++){var value=callback(elems[i],i);
if(value!=null){ret[ret.length]=value
}}return ret.concat.apply([],ret)
}});
var userAgent=navigator.userAgent.toLowerCase();
jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};
jQuery.each({parent:function(elem){return elem.parentNode
},parents:function(elem){return jQuery.dir(elem,"parentNode")
},next:function(elem){return jQuery.nth(elem,2,"nextSibling")
},prev:function(elem){return jQuery.nth(elem,2,"previousSibling")
},nextAll:function(elem){return jQuery.dir(elem,"nextSibling")
},prevAll:function(elem){return jQuery.dir(elem,"previousSibling")
},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem)
},children:function(elem){return jQuery.sibling(elem.firstChild)
},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes)
}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);
if(selector&&typeof selector=="string"){ret=jQuery.multiFilter(selector,ret)
}return this.pushStack(jQuery.unique(ret),name,selector)
}
});
jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(selector){var ret=[],insert=jQuery(selector);
for(var i=0,l=insert.length;
i<l;
i++){var elems=(i>0?this.clone(true):this).get();
jQuery.fn[original].apply(jQuery(insert[i]),elems);
ret=ret.concat(elems)
}return this.pushStack(ret,name,selector)
}
});
jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");
if(this.nodeType==1){this.removeAttribute(name)
}},addClass:function(classNames){jQuery.className.add(this,classNames)
},removeClass:function(classNames){jQuery.className.remove(this,classNames)
},toggleClass:function(classNames,state){if(typeof state!=="boolean"){state=!jQuery.className.has(this,classNames)
}jQuery.className[state?"add":"remove"](this,classNames)
},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).length){jQuery("*",this).add([this]).each(function(){jQuery.event.remove(this);
jQuery.removeData(this)
});
if(this.parentNode){this.parentNode.removeChild(this)
}}},empty:function(){jQuery(this).children().remove();
while(this.firstChild){this.removeChild(this.firstChild)
}}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments)
}
});
function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0
}var expando="jQuery"+now(),uuid=0,windowData={};
jQuery.extend({cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;
var id=elem[expando];
if(!id){id=elem[expando]=++uuid
}if(name&&!jQuery.cache[id]){jQuery.cache[id]={}
}if(data!==undefined){jQuery.cache[id][name]=data
}return name?jQuery.cache[id][name]:id
},removeData:function(elem,name){elem=elem==window?windowData:elem;
var id=elem[expando];
if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];
name="";
for(name in jQuery.cache[id]){break
}if(!name){jQuery.removeData(elem)
}}}else{try{delete elem[expando]
}catch(e){if(elem.removeAttribute){elem.removeAttribute(expando)
}}delete jQuery.cache[id]
}},queue:function(elem,type,data){if(elem){type=(type||"fx")+"queue";
var q=jQuery.data(elem,type);
if(!q||jQuery.isArray(data)){q=jQuery.data(elem,type,jQuery.makeArray(data))
}else{if(data){q.push(data)
}}}return q
},dequeue:function(elem,type){var queue=jQuery.queue(elem,type),fn=queue.shift();
if(!type||type==="fx"){fn=queue[0]
}if(fn!==undefined){fn.call(elem)
}}});
jQuery.fn.extend({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)
})
},queue:function(type,data){if(typeof type!=="string"){data=type;
type="fx"
}if(data===undefined){return jQuery.queue(this[0],type)
}return this.each(function(){var queue=jQuery.queue(this,type,data);
if(type=="fx"&&queue.length==1){queue[0].call(this)
}})
},dequeue:function(type){return this.each(function(){jQuery.dequeue(this,type)
})
}});
/*
 * Sizzle CSS Selector Engine - v0.9.3
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
(function(){var chunker=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,done=0,toString=Object.prototype.toString;
var Sizzle=function(selector,context,results,seed){results=results||[];
context=context||document;
if(context.nodeType!==1&&context.nodeType!==9){return[]
}if(!selector||typeof selector!=="string"){return results
}var parts=[],m,set,checkSet,check,mode,extra,prune=true;
chunker.lastIndex=0;
while((m=chunker.exec(selector))!==null){parts.push(m[1]);
if(m[2]){extra=RegExp.rightContext;
break
}}if(parts.length>1&&origPOS.exec(selector)){if(parts.length===2&&Expr.relative[parts[0]]){set=posProcess(parts[0]+parts[1],context)
}else{set=Expr.relative[parts[0]]?[context]:Sizzle(parts.shift(),context);
while(parts.length){selector=parts.shift();
if(Expr.relative[selector]){selector+=parts.shift()
}set=posProcess(selector,set)
}}}else{var ret=seed?{expr:parts.pop(),set:makeArray(seed)}:Sizzle.find(parts.pop(),parts.length===1&&context.parentNode?context.parentNode:context,isXML(context));
set=Sizzle.filter(ret.expr,ret.set);
if(parts.length>0){checkSet=makeArray(set)
}else{prune=false
}while(parts.length){var cur=parts.pop(),pop=cur;
if(!Expr.relative[cur]){cur=""
}else{pop=parts.pop()
}if(pop==null){pop=context
}Expr.relative[cur](checkSet,pop,isXML(context))
}}if(!checkSet){checkSet=set
}if(!checkSet){throw"Syntax error, unrecognized expression: "+(cur||selector)
}if(toString.call(checkSet)==="[object Array]"){if(!prune){results.push.apply(results,checkSet)
}else{if(context.nodeType===1){for(var i=0;
checkSet[i]!=null;
i++){if(checkSet[i]&&(checkSet[i]===true||checkSet[i].nodeType===1&&contains(context,checkSet[i]))){results.push(set[i])
}}}else{for(var i=0;
checkSet[i]!=null;
i++){if(checkSet[i]&&checkSet[i].nodeType===1){results.push(set[i])
}}}}}else{makeArray(checkSet,results)
}if(extra){Sizzle(extra,context,results,seed);
if(sortOrder){hasDuplicate=false;
results.sort(sortOrder);
if(hasDuplicate){for(var i=1;
i<results.length;
i++){if(results[i]===results[i-1]){results.splice(i--,1)
}}}}}return results
};
Sizzle.matches=function(expr,set){return Sizzle(expr,null,null,set)
};
Sizzle.find=function(expr,context,isXML){var set,match;
if(!expr){return[]
}for(var i=0,l=Expr.order.length;
i<l;
i++){var type=Expr.order[i],match;
if((match=Expr.match[type].exec(expr))){var left=RegExp.leftContext;
if(left.substr(left.length-1)!=="\\"){match[1]=(match[1]||"").replace(/\\/g,"");
set=Expr.find[type](match,context,isXML);
if(set!=null){expr=expr.replace(Expr.match[type],"");
break
}}}}if(!set){set=context.getElementsByTagName("*")
}return{set:set,expr:expr}
};
Sizzle.filter=function(expr,set,inplace,not){var old=expr,result=[],curLoop=set,match,anyFound,isXMLFilter=set&&set[0]&&isXML(set[0]);
while(expr&&set.length){for(var type in Expr.filter){if((match=Expr.match[type].exec(expr))!=null){var filter=Expr.filter[type],found,item;
anyFound=false;
if(curLoop==result){result=[]
}if(Expr.preFilter[type]){match=Expr.preFilter[type](match,curLoop,inplace,result,not,isXMLFilter);
if(!match){anyFound=found=true
}else{if(match===true){continue
}}}if(match){for(var i=0;
(item=curLoop[i])!=null;
i++){if(item){found=filter(item,match,i,curLoop);
var pass=not^!!found;
if(inplace&&found!=null){if(pass){anyFound=true
}else{curLoop[i]=false
}}else{if(pass){result.push(item);
anyFound=true
}}}}}if(found!==undefined){if(!inplace){curLoop=result
}expr=expr.replace(Expr.match[type],"");
if(!anyFound){return[]
}break
}}}if(expr==old){if(anyFound==null){throw"Syntax error, unrecognized expression: "+expr
}else{break
}}old=expr
}return curLoop
};
var Expr=Sizzle.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(elem){return elem.getAttribute("href")
}},relative:{"+":function(checkSet,part,isXML){var isPartStr=typeof part==="string",isTag=isPartStr&&!/\W/.test(part),isPartStrNotTag=isPartStr&&!isTag;
if(isTag&&!isXML){part=part.toUpperCase()
}for(var i=0,l=checkSet.length,elem;
i<l;
i++){if((elem=checkSet[i])){while((elem=elem.previousSibling)&&elem.nodeType!==1){}checkSet[i]=isPartStrNotTag||elem&&elem.nodeName===part?elem||false:elem===part
}}if(isPartStrNotTag){Sizzle.filter(part,checkSet,true)
}},">":function(checkSet,part,isXML){var isPartStr=typeof part==="string";
if(isPartStr&&!/\W/.test(part)){part=isXML?part:part.toUpperCase();
for(var i=0,l=checkSet.length;
i<l;
i++){var elem=checkSet[i];
if(elem){var parent=elem.parentNode;
checkSet[i]=parent.nodeName===part?parent:false
}}}else{for(var i=0,l=checkSet.length;
i<l;
i++){var elem=checkSet[i];
if(elem){checkSet[i]=isPartStr?elem.parentNode:elem.parentNode===part
}}if(isPartStr){Sizzle.filter(part,checkSet,true)
}}},"":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;
if(!part.match(/\W/)){var nodeCheck=part=isXML?part:part.toUpperCase();
checkFn=dirNodeCheck
}checkFn("parentNode",part,doneName,checkSet,nodeCheck,isXML)
},"~":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;
if(typeof part==="string"&&!part.match(/\W/)){var nodeCheck=part=isXML?part:part.toUpperCase();
checkFn=dirNodeCheck
}checkFn("previousSibling",part,doneName,checkSet,nodeCheck,isXML)
}},find:{ID:function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);
return m?[m]:[]
}},NAME:function(match,context,isXML){if(typeof context.getElementsByName!=="undefined"){var ret=[],results=context.getElementsByName(match[1]);
for(var i=0,l=results.length;
i<l;
i++){if(results[i].getAttribute("name")===match[1]){ret.push(results[i])
}}return ret.length===0?null:ret
}},TAG:function(match,context){return context.getElementsByTagName(match[1])
}},preFilter:{CLASS:function(match,curLoop,inplace,result,not,isXML){match=" "+match[1].replace(/\\/g,"")+" ";
if(isXML){return match
}for(var i=0,elem;
(elem=curLoop[i])!=null;
i++){if(elem){if(not^(elem.className&&(" "+elem.className+" ").indexOf(match)>=0)){if(!inplace){result.push(elem)
}}else{if(inplace){curLoop[i]=false
}}}}return false
},ID:function(match){return match[1].replace(/\\/g,"")
},TAG:function(match,curLoop){for(var i=0;
curLoop[i]===false;
i++){}return curLoop[i]&&isXML(curLoop[i])?match[1]:match[1].toUpperCase()
},CHILD:function(match){if(match[1]=="nth"){var test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(match[2]=="even"&&"2n"||match[2]=="odd"&&"2n+1"||!/\D/.test(match[2])&&"0n+"+match[2]||match[2]);
match[2]=(test[1]+(test[2]||1))-0;
match[3]=test[3]-0
}match[0]=done++;
return match
},ATTR:function(match,curLoop,inplace,result,not,isXML){var name=match[1].replace(/\\/g,"");
if(!isXML&&Expr.attrMap[name]){match[1]=Expr.attrMap[name]
}if(match[2]==="~="){match[4]=" "+match[4]+" "
}return match
},PSEUDO:function(match,curLoop,inplace,result,not){if(match[1]==="not"){if(match[3].match(chunker).length>1||/^\w/.test(match[3])){match[3]=Sizzle(match[3],null,null,curLoop)
}else{var ret=Sizzle.filter(match[3],curLoop,inplace,true^not);
if(!inplace){result.push.apply(result,ret)
}return false
}}else{if(Expr.match.POS.test(match[0])||Expr.match.CHILD.test(match[0])){return true
}}return match
},POS:function(match){match.unshift(true);
return match
}},filters:{enabled:function(elem){return elem.disabled===false&&elem.type!=="hidden"
},disabled:function(elem){return elem.disabled===true
},checked:function(elem){return elem.checked===true
},selected:function(elem){elem.parentNode.selectedIndex;
return elem.selected===true
},parent:function(elem){return !!elem.firstChild
},empty:function(elem){return !elem.firstChild
},has:function(elem,i,match){return !!Sizzle(match[3],elem).length
},header:function(elem){return/h\d/i.test(elem.nodeName)
},text:function(elem){return"text"===elem.type
},radio:function(elem){return"radio"===elem.type
},checkbox:function(elem){return"checkbox"===elem.type
},file:function(elem){return"file"===elem.type
},password:function(elem){return"password"===elem.type
},submit:function(elem){return"submit"===elem.type
},image:function(elem){return"image"===elem.type
},reset:function(elem){return"reset"===elem.type
},button:function(elem){return"button"===elem.type||elem.nodeName.toUpperCase()==="BUTTON"
},input:function(elem){return/input|select|textarea|button/i.test(elem.nodeName)
}},setFilters:{first:function(elem,i){return i===0
},last:function(elem,i,match,array){return i===array.length-1
},even:function(elem,i){return i%2===0
},odd:function(elem,i){return i%2===1
},lt:function(elem,i,match){return i<match[3]-0
},gt:function(elem,i,match){return i>match[3]-0
},nth:function(elem,i,match){return match[3]-0==i
},eq:function(elem,i,match){return match[3]-0==i
}},filter:{PSEUDO:function(elem,match,i,array){var name=match[1],filter=Expr.filters[name];
if(filter){return filter(elem,i,match,array)
}else{if(name==="contains"){return(elem.textContent||elem.innerText||"").indexOf(match[3])>=0
}else{if(name==="not"){var not=match[3];
for(var i=0,l=not.length;
i<l;
i++){if(not[i]===elem){return false
}}return true
}}}},CHILD:function(elem,match){var type=match[1],node=elem;
switch(type){case"only":case"first":while(node=node.previousSibling){if(node.nodeType===1){return false
}}if(type=="first"){return true
}node=elem;
case"last":while(node=node.nextSibling){if(node.nodeType===1){return false
}}return true;
case"nth":var first=match[2],last=match[3];
if(first==1&&last==0){return true
}var doneName=match[0],parent=elem.parentNode;
if(parent&&(parent.sizcache!==doneName||!elem.nodeIndex)){var count=0;
for(node=parent.firstChild;
node;
node=node.nextSibling){if(node.nodeType===1){node.nodeIndex=++count
}}parent.sizcache=doneName
}var diff=elem.nodeIndex-last;
if(first==0){return diff==0
}else{return(diff%first==0&&diff/first>=0)
}}},ID:function(elem,match){return elem.nodeType===1&&elem.getAttribute("id")===match
},TAG:function(elem,match){return(match==="*"&&elem.nodeType===1)||elem.nodeName===match
},CLASS:function(elem,match){return(" "+(elem.className||elem.getAttribute("class"))+" ").indexOf(match)>-1
},ATTR:function(elem,match){var name=match[1],result=Expr.attrHandle[name]?Expr.attrHandle[name](elem):elem[name]!=null?elem[name]:elem.getAttribute(name),value=result+"",type=match[2],check=match[4];
return result==null?type==="!=":type==="="?value===check:type==="*="?value.indexOf(check)>=0:type==="~="?(" "+value+" ").indexOf(check)>=0:!check?value&&result!==false:type==="!="?value!=check:type==="^="?value.indexOf(check)===0:type==="$="?value.substr(value.length-check.length)===check:type==="|="?value===check||value.substr(0,check.length+1)===check+"-":false
},POS:function(elem,match,i,array){var name=match[2],filter=Expr.setFilters[name];
if(filter){return filter(elem,i,match,array)
}}}};
var origPOS=Expr.match.POS;
for(var type in Expr.match){Expr.match[type]=RegExp(Expr.match[type].source+/(?![^\[]*\])(?![^\(]*\))/.source)
}var makeArray=function(array,results){array=Array.prototype.slice.call(array);
if(results){results.push.apply(results,array);
return results
}return array
};
try{Array.prototype.slice.call(document.documentElement.childNodes)
}catch(e){makeArray=function(array,results){var ret=results||[];
if(toString.call(array)==="[object Array]"){Array.prototype.push.apply(ret,array)
}else{if(typeof array.length==="number"){for(var i=0,l=array.length;
i<l;
i++){ret.push(array[i])
}}else{for(var i=0;
array[i];
i++){ret.push(array[i])
}}}return ret
}
}var sortOrder;
if(document.documentElement.compareDocumentPosition){sortOrder=function(a,b){var ret=a.compareDocumentPosition(b)&4?-1:a===b?0:1;
if(ret===0){hasDuplicate=true
}return ret
}
}else{if("sourceIndex" in document.documentElement){sortOrder=function(a,b){var ret=a.sourceIndex-b.sourceIndex;
if(ret===0){hasDuplicate=true
}return ret
}
}else{if(document.createRange){sortOrder=function(a,b){var aRange=a.ownerDocument.createRange(),bRange=b.ownerDocument.createRange();
aRange.selectNode(a);
aRange.collapse(true);
bRange.selectNode(b);
bRange.collapse(true);
var ret=aRange.compareBoundaryPoints(Range.START_TO_END,bRange);
if(ret===0){hasDuplicate=true
}return ret
}
}}}(function(){var form=document.createElement("form"),id="script"+(new Date).getTime();
form.innerHTML="<input name='"+id+"'/>";
var root=document.documentElement;
root.insertBefore(form,root.firstChild);
if(!!document.getElementById(id)){Expr.find.ID=function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);
return m?m.id===match[1]||typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id").nodeValue===match[1]?[m]:undefined:[]
}};
Expr.filter.ID=function(elem,match){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");
return elem.nodeType===1&&node&&node.nodeValue===match
}
}root.removeChild(form)
})();
(function(){var div=document.createElement("div");
div.appendChild(document.createComment(""));
if(div.getElementsByTagName("*").length>0){Expr.find.TAG=function(match,context){var results=context.getElementsByTagName(match[1]);
if(match[1]==="*"){var tmp=[];
for(var i=0;
results[i];
i++){if(results[i].nodeType===1){tmp.push(results[i])
}}results=tmp
}return results
}
}div.innerHTML="<a href='#'></a>";
if(div.firstChild&&typeof div.firstChild.getAttribute!=="undefined"&&div.firstChild.getAttribute("href")!=="#"){Expr.attrHandle.href=function(elem){return elem.getAttribute("href",2)
}
}})();
if(document.querySelectorAll){(function(){var oldSizzle=Sizzle,div=document.createElement("div");
div.innerHTML="<p class='TEST'></p>";
if(div.querySelectorAll&&div.querySelectorAll(".TEST").length===0){return 
}Sizzle=function(query,context,extra,seed){context=context||document;
if(!seed&&context.nodeType===9&&!isXML(context)){try{return makeArray(context.querySelectorAll(query),extra)
}catch(e){}}return oldSizzle(query,context,extra,seed)
};
Sizzle.find=oldSizzle.find;
Sizzle.filter=oldSizzle.filter;
Sizzle.selectors=oldSizzle.selectors;
Sizzle.matches=oldSizzle.matches
})()
}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var div=document.createElement("div");
div.innerHTML="<div class='test e'></div><div class='test'></div>";
if(div.getElementsByClassName("e").length===0){return 
}div.lastChild.className="e";
if(div.getElementsByClassName("e").length===1){return 
}Expr.order.splice(1,0,"CLASS");
Expr.find.CLASS=function(match,context,isXML){if(typeof context.getElementsByClassName!=="undefined"&&!isXML){return context.getElementsByClassName(match[1])
}}
})()
}function dirNodeCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){var sibDir=dir=="previousSibling"&&!isXML;
for(var i=0,l=checkSet.length;
i<l;
i++){var elem=checkSet[i];
if(elem){if(sibDir&&elem.nodeType===1){elem.sizcache=doneName;
elem.sizset=i
}elem=elem[dir];
var match=false;
while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];
break
}if(elem.nodeType===1&&!isXML){elem.sizcache=doneName;
elem.sizset=i
}if(elem.nodeName===cur){match=elem;
break
}elem=elem[dir]
}checkSet[i]=match
}}}function dirCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){var sibDir=dir=="previousSibling"&&!isXML;
for(var i=0,l=checkSet.length;
i<l;
i++){var elem=checkSet[i];
if(elem){if(sibDir&&elem.nodeType===1){elem.sizcache=doneName;
elem.sizset=i
}elem=elem[dir];
var match=false;
while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];
break
}if(elem.nodeType===1){if(!isXML){elem.sizcache=doneName;
elem.sizset=i
}if(typeof cur!=="string"){if(elem===cur){match=true;
break
}}else{if(Sizzle.filter(cur,[elem]).length>0){match=elem;
break
}}}elem=elem[dir]
}checkSet[i]=match
}}}var contains=document.compareDocumentPosition?function(a,b){return a.compareDocumentPosition(b)&16
}:function(a,b){return a!==b&&(a.contains?a.contains(b):true)
};
var isXML=function(elem){return elem.nodeType===9&&elem.documentElement.nodeName!=="HTML"||!!elem.ownerDocument&&isXML(elem.ownerDocument)
};
var posProcess=function(selector,context){var tmpSet=[],later="",match,root=context.nodeType?[context]:context;
while((match=Expr.match.PSEUDO.exec(selector))){later+=match[0];
selector=selector.replace(Expr.match.PSEUDO,"")
}selector=Expr.relative[selector]?selector+"*":selector;
for(var i=0,l=root.length;
i<l;
i++){Sizzle(selector,root[i],tmpSet)
}return Sizzle.filter(later,tmpSet)
};
jQuery.find=Sizzle;
jQuery.filter=Sizzle.filter;
jQuery.expr=Sizzle.selectors;
jQuery.expr[":"]=jQuery.expr.filters;
Sizzle.selectors.filters.hidden=function(elem){return elem.offsetWidth===0||elem.offsetHeight===0
};
Sizzle.selectors.filters.visible=function(elem){return elem.offsetWidth>0||elem.offsetHeight>0
};
Sizzle.selectors.filters.animated=function(elem){return jQuery.grep(jQuery.timers,function(fn){return elem===fn.elem
}).length
};
jQuery.multiFilter=function(expr,elems,not){if(not){expr=":not("+expr+")"
}return Sizzle.matches(expr,elems)
};
jQuery.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
};
jQuery.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
};
jQuery.sibling=function(n,elem){var r=[];
for(;
n;
n=n.nextSibling){if(n.nodeType==1&&n!=elem){r.push(n)
}}return r
};
return ;
window.Sizzle=Sizzle
})();
jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8){return 
}if(elem.setInterval&&elem!=window){elem=window
}if(!handler.guid){handler.guid=this.guid++
}if(data!==undefined){var fn=handler;
handler=this.proxy(fn);
handler.data=data
}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){return typeof jQuery!=="undefined"&&!jQuery.event.triggered?jQuery.event.handle.apply(arguments.callee.elem,arguments):undefined
});
handle.elem=elem;
jQuery.each(types.split(/\s+/),function(index,type){var namespaces=type.split(".");
type=namespaces.shift();
handler.type=namespaces.slice().sort().join(".");
var handlers=events[type];
if(jQuery.event.specialAll[type]){jQuery.event.specialAll[type].setup.call(elem,data,namespaces)
}if(!handlers){handlers=events[type]={};
if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem,data,namespaces)===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 namespaces=type.split(".");
type=namespaces.shift();
var namespace=RegExp("(^|\\.)"+namespaces.slice().sort().join(".*\\.")+"(\\.|$)");
if(events[type]){if(handler){delete events[type][handler.guid]
}else{for(var handle in events[type]){if(namespace.test(events[type][handle].type)){delete events[type][handle]
}}}if(jQuery.event.specialAll[type]){jQuery.event.specialAll[type].teardown.call(elem,namespaces)
}for(ret in events[type]){break
}if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem,namespaces)===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(event,data,elem,bubbling){var type=event.type||event;
if(!bubbling){event=typeof event==="object"?event[expando]?event:jQuery.extend(jQuery.Event(type),event):jQuery.Event(type);
if(type.indexOf("!")>=0){event.type=type=type.slice(0,-1);
event.exclusive=true
}if(!elem){event.stopPropagation();
if(this.global[type]){jQuery.each(jQuery.cache,function(){if(this.events&&this.events[type]){jQuery.event.trigger(event,data,this.handle.elem)
}})
}}if(!elem||elem.nodeType==3||elem.nodeType==8){return undefined
}event.result=undefined;
event.target=elem;
data=jQuery.makeArray(data);
data.unshift(event)
}event.currentTarget=elem;
var handle=jQuery.data(elem,"handle");
if(handle){handle.apply(elem,data)
}if((!elem[type]||(jQuery.nodeName(elem,"a")&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false){event.result=false
}if(!bubbling&&elem[type]&&!event.isDefaultPrevented()&&!(jQuery.nodeName(elem,"a")&&type=="click")){this.triggered=true;
try{elem[type]()
}catch(e){}}this.triggered=false;
if(!event.isPropagationStopped()){var parent=elem.parentNode||elem.ownerDocument;
if(parent){jQuery.event.trigger(event,data,parent,true)
}}},handle:function(event){var all,handlers;
event=arguments[0]=jQuery.event.fix(event||window.event);
event.currentTarget=this;
var namespaces=event.type.split(".");
event.type=namespaces.shift();
all=!namespaces.length&&!event.exclusive;
var namespace=RegExp("(^|\\.)"+namespaces.slice().sort().join(".*\\.")+"(\\.|$)");
handlers=(jQuery.data(this,"events")||{})[event.type];
for(var j in handlers){var handler=handlers[j];
if(all||namespace.test(handler.type)){event.handler=handler;
event.data=handler.data;
var ret=handler.apply(this,arguments);
if(ret!==undefined){event.result=ret;
if(ret===false){event.preventDefault();
event.stopPropagation()
}}if(event.isImmediatePropagationStopped()){break
}}}},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 toElement view wheelDelta which".split(" "),fix:function(event){if(event[expando]){return event
}var originalEvent=event;
event=jQuery.Event(originalEvent);
for(var i=this.props.length,prop;
i;
){prop=this.props[--i];
event[prop]=originalEvent[prop]
}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=proxy||function(){return fn.apply(this,arguments)
};
proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;
return proxy
},special:{ready:{setup:bindReady,teardown:function(){}}},specialAll:{live:{setup:function(selector,namespaces){jQuery.event.add(this,namespaces[0],liveHandler)
},teardown:function(namespaces){if(namespaces.length){var remove=0,name=RegExp("(^|\\.)"+namespaces[0]+"(\\.|$)");
jQuery.each((jQuery.data(this,"events").live||{}),function(){if(name.test(this.type)){remove++
}});
if(remove<1){jQuery.event.remove(this,namespaces[0],liveHandler)
}}}}}};
jQuery.Event=function(src){if(!this.preventDefault){return new jQuery.Event(src)
}if(src&&src.type){this.originalEvent=src;
this.type=src.type
}else{this.type=src
}this.timeStamp=now();
this[expando]=true
};
function returnFalse(){return false
}function returnTrue(){return true
}jQuery.Event.prototype={preventDefault:function(){this.isDefaultPrevented=returnTrue;
var e=this.originalEvent;
if(!e){return 
}if(e.preventDefault){e.preventDefault()
}e.returnValue=false
},stopPropagation:function(){this.isPropagationStopped=returnTrue;
var e=this.originalEvent;
if(!e){return 
}if(e.stopPropagation){e.stopPropagation()
}e.cancelBubble=true
},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=returnTrue;
this.stopPropagation()
},isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse};
var withinElement=function(event){var parent=event.relatedTarget;
while(parent&&parent!=this){try{parent=parent.parentNode
}catch(e){parent=this
}}if(parent!=this){event.type=event.data;
jQuery.event.handle.apply(this,arguments)
}};
jQuery.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(orig,fix){jQuery.event.special[fix]={setup:function(){jQuery.event.add(this,orig,withinElement,fix)
},teardown:function(){jQuery.event.remove(this,orig,withinElement)
}}
});
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){return this.each(function(){jQuery.event.trigger(type,data,this)
})
},triggerHandler:function(type,data){if(this[0]){var event=jQuery.Event(type);
event.preventDefault();
event.stopPropagation();
jQuery.event.trigger(event,data,this[0]);
return event.result
}},toggle:function(fn){var args=arguments,i=1;
while(i<args.length){jQuery.event.proxy(fn,args[i++])
}return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;
event.preventDefault();
return args[this.lastToggle++].apply(this,arguments)||false
}))
},hover:function(fnOver,fnOut){return this.mouseenter(fnOver).mouseleave(fnOut)
},ready:function(fn){bindReady();
if(jQuery.isReady){fn.call(document,jQuery)
}else{jQuery.readyList.push(fn)
}return this
},live:function(type,fn){var proxy=jQuery.event.proxy(fn);
proxy.guid+=this.selector+type;
jQuery(document).bind(liveConvert(type,this.selector),this.selector,proxy);
return this
},die:function(type,fn){jQuery(document).unbind(liveConvert(type,this.selector),fn?{guid:fn.guid+this.selector+type}:null);
return this
}});
function liveHandler(event){var check=RegExp("(^|\\.)"+event.type+"(\\.|$)"),stop=true,elems=[];
jQuery.each(jQuery.data(this,"events").live||[],function(i,fn){if(check.test(fn.type)){var elem=jQuery(event.target).closest(fn.data)[0];
if(elem){elems.push({elem:elem,fn:fn})
}}});
elems.sort(function(a,b){return jQuery.data(a.elem,"closest")-jQuery.data(b.elem,"closest")
});
jQuery.each(elems,function(){if(this.fn.call(this.elem,event,this.fn.data)===false){return(stop=false)
}});
return stop
}function liveConvert(type,selector){return["live",type,selector.replace(/\./g,"`").replace(/ /g,"|")].join(".")
}jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;
if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document,jQuery)
});
jQuery.readyList=null
}jQuery(document).triggerHandler("ready")
}}});
var readyBound=false;
function bindReady(){if(readyBound){return 
}readyBound=true;
if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);
jQuery.ready()
},false)
}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);
jQuery.ready()
}});
if(document.documentElement.doScroll&&window==window.top){(function(){if(jQuery.isReady){return 
}try{document.documentElement.doScroll("left")
}catch(error){setTimeout(arguments.callee,0);
return 
}jQuery.ready()
})()
}}}jQuery.event.add(window,"load",jQuery.ready)
}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name)
}
});
jQuery(window).bind("unload",function(){for(var id in jQuery.cache){if(id!=1&&jQuery.cache[id].handle){jQuery.event.remove(jQuery.cache[id].handle.elem)
}}});
(function(){jQuery.support={};
var root=document.documentElement,script=document.createElement("script"),div=document.createElement("div"),id="script"+(new Date).getTime();
div.style.display="none";
div.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';
var all=div.getElementsByTagName("*"),a=div.getElementsByTagName("a")[0];
if(!all||!all.length||!a){return 
}jQuery.support={leadingWhitespace:div.firstChild.nodeType==3,tbody:!div.getElementsByTagName("tbody").length,objectAll:!!div.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!div.getElementsByTagName("link").length,style:/red/.test(a.getAttribute("style")),hrefNormalized:a.getAttribute("href")==="/a",opacity:a.style.opacity==="0.5",cssFloat:!!a.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};
script.type="text/javascript";
try{script.appendChild(document.createTextNode("window."+id+"=1;"))
}catch(e){}root.insertBefore(script,root.firstChild);
if(window[id]){jQuery.support.scriptEval=true;
delete window[id]
}root.removeChild(script);
if(div.attachEvent&&div.fireEvent){div.attachEvent("onclick",function(){jQuery.support.noCloneEvent=false;
div.detachEvent("onclick",arguments.callee)
});
div.cloneNode(true).fireEvent("onclick")
}jQuery(function(){var div=document.createElement("div");
div.style.width=div.style.paddingLeft="1px";
document.body.appendChild(div);
jQuery.boxModel=jQuery.support.boxModel=div.offsetWidth===2;
document.body.removeChild(div).style.display="none"
})
})();
var styleFloat=jQuery.support.cssFloat?"cssFloat":"styleFloat";
jQuery.props={"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};
jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!=="string"){return this._load(url)
}var off=url.indexOf(" ");
if(off>=0){var selector=url.slice(off,url.length);
url=url.slice(0,off)
}var type="GET";
if(params){if(jQuery.isFunction(params)){callback=params;
params=null
}else{if(typeof params==="object"){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("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText)
}if(callback){self.each(callback,[res.responseText,status,res])
}}});
return this
},serialize:function(){return jQuery.param(this.serializeArray())
},serializeArray:function(){return this.map(function(){return this.elements?jQuery.makeArray(this.elements):this
}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))
}).map(function(i,elem){var val=jQuery(this).val();
return val==null?null:jQuery.isArray(val)?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",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()
},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 parts=/^(\w+:)?\/\/([^\/?#]+)/.exec(s.url);
if(s.dataType=="script"&&type=="GET"&&parts&&(parts[1]&&parts[1]!=location.protocol||parts[2]!=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();
script.onload=script.onreadystatechange=null;
head.removeChild(script)
}}
}head.appendChild(script);
return undefined
}var requestDone=false;
var xhr=s.xhr();
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){if(s.global&&!--jQuery.active){jQuery.event.trigger("ajaxStop")
}xhr.abort();
return false
}if(s.global){jQuery.event.trigger("ajaxSend",[xhr,s])
}var onreadystatechange=function(isTimeout){if(xhr.readyState==0){if(ival){clearInterval(ival);
ival=null;
if(s.global&&!--jQuery.active){jQuery.event.trigger("ajaxStop")
}}}else{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)
}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(isTimeout){xhr.abort()
}if(s.async){xhr=null
}}}};
if(s.async){var ival=setInterval(onreadystatechange,13);
if(s.timeout>0){setTimeout(function(){if(xhr&&!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
}catch(e){}return false
},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");
return xhr.status==304||xhrRes==jQuery.lastModified[url]
}catch(e){}return false
},httpData:function(xhr,type,s){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(s&&s.dataFilter){data=s.dataFilter(data,type)
}if(typeof data==="string"){if(type=="script"){jQuery.globalEval(data)
}if(type=="json"){data=window["eval"]("("+data+")")
}}return data
},param:function(a){var s=[];
function add(key,value){s[s.length]=encodeURIComponent(key)+"="+encodeURIComponent(value)
}if(jQuery.isArray(a)||a.jquery){jQuery.each(a,function(){add(this.name,this.value)
})
}else{for(var j in a){if(jQuery.isArray(a[j])){jQuery.each(a[j],function(){add(j,this)
})
}else{add(j,jQuery.isFunction(a[j])?a[j]():a[j])
}}}return s.join("&").replace(/%20/g,"+")
}});
var elemdisplay={},timerId,fxAttrs=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];
function genFx(type,num){var obj={};
jQuery.each(fxAttrs.concat.apply([],fxAttrs.slice(0,num)),function(){obj[this]=type
});
return obj
}jQuery.fn.extend({show:function(speed,callback){if(speed){return this.animate(genFx("show",3),speed,callback)
}else{for(var i=0,l=this.length;
i<l;
i++){var old=jQuery.data(this[i],"olddisplay");
this[i].style.display=old||"";
if(jQuery.css(this[i],"display")==="none"){var tagName=this[i].tagName,display;
if(elemdisplay[tagName]){display=elemdisplay[tagName]
}else{var elem=jQuery("<"+tagName+" />").appendTo("body");
display=elem.css("display");
if(display==="none"){display="block"
}elem.remove();
elemdisplay[tagName]=display
}jQuery.data(this[i],"olddisplay",display)
}}for(var i=0,l=this.length;
i<l;
i++){this[i].style.display=jQuery.data(this[i],"olddisplay")||""
}return this
}},hide:function(speed,callback){if(speed){return this.animate(genFx("hide",3),speed,callback)
}else{for(var i=0,l=this.length;
i<l;
i++){var old=jQuery.data(this[i],"olddisplay");
if(!old&&old!=="none"){jQuery.data(this[i],"olddisplay",jQuery.css(this[i],"display"))
}}for(var i=0,l=this.length;
i<l;
i++){this[i].style.display="none"
}return this
}},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){var bool=typeof fn==="boolean";
return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn==null||bool?this.each(function(){var state=bool?fn:jQuery(this).is(":hidden");
jQuery(this)[state?"show":"hide"]()
}):this.animate(genFx("toggle",3),fn,fn2)
},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(){var opt=jQuery.extend({},optall),p,hidden=this.nodeType==1&&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")&&this.style){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
})
},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
}});
jQuery.each({slideDown:genFx("show",1),slideUp:genFx("hide",1),slideToggle:genFx("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(name,props){jQuery.fn[name]=function(speed,callback){return this.animate(props,speed,callback)
}
});
jQuery.extend({speed:function(speed,easing,fn){var opt=typeof speed==="object"?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&!jQuery.isFunction(easing)&&easing};
opt.duration=jQuery.fx.off?0:typeof opt.duration==="number"?opt.duration:jQuery.fx.speeds[opt.duration]||jQuery.fx.speeds._default;
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:[],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){this.elem.style.display="block"
}},cur:function(force){if(this.elem[this.prop]!=null&&(!this.elem.style||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;
var self=this;
function t(gotoEnd){return self.step(gotoEnd)
}t.elem=this.elem;
if(t()&&jQuery.timers.push(t)&&!timerId){timerId=setInterval(function(){var timers=jQuery.timers;
for(var i=0;
i<timers.length;
i++){if(!timers[i]()){timers.splice(i--,1)
}}if(!timers.length){clearInterval(timerId);
timerId=undefined
}},13)
}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);
this.options.show=true;
this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());
jQuery(this.elem).show()
},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);
this.options.hide=true;
this.custom(this.cur(),0)
},step:function(gotoEnd){var t=now();
if(gotoEnd||t>=this.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){jQuery(this.elem).hide()
}if(this.options.hide||this.options.show){for(var p in this.options.curAnim){jQuery.attr(this.elem.style,p,this.options.orig[p])
}}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,_default:400},step:{opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now)
},_default:function(fx){if(fx.elem.style&&fx.elem.style[fx.prop]!=null){fx.elem.style[fx.prop]=fx.now+fx.unit
}else{fx.elem[fx.prop]=fx.now
}}}});
if(document.documentElement.getBoundingClientRect){jQuery.fn.offset=function(){if(!this[0]){return{top:0,left:0}
}if(this[0]===this[0].ownerDocument.body){return jQuery.offset.bodyOffset(this[0])
}var box=this[0].getBoundingClientRect(),doc=this[0].ownerDocument,body=doc.body,docElem=doc.documentElement,clientTop=docElem.clientTop||body.clientTop||0,clientLeft=docElem.clientLeft||body.clientLeft||0,top=box.top+(self.pageYOffset||jQuery.boxModel&&docElem.scrollTop||body.scrollTop)-clientTop,left=box.left+(self.pageXOffset||jQuery.boxModel&&docElem.scrollLeft||body.scrollLeft)-clientLeft;
return{top:top,left:left}
}
}else{jQuery.fn.offset=function(){if(!this[0]){return{top:0,left:0}
}if(this[0]===this[0].ownerDocument.body){return jQuery.offset.bodyOffset(this[0])
}jQuery.offset.initialized||jQuery.offset.initialize();
var elem=this[0],offsetParent=elem.offsetParent,prevOffsetParent=elem,doc=elem.ownerDocument,computedStyle,docElem=doc.documentElement,body=doc.body,defaultView=doc.defaultView,prevComputedStyle=defaultView.getComputedStyle(elem,null),top=elem.offsetTop,left=elem.offsetLeft;
while((elem=elem.parentNode)&&elem!==body&&elem!==docElem){computedStyle=defaultView.getComputedStyle(elem,null);
top-=elem.scrollTop,left-=elem.scrollLeft;
if(elem===offsetParent){top+=elem.offsetTop,left+=elem.offsetLeft;
if(jQuery.offset.doesNotAddBorder&&!(jQuery.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(elem.tagName))){top+=parseInt(computedStyle.borderTopWidth,10)||0,left+=parseInt(computedStyle.borderLeftWidth,10)||0
}prevOffsetParent=offsetParent,offsetParent=elem.offsetParent
}if(jQuery.offset.subtractsBorderForOverflowNotVisible&&computedStyle.overflow!=="visible"){top+=parseInt(computedStyle.borderTopWidth,10)||0,left+=parseInt(computedStyle.borderLeftWidth,10)||0
}prevComputedStyle=computedStyle
}if(prevComputedStyle.position==="relative"||prevComputedStyle.position==="static"){top+=body.offsetTop,left+=body.offsetLeft
}if(prevComputedStyle.position==="fixed"){top+=Math.max(docElem.scrollTop,body.scrollTop),left+=Math.max(docElem.scrollLeft,body.scrollLeft)
}return{top:top,left:left}
}
}jQuery.offset={initialize:function(){if(this.initialized){return 
}var body=document.body,container=document.createElement("div"),innerDiv,checkDiv,table,td,rules,prop,bodyMarginTop=body.style.marginTop,html='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';
rules={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};
for(prop in rules){container.style[prop]=rules[prop]
}container.innerHTML=html;
body.insertBefore(container,body.firstChild);
innerDiv=container.firstChild,checkDiv=innerDiv.firstChild,td=innerDiv.nextSibling.firstChild.firstChild;
this.doesNotAddBorder=(checkDiv.offsetTop!==5);
this.doesAddBorderForTableAndCells=(td.offsetTop===5);
innerDiv.style.overflow="hidden",innerDiv.style.position="relative";
this.subtractsBorderForOverflowNotVisible=(checkDiv.offsetTop===-5);
body.style.marginTop="1px";
this.doesNotIncludeMarginInBodyOffset=(body.offsetTop===0);
body.style.marginTop=bodyMarginTop;
body.removeChild(container);
this.initialized=true
},bodyOffset:function(body){jQuery.offset.initialized||jQuery.offset.initialize();
var top=body.offsetTop,left=body.offsetLeft;
if(jQuery.offset.doesNotIncludeMarginInBodyOffset){top+=parseInt(jQuery.curCSS(body,"marginTop",true),10)||0,left+=parseInt(jQuery.curCSS(body,"marginLeft",true),10)||0
}return{top:top,left:left}
}};
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||document.body;
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 null
}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",lower=name.toLowerCase();
jQuery.fn["inner"+name]=function(){return this[0]?jQuery.css(this[0],lower,false,"padding"):null
};
jQuery.fn["outer"+name]=function(margin){return this[0]?jQuery.css(this[0],lower,false,margin?"margin":"border"):null
};
var type=name.toLowerCase();
jQuery.fn[type]=function(size){return this[0]==window?document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(document.documentElement["client"+name],document.body["scroll"+name],document.documentElement["scroll"+name],document.body["offset"+name],document.documentElement["offset"+name]):size===undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,typeof size==="string"?size:size+"px")
}
})
})();
jQuery.ui||(function($){var _remove=$.fn.remove,isFF2=$.browser.mozilla&&(parseFloat($.browser.version)<1.9);
$.ui={version:"1.7",plugin:{add:function(module,option,set){var proto=$.ui[module].prototype;
for(var i in set){proto.plugins[i]=proto.plugins[i]||[];
proto.plugins[i].push([option,set[i]])
}},call:function(instance,name,args){var set=instance.plugins[name];
if(!set||!instance.element[0].parentNode){return 
}for(var i=0;
i<set.length;
i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args)
}}}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)
},hasScroll:function(el,a){if($(el).css("overflow")=="hidden"){return false
}var scroll=(a&&a=="left")?"scrollLeft":"scrollTop",has=false;
if(el[scroll]>0){return true
}el[scroll]=1;
has=(el[scroll]>0);
el[scroll]=0;
return has
},isOverAxis:function(x,reference,size){return(x>reference)&&(x<(reference+size))
},isOver:function(y,x,top,left,height,width){return $.ui.isOverAxis(y,top,height)&&$.ui.isOverAxis(x,left,width)
},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};
if(isFF2){var attr=$.attr,removeAttr=$.fn.removeAttr,ariaNS="http://www.w3.org/2005/07/aaa",ariaState=/^aria-/,ariaRole=/^wairole:/;
$.attr=function(elem,name,value){var set=value!==undefined;
return(name=="role"?(set?attr.call(this,elem,name,"wairole:"+value):(attr.apply(this,arguments)||"").replace(ariaRole,"")):(ariaState.test(name)?(set?elem.setAttributeNS(ariaNS,name.replace(ariaState,"aaa:"),value):attr.call(this,elem,name.replace(ariaState,"aaa:"))):attr.apply(this,arguments)))
};
$.fn.removeAttr=function(name){return(ariaState.test(name)?this.each(function(){this.removeAttributeNS(ariaNS,name.replace(ariaState,""))
}):removeAttr.call(this,name))
}
}$.fn.extend({remove:function(){$("*",this).add(this).each(function(){$(this).triggerHandler("remove")
});
return _remove.apply(this,arguments)
},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")
},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false
})
},scrollParent:function(){var scrollParent;
if(($.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){scrollParent=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test($.curCSS(this,"position",1))&&(/(auto|scroll)/).test($.curCSS(this,"overflow",1)+$.curCSS(this,"overflow-y",1)+$.curCSS(this,"overflow-x",1))
}).eq(0)
}else{scrollParent=this.parents().filter(function(){return(/(auto|scroll)/).test($.curCSS(this,"overflow",1)+$.curCSS(this,"overflow-y",1)+$.curCSS(this,"overflow-x",1))
}).eq(0)
}return(/fixed/).test(this.css("position"))||!scrollParent.length?$(document):scrollParent
}});
$.extend($.expr[":"],{data:function(elem,i,match){return !!$.data(elem,match[3])
},focusable:function(element){var nodeName=element.nodeName.toLowerCase(),tabIndex=$.attr(element,"tabindex");
return(/input|select|textarea|button|object/.test(nodeName)?!element.disabled:"a"==nodeName||"area"==nodeName?element.href||!isNaN(tabIndex):!isNaN(tabIndex))&&!$(element)["area"==nodeName?"parents":"closest"](":hidden").length
},tabbable:function(element){var tabIndex=$.attr(element,"tabindex");
return(isNaN(tabIndex)||tabIndex>=0)&&$(element).is(":focusable")
}});
function getter(namespace,plugin,method,args){function getMethods(type){var methods=$[namespace][plugin][type]||[];
return(typeof methods=="string"?methods.split(/,?\s+/):methods)
}var methods=getMethods("getter");
if(args.length==1&&typeof args[0]=="string"){methods=methods.concat(getMethods("getterSetter"))
}return($.inArray(method,methods)!=-1)
}$.widget=function(name,prototype){var namespace=name.split(".")[0];
name=name.split(".")[1];
$.fn[name]=function(options){var isMethodCall=(typeof options=="string"),args=Array.prototype.slice.call(arguments,1);
if(isMethodCall&&options.substring(0,1)=="_"){return this
}if(isMethodCall&&getter(namespace,name,options,args)){var instance=$.data(this[0],name);
return(instance?instance[options].apply(instance,args):undefined)
}return this.each(function(){var instance=$.data(this,name);
(!instance&&!isMethodCall&&$.data(this,name,new $[namespace][name](this,options))._init());
(instance&&isMethodCall&&$.isFunction(instance[options])&&instance[options].apply(instance,args))
})
};
$[namespace]=$[namespace]||{};
$[namespace][name]=function(element,options){var self=this;
this.namespace=namespace;
this.widgetName=name;
this.widgetEventPrefix=$[namespace][name].eventPrefix||name;
this.widgetBaseClass=namespace+"-"+name;
this.options=$.extend({},$.widget.defaults,$[namespace][name].defaults,$.metadata&&$.metadata.get(element)[name],options);
this.element=$(element).bind("setData."+name,function(event,key,value){if(event.target==element){return self._setData(key,value)
}}).bind("getData."+name,function(event,key){if(event.target==element){return self._getData(key)
}}).bind("remove",function(){return self.destroy()
})
};
$[namespace][name].prototype=$.extend({},$.widget.prototype,prototype);
$[namespace][name].getterSetter="option"
};
$.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")
},option:function(key,value){var options=key,self=this;
if(typeof key=="string"){if(value===undefined){return this._getData(key)
}options={};
options[key]=value
}$.each(options,function(key,value){self._setData(key,value)
})
},_getData:function(key){return this.options[key]
},_setData:function(key,value){this.options[key]=value;
if(key=="disabled"){this.element[value?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",value)
}},enable:function(){this._setData("disabled",false)
},disable:function(){this._setData("disabled",true)
},_trigger:function(type,event,data){var callback=this.options[type],eventName=(type==this.widgetEventPrefix?type:this.widgetEventPrefix+type);
event=$.Event(event);
event.type=eventName;
if(event.originalEvent){for(var i=$.event.props.length,prop;
i;
){prop=$.event.props[--i];
event[prop]=event.originalEvent[prop]
}}this.element.trigger(event,data);
return !($.isFunction(callback)&&callback.call(this.element[0],event,data)===false||event.isDefaultPrevented())
}};
$.widget.defaults={disabled:false};
$.ui.mouse={_mouseInit:function(){var self=this;
this.element.bind("mousedown."+this.widgetName,function(event){return self._mouseDown(event)
}).bind("click."+this.widgetName,function(event){if(self._preventClickEvent){self._preventClickEvent=false;
event.stopImmediatePropagation();
return false
}});
if($.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");
this.element.attr("unselectable","on")
}this.started=false
},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);
($.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))
},_mouseDown:function(event){event.originalEvent=event.originalEvent||{};
if(event.originalEvent.mouseHandled){return 
}(this._mouseStarted&&this._mouseUp(event));
this._mouseDownEvent=event;
var self=this,btnIsLeft=(event.which==1),elIsCancel=(typeof this.options.cancel=="string"?$(event.target).parents().add(event.target).filter(this.options.cancel).length:false);
if(!btnIsLeft||elIsCancel||!this._mouseCapture(event)){return true
}this.mouseDelayMet=!this.options.delay;
if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){self.mouseDelayMet=true
},this.options.delay)
}if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=(this._mouseStart(event)!==false);
if(!this._mouseStarted){event.preventDefault();
return true
}}this._mouseMoveDelegate=function(event){return self._mouseMove(event)
};
this._mouseUpDelegate=function(event){return self._mouseUp(event)
};
$(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);
($.browser.safari||event.preventDefault());
event.originalEvent.mouseHandled=true;
return true
},_mouseMove:function(event){if($.browser.msie&&!event.button){return this._mouseUp(event)
}if(this._mouseStarted){this._mouseDrag(event);
return event.preventDefault()
}if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,event)!==false);
(this._mouseStarted?this._mouseDrag(event):this._mouseUp(event))
}return !this._mouseStarted
},_mouseUp:function(event){$(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);
if(this._mouseStarted){this._mouseStarted=false;
this._preventClickEvent=(event.target==this._mouseDownEvent.target);
this._mouseStop(event)
}return false
},_mouseDistanceMet:function(event){return(Math.max(Math.abs(this._mouseDownEvent.pageX-event.pageX),Math.abs(this._mouseDownEvent.pageY-event.pageY))>=this.options.distance)
},_mouseDelayMet:function(event){return this.mouseDelayMet
},_mouseStart:function(event){},_mouseDrag:function(event){},_mouseStop:function(event){},_mouseCapture:function(event){return true
}};
$.ui.mouse.defaults={cancel:null,distance:1,delay:0}
})(jQuery);
(function($){$.widget("ui.accordion",{_init:function(){var o=this.options,self=this;
this.running=0;
if(o.collapsible==$.ui.accordion.defaults.collapsible&&o.alwaysOpen!=$.ui.accordion.defaults.alwaysOpen){o.collapsible=!o.alwaysOpen
}if(o.navigation){var current=this.element.find("a").filter(o.navigationFilter);
if(current.length){if(current.filter(o.header).length){this.active=current
}else{this.active=current.parent().parent().prev();
current.addClass("ui-accordion-content-active")
}}}this.element.addClass("ui-accordion ui-widget ui-helper-reset");
if(this.element[0].nodeName=="UL"){this.element.children("li").addClass("ui-accordion-li-fix")
}this.headers=this.element.find(o.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){$(this).addClass("ui-state-hover")
}).bind("mouseleave.accordion",function(){$(this).removeClass("ui-state-hover")
}).bind("focus.accordion",function(){$(this).addClass("ui-state-focus")
}).bind("blur.accordion",function(){$(this).removeClass("ui-state-focus")
});
this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");
this.active=this._findActive(this.active||o.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");
this.active.next().addClass("ui-accordion-content-active");
$("<span/>").addClass("ui-icon "+o.icons.header).prependTo(this.headers);
this.active.find(".ui-icon").toggleClass(o.icons.header).toggleClass(o.icons.headerSelected);
if($.browser.msie){this.element.find("a").css("zoom","1")
}this.resize();
this.element.attr("role","tablist");
this.headers.attr("role","tab").bind("keydown",function(event){return self._keydown(event)
}).next().attr("role","tabpanel");
this.headers.not(this.active||"").attr("aria-expanded","false").attr("tabIndex","-1").next().hide();
if(!this.active.length){this.headers.eq(0).attr("tabIndex","0")
}else{this.active.attr("aria-expanded","true").attr("tabIndex","0")
}if(!$.browser.safari){this.headers.find("a").attr("tabIndex","-1")
}if(o.event){this.headers.bind((o.event)+".accordion",function(event){return self._clickHandler.call(self,event,this)
})
}},destroy:function(){var o=this.options;
this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind(".accordion").removeData("accordion");
this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");
this.headers.find("a").removeAttr("tabindex");
this.headers.children(".ui-icon").remove();
var contents=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");
if(o.autoHeight||o.fillHeight){contents.css("height","")
}},_setData:function(key,value){if(key=="alwaysOpen"){key="collapsible";
value=!value
}$.widget.prototype._setData.apply(this,arguments)
},_keydown:function(event){var o=this.options,keyCode=$.ui.keyCode;
if(o.disabled||event.altKey||event.ctrlKey){return 
}var length=this.headers.length;
var currentIndex=this.headers.index(event.target);
var toFocus=false;
switch(event.keyCode){case keyCode.RIGHT:case keyCode.DOWN:toFocus=this.headers[(currentIndex+1)%length];
break;
case keyCode.LEFT:case keyCode.UP:toFocus=this.headers[(currentIndex-1+length)%length];
break;
case keyCode.SPACE:case keyCode.ENTER:return this._clickHandler({target:event.target},event.target)
}if(toFocus){$(event.target).attr("tabIndex","-1");
$(toFocus).attr("tabIndex","0");
toFocus.focus();
return false
}return true
},resize:function(){var o=this.options,maxHeight;
if(o.fillSpace){if($.browser.msie){var defOverflow=this.element.parent().css("overflow");
this.element.parent().css("overflow","hidden")
}maxHeight=this.element.parent().height();
if($.browser.msie){this.element.parent().css("overflow",defOverflow)
}this.headers.each(function(){maxHeight-=$(this).outerHeight()
});
var maxPadding=0;
this.headers.next().each(function(){maxPadding=Math.max(maxPadding,$(this).innerHeight()-$(this).height())
}).height(Math.max(0,maxHeight-maxPadding)).css("overflow","auto")
}else{if(o.autoHeight){maxHeight=0;
this.headers.next().each(function(){maxHeight=Math.max(maxHeight,$(this).outerHeight())
}).height(maxHeight)
}}},activate:function(index){var active=this._findActive(index)[0];
this._clickHandler({target:active},active)
},_findActive:function(selector){return selector?typeof selector=="number"?this.headers.filter(":eq("+selector+")"):this.headers.not(this.headers.not(selector)):selector===false?$([]):this.headers.filter(":eq(0)")
},_clickHandler:function(event,target){var o=this.options;
if(o.disabled){return false
}if(!event.target&&o.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header);
this.active.next().addClass("ui-accordion-content-active");
var toHide=this.active.next(),data={options:o,newHeader:$([]),oldHeader:o.active,newContent:$([]),oldContent:toHide},toShow=(this.active=$([]));
this._toggle(toShow,toHide,data);
return false
}var clicked=$(event.currentTarget||target);
var clickedIsActive=clicked[0]==this.active[0];
if(this.running||(!o.collapsible&&clickedIsActive)){return false
}this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header);
this.active.next().addClass("ui-accordion-content-active");
if(!clickedIsActive){clicked.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").find(".ui-icon").removeClass(o.icons.header).addClass(o.icons.headerSelected);
clicked.next().addClass("ui-accordion-content-active")
}var toShow=clicked.next(),toHide=this.active.next(),data={options:o,newHeader:clickedIsActive&&o.collapsible?$([]):clicked,oldHeader:this.active,newContent:clickedIsActive&&o.collapsible?$([]):toShow.find("> *"),oldContent:toHide.find("> *")},down=this.headers.index(this.active[0])>this.headers.index(clicked[0]);
this.active=clickedIsActive?$([]):clicked;
this._toggle(toShow,toHide,data,clickedIsActive,down);
return false
},_toggle:function(toShow,toHide,data,clickedIsActive,down){var o=this.options,self=this;
this.toShow=toShow;
this.toHide=toHide;
this.data=data;
var complete=function(){if(!self){return 
}return self._completed.apply(self,arguments)
};
this._trigger("changestart",null,this.data);
this.running=toHide.size()===0?toShow.size():toHide.size();
if(o.animated){var animOptions={};
if(o.collapsible&&clickedIsActive){animOptions={toShow:$([]),toHide:toHide,complete:complete,down:down,autoHeight:o.autoHeight||o.fillSpace}
}else{animOptions={toShow:toShow,toHide:toHide,complete:complete,down:down,autoHeight:o.autoHeight||o.fillSpace}
}if(!o.proxied){o.proxied=o.animated
}if(!o.proxiedDuration){o.proxiedDuration=o.duration
}o.animated=$.isFunction(o.proxied)?o.proxied(animOptions):o.proxied;
o.duration=$.isFunction(o.proxiedDuration)?o.proxiedDuration(animOptions):o.proxiedDuration;
var animations=$.ui.accordion.animations,duration=o.duration,easing=o.animated;
if(!animations[easing]){animations[easing]=function(options){this.slide(options,{easing:easing,duration:duration||700})
}
}animations[easing](animOptions)
}else{if(o.collapsible&&clickedIsActive){toShow.toggle()
}else{toHide.hide();
toShow.show()
}complete(true)
}toHide.prev().attr("aria-expanded","false").attr("tabIndex","-1").blur();
toShow.prev().attr("aria-expanded","true").attr("tabIndex","0").focus()
},_completed:function(cancel){var o=this.options;
this.running=cancel?0:--this.running;
if(this.running){return 
}if(o.clearStyle){this.toShow.add(this.toHide).css({height:"",overflow:""})
}this._trigger("change",null,this.data)
}});
$.extend($.ui.accordion,{version:"1.7",defaults:{active:null,alwaysOpen:true,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase()
}},animations:{slide:function(options,additions){options=$.extend({easing:"swing",duration:300},options,additions);
if(!options.toHide.size()){options.toShow.animate({height:"show"},options);
return 
}if(!options.toShow.size()){options.toHide.animate({height:"hide"},options);
return 
}var overflow=options.toShow.css("overflow"),percentDone,showProps={},hideProps={},fxAttrs=["height","paddingTop","paddingBottom"],originalWidth;
var s=options.toShow;
originalWidth=s[0].style.width;
s.width(parseInt(s.parent().width(),10)-parseInt(s.css("paddingLeft"),10)-parseInt(s.css("paddingRight"),10)-parseInt(s.css("borderLeftWidth"),10)-parseInt(s.css("borderRightWidth"),10));
$.each(fxAttrs,function(i,prop){hideProps[prop]="hide";
var parts=(""+$.css(options.toShow[0],prop)).match(/^([\d+-.]+)(.*)$/);
showProps[prop]={value:parts[1],unit:parts[2]||"px"}
});
options.toShow.css({height:0,overflow:"hidden"}).show();
options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate(hideProps,{step:function(now,settings){if(settings.prop=="height"){percentDone=(settings.now-settings.start)/(settings.end-settings.start)
}options.toShow[0].style[settings.prop]=(percentDone*showProps[settings.prop].value)+showProps[settings.prop].unit
},duration:options.duration,easing:options.easing,complete:function(){if(!options.autoHeight){options.toShow.css("height","")
}options.toShow.css("width",originalWidth);
options.toShow.css({overflow:overflow});
options.complete()
}})
},bounceslide:function(options){this.slide(options,{easing:options.down?"easeOutBounce":"swing",duration:options.down?1000:200})
},easeslide:function(options){this.slide(options,{easing:"easeinout",duration:700})
}}})
})(jQuery);
/*
 * jQuery UI Datepicker 1.7
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Datepicker
 *
 * Depends:
 *	ui.core.js
 */

(function($) { // hide the namespace

$.extend($.ui, { datepicker: { version: "1.7" } });

var PROP_NAME = 'datepicker';

/* Date picker manager.
   Use the singleton instance of this class, $.datepicker, to interact with the date picker.
   Settings for (groups of) date pickers are maintained in an instance object,
   allowing multiple different settings on the same page. */

function Datepicker() {
	this.debug = false; // Change this to true to start debugging
	this._curInst = null; // The current instance in use
	this._keyEvent = false; // If the last event was a key event
	this._disabledInputs = []; // List of date picker inputs that have been disabled
	this._datepickerShowing = false; // True if the popup picker is showing , false if not
	this._inDialog = false; // True if showing within a "dialog", false if not
	this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division
	this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class
	this._appendClass = 'ui-datepicker-append'; // The name of the append marker class
	this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class
	this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class
	this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class
	this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class
	this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class
	this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class
	this.regional = []; // Available regional settings, indexed by language code
	this.regional[''] = { // Default regional settings
		closeText: 'Done', // Display text for close link
		prevText: 'Prev', // Display text for previous month link
		nextText: 'Next', // Display text for next month link
		currentText: 'Today', // Display text for current month link
		monthNames: ['January','February','March','April','May','June',
			'July','August','September','October','November','December'], // Names of months for drop-down and formatting
		monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting
		dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting
		dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting
		dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday
		dateFormat: 'mm/dd/yy', // See format options on parseDate
		firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
		isRTL: false // True if right-to-left language, false if left-to-right
	};
	this._defaults = { // Global defaults for all the date picker instances
		showOn: 'focus', // 'focus' for popup on focus,
			// 'button' for trigger button, or 'both' for either
		showAnim: 'show', // Name of jQuery animation for popup
		showOptions: {}, // Options for enhanced animations
		defaultDate: null, // Used when field is blank: actual date,
			// +/-number for offset from today, null for today
		appendText: '', // Display text following the input box, e.g. showing the format
		buttonText: '...', // Text for trigger button
		buttonImage: '', // URL for trigger button image
		buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
		hideIfNoPrevNext: false, // True to hide next/previous month links
			// if not applicable, false to just disable them
		navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
		gotoCurrent: false, // True if today link goes back to current selection instead
		changeMonth: false, // True if month can be selected directly, false if only prev/next
		changeYear: false, // True if year can be selected directly, false if only prev/next
		showMonthAfterYear: false, // True if the year select precedes month, false for month then year
		yearRange: '-10:+10', // Range of years to display in drop-down,
			// either relative to current year (-nn:+nn) or absolute (nnnn:nnnn)
		showOtherMonths: false, // True to show dates in other months, false to leave blank
		calculateWeek: this.iso8601Week, // How to calculate the week of the year,
			// takes a Date and returns the number of the week for it
		shortYearCutoff: '+10', // Short year values < this are in the current century,
			// > this are in the previous century,
			// string value starting with '+' for current year + value
		minDate: null, // The earliest selectable date, or null for no limit
		maxDate: null, // The latest selectable date, or null for no limit
		duration: 'normal', // Duration of display/closure
		beforeShowDay: null, // Function that takes a date and returns an array with
			// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',
			// [2] = cell title (optional), e.g. $.datepicker.noWeekends
		beforeShow: null, // Function that takes an input field and
			// returns a set of custom settings for the date picker
		onSelect: null, // Define a callback function when a date is selected
		onChangeMonthYear: null, // Define a callback function when the month or year is changed
		onClose: null, // Define a callback function when the datepicker is closed
		numberOfMonths: 1, // Number of months to show at a time
		showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
		stepMonths: 1, // Number of months to step back/forward
		stepBigMonths: 12, // Number of months to step back/forward for the big links
		altField: '', // Selector for an alternate field to store selected dates into
		altFormat: '', // The date format to use for the alternate field
		constrainInput: true, // The input is constrained by the current date format
		showButtonPanel: false // True to show button panel, false to not show it
	};
	$.extend(this._defaults, this.regional['']);
	this.dpDiv = $('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>');
}

$.extend(Datepicker.prototype, {
	/* Class name added to elements to indicate already configured with a date picker. */
	markerClassName: 'hasDatepicker',

	/* Debug logging (if enabled). */
	log: function () {
		if (this.debug)
			console.log.apply('', arguments);
	},

	/* Override the default settings for all instances of the date picker.
	   @param  settings  object - the new settings to use as defaults (anonymous object)
	   @return the manager object */
	setDefaults: function(settings) {
		extendRemove(this._defaults, settings || {});
		return this;
	},

	/* Attach the date picker to a jQuery selection.
	   @param  target    element - the target input field or division or span
	   @param  settings  object - the new settings to use for this date picker instance (anonymous) */
	_attachDatepicker: function(target, settings) {
		// check for settings on the control itself - in namespace 'date:'
		var inlineSettings = null;
		for (var attrName in this._defaults) {
			var attrValue = target.getAttribute('date:' + attrName);
			if (attrValue) {
				inlineSettings = inlineSettings || {};
				try {
					inlineSettings[attrName] = eval(attrValue);
				} catch (err) {
					inlineSettings[attrName] = attrValue;
				}
			}
		}
		var nodeName = target.nodeName.toLowerCase();
		var inline = (nodeName == 'div' || nodeName == 'span');
		if (!target.id)
			target.id = 'dp' + (++this.uuid);
		var inst = this._newInst($(target), inline);
		inst.settings = $.extend({}, settings || {}, inlineSettings || {});
		if (nodeName == 'input') {
			this._connectDatepicker(target, inst);
		} else if (inline) {
			this._inlineDatepicker(target, inst);
		}
	},

	/* Create a new instance object. */
	_newInst: function(target, inline) {
		var id = target[0].id.replace(/([:\[\]\.])/g, '\\\\$1'); // escape jQuery meta chars
		return {id: id, input: target, // associated target
			selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
			drawMonth: 0, drawYear: 0, // month being drawn
			inline: inline, // is datepicker inline or not
			dpDiv: (!inline ? this.dpDiv : // presentation div
			$('<div class="' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))};
	},

	/* Attach the date picker to an input field. */
	_connectDatepicker: function(target, inst) {
		var input = $(target);
		if (input.hasClass(this.markerClassName))
			return;
		var appendText = this._get(inst, 'appendText');
		var isRTL = this._get(inst, 'isRTL');
		if (appendText)
			input[isRTL ? 'before' : 'after']('<span class="' + this._appendClass + '">' + appendText + '</span>');
		var showOn = this._get(inst, 'showOn');
		if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field
			input.focus(this._showDatepicker);
		if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked
			var buttonText = this._get(inst, 'buttonText');
			var buttonImage = this._get(inst, 'buttonImage');
			var trigger = $(this._get(inst, 'buttonImageOnly') ?
				$('<img/>').addClass(this._triggerClass).
					attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
				$('<button type="button"></button>').addClass(this._triggerClass).
					html(buttonImage == '' ? buttonText : $('<img/>').attr(
					{ src:buttonImage, alt:buttonText, title:buttonText })));
			input[isRTL ? 'before' : 'after'](trigger);
			trigger.click(function() {
				if ($.datepicker._datepickerShowing && $.datepicker._lastInput == target)
					$.datepicker._hideDatepicker();
				else
					$.datepicker._showDatepicker(target);
				return false;
			});
		}
		input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).
			bind("setData.datepicker", function(event, key, value) {
				inst.settings[key] = value;
			}).bind("getData.datepicker", function(event, key) {
				return this._get(inst, key);
			});
		$.data(target, PROP_NAME, inst);
	},

	/* Attach an inline date picker to a div. */
	_inlineDatepicker: function(target, inst) {
		var divSpan = $(target);
		if (divSpan.hasClass(this.markerClassName))
			return;
		divSpan.addClass(this.markerClassName).append(inst.dpDiv).
			bind("setData.datepicker", function(event, key, value){
				inst.settings[key] = value;
			}).bind("getData.datepicker", function(event, key){
				return this._get(inst, key);
			});
		$.data(target, PROP_NAME, inst);
		this._setDate(inst, this._getDefaultDate(inst));
		this._updateDatepicker(inst);
		this._updateAlternate(inst);
	},

	/* Pop-up the date picker in a "dialog" box.
	   @param  input     element - ignored
	   @param  dateText  string - the initial date to display (in the current format)
	   @param  onSelect  function - the function(dateText) to call when a date is selected
	   @param  settings  object - update the dialog date picker instance's settings (anonymous object)
	   @param  pos       int[2] - coordinates for the dialog's position within the screen or
	                     event - with x/y coordinates or
	                     leave empty for default (screen centre)
	   @return the manager object */
	_dialogDatepicker: function(input, dateText, onSelect, settings, pos) {
		var inst = this._dialogInst; // internal instance
		if (!inst) {
			var id = 'dp' + (++this.uuid);
			this._dialogInput = $('<input type="text" id="' + id +
				'" size="1" style="position: absolute; top: -100px;"/>');
			this._dialogInput.keydown(this._doKeyDown);
			$('body').append(this._dialogInput);
			inst = this._dialogInst = this._newInst(this._dialogInput, false);
			inst.settings = {};
			$.data(this._dialogInput[0], PROP_NAME, inst);
		}
		extendRemove(inst.settings, settings || {});
		this._dialogInput.val(dateText);

		this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
		if (!this._pos) {
			var browserWidth = window.innerWidth || document.documentElement.clientWidth ||	document.body.clientWidth;
			var browserHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
			var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
			var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
			this._pos = // should use actual width/height below
				[(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
		}

		// move input on screen for focus, but hidden behind dialog
		this._dialogInput.css('left', this._pos[0] + 'px').css('top', this._pos[1] + 'px');
		inst.settings.onSelect = onSelect;
		this._inDialog = true;
		this.dpDiv.addClass(this._dialogClass);
		this._showDatepicker(this._dialogInput[0]);
		if ($.blockUI)
			$.blockUI(this.dpDiv);
		$.data(this._dialogInput[0], PROP_NAME, inst);
		return this;
	},

	/* Detach a datepicker from its control.
	   @param  target    element - the target input field or division or span */
	_destroyDatepicker: function(target) {
		var $target = $(target);
		if (!$target.hasClass(this.markerClassName)) {
			return;
		}
		var nodeName = target.nodeName.toLowerCase();
		$.removeData(target, PROP_NAME);
		if (nodeName == 'input') {
			$target.siblings('.' + this._appendClass).remove().end().
				siblings('.' + this._triggerClass).remove().end().
				removeClass(this.markerClassName).
				unbind('focus', this._showDatepicker).
				unbind('keydown', this._doKeyDown).
				unbind('keypress', this._doKeyPress);
		} else if (nodeName == 'div' || nodeName == 'span')
			$target.removeClass(this.markerClassName).empty();
	},

	/* Enable the date picker to a jQuery selection.
	   @param  target    element - the target input field or division or span */
	_enableDatepicker: function(target) {
		var $target = $(target);
		if (!$target.hasClass(this.markerClassName)) {
			return;
		}
		var nodeName = target.nodeName.toLowerCase();
		if (nodeName == 'input') {
		target.disabled = false;
			$target.siblings('button.' + this._triggerClass).
			each(function() { this.disabled = false; }).end().
				siblings('img.' + this._triggerClass).
				css({opacity: '1.0', cursor: ''});
		}
		else if (nodeName == 'div' || nodeName == 'span') {
			var inline = $target.children('.' + this._inlineClass);
			inline.children().removeClass('ui-state-disabled');
		}
		this._disabledInputs = $.map(this._disabledInputs,
			function(value) { return (value == target ? null : value); }); // delete entry
	},

	/* Disable the date picker to a jQuery selection.
	   @param  target    element - the target input field or division or span */
	_disableDatepicker: function(target) {
		var $target = $(target);
		if (!$target.hasClass(this.markerClassName)) {
			return;
		}
		var nodeName = target.nodeName.toLowerCase();
		if (nodeName == 'input') {
		target.disabled = true;
			$target.siblings('button.' + this._triggerClass).
			each(function() { this.disabled = true; }).end().
				siblings('img.' + this._triggerClass).
				css({opacity: '0.5', cursor: 'default'});
		}
		else if (nodeName == 'div' || nodeName == 'span') {
			var inline = $target.children('.' + this._inlineClass);
			inline.children().addClass('ui-state-disabled');
		}
		this._disabledInputs = $.map(this._disabledInputs,
			function(value) { return (value == target ? null : value); }); // delete entry
		this._disabledInputs[this._disabledInputs.length] = target;
	},

	/* Is the first field in a jQuery collection disabled as a datepicker?
	   @param  target    element - the target input field or division or span
	   @return boolean - true if disabled, false if enabled */
	_isDisabledDatepicker: function(target) {
		if (!target) {
			return false;
		}
		for (var i = 0; i < this._disabledInputs.length; i++) {
			if (this._disabledInputs[i] == target)
				return true;
		}
		return false;
	},

	/* Retrieve the instance data for the target control.
	   @param  target  element - the target input field or division or span
	   @return  object - the associated instance data
	   @throws  error if a jQuery problem getting data */
	_getInst: function(target) {
		try {
			return $.data(target, PROP_NAME);
		}
		catch (err) {
			throw 'Missing instance data for this datepicker';
		}
	},

	/* Update the settings for a date picker attached to an input field or division.
	   @param  target  element - the target input field or division or span
	   @param  name    object - the new settings to update or
	                   string - the name of the setting to change or
	   @param  value   any - the new value for the setting (omit if above is an object) */
	_optionDatepicker: function(target, name, value) {
		var settings = name || {};
		if (typeof name == 'string') {
			settings = {};
			settings[name] = value;
		}
		var inst = this._getInst(target);
		if (inst) {
			if (this._curInst == inst) {
				this._hideDatepicker(null);
			}
			extendRemove(inst.settings, settings);
			var date = new Date();
			extendRemove(inst, {rangeStart: null, // start of range
				endDay: null, endMonth: null, endYear: null, // end of range
				selectedDay: date.getDate(), selectedMonth: date.getMonth(),
				selectedYear: date.getFullYear(), // starting point
				currentDay: date.getDate(), currentMonth: date.getMonth(),
				currentYear: date.getFullYear(), // current selection
				drawMonth: date.getMonth(), drawYear: date.getFullYear()}); // month being drawn
			this._updateDatepicker(inst);
		}
	},

	// change method deprecated
	_changeDatepicker: function(target, name, value) {
		this._optionDatepicker(target, name, value);
	},

	/* Redraw the date picker attached to an input field or division.
	   @param  target  element - the target input field or division or span */
	_refreshDatepicker: function(target) {
		var inst = this._getInst(target);
		if (inst) {
			this._updateDatepicker(inst);
		}
	},

	/* Set the dates for a jQuery selection.
	   @param  target   element - the target input field or division or span
	   @param  date     Date - the new date
	   @param  endDate  Date - the new end date for a range (optional) */
	_setDateDatepicker: function(target, date, endDate) {
		var inst = this._getInst(target);
		if (inst) {
			this._setDate(inst, date, endDate);
			this._updateDatepicker(inst);
			this._updateAlternate(inst);
		}
	},

	/* Get the date(s) for the first entry in a jQuery selection.
	   @param  target  element - the target input field or division or span
	   @return Date - the current date or
	           Date[2] - the current dates for a range */
	_getDateDatepicker: function(target) {
		var inst = this._getInst(target);
		if (inst && !inst.inline)
			this._setDateFromField(inst);
		return (inst ? this._getDate(inst) : null);
	},

	/* Handle keystrokes. */
	_doKeyDown: function(event) {
		var inst = $.datepicker._getInst(event.target);
		var handled = true;
		var isRTL = inst.dpDiv.is('.ui-datepicker-rtl');
		inst._keyEvent = true;
		if ($.datepicker._datepickerShowing)
			switch (event.keyCode) {
				case 9:  $.datepicker._hideDatepicker(null, '');
						break; // hide on tab out
				case 13: var sel = $('td.' + $.datepicker._dayOverClass +
							', td.' + $.datepicker._currentClass, inst.dpDiv);
						if (sel[0])
							$.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
						else
							$.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration'));
						return false; // don't submit the form
						break; // select the value on enter
				case 27: $.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration'));
						break; // hide on escape
				case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
							-$.datepicker._get(inst, 'stepBigMonths') :
							-$.datepicker._get(inst, 'stepMonths')), 'M');
						break; // previous month/year on page up/+ ctrl
				case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
							+$.datepicker._get(inst, 'stepBigMonths') :
							+$.datepicker._get(inst, 'stepMonths')), 'M');
						break; // next month/year on page down/+ ctrl
				case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target);
						handled = event.ctrlKey || event.metaKey;
						break; // clear on ctrl or command +end
				case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target);
						handled = event.ctrlKey || event.metaKey;
						break; // current on ctrl or command +home
				case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D');
						handled = event.ctrlKey || event.metaKey;
						// -1 day on ctrl or command +left
						if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
									-$.datepicker._get(inst, 'stepBigMonths') :
									-$.datepicker._get(inst, 'stepMonths')), 'M');
						// next month/year on alt +left on Mac
						break;
				case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D');
						handled = event.ctrlKey || event.metaKey;
						break; // -1 week on ctrl or command +up
				case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D');
						handled = event.ctrlKey || event.metaKey;
						// +1 day on ctrl or command +right
						if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
									+$.datepicker._get(inst, 'stepBigMonths') :
									+$.datepicker._get(inst, 'stepMonths')), 'M');
						// next month/year on alt +right
						break;
				case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D');
						handled = event.ctrlKey || event.metaKey;
						break; // +1 week on ctrl or command +down
				default: handled = false;
			}
		else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home
			$.datepicker._showDatepicker(this);
		else {
			handled = false;
		}
		if (handled) {
			event.preventDefault();
			event.stopPropagation();
		}
	},

	/* Filter entered characters - based on date format. */
	_doKeyPress: function(event) {
		var inst = $.datepicker._getInst(event.target);
		if ($.datepicker._get(inst, 'constrainInput')) {
			var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
			var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode);
			return event.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
		}
	},

	/* Pop-up the date picker for a given input field.
	   @param  input  element - the input field attached to the date picker or
	                  event - if triggered by focus */
	_showDatepicker: function(input) {
		input = input.target || input;
		if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger
			input = $('input', input.parentNode)[0];
		if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here
			return;
		var inst = $.datepicker._getInst(input);
		var beforeShow = $.datepicker._get(inst, 'beforeShow');
		extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));
		$.datepicker._hideDatepicker(null, '');
		$.datepicker._lastInput = input;
		$.datepicker._setDateFromField(inst);
		if ($.datepicker._inDialog) // hide cursor
			input.value = '';
		if (!$.datepicker._pos) { // position below input
			$.datepicker._pos = $.datepicker._findPos(input);
			$.datepicker._pos[1] += input.offsetHeight; // add the height
		}
		var isFixed = false;
		$(input).parents().each(function() {
			isFixed |= $(this).css('position') == 'fixed';
			return !isFixed;
		});
		if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled
			$.datepicker._pos[0] -= document.documentElement.scrollLeft;
			$.datepicker._pos[1] -= document.documentElement.scrollTop;
		}
		var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
		$.datepicker._pos = null;
		inst.rangeStart = null;
		// determine sizing offscreen
		inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});
		$.datepicker._updateDatepicker(inst);
		// fix width for dynamic number of date pickers
		// and adjust position before showing
		offset = $.datepicker._checkOffset(inst, offset, isFixed);
		inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
			'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
			left: offset.left + 'px', top: offset.top + 'px'});
		if (!inst.inline) {
			var showAnim = $.datepicker._get(inst, 'showAnim') || 'show';
			var duration = $.datepicker._get(inst, 'duration');
			var postProcess = function() {
				$.datepicker._datepickerShowing = true;
				if ($.browser.msie && parseInt($.browser.version,10) < 7) // fix IE < 7 select problems
					$('iframe.ui-datepicker-cover').css({width: inst.dpDiv.width() + 4,
						height: inst.dpDiv.height() + 4});
			};
			if ($.effects && $.effects[showAnim])
				inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
			else
				inst.dpDiv[showAnim](duration, postProcess);
			if (duration == '')
				postProcess();
			if (inst.input[0].type != 'hidden')
				inst.input[0].focus();
			$.datepicker._curInst = inst;
		}
	},

	/* Generate the date picker content. */
	_updateDatepicker: function(inst) {
		var dims = {width: inst.dpDiv.width() + 4,
			height: inst.dpDiv.height() + 4};
		var self = this;
		inst.dpDiv.empty().append(this._generateHTML(inst))
			.find('iframe.ui-datepicker-cover').
				css({width: dims.width, height: dims.height})
			.end()
			.find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a')
				.bind('mouseout', function(){
					$(this).removeClass('ui-state-hover');
					if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover');
					if(this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover');
				})
				.bind('mouseover', function(){
					if (!self._isDisabledDatepicker( inst.inline ? inst.dpDiv.parent()[0] : inst.input[0])) {
						$(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');
						$(this).addClass('ui-state-hover');
						if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover');
						if(this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover');
					}
				})
			.end()
			.find('.' + this._dayOverClass + ' a')
				.trigger('mouseover')
			.end();
		var numMonths = this._getNumberOfMonths(inst);
		var cols = numMonths[1];
		var width = 17;
		if (cols > 1) {
			inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
		} else {
			inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
		}
		inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
			'Class']('ui-datepicker-multi');
		inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
			'Class']('ui-datepicker-rtl');
		if (inst.input && inst.input[0].type != 'hidden' && inst == $.datepicker._curInst)
			$(inst.input[0]).focus();
	},

	/* Check positioning to remain on screen. */
	_checkOffset: function(inst, offset, isFixed) {
		var dpWidth = inst.dpDiv.outerWidth();
		var dpHeight = inst.dpDiv.outerHeight();
		var inputWidth = inst.input ? inst.input.outerWidth() : 0;
		var inputHeight = inst.input ? inst.input.outerHeight() : 0;
		var viewWidth = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) + $(document).scrollLeft();
		var viewHeight = (window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight) + $(document).scrollTop();

		offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0);
		offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;
		offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;

		// now check if datepicker is showing outside window viewport - move to a better place if so.
		offset.left -= (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? Math.abs(offset.left + dpWidth - viewWidth) : 0;
		offset.top -= (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? Math.abs(offset.top + dpHeight + inputHeight*2 - viewHeight) : 0;

		return offset;
	},

	/* Find an object's position on the screen. */
	_findPos: function(obj) {
        while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
            obj = obj.nextSibling;
        }
        var position = $(obj).offset();
	    return [position.left, position.top];
	},

	/* Hide the date picker from view.
	   @param  input  element - the input field attached to the date picker
	   @param  duration  string - the duration over which to close the date picker */
	_hideDatepicker: function(input, duration) {
		var inst = this._curInst;
		if (!inst || (input && inst != $.data(input, PROP_NAME)))
			return;
		if (inst.stayOpen)
			this._selectDate('#' + inst.id, this._formatDate(inst,
				inst.currentDay, inst.currentMonth, inst.currentYear));
		inst.stayOpen = false;
		if (this._datepickerShowing) {
			duration = (duration != null ? duration : this._get(inst, 'duration'));
			var showAnim = this._get(inst, 'showAnim');
			var postProcess = function() {
				$.datepicker._tidyDialog(inst);
			};
			if (duration != '' && $.effects && $.effects[showAnim])
				inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'),
					duration, postProcess);
			else
				inst.dpDiv[(duration == '' ? 'hide' : (showAnim == 'slideDown' ? 'slideUp' :
					(showAnim == 'fadeIn' ? 'fadeOut' : 'hide')))](duration, postProcess);
			if (duration == '')
				this._tidyDialog(inst);
			var onClose = this._get(inst, 'onClose');
			if (onClose)
				onClose.apply((inst.input ? inst.input[0] : null),
					[(inst.input ? inst.input.val() : ''), inst]);  // trigger custom callback
			this._datepickerShowing = false;
			this._lastInput = null;
			if (this._inDialog) {
				this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
				if ($.blockUI) {
					$.unblockUI();
					$('body').append(this.dpDiv);
				}
			}
			this._inDialog = false;
		}
		this._curInst = null;
	},

	/* Tidy up after a dialog display. */
	_tidyDialog: function(inst) {
		inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar');
	},

	/* Close date picker if clicked elsewhere. */
	_checkExternalClick: function(event) {
		if (!$.datepicker._curInst)
			return;
		var $target = $(event.target);
		if (($target.parents('#' + $.datepicker._mainDivId).length == 0) &&
				!$target.hasClass($.datepicker.markerClassName) &&
				!$target.hasClass($.datepicker._triggerClass) &&
				$.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))
			$.datepicker._hideDatepicker(null, '');
	},

	/* Adjust one of the date sub-fields. */
	_adjustDate: function(id, offset, period) {
		var target = $(id);
		var inst = this._getInst(target[0]);
		if (this._isDisabledDatepicker(target[0])) {
			return;
		}
		this._adjustInstDate(inst, offset +
			(period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning
			period);
		this._updateDatepicker(inst);
	},

	/* Action for current link. */
	_gotoToday: function(id) {
		var target = $(id);
		var inst = this._getInst(target[0]);
		if (this._get(inst, 'gotoCurrent') && inst.currentDay) {
			inst.selectedDay = inst.currentDay;
			inst.drawMonth = inst.selectedMonth = inst.currentMonth;
			inst.drawYear = inst.selectedYear = inst.currentYear;
		}
		else {
		var date = new Date();
		inst.selectedDay = date.getDate();
		inst.drawMonth = inst.selectedMonth = date.getMonth();
		inst.drawYear = inst.selectedYear = date.getFullYear();
		}
		this._notifyChange(inst);
		this._adjustDate(target);
	},

	/* Action for selecting a new month/year. */
	_selectMonthYear: function(id, select, period) {
		var target = $(id);
		var inst = this._getInst(target[0]);
		inst._selectingMonthYear = false;
		inst['selected' + (period == 'M' ? 'Month' : 'Year')] =
		inst['draw' + (period == 'M' ? 'Month' : 'Year')] =
			parseInt(select.options[select.selectedIndex].value,10);
		this._notifyChange(inst);
		this._adjustDate(target);
	},

	/* Restore input focus after not changing month/year. */
	_clickMonthYear: function(id) {
		var target = $(id);
		var inst = this._getInst(target[0]);
		if (inst.input && inst._selectingMonthYear && !$.browser.msie)
			inst.input[0].focus();
		inst._selectingMonthYear = !inst._selectingMonthYear;
	},

	/* Action for selecting a day. */
	_selectDay: function(id, month, year, td) {
		var target = $(id);
		if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
			return;
		}
		var inst = this._getInst(target[0]);
		inst.selectedDay = inst.currentDay = $('a', td).html();
		inst.selectedMonth = inst.currentMonth = month;
		inst.selectedYear = inst.currentYear = year;
		if (inst.stayOpen) {
			inst.endDay = inst.endMonth = inst.endYear = null;
		}
		this._selectDate(id, this._formatDate(inst,
			inst.currentDay, inst.currentMonth, inst.currentYear));
		if (inst.stayOpen) {
			inst.rangeStart = this._daylightSavingAdjust(
				new Date(inst.currentYear, inst.currentMonth, inst.currentDay));
			this._updateDatepicker(inst);
		}
	},

	/* Erase the input field and hide the date picker. */
	_clearDate: function(id) {
		var target = $(id);
		var inst = this._getInst(target[0]);
		inst.stayOpen = false;
		inst.endDay = inst.endMonth = inst.endYear = inst.rangeStart = null;
		this._selectDate(target, '');
	},

	/* Update the input field with the selected date. */
	_selectDate: function(id, dateStr) {
		var target = $(id);
		var inst = this._getInst(target[0]);
		dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
		if (inst.input)
			inst.input.val(dateStr);
		this._updateAlternate(inst);
		var onSelect = this._get(inst, 'onSelect');
		if (onSelect)
			onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);  // trigger custom callback
		else if (inst.input)
			inst.input.trigger('change'); // fire the change event
		if (inst.inline)
			this._updateDatepicker(inst);
		else if (!inst.stayOpen) {
			this._hideDatepicker(null, this._get(inst, 'duration'));
			this._lastInput = inst.input[0];
			if (typeof(inst.input[0]) != 'object')
				inst.input[0].focus(); // restore focus
			this._lastInput = null;
		}
	},

	/* Update any alternate field to synchronise with the main field. */
	_updateAlternate: function(inst) {
		var altField = this._get(inst, 'altField');
		if (altField) { // update alternate field too
			var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat');
			var date = this._getDate(inst);
			dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
			$(altField).each(function() { $(this).val(dateStr); });
		}
	},

	/* Set as beforeShowDay function to prevent selection of weekends.
	   @param  date  Date - the date to customise
	   @return [boolean, string] - is this date selectable?, what is its CSS class? */
	noWeekends: function(date) {
		var day = date.getDay();
		return [(day > 0 && day < 6), ''];
	},

	/* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
	   @param  date  Date - the date to get the week for
	   @return  number - the number of the week within the year that contains this date */
	iso8601Week: function(date) {
		var checkDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
		var firstMon = new Date(checkDate.getFullYear(), 1 - 1, 4); // First week always contains 4 Jan
		var firstDay = firstMon.getDay() || 7; // Day of week: Mon = 1, ..., Sun = 7
		firstMon.setDate(firstMon.getDate() + 1 - firstDay); // Preceding Monday
		if (firstDay < 4 && checkDate < firstMon) { // Adjust first three days in year if necessary
			checkDate.setDate(checkDate.getDate() - 3); // Generate for previous year
			return $.datepicker.iso8601Week(checkDate);
		} else if (checkDate > new Date(checkDate.getFullYear(), 12 - 1, 28)) { // Check last three days in year
			firstDay = new Date(checkDate.getFullYear() + 1, 1 - 1, 4).getDay() || 7;
			if (firstDay > 4 && (checkDate.getDay() || 7) < firstDay - 3) { // Adjust if necessary
				return 1;
			}
		}
		return Math.floor(((checkDate - firstMon) / 86400000) / 7) + 1; // Weeks to given date
	},

	/* Parse a string value into a date object.
	   See formatDate below for the possible formats.

	   @param  format    string - the expected format of the date
	   @param  value     string - the date in the above format
	   @param  settings  Object - attributes include:
	                     shortYearCutoff  number - the cutoff year for determining the century (optional)
	                     dayNamesShort    string[7] - abbreviated names of the days from Sunday (optional)
	                     dayNames         string[7] - names of the days from Sunday (optional)
	                     monthNamesShort  string[12] - abbreviated names of the months (optional)
	                     monthNames       string[12] - names of the months (optional)
	   @return  Date - the extracted date value or null if value is blank */
	parseDate: function (format, value, settings) {
		if (format == null || value == null)
			throw 'Invalid arguments';
		value = (typeof value == 'object' ? value.toString() : value + '');
		if (value == '')
			return null;
		var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
		var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
		var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
		var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
		var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
		var year = -1;
		var month = -1;
		var day = -1;
		var doy = -1;
		var literal = false;
		// Check whether a format character is doubled
		var lookAhead = function(match) {
			var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
			if (matches)
				iFormat++;
			return matches;
		};
		// Extract a number from the string value
		var getNumber = function(match) {
			lookAhead(match);
			var origSize = (match == '@' ? 14 : (match == 'y' ? 4 : (match == 'o' ? 3 : 2)));
			var size = origSize;
			var num = 0;
			while (size > 0 && iValue < value.length &&
					value.charAt(iValue) >= '0' && value.charAt(iValue) <= '9') {
				num = num * 10 + parseInt(value.charAt(iValue++),10);
				size--;
			}
			if (size == origSize)
				throw 'Missing number at position ' + iValue;
			return num;
		};
		// Extract a name from the string value and convert to an index
		var getName = function(match, shortNames, longNames) {
			var names = (lookAhead(match) ? longNames : shortNames);
			var size = 0;
			for (var j = 0; j < names.length; j++)
				size = Math.max(size, names[j].length);
			var name = '';
			var iInit = iValue;
			while (size > 0 && iValue < value.length) {
				name += value.charAt(iValue++);
				for (var i = 0; i < names.length; i++)
					if (name == names[i])
						return i + 1;
				size--;
			}
			throw 'Unknown name at position ' + iInit;
		};
		// Confirm that a literal character matches the string value
		var checkLiteral = function() {
			if (value.charAt(iValue) != format.charAt(iFormat))
				throw 'Unexpected literal at position ' + iValue;
			iValue++;
		};
		var iValue = 0;
		for (var iFormat = 0; iFormat < format.length; iFormat++) {
			if (literal)
				if (format.charAt(iFormat) == "'" && !lookAhead("'"))
					literal = false;
				else
					checkLiteral();
			else
				switch (format.charAt(iFormat)) {
					case 'd':
						day = getNumber('d');
						break;
					case 'D':
						getName('D', dayNamesShort, dayNames);
						break;
					case 'o':
						doy = getNumber('o');
						break;
					case 'm':
						month = getNumber('m');
						break;
					case 'M':
						month = getName('M', monthNamesShort, monthNames);
						break;
					case 'y':
						year = getNumber('y');
						break;
					case '@':
						var date = new Date(getNumber('@'));
						year = date.getFullYear();
						month = date.getMonth() + 1;
						day = date.getDate();
						break;
					case "'":
						if (lookAhead("'"))
							checkLiteral();
						else
							literal = true;
						break;
					default:
						checkLiteral();
				}
		}
		if (year == -1)
			year = new Date().getFullYear();
		else if (year < 100)
			year += new Date().getFullYear() - new Date().getFullYear() % 100 +
				(year <= shortYearCutoff ? 0 : -100);
		if (doy > -1) {
			month = 1;
			day = doy;
			do {
				var dim = this._getDaysInMonth(year, month - 1);
				if (day <= dim)
					break;
				month++;
				day -= dim;
			} while (true);
		}
		var date = this._daylightSavingAdjust(new Date(year, month - 1, day));
		if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day)
			throw 'Invalid date'; // E.g. 31/02/*
		return date;
	},

	/* Standard date formats. */
	ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601)
	COOKIE: 'D, dd M yy',
	ISO_8601: 'yy-mm-dd',
	RFC_822: 'D, d M y',
	RFC_850: 'DD, dd-M-y',
	RFC_1036: 'D, d M y',
	RFC_1123: 'D, d M yy',
	RFC_2822: 'D, d M yy',
	RSS: 'D, d M y', // RFC 822
	TIMESTAMP: '@',
	W3C: 'yy-mm-dd', // ISO 8601

	/* Format a date object into a string value.
	   The format can be combinations of the following:
	   d  - day of month (no leading zero)
	   dd - day of month (two digit)
	   o  - day of year (no leading zeros)
	   oo - day of year (three digit)
	   D  - day name short
	   DD - day name long
	   m  - month of year (no leading zero)
	   mm - month of year (two digit)
	   M  - month name short
	   MM - month name long
	   y  - year (two digit)
	   yy - year (four digit)
	   @ - Unix timestamp (ms since 01/01/1970)
	   '...' - literal text
	   '' - single quote

	   @param  format    string - the desired format of the date
	   @param  date      Date - the date value to format
	   @param  settings  Object - attributes include:
	                     dayNamesShort    string[7] - abbreviated names of the days from Sunday (optional)
	                     dayNames         string[7] - names of the days from Sunday (optional)
	                     monthNamesShort  string[12] - abbreviated names of the months (optional)
	                     monthNames       string[12] - names of the months (optional)
	   @return  string - the date in the above format */
	formatDate: function (format, date, settings) {
		if (!date)
			return '';
		var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
		var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
		var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
		var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
		// Check whether a format character is doubled
		var lookAhead = function(match) {
			var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
			if (matches)
				iFormat++;
			return matches;
		};
		// Format a number, with leading zero if necessary
		var formatNumber = function(match, value, len) {
			var num = '' + value;
			if (lookAhead(match))
				while (num.length < len)
					num = '0' + num;
			return num;
		};
		// Format a name, short or long as requested
		var formatName = function(match, value, shortNames, longNames) {
			return (lookAhead(match) ? longNames[value] : shortNames[value]);
		};
		var output = '';
		var literal = false;
		if (date)
			for (var iFormat = 0; iFormat < format.length; iFormat++) {
				if (literal)
					if (format.charAt(iFormat) == "'" && !lookAhead("'"))
						literal = false;
					else
						output += format.charAt(iFormat);
				else
					switch (format.charAt(iFormat)) {
						case 'd':
							output += formatNumber('d', date.getDate(), 2);
							break;
						case 'D':
							output += formatName('D', date.getDay(), dayNamesShort, dayNames);
							break;
						case 'o':
							var doy = date.getDate();
							for (var m = date.getMonth() - 1; m >= 0; m--)
								doy += this._getDaysInMonth(date.getFullYear(), m);
							output += formatNumber('o', doy, 3);
							break;
						case 'm':
							output += formatNumber('m', date.getMonth() + 1, 2);
							break;
						case 'M':
							output += formatName('M', date.getMonth(), monthNamesShort, monthNames);
							break;
						case 'y':
							output += (lookAhead('y') ? date.getFullYear() :
								(date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
							break;
						case '@':
							output += date.getTime();
							break;
						case "'":
							if (lookAhead("'"))
								output += "'";
							else
								literal = true;
							break;
						default:
							output += format.charAt(iFormat);
					}
			}
		return output;
	},

	/* Extract all possible characters from the date format. */
	_possibleChars: function (format) {
		var chars = '';
		var literal = false;
		for (var iFormat = 0; iFormat < format.length; iFormat++)
			if (literal)
				if (format.charAt(iFormat) == "'" && !lookAhead("'"))
					literal = false;
				else
					chars += format.charAt(iFormat);
			else
				switch (format.charAt(iFormat)) {
					case 'd': case 'm': case 'y': case '@':
						chars += '0123456789';
						break;
					case 'D': case 'M':
						return null; // Accept anything
					case "'":
						if (lookAhead("'"))
							chars += "'";
						else
							literal = true;
						break;
					default:
						chars += format.charAt(iFormat);
				}
		return chars;
	},

	/* Get a setting value, defaulting if necessary. */
	_get: function(inst, name) {
		return inst.settings[name] !== undefined ?
			inst.settings[name] : this._defaults[name];
	},

	/* Parse existing date and initialise date picker. */
	_setDateFromField: function(inst) {
		var dateFormat = this._get(inst, 'dateFormat');
		var dates = inst.input ? inst.input.val() : null;
		inst.endDay = inst.endMonth = inst.endYear = null;
		var date = defaultDate = this._getDefaultDate(inst);
		var settings = this._getFormatConfig(inst);
		try {
			date = this.parseDate(dateFormat, dates, settings) || defaultDate;
		} catch (event) {
			this.log(event);
			date = defaultDate;
		}
		inst.selectedDay = date.getDate();
		inst.drawMonth = inst.selectedMonth = date.getMonth();
		inst.drawYear = inst.selectedYear = date.getFullYear();
		inst.currentDay = (dates ? date.getDate() : 0);
		inst.currentMonth = (dates ? date.getMonth() : 0);
		inst.currentYear = (dates ? date.getFullYear() : 0);
		this._adjustInstDate(inst);
	},

	/* Retrieve the default date shown on opening. */
	_getDefaultDate: function(inst) {
		var date = this._determineDate(this._get(inst, 'defaultDate'), new Date());
		var minDate = this._getMinMaxDate(inst, 'min', true);
		var maxDate = this._getMinMaxDate(inst, 'max');
		date = (minDate && date < minDate ? minDate : date);
		date = (maxDate && date > maxDate ? maxDate : date);
		return date;
	},

	/* A date may be specified as an exact value or a relative one. */
	_determineDate: function(date, defaultDate) {
		var offsetNumeric = function(offset) {
			var date = new Date();
			date.setDate(date.getDate() + offset);
			return date;
		};
		var offsetString = function(offset, getDaysInMonth) {
			var date = new Date();
			var year = date.getFullYear();
			var month = date.getMonth();
			var day = date.getDate();
			var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
			var matches = pattern.exec(offset);
			while (matches) {
				switch (matches[2] || 'd') {
					case 'd' : case 'D' :
						day += parseInt(matches[1],10); break;
					case 'w' : case 'W' :
						day += parseInt(matches[1],10) * 7; break;
					case 'm' : case 'M' :
						month += parseInt(matches[1],10);
						day = Math.min(day, getDaysInMonth(year, month));
						break;
					case 'y': case 'Y' :
						year += parseInt(matches[1],10);
						day = Math.min(day, getDaysInMonth(year, month));
						break;
				}
				matches = pattern.exec(offset);
			}
			return new Date(year, month, day);
		};
		date = (date == null ? defaultDate :
			(typeof date == 'string' ? offsetString(date, this._getDaysInMonth) :
			(typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : date)));
		date = (date && date.toString() == 'Invalid Date' ? defaultDate : date);
		if (date) {
			date.setHours(0);
			date.setMinutes(0);
			date.setSeconds(0);
			date.setMilliseconds(0);
		}
		return this._daylightSavingAdjust(date);
	},

	/* Handle switch to/from daylight saving.
	   Hours may be non-zero on daylight saving cut-over:
	   > 12 when midnight changeover, but then cannot generate
	   midnight datetime, so jump to 1AM, otherwise reset.
	   @param  date  (Date) the date to check
	   @return  (Date) the corrected date */
	_daylightSavingAdjust: function(date) {
		if (!date) return null;
		date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
		return date;
	},

	/* Set the date(s) directly. */
	_setDate: function(inst, date, endDate) {
		var clear = !(date);
		var origMonth = inst.selectedMonth;
		var origYear = inst.selectedYear;
		date = this._determineDate(date, new Date());
		inst.selectedDay = inst.currentDay = date.getDate();
		inst.drawMonth = inst.selectedMonth = inst.currentMonth = date.getMonth();
		inst.drawYear = inst.selectedYear = inst.currentYear = date.getFullYear();
		if (origMonth != inst.selectedMonth || origYear != inst.selectedYear)
			this._notifyChange(inst);
		this._adjustInstDate(inst);
		if (inst.input) {
			inst.input.val(clear ? '' : this._formatDate(inst));
		}
	},

	/* Retrieve the date(s) directly. */
	_getDate: function(inst) {
		var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :
			this._daylightSavingAdjust(new Date(
			inst.currentYear, inst.currentMonth, inst.currentDay)));
			return startDate;
	},

	/* Generate the HTML for the current state of the date picker. */
	_generateHTML: function(inst) {
		var today = new Date();
		today = this._daylightSavingAdjust(
			new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time
		var isRTL = this._get(inst, 'isRTL');
		var showButtonPanel = this._get(inst, 'showButtonPanel');
		var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext');
		var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat');
		var numMonths = this._getNumberOfMonths(inst);
		var showCurrentAtPos = this._get(inst, 'showCurrentAtPos');
		var stepMonths = this._get(inst, 'stepMonths');
		var stepBigMonths = this._get(inst, 'stepBigMonths');
		var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);
		var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
			new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
		var minDate = this._getMinMaxDate(inst, 'min', true);
		var maxDate = this._getMinMaxDate(inst, 'max');
		var drawMonth = inst.drawMonth - showCurrentAtPos;
		var drawYear = inst.drawYear;
		if (drawMonth < 0) {
			drawMonth += 12;
			drawYear--;
		}
		if (maxDate) {
			var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
				maxDate.getMonth() - numMonths[1] + 1, maxDate.getDate()));
			maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
			while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
				drawMonth--;
				if (drawMonth < 0) {
					drawMonth = 11;
					drawYear--;
				}
			}
		}
		inst.drawMonth = drawMonth;
		inst.drawYear = drawYear;
		var prevText = this._get(inst, 'prevText');
		prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
			this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
			this._getFormatConfig(inst)));
		var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
			'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' +
			'><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>' :
			(hideIfNoPrevNext ? '' : '<a class="ui-datepicker-prev ui-corner-all ui-state-disabled"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>'));
		var nextText = this._get(inst, 'nextText');
		nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
			this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
			this._getFormatConfig(inst)));
		var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
			'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepMonths + ', \'M\');"' +
			'><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>' :
			(hideIfNoPrevNext ? '' : '<a class="ui-datepicker-next ui-corner-all ui-state-disabled"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>'));
		var currentText = this._get(inst, 'currentText');
		var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today);
		currentText = (!navigationAsDateFormat ? currentText :
			this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
		var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery.datepicker._hideDatepicker();">' + this._get(inst, 'closeText') + '</button>' : '');
		var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') +
			(this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery.datepicker._gotoToday(\'#' + inst.id + '\');"' +
			'>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : '';
		var firstDay = parseInt(this._get(inst, 'firstDay'),10);
		firstDay = (isNaN(firstDay) ? 0 : firstDay);
		var dayNames = this._get(inst, 'dayNames');
		var dayNamesShort = this._get(inst, 'dayNamesShort');
		var dayNamesMin = this._get(inst, 'dayNamesMin');
		var monthNames = this._get(inst, 'monthNames');
		var monthNamesShort = this._get(inst, 'monthNamesShort');
		var beforeShowDay = this._get(inst, 'beforeShowDay');
		var showOtherMonths = this._get(inst, 'showOtherMonths');
		var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;
		var endDate = inst.endDay ? this._daylightSavingAdjust(
			new Date(inst.endYear, inst.endMonth, inst.endDay)) : currentDate;
		var defaultDate = this._getDefaultDate(inst);
		var html = '';
		for (var row = 0; row < numMonths[0]; row++) {
			var group = '';
			for (var col = 0; col < numMonths[1]; col++) {
				var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
				var cornerClass = ' ui-corner-all';
				var calender = '';
				if (isMultiMonth) {
					calender += '<div class="ui-datepicker-group ui-datepicker-group-';
					switch (col) {
						case 0: calender += 'first'; cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break;
						case numMonths[1]-1: calender += 'last'; cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break;
						default: calender += 'middle'; cornerClass = ''; break;
					}
					calender += '">';
				}
				calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' +
					(/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') +
					(/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') +
					this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
					selectedDate, row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
					'</div><table class="ui-datepicker-calendar"><thead>' +
					'<tr>';
				var thead = '';
				for (var dow = 0; dow < 7; dow++) { // days of the week
					var day = (dow + firstDay) % 7;
					thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' +
						'<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>';
				}
				calender += thead + '</tr></thead><tbody>';
				var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
				if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth)
					inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
				var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
				var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); // calculate the number of rows to generate
				var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
				for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows
					calender += '<tr>';
					var tbody = '';
					for (var dow = 0; dow < 7; dow++) { // create date picker days
						var daySettings = (beforeShowDay ?
							beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);
						var otherMonth = (printDate.getMonth() != drawMonth);
						var unselectable = otherMonth || !daySettings[0] ||
							(minDate && printDate < minDate) || (maxDate && printDate > maxDate);
						tbody += '<td class="' +
							((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends
							(otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months
							((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key
							(defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ?
							// or defaultDate is current printedDate and defaultDate is selectedDate
							' ' + this._dayOverClass : '') + // highlight selected day
							(unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') +  // highlight unselectable days
							(otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates
							(printDate.getTime() >= currentDate.getTime() && printDate.getTime() <= endDate.getTime() ? // in current range
							' ' + this._currentClass : '') + // highlight selected day
							(printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different)
							((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title
							(unselectable ? '' : ' onclick="DP_jQuery.datepicker._selectDay(\'#' +
							inst.id + '\',' + drawMonth + ',' + drawYear + ', this);return false;"') + '>' + // actions
							(otherMonth ? (showOtherMonths ? printDate.getDate() : '&#xa0;') : // display for other months
							(unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' +
							(printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') +
							(printDate.getTime() >= currentDate.getTime() && printDate.getTime() <= endDate.getTime() ? // in current range
							' ui-state-active' : '') + // highlight selected day
							'" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display for this month
						printDate.setDate(printDate.getDate() + 1);
						printDate = this._daylightSavingAdjust(printDate);
					}
					calender += tbody + '</tr>';
				}
				drawMonth++;
				if (drawMonth > 11) {
					drawMonth = 0;
					drawYear++;
				}
				calender += '</tbody></table>' + (isMultiMonth ? '</div>' + 
							((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : '');
				group += calender;
			}
			html += group;
		}
		html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ?
			'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : '');
		inst._keyEvent = false;
		return html;
	},

	/* Generate the month and year header. */
	_generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
			selectedDate, secondary, monthNames, monthNamesShort) {
		minDate = (inst.rangeStart && minDate && selectedDate < minDate ? selectedDate : minDate);
		var changeMonth = this._get(inst, 'changeMonth');
		var changeYear = this._get(inst, 'changeYear');
		var showMonthAfterYear = this._get(inst, 'showMonthAfterYear');
		var html = '<div class="ui-datepicker-title">';
		var monthHtml = '';
		// month selection
		if (secondary || !changeMonth)
			monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + '</span> ';
		else {
			var inMinYear = (minDate && minDate.getFullYear() == drawYear);
			var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
			monthHtml += '<select class="ui-datepicker-month" ' +
				'onchange="DP_jQuery.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' +
				'onclick="DP_jQuery.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
			 	'>';
			for (var month = 0; month < 12; month++) {
				if ((!inMinYear || month >= minDate.getMonth()) &&
						(!inMaxYear || month <= maxDate.getMonth()))
					monthHtml += '<option value="' + month + '"' +
						(month == drawMonth ? ' selected="selected"' : '') +
						'>' + monthNamesShort[month] + '</option>';
			}
			monthHtml += '</select>';
		}
		if (!showMonthAfterYear)
			html += monthHtml + ((secondary || changeMonth || changeYear) && (!(changeMonth && changeYear)) ? '&#xa0;' : '');
		// year selection
		if (secondary || !changeYear)
			html += '<span class="ui-datepicker-year">' + drawYear + '</span>';
		else {
			// determine range of years to display
			var years = this._get(inst, 'yearRange').split(':');
			var year = 0;
			var endYear = 0;
			if (years.length != 2) {
				year = drawYear - 10;
				endYear = drawYear + 10;
			} else if (years[0].charAt(0) == '+' || years[0].charAt(0) == '-') {
				year = drawYear + parseInt(years[0], 10);
				endYear = drawYear + parseInt(years[1], 10);
			} else {
				year = parseInt(years[0], 10);
				endYear = parseInt(years[1], 10);
			}
			year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
			endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
			html += '<select class="ui-datepicker-year" ' +
				'onchange="DP_jQuery.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' +
				'onclick="DP_jQuery.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
				'>';
			for (; year <= endYear; year++) {
				html += '<option value="' + year + '"' +
					(year == drawYear ? ' selected="selected"' : '') +
					'>' + year + '</option>';
			}
			html += '</select>';
		}
		if (showMonthAfterYear)
			html += (secondary || changeMonth || changeYear ? '&#xa0;' : '') + monthHtml;
		html += '</div>'; // Close datepicker_header
		return html;
	},

	/* Adjust one of the date sub-fields. */
	_adjustInstDate: function(inst, offset, period) {
		var year = inst.drawYear + (period == 'Y' ? offset : 0);
		var month = inst.drawMonth + (period == 'M' ? offset : 0);
		var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) +
			(period == 'D' ? offset : 0);
		var date = this._daylightSavingAdjust(new Date(year, month, day));
		// ensure it is within the bounds set
		var minDate = this._getMinMaxDate(inst, 'min', true);
		var maxDate = this._getMinMaxDate(inst, 'max');
		date = (minDate && date < minDate ? minDate : date);
		date = (maxDate && date > maxDate ? maxDate : date);
		inst.selectedDay = date.getDate();
		inst.drawMonth = inst.selectedMonth = date.getMonth();
		inst.drawYear = inst.selectedYear = date.getFullYear();
		if (period == 'M' || period == 'Y')
			this._notifyChange(inst);
	},

	/* Notify change of month/year. */
	_notifyChange: function(inst) {
		var onChange = this._get(inst, 'onChangeMonthYear');
		if (onChange)
			onChange.apply((inst.input ? inst.input[0] : null),
				[inst.selectedYear, inst.selectedMonth + 1, inst]);
	},

	/* Determine the number of months to show. */
	_getNumberOfMonths: function(inst) {
		var numMonths = this._get(inst, 'numberOfMonths');
		return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));
	},

	/* Determine the current maximum date - ensure no time components are set - may be overridden for a range. */
	_getMinMaxDate: function(inst, minMax, checkRange) {
		var date = this._determineDate(this._get(inst, minMax + 'Date'), null);
		return (!checkRange || !inst.rangeStart ? date :
			(!date || inst.rangeStart > date ? inst.rangeStart : date));
	},

	/* Find the number of days in a given month. */
	_getDaysInMonth: function(year, month) {
		return 32 - new Date(year, month, 32).getDate();
	},

	/* Find the day of the week of the first of a month. */
	_getFirstDayOfMonth: function(year, month) {
		return new Date(year, month, 1).getDay();
	},

	/* Determines if we should allow a "next/prev" month display change. */
	_canAdjustMonth: function(inst, offset, curYear, curMonth) {
		var numMonths = this._getNumberOfMonths(inst);
		var date = this._daylightSavingAdjust(new Date(
			curYear, curMonth + (offset < 0 ? offset : numMonths[1]), 1));
		if (offset < 0)
			date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
		return this._isInRange(inst, date);
	},

	/* Is the given date in the accepted range? */
	_isInRange: function(inst, date) {
		// during range selection, use minimum of selected date and range start
		var newMinDate = (!inst.rangeStart ? null : this._daylightSavingAdjust(
			new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay)));
		newMinDate = (newMinDate && inst.rangeStart < newMinDate ? inst.rangeStart : newMinDate);
		var minDate = newMinDate || this._getMinMaxDate(inst, 'min');
		var maxDate = this._getMinMaxDate(inst, 'max');
		return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate));
	},

	/* Provide the configuration settings for formatting/parsing. */
	_getFormatConfig: function(inst) {
		var shortYearCutoff = this._get(inst, 'shortYearCutoff');
		shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
			new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
		return {shortYearCutoff: shortYearCutoff,
			dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'),
			monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')};
	},

	/* Format the given date for display. */
	_formatDate: function(inst, day, month, year) {
		if (!day) {
			inst.currentDay = inst.selectedDay;
			inst.currentMonth = inst.selectedMonth;
			inst.currentYear = inst.selectedYear;
		}
		var date = (day ? (typeof day == 'object' ? day :
			this._daylightSavingAdjust(new Date(year, month, day))) :
			this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
		return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst));
	}
});

/* jQuery extend now ignores nulls! */
function extendRemove(target, props) {
	$.extend(target, props);
	for (var name in props)
		if (props[name] == null || props[name] == undefined)
			target[name] = props[name];
	return target;
};

/* Determine whether an object is an array. */
function isArray(a) {
	return (a && (($.browser.safari && typeof a == 'object' && a.length) ||
		(a.constructor && a.constructor.toString().match(/\Array\(\)/))));
};

/* Invoke the datepicker functionality.
   @param  options  string - a command, optionally followed by additional parameters or
                    Object - settings for attaching new datepicker functionality
   @return  jQuery object */
$.fn.datepicker = function(options){

	/* Initialise the date picker. */
	if (!$.datepicker.initialized) {
		$(document).mousedown($.datepicker._checkExternalClick).
			find('body').append($.datepicker.dpDiv);
		$.datepicker.initialized = true;
	}

	var otherArgs = Array.prototype.slice.call(arguments, 1);
	if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate'))
		return $.datepicker['_' + options + 'Datepicker'].
			apply($.datepicker, [this[0]].concat(otherArgs));
	return this.each(function() {
		typeof options == 'string' ?
			$.datepicker['_' + options + 'Datepicker'].
				apply($.datepicker, [this].concat(otherArgs)) :
			$.datepicker._attachDatepicker(this, options);
	});
};

$.datepicker = new Datepicker(); // singleton instance
$.datepicker.initialized = false;
$.datepicker.uuid = new Date().getTime();
$.datepicker.version = "1.7";

// Workaround for #4055
// Add another global to avoid noConflict issues with inline event handlers
window.DP_jQuery = $;

})(jQuery);

(function($){var setDataSwitch={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"},uiDialogClasses="ui-dialog ui-widget ui-widget-content ui-corner-all ";
$.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr("title");
var self=this,options=this.options,title=options.title||this.originalTitle||"&nbsp;",titleId=$.ui.dialog.getTitleId(this.element),uiDialog=(this.uiDialog=$("<div/>")).appendTo(document.body).hide().addClass(uiDialogClasses+options.dialogClass).css({position:"absolute",overflow:"hidden",zIndex:options.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(event){(options.closeOnEscape&&event.keyCode&&event.keyCode==$.ui.keyCode.ESCAPE&&self.close(event))
}).attr({role:"dialog","aria-labelledby":titleId}).mousedown(function(event){self.moveToTop(false,event)
}),uiDialogContent=this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(uiDialog),uiDialogTitlebar=(this.uiDialogTitlebar=$("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(uiDialog),uiDialogTitlebarClose=$('<a href="#"/>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){uiDialogTitlebarClose.addClass("ui-state-hover")
},function(){uiDialogTitlebarClose.removeClass("ui-state-hover")
}).focus(function(){uiDialogTitlebarClose.addClass("ui-state-focus")
}).blur(function(){uiDialogTitlebarClose.removeClass("ui-state-focus")
}).mousedown(function(ev){ev.stopPropagation()
}).click(function(event){self.close(event);
return false
}).appendTo(uiDialogTitlebar),uiDialogTitlebarCloseText=(this.uiDialogTitlebarCloseText=$("<span/>")).addClass("ui-icon ui-icon-closethick").text(options.closeText).appendTo(uiDialogTitlebarClose),uiDialogTitle=$("<span/>").addClass("ui-dialog-title").attr("id",titleId).html(title).prependTo(uiDialogTitlebar);
uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();
(options.draggable&&$.fn.draggable&&this._makeDraggable());
(options.resizable&&$.fn.resizable&&this._makeResizable());
this._createButtons(options.buttons);
this._isOpen=false;
(options.bgiframe&&$.fn.bgiframe&&uiDialog.bgiframe());
(options.autoOpen&&this.open())
},destroy:function(){(this.overlay&&this.overlay.destroy());
this.uiDialog.hide();
this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");
this.uiDialog.remove();
(this.originalTitle&&this.element.attr("title",this.originalTitle))
},close:function(event){var self=this;
if(false===self._trigger("beforeclose",event)){return 
}(self.overlay&&self.overlay.destroy());
self.uiDialog.unbind("keypress.ui-dialog");
(self.options.hide?self.uiDialog.hide(self.options.hide,function(){self._trigger("close",event)
}):self.uiDialog.hide()&&self._trigger("close",event));
$.ui.dialog.overlay.resize();
self._isOpen=false
},isOpen:function(){return this._isOpen
},moveToTop:function(force,event){if((this.options.modal&&!force)||(!this.options.stack&&!this.options.modal)){return this._trigger("focus",event)
}if(this.options.zIndex>$.ui.dialog.maxZ){$.ui.dialog.maxZ=this.options.zIndex
}(this.overlay&&this.overlay.$el.css("z-index",$.ui.dialog.overlay.maxZ=++$.ui.dialog.maxZ));
var saveScroll={scrollTop:this.element.attr("scrollTop"),scrollLeft:this.element.attr("scrollLeft")};
this.uiDialog.css("z-index",++$.ui.dialog.maxZ);
this.element.attr(saveScroll);
this._trigger("focus",event)
},open:function(){if(this._isOpen){return 
}var options=this.options,uiDialog=this.uiDialog;
this.overlay=options.modal?new $.ui.dialog.overlay(this):null;
(uiDialog.next().length&&uiDialog.appendTo("body"));
this._size();
this._position(options.position);
uiDialog.show(options.show);
this.moveToTop(true);
(options.modal&&uiDialog.bind("keypress.ui-dialog",function(event){if(event.keyCode!=$.ui.keyCode.TAB){return 
}var tabbables=$(":tabbable",this),first=tabbables.filter(":first")[0],last=tabbables.filter(":last")[0];
if(event.target==last&&!event.shiftKey){setTimeout(function(){first.focus()
},1)
}else{if(event.target==first&&event.shiftKey){setTimeout(function(){last.focus()
},1)
}}}));
$([]).add(uiDialog.find(".ui-dialog-content :tabbable:first")).add(uiDialog.find(".ui-dialog-buttonpane :tabbable:first")).add(uiDialog).filter(":first").focus();
this._trigger("open");
this._isOpen=true
},_createButtons:function(buttons){var self=this,hasButtons=false,uiDialogButtonPane=$("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");
this.uiDialog.find(".ui-dialog-buttonpane").remove();
(typeof buttons=="object"&&buttons!==null&&$.each(buttons,function(){return !(hasButtons=true)
}));
if(hasButtons){$.each(buttons,function(name,fn){$('<button type="button"></button>').addClass("ui-state-default ui-corner-all").text(name).click(function(){fn.apply(self.element[0],arguments)
}).hover(function(){$(this).addClass("ui-state-hover")
},function(){$(this).removeClass("ui-state-hover")
}).focus(function(){$(this).addClass("ui-state-focus")
}).blur(function(){$(this).removeClass("ui-state-focus")
}).appendTo(uiDialogButtonPane)
});
uiDialogButtonPane.appendTo(this.uiDialog)
}},_makeDraggable:function(){var self=this,options=this.options,heightBeforeDrag;
this.uiDialog.draggable({cancel:".ui-dialog-content",handle:".ui-dialog-titlebar",containment:"document",start:function(){heightBeforeDrag=options.height;
$(this).height($(this).height()).addClass("ui-dialog-dragging");
(options.dragStart&&options.dragStart.apply(self.element[0],arguments))
},drag:function(){(options.drag&&options.drag.apply(self.element[0],arguments))
},stop:function(){$(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);
(options.dragStop&&options.dragStop.apply(self.element[0],arguments));
$.ui.dialog.overlay.resize()
}})
},_makeResizable:function(handles){handles=(handles===undefined?this.options.resizable:handles);
var self=this,options=this.options,resizeHandles=typeof handles=="string"?handles:"n,e,s,w,se,sw,ne,nw";
this.uiDialog.resizable({cancel:".ui-dialog-content",alsoResize:this.element,maxWidth:options.maxWidth,maxHeight:options.maxHeight,minWidth:options.minWidth,minHeight:options.minHeight,start:function(){$(this).addClass("ui-dialog-resizing");
(options.resizeStart&&options.resizeStart.apply(self.element[0],arguments))
},resize:function(){(options.resize&&options.resize.apply(self.element[0],arguments))
},handles:resizeHandles,stop:function(){$(this).removeClass("ui-dialog-resizing");
options.height=$(this).height();
options.width=$(this).width();
(options.resizeStop&&options.resizeStop.apply(self.element[0],arguments));
$.ui.dialog.overlay.resize()
}}).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")
},_position:function(pos){var wnd=$(window),doc=$(document),pTop=doc.scrollTop(),pLeft=doc.scrollLeft(),minTop=pTop;
if($.inArray(pos,["center","top","right","bottom","left"])>=0){pos=[pos=="right"||pos=="left"?pos:"center",pos=="top"||pos=="bottom"?pos:"middle"]
}if(pos.constructor!=Array){pos=["center","middle"]
}if(pos[0].constructor==Number){pLeft+=pos[0]
}else{switch(pos[0]){case"left":pLeft+=0;
break;
case"right":pLeft+=wnd.width()-this.uiDialog.outerWidth();
break;
default:case"center":pLeft+=(wnd.width()-this.uiDialog.outerWidth())/2
}}if(pos[1].constructor==Number){pTop+=pos[1]
}else{switch(pos[1]){case"top":pTop+=0;
break;
case"bottom":pTop+=wnd.height()-this.uiDialog.outerHeight();
break;
default:case"middle":pTop+=(wnd.height()-this.uiDialog.outerHeight())/2
}}pTop=Math.max(pTop,minTop);
this.uiDialog.css({top:pTop,left:pLeft})
},_setData:function(key,value){(setDataSwitch[key]&&this.uiDialog.data(setDataSwitch[key],value));
switch(key){case"buttons":this._createButtons(value);
break;
case"closeText":this.uiDialogTitlebarCloseText.text(value);
break;
case"dialogClass":this.uiDialog.removeClass(this.options.dialogClass).addClass(uiDialogClasses+value);
break;
case"draggable":(value?this._makeDraggable():this.uiDialog.draggable("destroy"));
break;
case"height":this.uiDialog.height(value);
break;
case"position":this._position(value);
break;
case"resizable":var uiDialog=this.uiDialog,isResizable=this.uiDialog.is(":data(resizable)");
(isResizable&&!value&&uiDialog.resizable("destroy"));
(isResizable&&typeof value=="string"&&uiDialog.resizable("option","handles",value));
(isResizable||this._makeResizable(value));
break;
case"title":$(".ui-dialog-title",this.uiDialogTitlebar).html(value||"&nbsp;");
break;
case"width":this.uiDialog.width(value);
break
}$.widget.prototype._setData.apply(this,arguments)
},_size:function(){var options=this.options;
this.element.css({height:0,minHeight:0,width:"auto"});
var nonContentHeight=this.uiDialog.css({height:"auto",width:options.width}).height();
this.element.css({minHeight:Math.max(options.minHeight-nonContentHeight,0),height:options.height=="auto"?"auto":Math.max(options.height-nonContentHeight,0)})
}});
$.extend($.ui.dialog,{version:"1.7",defaults:{autoOpen:true,bgiframe:false,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:"center",resizable:true,show:null,stack:true,title:"",width:300,zIndex:1000},getter:"isOpen",uuid:0,maxZ:0,getTitleId:function($el){return"ui-dialog-title-"+($el.attr("id")||++this.uuid)
},overlay:function(dialog){this.$el=$.ui.dialog.overlay.create(dialog)
}});
$.extend($.ui.dialog.overlay,{instances:[],maxZ:0,events:$.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(event){return event+".dialog-overlay"
}).join(" "),create:function(dialog){if(this.instances.length===0){setTimeout(function(){$(document).bind($.ui.dialog.overlay.events,function(event){var dialogZ=$(event.target).parents(".ui-dialog").css("zIndex")||0;
return(dialogZ>$.ui.dialog.overlay.maxZ)
})
},1);
$(document).bind("keydown.dialog-overlay",function(event){(dialog.options.closeOnEscape&&event.keyCode&&event.keyCode==$.ui.keyCode.ESCAPE&&dialog.close(event))
});
$(window).bind("resize.dialog-overlay",$.ui.dialog.overlay.resize)
}var $el=$("<div></div>").appendTo(document.body).addClass("ui-widget-overlay").css({width:this.width(),height:this.height()});
(dialog.options.bgiframe&&$.fn.bgiframe&&$el.bgiframe());
this.instances.push($el);
return $el
},destroy:function($el){this.instances.splice($.inArray(this.instances,$el),1);
if(this.instances.length===0){$([document,window]).unbind(".dialog-overlay")
}$el.remove()
},height:function(){if($.browser.msie&&$.browser.version<7){var scrollHeight=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);
var offsetHeight=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);
if(scrollHeight<offsetHeight){return $(window).height()+"px"
}else{return scrollHeight+"px"
}}else{return $(document).height()+"px"
}},width:function(){if($.browser.msie&&$.browser.version<7){var scrollWidth=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);
var offsetWidth=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);
if(scrollWidth<offsetWidth){return $(window).width()+"px"
}else{return scrollWidth+"px"
}}else{return $(document).width()+"px"
}},resize:function(){var $overlays=$([]);
$.each($.ui.dialog.overlay.instances,function(){$overlays=$overlays.add(this)
});
$overlays.css({width:0,height:0}).css({width:$.ui.dialog.overlay.width(),height:$.ui.dialog.overlay.height()})
}});
$.extend($.ui.dialog.overlay.prototype,{destroy:function(){$.ui.dialog.overlay.destroy(this.$el)
}})
})(jQuery);
(function($){$.fn.predictiveText=function(options){var defaults={data:VAIL.data.autocompleteList,searchUrl:"",trigger:"",onEnter:function(){},callback:function(){}};
var options=$.extend(defaults,options);
function closeLayer(){$("#autocompleteLayer li").removeClass("selected");
$("#autocompleteLayer").hide();
layerVisible=false;
$currentControl=null
}function updateLayer(list){$("#autocompleteLayer li").hide();
$.each(list,function(key,value){$("#autocompleteLayer li").eq(value).show()
})
}function filterList(str){var list=[];
$.each(options.data,function(key,value){if(value.substr(0,str.length).toLowerCase()==str.toLowerCase()){list.push(key)
}});
return list
}function getTarget(e){var targ;
if(!e){var e=window.event
}if(e.target){targ=e.target
}else{if(e.srcElement){targ=e.srcElement
}}if(targ.nodeType==3){targ=targ.parentNode
}return targ
}function getKeyCode(e){var code;
if(!e){var e=window.event
}if(e.keyCode){code=e.keyCode
}else{if(e.which){code=e.which
}}return code
}function setValue(s,e){s.val(e.find("a").html())
}var $currentControl=null;
var layerVisible=false;
$("body").append("<div id='autocompleteLayer'><ul></ul></div>");
$.each(options.data,function(key,val){$("<li><a href='javascript: void(0)'>"+val+"</a></li>").appendTo("#autocompleteLayer ul")
});
$(document).click(function(e){if($currentControl==null||getTarget(e)!=$currentControl[0]){closeLayer()
}});
$("#autocompleteLayer a").click(function(){if($currentControl!=null){$currentControl.val($(this).text())
}});
return this.each(function(){$(this).attr("autocomplete","off");
$(this).bind("keydown",function(e){var code=getKeyCode(e);
if(code==13){e.preventDefault();
return false
}});
$(this).bind("keyup",function(e){e.preventDefault();
$currentControl=$(this);
var code=getKeyCode(e);
var key_LEFT=37;
var key_UP=38;
var key_RIGHT=39;
var key_DOWN=40;
var key_ENTER=13;
var key_ESCAPE=27;
if(code!=37&&code!=39){if(!layerVisible){if(code!=38&&code!=40){if(code==key_ENTER){options.onEnter($(this).val());
if($.trim($(this).val()).length>0){if(typeof options.trigger=="string"){$(options.trigger).trigger("click")
}else{options.trigger()
}}}else{if($.trim($currentControl.val()).length>0){var itemList=filterList($currentControl.val());
if(itemList.length>0){updateLayer(itemList);
var top=$currentControl.offset().top+$currentControl.outerHeight()+"px";
var left=$currentControl.offset().left+"px";
var width=$currentControl.outerWidth()+"px";
$("#autocompleteLayer").css({top:top,left:left,width:width}).show();
layerVisible=true
}else{closeLayer()
}}else{closeLayer()
}}}}else{if(layerVisible){var items=$("#autocompleteLayer li:visible");
var selectedItem=items.parents("ul").find(".selected");
var idx=items.index(selectedItem[0]);
switch(code){case key_UP:items.removeClass("selected");
if(--idx<0){items.eq(0).addClass("selected")
}else{items.eq(idx).addClass("selected")
}break;
case key_DOWN:items.removeClass("selected");
if(++idx>items.length-1){items.eq(items.length-1).addClass("selected")
}else{items.eq(idx).addClass("selected")
}break;
case key_ENTER:if(idx>-1){$currentControl.val(selectedItem.find("a").text());
closeLayer()
}else{closeLayer();
options.onEnter($(this).val());
if($.trim($(this).val()).length>0){if(typeof options.trigger=="string"){$(options.trigger).trigger("click")
}else{options.trigger()
}}}break;
case key_ESCAPE:closeLayer();
break;
default:if($.trim($currentControl.val()).length>0){var itemList=filterList($currentControl.val());
if(itemList.length>0){updateLayer(itemList)
}else{closeLayer()
}}else{closeLayer()
}break
}}}}options.callback(code,String.fromCharCode(code))
})
})
}
})(jQuery);
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))
};
if(!"".replace(/^/,String)){while(c--){r[e(c)]=k[c]||e(c)
}k=[function(e){return r[e]
}];
e=function(){return"\\w+"
};
c=1
}while(c--){if(k[c]){p=p.replace(new RegExp("\\b"+e(c)+"\\b","g"),k[c])
}}return p
}("(4($){$.2l({z:{2k:0}});$.1P.z=4(x,w){3(O x=='2Y')w=x;w=$.2l({K:(x&&O x=='1Z'&&x>0)?--x:0,12:C,J:$.1f?2h:T,18:T,1r:'2X&#2Q;',21:'18-2F-',1m:C,1u:C,1l:C,1F:C,1x:'2u',2r:C,2p:C,2m:T,2i:C,1d:C,1c:C,1j:'z-1M',H:'z-2b',14:'z-12',16:'z-26',1q:'z-1H',1L:'z-2L',2j:'10'},w||{});$.8.1D=$.8.U&&($.8.1Y&&$.8.1Y<7||/2A 6.0/.2y(2x.2w));4 1w(){1V(0,0)}F 5.Y(4(){2 p=5;2 r=$('13.'+w.1j,p);r=r.V()&&r||$('>13:9(0)',p);2 j=$('a',r);3(w.18){j.Y(4(){2 c=w.21+(++$.z.2k),B='#'+c,2f=5.1O;5.1O=B;$('<10 S=\"'+c+'\" 34=\"'+w.16+'\"></10>').2c(p);$(5).19('1B',4(e,a){2 b=$(5).I(w.1L),X=$('X',5)[0],27=X.1J;3(w.1r){X.1J='<24>'+w.1r+'</24>'}1p(4(){$(B).2T(2f,4(){3(w.1r){X.1J=27}b.17(w.1L);a&&a()})},0)})})}2 n=$('10.'+w.16,p);n=n.V()&&n||$('>'+w.2j,p);r.P('.'+w.1j)||r.I(w.1j);n.Y(4(){2 a=$(5);a.P('.'+w.16)||a.I(w.16)});2 s=$('A',r).20($('A.'+w.H,r)[0]);3(s>=0){w.K=s}3(1e.B){j.Y(4(i){3(5.B==1e.B){w.K=i;3(($.8.U||$.8.2E)&&!w.18){2 a=$(1e.B);2 b=a.15('S');a.15('S','');1p(4(){a.15('S',b)},2D)}1w();F T}})}3($.8.U){1w()}n.1a(':9('+w.K+')').1C().1n().2C(':9('+w.K+')').I(w.1q);$('A',r).17(w.H).9(w.K).I(w.H);j.9(w.K).N('1B').1n();3(w.2m){2 l=4(d){2 c=$.2B(n.1t(),4(a){2 h,1A=$(a);3(d){3($.8.1D){a.Z.2z('1X');a.Z.G='';a.1k=C}h=1A.L({'1h-G':''}).G()}E{h=1A.G()}F h}).2v(4(a,b){F b-a});3($.8.1D){n.Y(4(){5.1k=c[0]+'1W';5.Z.2t('1X','5.Z.G = 5.1k ? 5.1k : \"2s\"')})}E{n.L({'1h-G':c[0]+'1W'})}};l();2 q=p.1U;2 m=p.1v;2 v=$('#z-2q-2o-V').1t(0)||$('<X S=\"z-2q-2o-V\">M</X>').L({1T:'2n',3a:'39',38:'37'}).2c(Q.1S).1t(0);2 o=v.1v;36(4(){2 b=p.1U;2 a=p.1v;2 c=v.1v;3(a>m||b!=q||c!=o){l((b>q||c<o));q=b;m=a;o=c}},35)}2 u={},11={},1R=w.2r||w.1x,1Q=w.2p||w.1x;3(w.1u||w.1m){3(w.1u){u['G']='1C';11['G']='1H'}3(w.1m){u['W']='1C';11['W']='1H'}}E{3(w.1l){u=w.1l}E{u['1h-2g']=0;1R=1}3(w.1F){11=w.1F}E{11['1h-2g']=0;1Q=1}}2 t=w.2i,1d=w.1d,1c=w.1c;j.19('2e',4(){2 c=$(5).1g('A:9(0)');3(p.1i||c.P('.'+w.H)||c.P('.'+w.14)){F T}2 a=5.B;3($.8.U){$(5).N('1b');3(w.J){$.1f.1N(a);1e.B=a.1z('#','')}}E 3($.8.1y){2 b=$('<2d 33=\"'+a+'\"><10><32 31=\"2a\" 30=\"h\" /></10></2d>').1t(0);b.2a();$(5).N('1b');3(w.J){$.1f.1N(a)}}E{3(w.J){1e.B=a.1z('#','')}E{$(5).N('1b')}}});j.19('1E',4(){2 a=$(5).1g('A:9(0)');3($.8.1y){a.1o({W:0},1,4(){a.L({W:''})})}a.I(w.14)});3(w.12&&w.12.1K){29(2 i=0,k=w.12.1K;i<k;i++){j.9(--w.12[i]).N('1E').1n()}};j.19('28',4(){2 a=$(5).1g('A:9(0)');a.17(w.14);3($.8.1y){a.1o({W:1},1,4(){a.L({W:''})})}});j.19('1b',4(e){2 g=e.2Z;2 d=5,A=$(5).1g('A:9(0)'),D=$(5.B),R=n.1a(':2W');3(p['1i']||A.P('.'+w.H)||A.P('.'+w.14)||O t=='4'&&t(5,D[0],R[0])===T){5.25();F T}p['1i']=2h;3(D.V()){3($.8.U&&w.J){2 c=5.B.1z('#','');D.15('S','');1p(4(){D.15('S',c)},0)}2 f={1T:'',2V:'',G:''};3(!$.8.U){f['W']=''}4 1I(){3(w.J&&g){$.1f.1N(d.B)}R.1o(11,1Q,4(){$(d).1g('A:9(0)').I(w.H).2U().17(w.H);R.I(w.1q).L(f);3(O 1d=='4'){1d(d,D[0],R[0])}3(!(w.1u||w.1m||w.1l)){D.L('1T','2n')}D.1o(u,1R,4(){D.17(w.1q).L(f);3($.8.U){R[0].Z.1a='';D[0].Z.1a=''}3(O 1c=='4'){1c(d,D[0],R[0])}p['1i']=C})})}3(!w.18){1I()}E{$(d).N('1B',[1I])}}E{2S('2R P 2P 2O 26.')}2 a=1G.2N||Q.1s&&Q.1s.23||Q.1S.23||0;2 b=1G.2M||Q.1s&&Q.1s.22||Q.1S.22||0;1p(4(){1G.1V(a,b)},0);5.25();F w.J&&!!g});3(w.J){$.1f.2K(4(){j.9(w.K).N('1b').1n()})}})};2 y=['2e','1E','28'];29(2 i=0;i<y.1K;i++){$.1P[y[i]]=(4(d){F 4(c){F 5.Y(4(){2 b=$('13.z-1M',5);b=b.V()&&b||$('>13:9(0)',5);2 a;3(!c||O c=='1Z'){a=$('A a',b).9((c&&c>0&&c-1||0))}E 3(O c=='2J'){a=$('A a[@1O$=\"#'+c+'\"]',b)}a.N(d)})}})(y[i])}$.1P.2I=4(){2 c=[];5.Y(4(){2 a=$('13.z-1M',5);a=a.V()&&a||$('>13:9(0)',5);2 b=$('A',a);c.2H(b.20(b.1a('.z-2b')[0])+1)});F c[0]}})(2G);",62,197,"||var|if|function|this|||browser|eq||||||||||||||||||||||||||tabs|li|hash|null|toShow|else|return|height|selectedClass|addClass|bookmarkable|initial|css||trigger|typeof|is|document|toHide|id|false|msie|size|opacity|span|each|style|div|hideAnim|disabled|ul|disabledClass|attr|containerClass|removeClass|remote|bind|filter|click|onShow|onHide|location|ajaxHistory|parents|min|locked|navClass|minHeight|fxShow|fxFade|end|animate|setTimeout|hideClass|spinner|documentElement|get|fxSlide|offsetHeight|unFocus|fxSpeed|safari|replace|jq|loadRemoteTab|show|msie6|disableTab|fxHide|window|hide|switchTab|innerHTML|length|loadingClass|nav|update|href|fn|hideSpeed|showSpeed|body|display|offsetWidth|scrollTo|px|behaviour|version|number|index|hashPrefix|scrollTop|scrollLeft|em|blur|container|tabTitle|enableTab|for|submit|selected|appendTo|form|triggerTab|url|width|true|onClick|tabStruct|remoteCount|extend|fxAutoHeight|block|font|fxHideSpeed|watch|fxShowSpeed|1px|setExpression|normal|sort|userAgent|navigator|test|removeExpression|MSIE|map|not|500|opera|tab|jQuery|push|activeTab|string|initialize|loading|pageYOffset|pageXOffset|such|no|8230|There|alert|load|siblings|overflow|visible|Loading|object|clientX|value|type|input|action|class|50|setInterval|hidden|visibility|absolute|position".split("|"),0,{}));
﻿/* Globals
=========================================================================================== */

// Vail namespace to safely hold any global config/logging/functions/etc.
var VAIL = 
{
    proxy: '/VailResorts/HttpHandlers/GenericProxy.ashx',
    feeds: 
	{
        vri: 'http://common.snow.com/adminincludes/rtp.resorts.vri.xml.asp',
        videos: 'http://link.brightcove.com/services/link/bcpid1726689763?action=mrss',
        heavenly: '/vailresorts/sites/snow/layouts/weatherfeed.aspx?days=6&lat=38.934787&long=-119.940384',
        terrainStatus: 
		{
            beavercreek: '/VailResorts/HttpHandlers/GenericProxy.ashx?url=http://common.snow.com/adminincludes/groomingReportXml.asp?siteid=2',
            breckenridge: '/VailResorts/HttpHandlers/GenericProxy.ashx?url=http://common.snow.com/adminincludes/groomingReportXml.asp?siteid=4',
            heavenly: '/VailResorts/HttpHandlers/GenericProxy.ashx?url=http://common.snow.com/adminincludes/groomingReportXml.asp?siteid=50',
            keystone: '/VailResorts/HttpHandlers/GenericProxy.ashx?url=http://common.snow.com/adminincludes/groomingReportXml.asp?siteid=3',
            vail: '/VailResorts/HttpHandlers/GenericProxy.ashx?url=http://common.snow.com/adminincludes/groomingReportXml.asp?siteid=1',
            keystoneterrain: '/VailResorts/HttpHandlers/GenericProxy.ashx?url=http://common.snow.com/adminincludes/rtp.resorts.vri.xml.asp'
        }
    },
    data: {
        brightcove: 
		{
            weather: 
			{
                vail: { playerId: '1745088821', lineupId: '471470177' },
                beavercreek: { playerId: '1745088821', lineupId: '1134010055' },
                breckenridge: { playerId: '1745088821', lineupId: '483267790' },
                keystone: { playerId: '1745088821', lineupId: '483623200' },
                heavenly: { playerId: '1745088821', lineupId: '1419760633' }
            }
        },
        autocompleteList: ["colorado vacations", "colorado transportation", "colorado vacation", "colorado vacations", "colorado web cams", "colorado webcams", "cross country skiing", "colorado cams", "colorado lift ticket deals", "colorado lodge", "colorado mountain transportation", "colorado resorts", "colorado season ski pass", "colorado ski", "colorado ski areas", "colorado ski packages", "colorado ski pass", "colorado ski passes", "colorado ski resort", "colorado ski resorts", "colorado skiing", "colorado snow", "colorado snow report", "downhill skiing", "daily lift ticket prices", "first snow", "fish and ski", "freestyle skiing", "group ski holidays", "group skiing holidays", "lift ticket discounts", "lift ticket prices", "lift tickets", "mountain snow", "package deals", "breckenridge", "pictures of snow", "resort", "resort skiing", "season ski pass", "ski", "ski accessories", "ski apparel", "resorts", "ski areas", "ski clothing", "ski colorado", "ski conditions", "ski conditions colorado", "ski equipment", "ski freestyle", "ski gear", "ski holidays child care", "ski jump", "ski jumping", "ski lift", "ski lift ticket discounts", "ski lift tickets", "ski lodges", "ski packages", "ski packages in breckenridge", "ski passes", "ski rentals", "ski reports", "ski resort pictures", "ski resorts", "ski resorts in colorado", "ski school", "ski shops"],
        weatherConditions: { // class_name: transformed weather conditions from xml as array
            cloud_light: ['partlycloudy', 'partlycloudywithhaze', 'partlycloudyandbreezy', 'cloudy'],
            cloud_dark: ['mostlycloudy', 'overcast', 'overcastwithhaze', 'overcastandbreezy'],
            sun: ['sunny', 'starrynight', 'mostlysunny', 'fair', 'clear', 'fairwithhaze', 'clearwithhaze', 'fairandbreezy', 'clearandbreezy'],
            sun_cloud_light: ['partlycloudy', 'afewclouds', 'afewcloudswithhaze', 'afewcloudsandbreezy'],
            sun_cloud_dark: ['mostlycloudy', 'mostlycloudywithhaze', 'mostlycloudyandbreezy', 'increasingclouds'],
            fog: ['fogmist', 'fog', 'freezingfog', 'shallowfog', 'partialfog', 'patchesoffog', 'foginvicinity', 'freezingfoginvicinity', 'shallowfoginvicinity', 'partialfoginvicinity', 'patchesoffoginvicinity', 'showersinvicinityfog', 'lightfreezingfog', 'heavyfreezingfog', 'smoke',
'dust', 'lowdriftingdust| blowingdust', 'sand', 'blowingsand', 'lowdriftingsand', 'dustsand whirls', 'dustsandwhirlsinvicinity', 'duststorm', 'heavyduststorm ', 'duststorminvicinity', 'sandstorm', 'heavysandstorm', 'sandstorm invicinity', 'haze'],
            wind: ['windy', 'breezy', 'fairandwindy', 'afewcloudsandwindy', 'partlycloudyandwindy', 'mostlycloudyandwindy', 'overcastandwindy'],
            rain: ['thunderstorms', 'scatteredshowers', 'rainshowers', 'rain', 'isolatedthunderstorms', 'rainshowers', 'lightrainshowers', 'lightrainandbreezy', 'heavyrainshowers', 'rainshowersinvicinity', 'lightshowersrain', 'heavyshowersrain', 'showersrain', 'showersraininvicinity', 'rainshowersfogmist', 'lightrainshowersfogmist', 'heavyrainshowersfogmist', 'rainshowersinvicinityfogmist', 'lightshowersrainfogmist', 'heavyshowersrainfogmist', 'showersrainfogmist', 'showersraininvicinityfogmist', 'thunderstorm', 'thunderstormrain', 'lightthunderstormrain', 'heavythunderstormrain', 'thunderstormrainfogmist', 'lightthunderstormrainfogmist', 'heavythunderstormrainfogandwindy', 'heavythunderstormrainfogmist', 'thunderstormshowersinvicinity', 'lightthunderstormrainhaze', 'heavythunderstormrainhaze', 'thunderstormfog', 'lightthunderstormrainfog', 'heavythunderstormrainfog', 'thunderstormlightrain', 'thunderstormheavyrain', 'thunderstormrainfogmist', 'thunderstormlightrainfogmist', 'thunderstormheavyrainfogmist', 'thunderstorminvicinityfogmist', 'thunderstormshowersinvicinity', 'thunderstorminvicinityhaze', 'thunderstormhazeinvicinity', 'thunderstormlightrainhaze', 'thunderstormheavyrainhaze', 'thunderstormfog', 'thunderstormlightrainfog', 'thunderstormheavyrainfog', 'thunderstormhail', 'lightthunderstormrainhail', 'heavythunderstormrainhail', 'thunderstormrainhailfogmist', 'lightthunderstormrainhailfogmist', 'heavythunderstormrainhailfoghail', 'thunderstormshowersinvicinityhail', 'lightthunderstormrainhailhaze', 'heavythunderstormrainhailhaze', 'thunderstormhailfog', 'lightthunderstormrainhailfog', 'heavythunderstormrainhailfog', 'thunderstormlightrainhail', 'thunderstormheavyrainhail', 'thunderstormrainhailfogmist', 'thunderstormlightrainhailfogmist', 'thunderstormheavyrainhailfogmist', 'thunderstorminvicinityhail', 'thunderstorminvicinityhailhaze', 'thunderstormhazeinvicinityhail', 'thunderstormlightrainhailhaze', 'thunderstormheavyrainhailhaze', 'thunderstormhailfog', 'thunderstormlightrainhailfog', 'thunderstormheavyrainhailfog', 'thunderstormsmallhailsnowpellets', 'thunderstormrainsmallhailsnowpellets', 'lightthunderstormrainsmallhailsnowpellets', 'heavythunderstormrainsmallhailsnowpellets', 'showersinvicinity', 'showersinvicinityfogmist', 'showersinvicinityfog', 'showersinvicinityhaze', 'thunderstorminvicinity', 'thunderstorminvicinityfog', 'thunderstorminvicinityhaze', 'lightrain', 'drizzle', 'lightdrizzle', 'heavydrizzle', 'lightrainfogmist', 'drizzlefogmist', 'lightdrizzlefogmist', 'heavydrizzlefogmist', 'lightrainfog', 'drizzlefog', 'lightdrizzlefog', 'heavydrizzlefog', 'rain', 'heavyrain', 'rainfogmist', 'heavyrainfogmist', 'rainfog', 'heavyrainfog'],
            rain_snow_light: ['freezingrain', 'freezingdrizzle', 'lightfreezingrain', 'lightfreezingdrizzle', 'heavyfreezingrain', 'heavyfreezingdrizzle', 'freezingraininvicinity', 'freezingdrizzleinvicinity', 'icepellets', 'lighticepellets', 'heavyicepellets', 'icepelletsinvicinity', 'showersicepellets', 'thunderstormicepellets', 'icecrystals', 'hail', 'smallhailsnowpellets', 'lightsmallhailsnowpellets', 'heavysmallhailsnowpellets', 'showershail', 'hailshowers', 'rainicepellets', 'lightrainicepellets', 'heavyrainicepellets', 'drizzleicepellets', 'lightdrizzleicepellets', 'heavydrizzleicepellets', 'icepelletsrain', 'lighticepelletsrain', 'heavyicepelletsrain', 'icepelletsdrizzle', 'lighticepelletsdrizzle', 'heavyicepelletsdrizzle', 'freezingrainrain', 'lightfreezingrainrain', 'heavyfreezingrainrain', 'rainfreezingrain', 'lightrainfreezingrain', 'heavyrainfreezingrain', 'freezingdrizzlerain', 'lightfreezingdrizzlerain', 'heavyfreezingdrizzlerain', 'rainfreezingdrizzle', 'lightrainfreezingdrizzle', 'heavyrainfreezingdrizzle'],
            rain_snow_heavy: ['freezingrainsnow', 'lightfreezingrainsnow', 'heavyfreezingrainsnow', 'freezingdrizzlesnow', 'lightfreezingdrizzlesnow', 'heavyfreezingdrizzlesnow', 'snowfreezingrain', 'lightsnowfreezingrain', 'heavysnowfreezingrain', 'snowfreezingdrizzle', 'lightsnowfreezingdrizzle', 'heavysnowfreezingdrizzle', 'rainsnow', 'lightrainsnow', 'heavyrainsnow', 'snowrain', 'lightsnowrain', 'heavysnowrain', 'drizzlesnow', 'lightdrizzlesnow', 'heavydrizzlesnow', 'snowdrizzle', 'lightsnowdrizzle', 'heavydrizzlesnow', 'funnelcloud', 'funnelcloudinvicinity', 'tornadowaterspout'],
            snow: ['isolatedsnowshowers', 'heavysnow', 'snow', 'lightsnow', 'heavysnow', 'snowshowers', 'lightsnowshowers', 'heavysnowshowers', 'showerssnow', 'lightshowerssnow', 'heavyshowerssnow', 'snowfogmist', 'lightsnowfogmist', 'heavysnowfogmist', 'snowshowersfogmist', 'lightsnowshowersfogmist', 'heavysnowshowersfogmist', 'showerssnowfogmist', 'lightshowerssnowfogmist', 'heavyshowerssnowfogmist', 'snowfog', 'lightsnowfog', 'heavysnowfog', 'snowshowersfog', 'lightsnowshowersfog', 'heavysnowshowersfog', 'showerssnowfog', 'lightshowerssnowfog', 'heavyshowerssnowfog', 'showersinvicinitysnow', 'snowshowersinvicinity', 'snowshowersinvicinityfogmist', 'snowshowersinvicinityfog', 'lowdriftingsnow', 'blowingsnow', 'snowlowdriftingsnow', 'snowblowingsnow', 'lightsnowlowdriftingsnow', 'lightsnowblowingsnow', 'lightsnowblowingsnowfogmist', 'heavysnowlowdriftingsnow', 'heavysnowblowingsnow', 'thunderstormsnow', 'lightthunderstormsnow', 'heavythunderstormsnow', 'snowgrains', 'lightsnowgrains', 'heavysnowgrains', 'heavyblowingsnow', 'blowingsnowinvicinity']
        }
    },
    fn: 
	{
        getWeatherClass: function(weatherCondition) 
		{
            weatherCondition = weatherCondition.toLowerCase().replace(/\W*/g, '');
            weatherCondition = weatherCondition.replace('chance', '');
            weatherCondition = weatherCondition.replace('likely', '');
            weatherCondition = weatherCondition.replace('slight', '');
            for (prop in VAIL.data.weatherConditions) if (VAIL.data.weatherConditions.hasOwnProperty(prop)) 
			{
                if (VAIL.data.weatherConditions[prop].indexOf(weatherCondition) !== -1) { return prop; }
            }
            return '';
        }
    },
    debug: false,
    errors: []
};

// Button init needs to be available in the global namespace
var buttonInit;

// Error alert suppression
//window.onerror = VAIL.debug ? window.onerror : function() { return true; };

/* Functions
=========================================================================================== */

/*
* The function will parse the querystring passed in paramter
* Returns: The array of name value pair for query string passed as paramerter
*/
function parseQuery(query) 
{
    var Params = new Object();
    if (!query) return Params; // return empty object
    var Pairs = query.split(/[;&]/);
    for (var i = 0; i < Pairs.length; i++) 
	{
        var KeyVal = Pairs[i].split('=');
        if (!KeyVal || KeyVal.length != 2) continue;
        var key = unescape(KeyVal[0]);
        var val = unescape(KeyVal[1]);
        val = val.replace(/\+/g, ' ');
        Params[key] = val;
    }
    return Params;
}

/*
* This function formats the date coming from the XML into ISO format to be displayed
*/
function ISOtoDate(ISO) 
{
    ISO = ISO.split('T');
    ISO = ISO[0].split('-').concat(ISO[1] ? ISO[1].split(':') : [0, 0, 0]);
    return new Date(ISO[0], ISO[1], ISO[2], ISO[3], ISO[4], ISO[5]);
}


/* Manu - Following 2 functions are for dynamic height of iframe modal */
function adjustIframeModalHeight(el){
    if ( $(".modalWindow").length > 0 || $(".modalDialog").length > 0 ){
        var height = $("body").height();
        window.parent.setIframeModalHeight( el, height );
        
        height = $("body").height();
        window.parent.setIframeModalHeight( el, height );
    }
}
function setIframeModalHeight(el, height){
    $(el).height(height);
}

//To increase or decrease the height to iframe as per needed.
function autoAdjustIframeModalHeight(){
    if ( $(".modalWindow").length > 0 || $(".modalDialog").length > 0 ){
		var height = $("body").height();
		try { window.parent.setAllIframeModalHeight( height ); } catch (e){}
		
        $(window).load(function(){
            var height = $("body").height();
            try { window.parent.setAllIframeModalHeight( height ); } catch (e){}
        });
    }
}
function setAllIframeModalHeight(height){
    $("body > .ui-dialog > .ui-dialog-content:visible").each(function(){
        if ( !$(this).find("iframe").hasClass("modalNoResize") ){
            $(this).height(height);
            if ( $(this).find("iframe").length > 0 ){
                $(this).find("iframe").height(height);
            }
        }
    });
    
    //Code to increase height of overlay window to set it's background color       //according to height of modal window. Fixed artf1006628.
    if($('.ui-widget-overlay').length > 0)
    {   
        var height = getDocHeight();
        $('.ui-widget-overlay').css('height',height);
    } 
}

//Function created to get maximum document height. Fixed artf1006628.
function getDocHeight() {
    var D = document;
    return Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    );
}

function closeModalWindow( sel ){
    if ( window.parent == window ){
        try {
            $( sel ).dialog( 'close' );
        } catch (e) {}
    } else {
        try {
            window.parent.$( sel ).dialog( 'close' );
        } catch (e) {}
    }
}

function closeAllModalWindows(){
    $("body > .ui-dialog > .ui-dialog-content").each(function(){
        $(this).dialog("close");
    });
}

function pageRefresh(){
    document.location.href = document.location.href;
}
	  


/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:100};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);

// Manu - Extending the jQuery Datepicker class to fix "artf992072" && "artf992300"
$.extend(jQuery.datepicker, {
    _checkOffset: function(inst, offset, isFixed) {
	    var dpWidth = inst.dpDiv.outerWidth();
	    var dpHeight = inst.dpDiv.outerHeight();
	    var inputWidth = inst.input ? inst.input.outerWidth() : 0;
	    var inputHeight = inst.input ? inst.input.outerHeight() : 0;
	    var viewWidth = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) + $(document).scrollLeft();
	    var viewHeight = (window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight) + $(document).scrollTop();

	    offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0);
	    offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;
	    offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;

	    // now check if datepicker is showing outside window viewport - move to a better place if so.
	    offset.left -= (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? Math.abs(offset.left + dpWidth - viewWidth) : 0;
	    offset.top -= (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? Math.abs(offset.top + dpHeight + inputHeight*2 - viewHeight) : 0;

        // Manu - Manually override the vertical position to always pin the layer below the textbox
	    if ( offset.top < inst.input.offset().top + inputHeight ){
            offset.top = inst.input.offset().top - dpHeight;
        }
        
        if (offset.left + dpWidth >= viewWidth - 20) {
            offset.left = viewWidth - dpWidth - 30;
        }
	    return offset;
    }
});

function blankIframeFix(me){
    $(me).addClass("temp").removeClass("temp");
}


$(document).ready(function(){

/* Copied from snow.com DOM Ready
=========================================================================================== */
 /* image flicker fix: mister-pixel */ 
 if($.browser.msie && $.browser.version == '6.0'){
  try { 
   document.execCommand("BackgroundImageCache", false, true); 
  } catch(err) {}
}

// This code checks if session got timed out during the ajax calls. If session is expired then
// user is redirected to the error page.
$("body").ajaxComplete(function(event, request, settings) {
    if (request.responseText != null && request.responseText != undefined && request.responseText != "") {
        try {
            var result = eval('(' + request.responseText + ')');
            if (result != null && result.Message != undefined) {
                if (result.Message.toUpperCase() == 'SESSION_ERROR'.toUpperCase()) {
                    //top.location.href = "/Vailresorts/sites/global/ErrorPage.aspx?errid=SESSION_ERROR";
                }
            }
        }
        catch (e) {
            // This catch block is to absorb the exception during eval() function call.
        }
    }
});

$.ajaxSetup({
    timeout: 120000
});

    $(document).bind("keypress", function(evt){
        if (evt.keyCode == 13) {
            if( $(this).is("input[type='text']") )
                return false;
        }
    });

$("#middleTabsContainer ul.middleTabs a").bind("mouseup", function(e){
	var url = window.location.href;
    var arrHref = $(this).attr("href").split("#");
    if ( arrHref.length > 1 && arrHref[1].length > 0 ){
        window.location.replace(url.split("#")[0] + "#" + arrHref[1] + "#Top");
    }
});
$(window).load(function(){
	$("div#middleTabsContainer > ul.middleTabs > li.tabs-selected > a").triggerHandler('click');
});
if( $('#topNav ul').length > 0){
    $('#topNav ul').bgiframe(); // This will prevent z-index problems with the top menu in IE6 
}

if ( $(".modalWindow, .modalDialog").length > 0 ){
    autoAdjustIframeModalHeight();
}

/** Predictive Text Search Fixes - Start **/
if (typeof VAIL != "undefined" && $("input.searchHeaderHeav").length > 0){  
    $("input.searchHeaderHeav").predictiveText({
  	    data: VAIL.data.autocompleteList,
	    trigger:  function(){
	        if ( search_btnSubmit_onclick ){
	            search_btnSubmit_onclick();
	        }
	    },
	    onEnter: function(){
	    if($('[id$=txtSearchText]').length > 0)
	        {
	            var txtSearch = $('[id$=txtSearchText]').val();
                if (txtSearch.toLowerCase() == "search" || $.trim(txtSearch) == '') {
                    return false;
                }
            }
            
	        //var searchurl = document.location.href;
//	        var searchTerm = $('[id$=txtSearchText]').val();//$('.searchHeaderHeav').val();
//	        if( $("[id$='hdnSearchPage']").length > 0 && $.trim( $("[id$='hdnSearchPage']").eq(0).val() ).length > 0 ) {
//                window.location.href = $("[id$='hdnSearchPage']").eq(0).val() + '?searchTerm='+searchTerm+'&page=1&SearchType=AllResults';
//            }
            /*	        
	        var searchIndex = self.location.protocol + '//' + self.location.host;// + self.location.pathname;// searchurl.indexOf('?');
	        if(searchurl.indexOf('?') == '-1')
            {                        
                //searchurl = searchIndex + '?searchTerm='+searchTerm+'&page=1&SearchType=AllResults';                           
                searchurl = searchIndex + '/Search/Keyword-Search.aspx?searchTerm='+searchTerm+'&page=1&SearchType=AllResults';                           
            }
            else
            {               
                searchurl = searchIndex + '/Search/Keyword-Search.aspx?searchTerm='+searchTerm+'&page=1&SearchType=AllResults';                              
            }            
            window.location = searchurl;
            //location.reload();*/
	        

	    }
    });
}
/** Predictive Text Search Fixes - Ends **/

//code for adding 'class' on instructor profile page
if ( $('.profileDataOther').length ) $('.profileDataOther ul:first-child').addClass('first')

/*Begin:Kuldip:Footer Fix Ie6 pseudoclass issue*/
$('#footer ul > li.first:first').addClass('firstChild');
/*End:Footer Fix Ie6 pseudoclass issue*/

// Init plan trip Go and Close buttons
	$(".planYourVacationContainer .closeBtn").click(function(){
		$(this).closest(".planYourVacationContainer").addClass("hidden");
	})
	$(".#panningPanel .go").click(function(){
		$(".planYourVacationContainer").removeClass("hidden")
	})


//$("#middleTabsContainer ul.middleTabs a").bind("click", function(e){
//    document.location.href = document.location.href.split("#")[0] + $(this).attr("href");    
//});

$(".contentContainer").each(function(){
  var index = $(".contentContainer").index(this);
  if(index == 1 ){
	$(this).addClass("topDivider");
  };
  if(index == 2 ){
	$(this).addClass("shadeMode");
  };
   if(index == 3 ){
	$(this).addClass("shadeMode");
  };

})

$(".signUp input").focus(function(){
	if ($(this).attr("value")=="YOUR EMAIL ADDRESS"){
		$(this).attr("value","")
	}
}).blur(function(){
	if ($(this).attr("value")==""){
		$(this).attr("value","YOUR EMAIL ADDRESS")
	}
})
$("#accountInfoTopBar input").focus(function(){
	if ($(this).attr("value")=="SEARCH THE SITE"){
		$(this).attr("value","")
	}
}).blur(function(){
	if ($(this).attr("value")==""){
		$(this).attr("value","SEARCH THE SITE")
	}
})

//$("#middleTabsContainer ul.middleTabs a").live("mousedown", function(e){
//    document.location.href = document.location.href.split("#")[0] + $(this).attr("href");    
//});


 function mycarousel_itemFirstInCallback(carousel, item, idx, state) {}; 

// functions need to be set on DOM load (first time) [begin]
	//setSelectedThumbnail();
// functions need to be set on DOM load (first time) [end]

function mycarousel_initCallback(carousel) {
	
		carousel.options.scroll = jQuery.jcarousel.intval(3);
	$(".hmPagination").text("");		
			var noLi = $('#hmCarousel li').length;
			var requiredLi = Math.ceil(noLi/3);
			for (var i=0; i<requiredLi; i++){
				var count = i+1;
			var liSrting ="<li>" +count+ "</li>";
				$(".hmPagination").append(liSrting);
			}
			$(".hmPagination").children(":first").addClass("selected");
			$(".jcarousel-next").click(function(){
				$(".hmPagination").find("li.selected").next().addClass("selected");
				$(".hmPagination").find("li.selected:last").prev().removeClass("selected");
			})
			$(".jcarousel-prev").click(function(){
				$(".hmPagination").find("li.selected:last").prev().addClass("selected");
				$(".hmPagination li.selected").next().removeClass("selected")
				})
			
			$('.hmPagination li').each(function(){
				
				$(this).bind("click",function() {
					$('.hmPagination li').removeClass("selected");
					$(this).addClass("selected");
					var noClick =parseInt($(this).text());
					var remain = noLi%3;
					if ($(this).text()=="1"){
						carousel.scroll(jQuery.jcarousel.intval(1))
					}
					if (remain==0){
						var ulLi= $("ul.pagination li").length
						var scrollNo = ((noClick-1)*3)+1
						carousel.scroll(jQuery.jcarousel.intval(scrollNo))
					}else{
						var scrollNo = ((noClick-1)*3)+1
						carousel.scroll(jQuery.jcarousel.intval(scrollNo))
					}			
						//carousel.scroll(jQuery.jcarousel.intval(firstItem));
						// return false;
				})
			 });
 }
//Home page Carousel
//var hmCarousel = document.getElementById("hmCarousel");

if ( $("#hmCarousel").length ){
	
	// $("#hmCarousel").jcarousel({
			// scroll: 3,
			// initCallback: mycarousel_initCallback,
			// itemFirstInCallback:mycarousel_itemFirstInCallback
	// });		
}

//JS function to show main page image slideshow
if ( $("#headPhotoPager").length > 0 ){
    $("#headPhotoPager").headPhotoPager();
}

//loadFlashImage();

// sIFR initialize [begin]
if(typeof sIFR == "function"){

// This is the preferred "named argument" syntax
	//sIFR.replaceElement(named({sSelector:"h2", sFlashSrc:"tradegothic.swf", sColor:"#000000", sLinkColor:"#000000", sBgColor:"#FFFFFF", sHoverColor:"#CCCCCC", nPaddingTop:20, nPaddingBottom:20, sFlashVars:"textalign=center&offsetTop=6"}));
	//sIFR.replaceElement(named({sSelector:"h1", sFlashSrc:"tradegothic.swf", sColor:"#003540", sLinkColor:"#003540", sHoverColor:"#003540", sBgColor:"#FFFFFF", nPadding : "0,0,20,0", sCase:"upper", sWmode:"transparent"}));
	//sIFR.replaceElement(named({sSelector:"h1", sFlashSrc:"/VailResorts/sites/Keystone/assets/flash/tradegothic.swf", sColor:"#74B8C7", sLinkColor:"#74B8C7", sHoverColor:"#74B8C7", sBgColor:"#FFFFFF", nPadding : "0,0,0,0", sCase:"normal", sWmode:"transparent"}));
	//sIFR.replaceElement(named({sSelector:".calendarBG th", sColor:"#FFFFFF", sFlashSrc:"tradegothic.swf", nPadding : "0,0,0,0", sCase:"normal", sWmode:"transparent"}));
//	sIFR.replaceElement(named({sSelector:"ul.nav li ul li", sFlashSrc:"", sColor:"#74B8C7", sLinkColor:"#74B8C7", sHoverColor:"#74B8C7", sBgColor:"#FFFFFF", nPadding : "0,0,20,0", sCase:"normal", sWmode:"transparent"}));
	//	sIFR.replaceElement("h1", "tradegothic.swf", "#74B8C7", null, null, null, 0, 0, 0, 0, 'upper', 'transparent');
	//sIFR.replaceElement("h2", "tradegothic.swf", "#4C8392", null, null, null, 0, 0, 0, 0);
};
// sIFR initialize [end]
	
// ***** Photo and video page Carousel
/* var myCarousel = document.getElementById("mycarousel");
if (myCarousel){
	jQuery('#mycarousel').jcarousel({scroll: 1});
			var getWidth= $("#mycarousel").width()
			var setWidth = getWidth + 200;
			$("#mycarousel").width(setWidth)
		} */

	// ***** Shadebox for thumbnil and other on main area [begin] *****		
//	  $('.shadebox').wrap(
//		  "<div class='shadeboxWrapper'>" +
//		  "<div class='shadeboxWrapper2'>" +
//		  "<div class='shadeboxWrapper3'>" +
//		  "</div></div></div>");

	 
	
//		$('.shadebox').prepend("<div class='shadeboxHeader'><b class='shadeboxTlc'></b><b class='shadeboxTrc'></b></div>");
//		$('.shadebox').append("<div class='shadeboxFooter'><b class='shadeboxBlc'></b><b class='shadeboxBrc'></b></div>");
	
	// ***** Shadebox for thumbnil and other on main area [End] *****		

	// ***** Shadebox for top and bottom blue border [begin] *****
//	 $('.shadeboxTopBotBdr').wrap(
//		  "<div class='shadeboxTopBotBdrWrapper'>" +
//		  "<div class='shadeboxTopBotBdrWrapper2'>" +
//		  "<div class='shadeboxTopBotBdrWrapper3'>" +
//		  "</div></div></div>");
	
//	 	$('.shadeboxTopBotBdr').prepend("<div class='shadeboxTopBotBdrHeader'><b class='shadeboxTopBotBdrTlc'></b><b class='shadeboxTopBotBdrTrc'></b></div>");
//		$('.shadeboxTopBotBdr').append("<div class='shadeboxTopBotBdrFooter'><b class='shadeboxTopBotBdrBlc'></b><b class='shadeboxTopBotBdrBrc'></b></div>");

	// ***** Shadebox for top and bottom blue border [end] *****		
		

	//*** Shadebox for left and right module***/
			//$('.outerGlowBox').prepend("<div class='topLeft'><span></span></div>");
			//$('.outerGlowBox').append("<div class='bottomLeft'><span></span></div>");
		
	// ***** Shadebox for left and right modules [begin] *****		
    
//	 $('.container').wrap(
//		  "<div class='middleLeft'>" +
//		  "<div class='middleRight'>" +
//		  "</div></div>");
//		$('.moduleContainer').prepend("<div class='topLeft'><span></span></div>");
//		$('.moduleContainer').append("<div class='bottomLeft'><span></span></div>");
	
	// ***** Shadebox for left and right modules [end] *****		
	
	// ***** Shadebox for left, bottom and right [begin] *****

	if ('.shadeboxLBR')
	{
//		$('.shadeboxLBR').wrap(
//		  "<div class='shadeWrapper'>" +
//		  "<div class='shadeLeft'>" +
//		  "<div class='shadeRight'>" +
//		  "</div></div></div>");
		
		$('.shadeboxLBR').parents('.shadeWrapper').after('<div class="shadeBottom"><div class="bl"></div><div class="br"></div><div class="b"></div></div>');			
	}
		

	// ***** Shadebox for left, bottom and right [end] *****


		
	// ***** Shadebox for right modules on blue gradient background [begin] *****	
//     $('.containerGra').wrap(
//		  "<div class='middleLeftGra'>" +
//		  "<div class='middleRightGra'>" +
//		  "</div></div>");
//		$('.moduleContainerGra').prepend("<div class='topLeftGra'><span></span></div>");
//		$('.moduleContainerGra').append("<div class='bottomLeftGra'><span></span></div>");		
	// ***** Shadebox for right modules on blue gradient background [end] *****		
initialize()
/*
$(".photoTabs a").each(function(){
		$(this).click(function(event){
			event.preventDefault();
			$(".photoTabs a").parent().removeClass("tabs-selected");
			var activeClass = $(this).parent().attr("class")
			$(this).parent().addClass("tabs-selected");
			var element = $("#pageCategoryContentHolder");

			$(element).remove();
			 tabUrl = $(this).attr("href");
			 var widthCon = $("#pageCategory").width();
			 var heightCon = $("#pageCategory").height();
			 var topPos = widthCon/2
			 $("#loading").css("left", topPos);
			 $("#loading").css("top", "174px");
			 $("#loading").show();
			$.ajax({
				url: tabUrl,
				cache: true,
				success: function(html){
				$("#loading").hide();
				$("#pageCategory").append(html);
				initialize();
			setSelectedThumbnail();
			  }
			});

		});
});*/
/*
$(".videoTabs a").each(function(){
		$(this).click(function(event){
			alert(1);
			event.preventDefault();
			$(".videoTabs a").parent().removeClass("tabs-selected");
			var activeClass = $(this).parent().attr("class")
			$(this).parent().addClass("tabs-selected");
			var element = $("#pageCategoryContentHolder");

			$(element).remove();
			 tabUrl = $(this).attr("href");
			 var widthCon = $("#pageCategory").width();
			 var heightCon = $("#pageCategory").height();
			 var topPos = widthCon/2
			 $("#loading").css("left", topPos);
			 $("#loading").css("top", "174px");
			 $("#loading").show();
			$.ajax({
				url: tabUrl,
				cache: true,
				success: function(html){
				$("#loading").hide();
				$("#pageCategory").append(html);
				initialize();
			setSelectedVideoThumbnail();
			  }
			});

		});
});*/


        /*
        $(".photo_thumbnail_links a").click(function(event){
			event.preventDefault();
			
			//var activeClass = $(this).parent().attr("class")
			//$(this).parent().addClass("tabs-selected");
			var element = $("#thumbnailContainer");
			$(element).remove();
			
			
			
			 newUrl = $(this).attr("href");
			

			$("#loading").show();
			$.ajax({
				url: newUrl,
				cache: true,
				success: function(html){
				$("#loading").hide();
				$("#pageCategory").append(html);
				initialize();
				setSelectedThumbnail();
			  }
			});

		});
		*/

		//Begin Snow Report Dropdown
		if ( $('#weatherWidget').length )
		{
			
			/*
			$('#weatherWidget .report a').bind('mouseover', function(){
				$('.snowReportDrop').slideDown(500);
				$('body').click (
					function(){ $('.snowReportDrop').slideUp(500); }
				)
			});
			
			$('.snowReportDrop').bind('mouseleave', function(){
				$(this).slideUp(500);
			});*/

			$('#weatherWidget .innerContainer').hoverIntent(
				function(){
					$('.snowReportDrop').slideDown(500); 				
				},
				function(){
					$('.snowReportDrop').slideUp(500); 
				}
			);

			$('.snowReportDrop dl dt:odd, .snowReportDrop dl dd:odd').css('background','#efefef');	
			$('.snowReportDrop dl dt:even, .snowReportDrop dl dd:even').css('background','#fff');	
		}
        if ( $('div.search').length ) GlobalObjects.setup();
	   //Global Objects Setup
         if ( $('#globalObjects').length ) GlobalObjects.setup();
         

		if ( $('.searchResultHeader span.tool') )
		{
			$('.searchResultHeader span.tool').bind('mouseover', function(){ 
				
				if ( !$.browser.msie) {
					$('.relevancyPopup').show(300);
					$('.relevancyPopup').mouseleave(function(){ $(this).hide(300);  });
				} else {
					$('.relevancyPopup').show();
					$('.relevancyPopup').mouseleave(function(){ $(this).hide();  });
				}
				
			});		
		}

		if ( $('#mapLoader').length ) $('#mapLoader').bind('click', loadXML );

// load modal window in a local div
if ($('.printableFullDisplay').length){
	$('.printableFullDisplay').dialog({
		bgiframe: true,
		autoOpen: false,
		width: function(){
			if($(".pentaColumn").length){ requiredWidth = 922; }
			else if($(".quadColumn").length){requiredWidth = 752; }
			else{ requiredWidth = 564;}
			return requiredWidth;
			},
		modal: true,
		resizable: false,
		position: 'center',
		closeOnEscape: true,
		onClose: function(){
			$(".printLink").find("img").remove()
			$(".printableArea").removeClass("noPrint");
			$("#mainContainer").removeClass("noPrint");
		}
	});
}
	// open a modal window containing the page data 

if ($('.print').length){
    $('.print').bind('click', function(e){
        e.preventDefault();
		
		$(".printableDisplay").html( $(".printableArea", "#mainContainer").clone() );
		$(".printableArea").addClass("noPrint");
		$("#logo img").clone().insertAfter(".printLink a");
		$('.printableFullDisplay').dialog('open');
		$('.detailedForecast ul').hide();
		$('.printableFullDisplay .detailedForecast ul').show();
        return false;
    });
}
// Print the page 
if ($('.printNow').length){
	$('.printNow').bind('click', function(e){
		e.preventDefault();
        self.print();
        return false;
    });
}
//onClose function
$('.ui-dialog-titlebar-close').bind('click', function(){
		$(".printLink").find("img").remove();
		$(".printableArea").removeClass("noPrint");
		$("#mainContainer").removeClass("noPrint");	
		$('.detailedForecast ul').show();
													 });

// ***** Photo and video page Carousel
var myCarousel = document.getElementById("mycarousel");
if (myCarousel){
	jQuery('#mycarousel').jcarousel({
	    scroll: 1,
	    initCallback: function(carousel){
	        tabCarousel = carousel;
	    }
	});
			var getWidth= $("#mycarousel").width()
			var setWidth = getWidth + 200;
			$("#mycarousel").width(setWidth)
}


//planYourTripBarWrapper
$('.closeBtn').click(function(){
   if ((jQuery.browser.msie) && (parseInt(jQuery.browser.version)==6)){
		$('#planYourTripBarWrapper').css('z-index','-1');
   }
   else {
	   	$('#planYourTripBarWrapper').css('z-index','1');
   }
})

//add class to filter item on dining page
if ( $(".keywordFilter ul").length  ) $(".keywordFilter ul").find('li:eq(1)').addClass('filterLi');
if ( $(".generalContent").length  ){$(".generalContent h2").next(".introText").css({"padding-left": "0px", "padding-top":"0px"})};
	$('[id$=txtDepartDate]').bind("change", function(){
	    if($('[id$=txtDepartDate]').val() != '' && IsDateMMDDYYYY($('[id$=txtDepartDate]').val())) {
            var NewDate=new Date( $('[id$=txtDepartDate]').val());
            NewDate.setDate(NewDate.getDate()+1);
            $('[id$=txtReturnDate]').datepicker('option', 'minDate', NewDate );
            $('[id$=txtReturnDate]').datepicker('setDate', NewDate);            
        }
    });
    if(typeof($('[id$=txtDepartDate]').datepicker) != "undefined" ){
        $('[id$=txtDepartDate]').datepicker("option", "onClose", function(){
            if($('[id$=txtDepartDate]').val() != '' && IsDateMMDDYYYY($('[id$=txtDepartDate]').val())) {
                var NewDate=new Date( $('[id$=txtDepartDate]').val());
                NewDate.setDate(NewDate.getDate()+1);
                $('[id$=txtReturnDate]').datepicker('option', 'minDate', NewDate );
                $('[id$=txtReturnDate]').datepicker('setDate', NewDate);                
            }
        });
    }
});//END Document Ready

function initialize(){


//	if($('#middleTabsContainer').text()){
//		$('#middleTabsContainer').tabs(1);
//	}; 
    if($('#middleTabsContainer').length){
	    var idx = 1;
	    var hash = document.location.hash;
	    var selectedAnchor = $('#middleTabsContainer ul.middleTabs > li:first > a');
	    if (hash.length > 1){
		    var id = hash.split("#")[1];
		    selectedAnchor = $('#middleTabsContainer ul.middleTabs > li > a[href$=#' + id + ']');
		    if ( selectedAnchor.length > 0 ){
			    idx = $('#middleTabsContainer ul.middleTabs > li > a').index(selectedAnchor) + 1;
		    }
	    }
        $('#middleTabsContainer').tabs(idx);
	    if ( selectedAnchor.length > 0 ){
			    if ( idx > 1){
				    selectedAnchor.trigger('click');
			    }
		    }
	    $('#middleTabsContainer ul.middleTabs li:last').addClass('last');
    };
	if ( $('#homepageColumn1').length )
	{
		$('#middleTabsContainer .middleTabs').wrap('<div class="middleTabsWrapper"></div>');
		$('#middleTabsContainer .middleTabsWrapper').tabs(1);

	}

	
	// ***** Shadebox for thumbnil and other on main area [begin] *****	
//if ($(".searchBoxHolder .shadebox").parent().attr("class")!="shadeboxWrapper3")
//	{
//	
//	if ($(".searchBoxHolder .shadebox .shadeboxHeader").length == 0)
//	{
////		  $('.searchBoxHolder .shadebox').wrap(
//		  "<div class='shadeboxWrapper'>" +
//		  "<div class='shadeboxWrapper2'>" +
//		  "<div class='shadeboxWrapper3'>" +
//		  "</div></div></div>");

//		$('.searchBoxHolder .shadebox').prepend("<div class='shadeboxHeader'><b class='shadeboxTlc'></b><b class='shadeboxTrc'></b></div>");
//		$('.searchBoxHolder .shadebox').append("<div class='shadeboxFooter'><b class='shadeboxBlc'></b><b class='shadeboxBrc'></b></div>");
//		}
//	}
	// ***** Shadebox for thumbnil and other on main area [End] *****	
	
	// ***** Left Navigation [begin] *****
	$("#leftNav ul li ul").hide();
	
	$("#leftNav ul li").hover(
      function () { $(this).addClass("on"); }, 
      function () { $(this).removeClass("on"); }
    );

	$("#leftNav li.hasChild").prepend("<img src='/VailResorts/sites/Heavenly/assets/img/plus_icon.jpg' alt='' class='treeView' />");

	$("#leftNav ul li img").click(function(){
		$(this).next("a").next("ul").toggle();

		if ($(this).attr("src")=="/VailResorts/sites/Heavenly/assets/img/minus_icon.jpg") { 
				$(this).attr("src","/VailResorts/sites/Heavenly/assets/img/plus_icon.jpg"); 
				$(this).parents("li").removeClass("current");
			}
		else { 
				$(this).attr("src","/VailResorts/sites/Heavenly/assets/img/minus_icon.jpg");
				$(this).parents("li").addClass("current");
			}
		});

	$("#leftNav .shadeboxInner > ul").show(); /*pn artf906568 :*/
	$("#leftNav .hasChild.current.selected ul").show(); /*st artf1008365 :*/
	$("#leftNav .hasChild.current img").attr('src','/VailResorts/sites/Heavenly/assets/img/minus_icon.jpg'); /*st artf1008578*/
	
	
// ***** Left Navigation [end] *****

// ***** Top Navigation [begin] *****
	     if ($.browser.msie) {
        $("#topNav ul li a").unbind("click").bind("click", function(event) {
             event.stopPropagation();
        });
        $("#topNav ul li").unbind("click").bind("click", function(event) {
			var url = $(this).find("a").attr("href");
    		if($(this).find("a").attr("target") == '_blank'){
				window.open(url);
			} else {
				document.location.href = $(this).find("a").attr('href');	
			}
        });
    } 



	$("#topNav > li").hover(
      function () {
		$(this).addClass("on");
		if ((jQuery.browser.msie) && (parseInt(jQuery.browser.version)==6)){
			//png hack for ie6 fixes the height for topnav which prevents dropdowns from showing up. Height will have to be dynamically rendered thru js
			$('#topNavContainner').height(55 + $(this).find('ul').height());
		}
		$(this).find('ul li').hover(
			function(){
				$(this).addClass("hoverOn");
			},
			function(){
				$(this).removeClass("hoverOn");
				$(this).unbind('click');
			}
		).bind( 'click', function(){
		    
			location.href = $(this).find('a').attr('href');
		});
	}, 
      function () {
       $(this).removeClass("on");
	   if ((jQuery.browser.msie) && (parseInt(jQuery.browser.version)==6)){
		   $('#topNavContainner').css('height','1%')
	   }
      }
    )
	
	

// ***** Top Navigation [begin] *****

/*Plan a vacation on focus*/
$('#planYourTripBar input').each(function(){
	$(this).bind("focus", function(){
                    
					var defaultText = '';
					defaultText = $(this).val();
					
					if (defaultText=="Arrive:" || defaultText=="Depart:" || defaultText=="# of adults" || defaultText=="# of kids" ){
					$(this).val('');
					}
					$(this).blur(function(){
						var userInput =$(this).val();
						if (userInput == ''){
						
							
							if ($(this).attr("id")=="PlanYourTrip1_txtArriveDate" || $(this).attr("id")=="PlanYourTrip_txtArriveDate"){
								$(this).val("Arrive:");
							}
							if ($(this).attr("id")=="PlanYourTrip1_txtDepartDate" || $(this).attr("id")=="PlanYourTrip_txtDepartDate"){
								$(this).val("Depart:");
							}
						
						}
					})
					
				});
			 });
/*plan a vacation on focus end*/

	// ***** Promo toggling [begin] *****
	  $('#vacationDeal .promo').hide();
	  $('#vacationDeal h3').click(function(){
		var $this = $(this); 
		if( $this.is('.expand') ) {
		$('.promo').toggle(400);								
		$this.removeClass('expand');
		$this.addClass('collapse');
		}
		else {
		$('.promo').toggle(400);
		$this.removeClass('collapse');
		$this.addClass('expand');
		}
		return false;
		}); 
	
	// ***** Promo toggling [End] *****	  
  
	// ***** Accordion [begin] *****

		if ($('.accordion').text()) {
		    $(".accordion").accordion({
		        autoHeight: false,
		        change: function() {
		            $('.accordion .mediaAssetContainer').css("overflow", "visible");
		        },
		        active: 0
		    });
		};		
	// ***** Accordion [End] *****		
	  
	// ***** Date Picker [begin] *****
	// ******* artf971517 [begin] *****
	
	if($("input").hasClass("withCalendar")){
	    if ( $("[id$=hdMaxDate]").length > 0 ){
	        maxDate = $("[id$=hdMaxDate]").val();
	    }
		if (!maxDate){
			var maxDate = "+365";
		} else {
			maxDate = new Date(maxDate);
		}
	    if ( $("[id$=hdMinDate]").length > 0 ){
	        minDate = $("[id$=hdMinDate]").val();
	    }
		if (!minDate){
			var minDate = "+1"; //PS
		} else {
			minDate = new Date(minDate);
		}
		
		$(".withCalendar").datepicker({
			showOn: 'both', 
			buttonImage: '/VailResorts/sites/heavenly/assets/img/icon_calender.gif', 
			buttonImageOnly: true,
			defaultDate: minDate,
			maxDate: maxDate,
			minDate: minDate,
		    onSelect: function(dateText, inst) {
	            return false;
	        }
		});
		$(".withCalendar").unbind("keydown").bind("keydown", function(e){
            if (e.keyCode == 13) { e.preventDefault(); return false; }
            else if (e.keyCode == 27) { $(this).datepicker('hide'); return false;}
            return true;
        });
	}
	
	// ******* artf971517 [end] *****
	
	
	
//	if($("input").hasClass("withCalendar")){
//		$(".withCalendar").datepicker({showOn: 'button', buttonImage: '/VailResorts/sites/heavenly/assets/img/spacer.gif', buttonImageOnly: true});
//	}
  	//	$("#arrive").datepicker({showOn: 'button', buttonImage: '/VailResorts/sites/Keystone/assets/img/icon_calender.gif', buttonImageOnly: true});
	//	$("#depart").datepicker({showOn: 'button', buttonImage: '/VailResorts/sites/Keystone/assets/img/icon_calender.gif', buttonImageOnly: true});
		
	// ***** Date Picker [end] *****		

	

// ***** Tabs
/*pn - homepage carousel fix */
if($('.middleTabsWrapper').text()){
	$('.middleTabsWrapper').tabs(1);	
};
if($('#vacationDealsHomepage').text()){
	$('#vacationDealsHomepage').tabs(1);
	if ($(".vacationDeals >li").attr("class")=="tabs-selected"){
		$(".vacationDeals >li.tabs-selected").children(":first").prepend("<span class='leftLine'></span><span class='rightLine'></span>");
	}
	$(".vacationDeals a").click(function(){
		
	$(".leftLine").remove();
	$(".rightLine").remove();
	$(this).prepend("<span class='leftLine'></span><span class='rightLine'></span>");

 })
};

/* PK [begin] */
if($('#mainTabsContainer').text()){
	$('#mainTabsContainer').tabs(1);
};
	// hover effect for photogallery thumbnails
		$("ul.thumbnails li" ).hover(
				function () {
						$(this).addClass('imgOver');					
					},
					function () {
						$(this).removeClass('imgOver');
					});
	// hover effect for web cam thumbnails
		$("ul.webCam_thumbs li" ).hover(
				function () {
						$(this).addClass('imgOver');					
					},
					function () {
						$(this).removeClass('imgOver');
					});
	// hover effect for photogallery thumbnails
		$("ul.thumbsAlign li" ).hover(
			
				function () {
					$(this).children(":first").addClass('bdrThumOn');					
					},
					function () {
					
					var onClass =$(this).children(":first").attr("class")
					if (onClass == "bdrThumOn"){
						$(this).children(":first").removeClass('bdrThumOn');
						$(this).children(":first").addClass('bdrThumOn');
					}else{
						$(this).children(":first").removeClass('bdrThumOn');
					}
					});

		
/* 



JavaScript methods of modal dialgue window for photo slideshow page
----------------------------------------------------------------------*/
/*
//to show the div
$(".viewSlideShow").bind("click", function() {
	$(".overlayDiv").css("height", $(document).height());
	$(".overlayDiv").css("width", $(document).width());
	$(".overlayDiv").css("opacity","0.5");	
	$(".overlayDiv").removeClass("hideDiv");	
	$(".modalDiv").removeClass("hideDiv");
	$("#control>li.play").addClass('current');
	var modalWin = $(".modalDiv");
	var height = $(window).height();
	var width = $(document).width();
	leftPos = width/2 - (modalWin.width() / 2) ; // half width - half element width
	topPos = height/2 - (modalWin.height() / 2); // similar
	$(".modalDiv").css({'left':leftPos, 'top': topPos})
		
		});	

//to close the div
$(".linkClose").bind("click", function (){
	$(".overlayDiv").addClass("hideDiv");	
	$(".modalDiv").addClass("hideDiv");
	$(".viewLargeModal").addClass("hideDiv");
	$("#control>li").removeClass('current');
	$("#control>li.play").addClass('current');
	});
	
//View Large
//to show the div
$(".viewLargerLink").bind("click", function() {
	$(".overlayDiv").css("width", $(document).width());
	$(".overlayDiv").css("height", $(document).height());
	$(".overlayDiv").css("opacity","0.5");	
	$(".overlayDiv").removeClass("hideDiv");	
	$(".viewLargeModal").removeClass("hideDiv");
	var modalWin = $(".viewLargeModal");
	var height = $(window).height();
	var width = $(document).width();
	leftPos = width/2 - (modalWin.width() / 2) ; // half width - half element width
	topPos = height/2 - (modalWin.height() / 2); // similar
	$(".viewLargeModal").css({'left':leftPos, 'top': topPos})	
	});	

//Image switching photogallery
$("#thumbnailContainer a").click(function(event) {
	event.preventDefault();
	$(this).parents("li").parents("ul").find("li").removeClass("selected");
	$(this).parent("li").addClass("selected");
	
	setSelectedThumbnail();
	setSelectedVideoThumbnail();
	
	});
*/
//Video switching videogallery / *****????? 
$("#thumbnailContainer a").click(function(event) {
	event.preventDefault();
	var image = $(this).children(":first").attr("src");
	$("#videoContainer").children(":first").attr("src", image);
	});

//Toggle blank fill
$('input.txtBoxSearch').focus(function(){

		var defaultText = '';
		defaultText = $(this).val();
		$(this).val('');

		$("input").blur( function () {
		var userInput = $(this).val();

		if (userInput == ''){
			$(this).val(defaultText);
			defaultText = '';
		}
	});

 });
/*
//Slideshow control//
$("#control>li" ).hover(
		function () {
				$(this).addClass('active');
					},
		function () {
			$(this).removeClass('active');
		});	
	

$(".viewSlideShow").click(function (){
	 slideShow = setInterval( "slideSwitch()", 3000 );
	 	   $("#control>li").bind("click", function(){
	   		$("#control>li").removeClass('current');
	   		var currentId = $(this).attr("class");
			if (currentId == "pause active"){
				clearInterval(slideShow);
				$(this).addClass('current');
			}

			if (currentId == "play active"){
				clearInterval(slideShow);
				slideShow = setInterval( "slideSwitch()", 3000 );
				$(this).addClass('current');
			}

			if (currentId == "stop active" ){
				clearInterval(slideShow);
				$("#slideshow>img").each(function(){
					var activeClass = $(this).attr("class")
					if (activeClass =="active"){
						$(this).removeClass("active");
						}
				})
				$('#slideshow IMG:first').addClass("active");
				$(this).addClass('current');
			}
			
			if (currentId == "forward active" ){
				clearInterval(slideShow);
				$("#slideshow>img.active").next().addClass("active");
				$("#slideshow>img.active").prev().removeClass("active");
				//setInterval( "slideSwitch()", 3000 );
			
				}
			if (currentId == "backward active" ){
				clearInterval(slideShow);
				$("#slideshow>img.active").prev().addClass("active");
				$("#slideshow>img.active").next().removeClass("active");
			
				}
	   })
})*/

//Tab Ajax

//ski snow hover
// Show/Hide Weather report on day wise *****
		$("#WR1").hide();
		$("#WR2").hide();
		$("#WR3").hide();		
		$("#WR4").hide();				
		$("#WR5").hide();	
		$("#WR6").hide();
		function getPosition(no){
			//var pos = $("#weatherReportData").position();
			var defaultLeft =-85
				if (no==0){
				$(".WinfoBox1").css({"left":"0px"});
				} else{
					 if ($.browser.version == "6.0"){
						$(".WinfoBox1").css({"left":(defaultLeft*no) +"px"}); 
					 } else{
					$(".WinfoBox1").css({"left":((defaultLeft*no)-no) +"px"});
					 }
				}
		}
		$("#detailedForecast ul li#dayone" ).hover(
		function () {
				$("#WR1").show();
				$(this).children(":first").addClass("snowShadowOn");
				getPosition(0)
				},
		function () {
			$("#WR1").hide(); 
			$(this).children(":first").removeClass("snowShadowOn");
		});	
		
		$("#detailedForecast ul li#daytwo" ).hover(
		function () {
				$("#WR2").show();
				$(this).children(":first").addClass("snowShadowOn");
				getPosition(1)
				},
		function () {
			$("#WR2").hide(); 
			$(this).children(":first").removeClass("snowShadowOn");
		});	
		
  		$("#detailedForecast ul li#daythree" ).hover(
		function () {
				$("#WR3").show();
				$(this).children(":first").addClass("snowShadowOn");
				getPosition(2)
				},
		function () {
			$("#WR3").hide(); 
			$(this).children(":first").removeClass("snowShadowOn");
		});	
		
  		$("#detailedForecast ul li#dayfour" ).hover(
		function () {
				$("#WR4").show();
				$(this).children(":first").addClass("snowShadowOn");
				getPosition(3)
				},
		function () {
			$("#WR4").hide(); 
			$(this).children(":first").removeClass("snowShadowOn");
			
		});			

		$("#detailedForecast ul li#dayfive" ).hover(
		function () {
				$("#WR5").show();
				$(this).children(":first").addClass("snowShadowOn");
				getPosition(4)
				},
		function () {
			$("#WR5").hide(); 
			$(this).children(":first").removeClass("snowShadowOn");
			
		});	
		
		$("#detailedForecast ul li#daysix" ).hover(
		function () {
				$("#WR6").show();
				$(this).children(":first").addClass("snowShadowOn");
				getPosition(5)
				},
		function () {
			$("#WR6").hide(); 
			$(this).children(":first").removeClass("snowShadowOn");
			
		});	
		
		// Add Remove for image hover*****

		
}

/* PK [end] */
/*
function setSelectedThumbnail(){
	var image = $(".thumbnailContainer ul li.selected a").attr("href");
	$("#previewImageContainer .previewImage").attr("src", image);
	
	var changedCaption = $(".thumbnailContainer ul li.selected div.photoInfoThumbnail").html();
	$(".photoCaption").html(changedCaption);
	
	var photoNumber = $(".thumbnailContainer ul li.selected div.photoInfoThumbnail span.photoNumber").html();
	var totalCategoryPhotos = $("input.totalCategoryPhotos").val();
	var photoPagingNumber = photoNumber +" OF " + totalCategoryPhotos;
	$(".photoPagingNumber").html(photoPagingNumber);
	
	
	var firstPhotoNumber = $(".thumbnailContainer ul li:first div.photoInfoThumbnail span.photoNumber").html();
	var lastPhotoNumber = $(".thumbnailContainer ul li:last div.photoInfoThumbnail span.photoNumber").html();
	
	var categoryPagingNumber = firstPhotoNumber +"-"+ lastPhotoNumber +" OF " + totalCategoryPhotos;
	$(".categoryPagingNumber").html(categoryPagingNumber);
	}
*/
function setSelectedVideoThumbnail(){
	var image = $(".thumbnailContainer ul li.selected a").attr("href");
	$("#previewImageContainer .previewImage").attr("src", image);
	
	var totalCategoryPhotos = $("input.totalCategoryVideos").val();

	var changedCaption = $(".thumbnailContainer ul li.selected div.videoInfoThumbnail").html();
	$(".videoCaption").html(changedCaption);
		
	var firstPhotoNumber = $(".thumbnailContainer ul li:first div.videoInfoThumbnail span.videoNumber").html();
	var lastPhotoNumber = $(".thumbnailContainer ul li:last div.videoInfoThumbnail span.videoNumber").html();
	
	var categoryPagingNumber = firstPhotoNumber +"-"+ lastPhotoNumber +" OF " + totalCategoryPhotos;
	$(".categoryPagingNumber").html(categoryPagingNumber);
	}

// Apply drop shadow to the children of the passed obj cointainer (used for example on html elements loaded via ajax)
function applyShader(obj){
	// ***** Shadebox for thumbnil and other on main area [begin] *****		
//	$(obj).find('.shadebox').wrap(
//		  "<div class='shadeboxWrapper'>" +
//		  "<div class='shadeboxWrapper2'>" +
//		  "<div class='shadeboxWrapper3'>" +
//		  "</div></div></div>");
//		$(obj).find('.shadebox').prepend("<div class='shadeboxHeader'><b class='shadeboxTlc'></b><b class='shadeboxTrc'></b></div>");
//		$(obj).find('.shadebox').append("<div class='shadeboxFooter'><b class='shadeboxBlc'></b><b class='shadeboxBrc'></b></div>");
}

GlobalObjects =
{
	temp:'',
	setup:function()
	{
	    	    
        $('#globalObjects').find('input[type=text]').each( function() {
			jQuery(this).bind('click', function(){
				GlobalObjects.temp = jQuery(this).val();
				jQuery(this).val('');
			});

			jQuery(this).bind('blur', function(){
				if ( ( GlobalObjects.temp != null ) && ( jQuery(this).val()=='' ) )
				{
					jQuery(this).val(GlobalObjects.temp);
				}
			});
		});

        
		if ( $('.pageTools').length )
		{
		    
			//$('.pageTools .print a').bind('click', function(){ self.print() });
		    $('.pageTools .share').bind('mouseover', function() {
		        $('#at15s').bgiframe(); 
				var shareTop = $(this).position().top
				var shareLeft = $(this).position().left
				
				if ( !$.browser.msie) {
					$('.sharePopup').show(300);
					$('.sharePopup').css({ top:shareTop-13, left: shareLeft-14});
					$('.sharePopup').mouseleave(function(){ $(this).hide(300);  });
					
				} else {
					$('.sharePopup').show();
					if($.browser.version == "6.0"){ 
					$('.sharePopup').css({ top:shareTop-6, left: shareLeft-8});
					}
					else{
					$('.sharePopup').css({ top:shareTop-14, left: shareLeft-14});
					}
					$('.sharePopup').mouseleave(function(){ $(this).hide();  });
				}
				
			});					
		}
		
		setTimeout(function(){ $('.sharePopup .content').bgiframe(),1500});
		
        $('.sendToShare').click(function(event){
    
      event.preventDefault();
      
      var url;
      var protocol = 'http://'
      var targetUrl;   
      title=document.title;  
    
        if (($('.previewImageWrap').length) &&(!($('.media').length)))
	    {   
	        url=protocol + location.hostname + '/' +  $('.previewImageWrap').find('img').attr('src');
	    }	
	    else if ($('.webCam_imgHolder').length)
	    {
	        url=$('.webCam_imgHolder').find('img').attr('src');	    
	    }  
        else {
            url = window.location; 
        } 
	  
	  var $this= $(this).parents("li").attr("class");
	  switch($this)
	  {
	    case 'facebook':	                    	                     
	                     targetUrl='http://www.facebook.com/sharer.php?u='+encodeURIComponent(url)+'&t='+encodeURIComponent(title);
                         window.open(targetUrl,'sharer','location=no,menubar=no,resizable=no,scrollbars=yes,status=no ,toolbar=no,width=626,height=436');
                         break;
        case 'myspace': 
                         targetUrl = 'http://www.myspace.com/index.cfm?fuseaction=postto&' + encodeURIComponent(title)+ encodeURIComponent(url) + '&u=' + encodeURIComponent(url) + '&l=' + 3;
                         window.open(targetUrl,'','location=no,menubar=no,resizable=no,scrollbars=yes,status=no ,toolbar=no,width=626,height=436');
                         break;
        case 'digg':
                         targetUrl = 'http://digg.com/submit?url=' + url + '&title'+title;
                         window.open(targetUrl,'','location=no,menubar=no,resizable=no,scrollbars=yes,status=no ,toolbar=no,width=626,height=436');            
                         break; 
        case 'delicious':
                         targetUrl='http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url='+encodeURIComponent(url)+'&amp;title='+encodeURIComponent(title);
                         window.open(targetUrl,'delicious','location=no,menubar=no,resizable=no,scrollbars=yes,status=no ,toolbar=no,width=550,height=550');
                         break;
        case 'flickr':
                         targetUrl='http://www.flickr.com/photos/';
                          window.open(targetUrl,'flickr','location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no,width=550,height=550');
                         break;             
        default:
                         alert("Invalid Choice");
	    
	  }
	  
	 
});
        $('ul.search').find('input#search').each( function() {
			jQuery(this).bind('click', function(){
				GlobalObjects.temp = jQuery(this).val();
				jQuery(this).val('');
			});
			
			jQuery(this).bind('blur', function(){
				if ( ( GlobalObjects.temp != null ) && ( jQuery(this).val()=='' ) )
				{
					jQuery(this).val(GlobalObjects.temp);
				}
			});
		});
	
	}
	
}


/* This function is responsible for showing first image in creative
   space when browser has no flash player. */
//function loadFlashImage(){
//   if(!$('object#flashObj').length){
//        if($('#flashImageURL').length>0){
//           $('#flashObj').append('<a target="" href="'+$('#flashImageURL').val()+'"> <img src="'+$('#flashLoaderParam').val()+'" alt="flashImage" /> </a>');
//        }
//        else{
//           $('#flashObj').append('<img src="'+$('#flashLoaderParam').val()+'" alt="flashImage" />');
//        }
//        $('.flsLinks').hide();
//   }
//}

function BindKeyPressEventWithTextBox(e, buttonid){
      var evt = e ? e : window.event;
      var bt = document.getElementById(buttonid);
      if (bt){
          if (evt.keyCode == 13){
                $(bt).click();                
                return false;
          }
      }
  }


  function getErrorMessage(xhr, status, error) {
      var err = eval('xhr.responseText');
      var errMsg = ' ';

      if (status.toLowerCase() == "timeout".toLowerCase()) {
          errMsg = "An unexpected error has occurred. Please try after some time or contact support center for assistance.";
          return errMsg;
      }

      if (err != undefined && err.Message != undefined) {
          return err.Message;
      }

      return errMsg;
  }
  
  //This function verifies if date entered is in mm/dd/yyyy format or not.
function IsDateMMDDYYYY(dtStr) {    

    var dtCh = "/"; 

    var minYear = 1900;
    var maxYear = 2100;

    var daysInMonth = DaysArray(12);
    var pos1 = dtStr.indexOf(dtCh);
    var pos2 = dtStr.indexOf(dtCh, pos1 + 1);
    var strMonth = dtStr.substring(0, pos1);
    var strDay = dtStr.substring(pos1 + 1, pos2);
    var strYear = dtStr.substring(pos2 + 1);
    strYr = strYear;
    if (strDay.charAt(0) == "0" && strDay.length > 1) strDay = strDay.substring(1);
    if (strMonth.charAt(0) == "0" && strMonth.length > 1) strMonth = strMonth.substring(1);
    for (var i = 1; i <= 3; i++) {
        if (strYr.charAt(0) == "0" && strYr.length > 1) strYr = strYr.substring(1);
    }
    month = parseInt(strMonth);
    day = parseInt(strDay);
    year = parseInt(strYr);
    if (pos1 == -1 || pos2 == -1) {        
        return (false);
    }
    if (strMonth.length < 1 || month < 1 || month > 12) {        
        return (false);
    }
    if (strDay.length < 1 || day < 1 || day > 31 || (month == 2 && day > daysInFebruary(year)) || day > daysInMonth[month]) {        
        return (false);
    }
    if (strYear.length != 4 || year == 0 || year < minYear || year > maxYear) {        
        return (false);
    }
    if (dtStr.indexOf(dtCh, pos2 + 1) != -1 || isInteger(StripCharsInBag(dtStr, dtCh)) == false) {        
        return (false);
    }
    return (true);
}
function StripCharsInBag(s, bag) {
    var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++) {
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return (returnString);
}

function xreplace(checkMe,toberep,repwith) {
	var temp=checkMe;
	var i=temp.indexOf(toberep);
	while (i>-1) {
		temp = temp.replace(toberep, repwith);
		i = temp.indexOf(toberep, i + repwith.length + 1)
	}
	return temp;
}
﻿/*******************************************************************************
Module: Page analytics using Omniture sitecatalyst.
File: jquery.Tagging.js
Initial Author: Manish
Date Created: 5/22/2009 
Purpose: jQuery code for tagging links on a page using Omniture sitecatalyst.
Copyright (c) 2008 Vail Resorts, Inc.
*******************************************************************************/

// Binds click event on each link fetched through the given selector.
function attachClick(selector, func){
    
    $(selector).each(function(){
        // Copy the default onclick handler
        var handler = this.onclick; 
    	
        // Remove the default onclick handler
        this.onclick = function(){}; 

        // Attach click on link
        singleClick(this, handler, func);
    });
}

// Binds click event on a link after a delay of 500ms
function singleClick(obj, handler, func){
    // Bind click event only for one time.
    $(obj).one("click", function(){
        
        // Handle the validation of results
        var result = true;
    
        // Get the page hierarchy
        var seoHierarchy = $(obj).attr("name");
        
        // Set analytics variables
	    func(seoHierarchy);
	    
	    // Call the default onclick function
	    if(handler!= null)
	    {
	        result = handler();
	    }
	    
	    // Delay the click event by 500ms
	    setTimeout(function(){
	        singleClick(obj, handler, function(seoHierarchy){
	            func(seoHierarchy);
	        });
	    }, 500);
	    
	    return result;
    });
    
}
	
function BindLodgingData()
{
    // Tag plan a Lodging button
	attachClick(".tagLodgingData", function(seoHierarchy){
        var tagArray = omniturePixels.split(":");
        
        //set variables
        linkTrackVars='products';
        linkTrackEvents='scAdd';  
        s.events='scAdd, event33';
        s.products = tagArray[tagArray.length - 1];
        s.tl(this, 'o', omniturePixels);   
	});
}	
function BindLodgingDetail()
{       
    // Tag plan a Lodging button
    attachClick(".tagcontforcart", function(seoHierarchy){
    var seoHierarchy = $(".tagcontforcart").prev().attr("value");
   var productCode=$("input[type=hidden][name$=hdnLodgingProduct]").val(); 
   //Modified by Naveen Kumar
     if(seoHierarchy != null)
        {
    linkTrackVars='products';
    linkTrackEvents='scAdd';  
     s.events='scAdd, event33';
     s.products = productCode;
     s.tl(this, 'o', seoHierarchy); 
	}});
}	

function TagEquipmentRentalResults()
{
    if(document.getElementById('hdnEquipmentRentals') != null)
    {
        attachClick(".tagEquipmentRentalData", function(seoHierarchy){
            var hdtag='';   
            $('.dropItem li').each(function(i){              
               if(hdtag=='')
                {      
                    hdtag=$(this).find('.boxData #hdSelectedSKU').val();
                }
                else
                {
                    hdtag+=","+$(this).find('.boxData #hdSelectedSKU').val();
                }
            });
            //Modified by Naveen to correct to tagging of Equipment Rental: 21st Oct.
            var omniturePixels=document.getElementById('hdnEquipmentRentals').value;
            linkTrackVars='products';
            linkTrackEvents='scAdd';
            s.events='scAdd';
            s.products = hdtag;
            s.tl(this, 'o', omniturePixels);
            
	    });
	}
}

function TagLessonResults()
{

  // Tag plan for Lift Ticket
	attachClick(".tagClassesData", function(seoHierarchy){      
	    var hdtag='';    
        $("ul.dropItem li").each(function(i){   
            if(hdtag=='')
                {
                    var hdnValue = $(this).find("input[type=hidden][name=purchasedLessonID]").val();
                    if(hdnValue != '')
                    {
                        var ArrProductCodes = hdnValue.split('|');
                        hdtag = ArrProductCodes[0];
                    }
                }
                else
                {
                    var hdnValue = $(this).find("input[type=hidden][name=purchasedLessonID]").val();
                    if(hdnValue != '')
                    {
                        var ArrProductCodes = hdnValue.split('|');
                        hdtag += ","+ArrProductCodes[0];
                    }
                }
        });
                 
                 
      
	    var seoHierarchy = $(".tagClassesData").prev().attr("value");
        
        document.getElementById('hdnLessonDetails').value +=":"+hdtag;
        var completeHierarchy = document.getElementById('hdnLessonDetails').value ;
        if(completeHierarchy != null)
        {
            var tagArray = completeHierarchy.split(":");
            //set variables
            linkTrackVars='products';
            linkTrackEvents='scAdd';
            s.events = 'scAdd';
            s.products = tagArray[tagArray.length - 1];
            s.tl(this, 'o', seoHierarchy);
        }
        
	});
}

function BindFlightTags()
{
//Modified by Naveen to correct tagging for air: 20th Oct.
    attachClick(".tagContinueData", function(seoHierarchy){
        var seoHierarchy = $(".tagContinueData").prev().attr("value");
        var productCode=$("input[type=hidden][name=flightSearch]").val();
        if(seoHierarchy != null)
        {
            //set variables
            linkTrackVars='products';
            linkTrackEvents='scAdd';
            s.events = 'scAdd';
            s.products = productCode;
            s.tl(this, 'o', seoHierarchy);
        }
	});	
}
//Bind Child care nursery continue button tagging
function BindCCNContinueTags()
{
    var seoHierarchy = "";
    $("#ChildCareTypeContainer .radioButtonList").each(function() {
        if ($(this).find(":radio").length > 0) {
            var value = $(this).find(":radio:selected").val();
        } else {
            var value = $(this).find(":hidden:eq(0)").val();
        }
        seoHierarchy += ";"+ value ;
    });
        if(seoHierarchy != null)
        {
            linkTrackVars='products';
            linkTrackEvents='scAdd';
            s.events = 'scAdd';
            s.products = seoHierarchy;
            s.tl(this, 'o',$(".ccnseoHierarchy").val());
        }
}

//Bind Dining Book it Tagging
function BindDiningBookItTags()
{
    var seoHierarchy = "";
    seoHierarchy = ";" +  $("#merchantId").val();
    if(seoHierarchy != null)
    {
        linkTrackVars='products';
        linkTrackEvents='scAdd';
        s.events = 'scAdd';
        s.products = seoHierarchy;
        var val = $(".DiningProduct").val();
        s.tl(this, 'o',val);
    }
}

//Binding Save Item to Trip Tagging
function BindSaveItineraryTags() 
{
    //alert($(".SaveItinerary_pixels").val());

    if ($(".SaveItinerary_pixels").val() != "") 
    {
        //alert($(".SaveItinerary_pixels").val());
        s.tl(this, 'o', $(".SaveItinerary_pixels").val());
        s.events = "event15";
    }
}
	
// Attach custom click event on a link on page load.	
$(function(){
     // Tag save itinerary button
    if ($(".tagSaveItinerary").length > 0) {
        //debugger;
        attachClick(".tagSaveItinerary",function(){
            BindSaveItineraryTags();
        });
    }

    if($(".tagBookDining").length>0)
	{
        //Tag BookIt Dining button
        attachClick(".tagBookDining",function(){
            BindDiningBookItTags();
        });
    }

    //Tag Childcare nursery continue button
	if($(".tagCCNContinue").length>0)
	{
	    attachClick(".tagCCNContinue", function(){
	        //alert('attaching event');
	        BindCCNContinueTags();
	    });
    }

	// Tag promotional links
	attachClick(".tagPromoLink", function(seoHierarchy){
	s.evar5 = 'INT_PROMO_ID';
	s.events = 'event1';
	s.tl(s.pageURL, 'o', seoHierarchy);
	});
	
	// Tag plan a vacation button
	attachClick(".tagPlanButton", function(seoHierarchy){
        var seoHierarchy = $(".tagPlanButton").prev().attr("value");
        s.evar35 = seoHierarchy;
        s.tl(s.pageURL, 'o', seoHierarchy);
	});
	
	// Tag plan a vacation button
	attachClick(".inputButton", function(seoHierarchy){
        var seoHierarchy = $(".inputButton").prev().attr("value");
        s.evar35 = seoHierarchy;
        s.tl(s.pageURL, 'o', seoHierarchy);
	});
	
	
	// Tag quick links
	attachClick(".tagQuickLink", function(seoHierarchy){
        if(seoHierarchy != null)
        {
            seoHierarchy=seoHierarchy.replace("http://","").replace("http%3A//","");
            s.tl(s.pageURL, 'o', seoHierarchy);
        }
	});
	
	// Bind Lodging Data
	if($(".tagLodgingData").length>0)
	{
	    BindLodgingData();
	}
	
	if($(".tagcontforcart").length>0)
	{
	    BindLodgingDetail();
	}
	
	// Tag flight search results
	if($(".tagContinueData").length>0)
	{
	    BindFlightTags();
	}
	
	 // Tag plan for Lift Ticket
	attachClick(".tagLiftTicketContinueData", function(seoHierarchy){          
	    var hdtag='';    
        $("ul.dropItem li").each(function(i){   
            if(hdtag=='')
                {
                 hdtag=$(this).find("input[type=hidden][name=SelectedSKU]").val();                             
                          
                }
                else
                {
                 hdtag+=","+$(this).find("input[type=hidden][name=SelectedSKU]").val();
                }
        
                    
        });
                 
        document.getElementById('hdnLiftTicket').value+=":"+hdtag;
	    var seoHierarchy = $(".tagLiftTicketContinueData").prev().attr("value");
        
        if(seoHierarchy != null)
        {
            var tagArray = seoHierarchy.split(":");
            //set variables
            linkTrackVars='products';
            linkTrackEvents='scAdd';
            s.events = 'scAdd';
            s.products = tagArray[tagArray.length - 1];
            s.tl(this, 'o', seoHierarchy);
        }
	});
	
	// Tag plan for Lessons
	 if($(".tagClassesData").length>0)
	 {
	    TagLessonResults();
	 }
	 // Tag plan for Equipment Rental
	 if($(".tagEquipmentRentalData").length>0)
	 {
	    TagEquipmentRentalResults();
	 }
	 
	 // Tag plan for Equipment Rental
	 attachClick(".tagSeasonPassesExplorerData", function(seoHierarchy){
	    
        var hdtag='';   
        $("ul.dropItem li").each(function(i){  
         var div1 = $(this).find(".boxData"); 
         var div2 = div1.find(".amount");
         var sSKU = div2.find("input[type=hidden][class='hdnSKU']").val();
         
           if(hdtag=='')
            {      
                hdtag=sSKU ;
            }
            else
            {
               
                hdtag+=","+sSKU ;
            }
            
           
        });
          
          var seoHierarchy = document.getElementById('hdnSeasonPasses').value;

        if(hdtag != null)
        {
       
            linkTrackVars='products';
            linkTrackEvents='scAdd';
            s.events = 'scAdd';
            s.products = hdtag;
            s.tl(this, 'o', seoHierarchy);
        }
	});
	
	
	// Tag plan a Ground Transportation Continue
	attachClick(".btnRight", function(seoHierarchy){
        var seoHierarchy = $(".btnRight").prev().attr("value");
        if(seoHierarchy != null)
        {
            var tagArray = seoHierarchy.split(":");
            //set variables
            linkTrackVars='products';
            linkTrackEvents='scAdd';
            s.events = 'scAdd';
            s.products = tagArray[tagArray.length - 1];
            s.tl(this, 'o', seoHierarchy);
		}
        
	});
	
	// Tag plan a Offer Explorer Continue
	attachClick(".openModalForTraveller", function(seoHierarchy){
        var seoHierarchy = $(".openModalForTraveller").prev().attr("value");
        
        if(seoHierarchy != null)
        {
            var tagArray = seoHierarchy.split(":");
            //set variables
            linkTrackVars='products';
            linkTrackEvents='scAdd';
            s.events = 'scAdd';
            s.products = tagArray[tagArray.length - 1];
            s.tl(this, 'o', seoHierarchy);
		}
        
	});
	
	// Tag keyword search links
	attachClick("ul.resultPanel li h4 a", function(seoHierarchy){
        linkTrackVars = 'events';
        linkTrackEvents = 'event32';
        s.events = 'event32';
        s.tl(this, 'o', 'keystoneresort:internal search clicked');
	});
	
	// Tag learn more link on vacation deals widget
	attachClick(".tagLearnMore", function(seoHierarchy){
	    if(seoHierarchy != null)
	    {
	        var tagArray = seoHierarchy.split(":");
    	    
            //set variables
	        s.evar5 = tagArray[tagArray.length - 1];
	        s.events = 'event1';
	        s.tl(s.pageURL, 'o', seoHierarchy);
        }
	});
});

// Code for tagging the links on RSS feeds signup page i.e. RSSLanding.aspx.
(function(A){
    A.fn.rssLinks=function(B){
        return this.each(function(){
            var E=A(this);
            var G=A.extend({},A.fn.rssLinks.defaults,B);
            var F=A(G.target||A(this).attr("target"));
            var C=[];
            G.url=G.url||this.tagName.toLowerCase()=="a"?A(this).attr("href").split("#")[0]:A(this).attr("rel");
            G.url=G.url.replace("http://","").replace("http%3A//","");
            for(var D=0;D<G.services.length;D++){
                C[D]='<a href="'+G.serviceList[G.services[D]].pattern+'" name="'+G.services[D]+'"><img src="'+G.serviceList[G.services[D]].image+'" alt="Add to '+G.services[D]+'" /></a>';
                C[D]=C[D].replace(/\{url\}/gi,escape(unescape(G.url)))
            }
            C=A(C.join(""));
            F[G.insertionType](C);
            if(G.wrapper){
                C.each(function(){
                    A(this).wrap(G.wrapper)
                })
            }
            if (G.taggingPattern && s && s.tl) {
                C.each(function(){
                    A(this).click(function(){
                    s.tl(this, "o", G.taggingPattern.replace(/\{name\}/gi, E.attr("name")).replace(/\{service\}/gi, A(this).attr("name")))
                    })
                })
            }
        })
     };
    A.fn.rssLinks.defaults={
        target:false,
        url:false,
        wrapper:false,
        insertionType:"html",
        taggingPattern:"keystoneresort:rss feeds:{name}:{service}",
        services:["my yahoo","my aol","google","windows live"],
        serviceList:{
            MyYahoo:{
                pattern:"http://us.rd.yahoo.com/my/atm/*http://add.my.yahoo.com/rss?url=http%3A//{url}",
                image:"/vailresorts/sites/snow/assets/img/rss/rss_yahoo.gif"
            },
            MyAOL:{
                pattern:"http://feeds.my.aol.com/?url=http%3A//{url}",
                image:"/vailresorts/sites/snow/assets/img/rss/rss_aol.gif"
            },
            Google:{
                pattern:"http://fusion.google.com/add?source=atgs&feedurl=http%3A//{url}",
                image:"/vailresorts/sites/snow/assets/img/rss/rss_google.gif"
            },
            WindowsLive:{
                pattern:"http://www.live.com/?add=http://{url}",
                image:"/vailresorts/sites/snow/assets/img/rss/rss_windows.gif"
            }
       }
   }
})(jQuery);

(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&/6.0/.test(navigator.userAgent)){s=$.extend({top:"auto",left:"auto",width:"auto",height:"auto",opacity:true,src:"javascript:false;"},s||{});
var prop=function(n){return n&&n.constructor==Number?n+"px":n
},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?"filter:Alpha(Opacity='0');":"")+"top:"+(s.top=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+'px')":prop(s.top))+";left:"+(s.left=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+'px')":prop(s.left))+";width:"+(s.width=="auto"?"expression(this.parentNode.offsetWidth+'px')":prop(s.width))+";height:"+(s.height=="auto"?"expression(this.parentNode.offsetHeight+'px')":prop(s.height))+';"/>';
return this.each(function(){if($("> iframe.bgiframe",this).length==0){this.insertBefore(document.createElement(html),this.firstChild)
}})
}return this
}
})(jQuery);
(function($){$.fn.shadeBox=function(options){var defaults={theme:"shadeBox",callback:function(){}};
var options=$.extend(defaults,options);
var shadeBox={replace:["",'<div class="shadeboxWrapper">','<div class="shadeboxWrapper2">','<div class="shadeboxWrapper3">','<div class="shadebox">','<div class="shadeboxHeader">','<b class="shadeboxTlc"></b>','<b class="shadeboxTrc"></b>',"</div>",'<div class="shadeboxInner">',"</div>",'<div class="shadeboxFooter">','<b class="shadeboxBlc"></b>','<b class="shadeboxBrc"></b>',"</div>","</div>","</div>","</div>","</div>"].join("")};
var whiteBoxBrandSite={wrap:["",'<div class="shadeboxWrapper">','<div class="roundedCornerMiddleLeft">','<div class="roundedCornerMiddleRight shadeboxInner">',"</div>","</div>","</div>"].join(""),prepend:'<div class="roundedCornerTopLeft"><span></span></div>',append:'<div class="roundedCornerBottomLeft"><span></span></div>'};
return this.each(function(){var theme=eval(options.theme);
if(theme.replace){options.callback();
var container=$(this);
var content=container.html();
var theme=eval(options.theme);
if(!$(this).parent().is(".shadeboxWrapper")){$(this).html(theme.replace).find(".shadeboxInner").append(content)
}options.callback()
}else{if(!$(this).parent().is(".shadeboxInner")){if(typeof theme=="string"){$(this).before(theme).prev(".shadeboxWrapper").find(".shadeboxInner").append($(this).clone(true));
$(this).remove()
}else{$(this).wrap(theme.wrap).parents(".shadeboxWrapper").eq(0).prepend(theme.prepend).append(theme.append)
}}}})
}
})(jQuery);
$(function(){
        if ( $(".ModalImage").length > 0 ){
            if ( $('.ModalImage_ModalContainer', $(".ModalImage")).length > 0 && $('body > .ui-dialog .ModalImage_ModalContainer').length == 0 ){
                $('.ModalImage_ModalContainer', $(".ModalImage")).eq(0).dialog({
                    bgiframe: true,
                    autoOpen: false,
                    width: 800,
                    height: 500,
                    modal: true,
                    resizable: false,
                    position: 'center',
                    closeOnEscape: true
                });
            }
            var objDialog = $('body > .ui-dialog .ModalImage_ModalContainer');

            $('[id$=ancActionLink], [id$=ancPromo]', $(".ModalImage")).unbind("click").bind("click", function(e) {
                e.preventDefault();
                var url = $(this).attr('href');
                $('iframe', objDialog)
                    .attr('src', url)
                    .attr('width', '100%')
                    .attr('height', '100%')
                    .attr('scrolling', 'auto');
                try {
                    objDialog.dialog('open');
                } catch(e){}
                return false;
            });
        }
    })
﻿// Declaring valid date character, minimum year and maximum year
var dtCh= "/";
var minYear=1900;
var maxYear=2100;


$(function(){
    $("#vacationPlan .date-pick").blur(function(){
        var dateStr = $(this).val();
        if ( $.trim( dateStr ) != "" ){
            var dateStr = dateStr.split("/");
            
            if( dateStr[2].length < 4 ){
                dateStr[2] = "20" + dateStr[2];
            }
            
            dateStr = dateStr.join("/");
            $(this).val(dateStr);
        }
    });
    
    
    //this code prevent the enter on textboxes because in that case control was going into server side 
    //and throwing exception.
    if ( $(".gradBorderModule fieldset ul li").length > 0 ){
        $(".gradBorderModule fieldset ul li :text").unbind("keydown").bind("keydown", function(e){
            var code = getKeyCode(e);
            if(code == "13")
            {
                e.preventDefault(); 
                return false;
            }
        });
	}
});

//function to get given key ascii value
function getKeyCode(e) {
			var code;
			if (!e) var e = window.event;
			if (e.keyCode) code = e.keyCode;
			else if (e.which) code = e.which;
			
			return code;
}


/***********************************************************************************************************
Function Name : isInteger
Purpose : The Method Checks that the variable entered is integer or not
Parameters : s -  variable needs to be checked             
Created By : Nishit Rastogi
Created On : 30-Mar-2009
***********************************************************************************************************/
function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}
/***********************************************************************************************************
Function Name : stripCharsInBag
Purpose : The Method Search through string's characters one by one and if character is not in bag, append to returnString.
Parameters : s -  string variable             
Created By : Nishit Rastogi
Created On : 30-Mar-2009
***********************************************************************************************************/
function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}
/***********************************************************************************************************
Function Name : daysInFebruary
Purpose : The Method Checks the no. of days in month of february i.e. whether a year is leap year or not
Parameters : year -  year as string             
Created By : Nishit Rastogi
Created On : 30-Mar-2009
***********************************************************************************************************/
function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
/***********************************************************************************************************
Function Name : DaysArray
Purpose : The Method creates the array of days.
Parameters : n- month 
Created By : Nishit Rastogi
Created On : 30-Mar-2009
***********************************************************************************************************/
function DaysArray(n) {
	var days = [];
	for (var i = 1; i <= n; i++) {
		days[i] = 31;
		if (i==4 || i==6 || i==9 || i==11) {days[i] = 30;}
		if (i==2) {days[i] = 29;}
   } 
   return days;
}
/***********************************************************************************************************
Function Name : isDate
Purpose : The Method Checks whether the entered string is a date object or not
Parameters : dtStr -  string object              
Created By : Nishit Rastogi
Created On : 30-Mar-2009
***********************************************************************************************************/
function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)	
	
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		//alert(invalidDtFormatErrMsg)
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		//alert(invalidDtErrMsg)
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		//alert(invalidDtErrMsg)
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		//alert(invalidDtErrMsg)
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		//alert(invalidDtErrMsg)
		return false
	}
return true
}
/***********************************************************************************************************
Function Name : compareDates
Purpose : The Method compares the two date objects
Parameters : date1, date2 which needs to be compared
Created By : Nishit Rastogi
Created On : 30-Mar-2009
***********************************************************************************************************/		
function compareDates (value1, value2) {

   	var date1, date2;
	var month1, month2;
	var year1, year2;
	
	value1 = new Date(value1);
	value2= new Date(value2);
	
	month1 = value1.getMonth();
	month2 = value2.getMonth();
		
	year1 = value1.getFullYear();
	year2 = value2.getFullYear()
	
	date1 =  value1.getDate();
	date2 =  value2.getDate();

   if (year1 > year2) return -1;
   else if (year1 < year2) return 1;
   else if (month1 > month2) return -1;
   else if (month1 < month2) return 1;
   else if (date1 > date2) return -1;
   else if (date1 < date2) return 1;
   else return 0;
}
/***********************************************************************************************************
Function Name : trimValues
Purpose : The Method trims the white spaces from the string
Parameters : sString -  String needs to be trimmed             
Created By : Nishit Rastogi
Created On : 30-Mar-2009
***********************************************************************************************************/
function trimValues(sString)
{
	while (sString.substring(0,1) == ' ')
	{		
		sString = sString.substring(1, sString.length);		
	}
		
	while (sString.substring(sString.length-1, sString.length) == ' ')
	{
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}
/***********************************************************************************************************
Function Name : checkForNumeric
Purpose : The Method trims the white spaces from the string
Parameters : sString -  String needs to be trimmed             
Created By : Nishit Rastogi
Created On : 30-Mar-2009
***********************************************************************************************************/
function checkForNumeric(strValue) 
{ 
  var numRegex = /^([0-9]*)$/;
 if(!strValue.match(numRegex))
  {     
      return false;
  }
 return true;
}
