/*
 * jQuery 1.2.6 - New Wave Javascript
 *
 * Copyright (c) 2008 John Resig, http://jquery.com/
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
 * $Rev: 5685 $
 */
(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else
return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
return(this[0].value||"").replace(/\r/g,"");}return undefined;}if(value.constructor==Number)value+='';return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/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:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else
return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<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 expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},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];}},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 value&&value.constructor==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 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){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}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){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';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=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");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.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?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(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&&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;return elem[name];}if(msie&&notxml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else
while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else
while(elem=second[i++])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.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});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));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});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){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.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).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<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.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});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.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){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,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);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});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);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else
xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";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)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})();
function MibAjaxCache()
{
}
MibAjaxCache.prototype.items = this.items = Array();
MibAjaxCache.prototype.Add = function(item)
{
this.items.push(item);
}
MibAjaxCache.prototype.Get = function(url)
{
for (var i = 0; i < this.items.length; i++)
{
if (this.items[i].cacheKey == url)
{
return this.items[i];
}
}
return null;
}
function MibAjaxManager()
{
}
MibAjaxManager.prototype.CreateLoading = function() { };
MibAjaxManager.prototype.DestroyLoading = function() { };
MibAjaxManager.prototype.DefaultRequestError = function(xhr, desc, ex) { };
MibAjaxManager.prototype.Cache = new MibAjaxCache();
MibAjaxManager.prototype.Get = function(url, useCache, beginRequest, parseRequest, endRequest, requestError, contentType) {
var urlPath = url.toString().split(/\?/)[0];
var data = url.toString().split(/\?/)[1];
if (!contentType) contentType = 'html';
if (!data) data = {}; // FDB: jQuery breaks if you use POST with undefined data
var item =
{
beforeSend: beginRequest,
type: "POST",
cacheKey: url,
url: urlPath,
data: data,
error: requestError,
complete: endRequest,
cache: useCache,
success: parseRequest,
dataType: contentType
}
if (useCache) {
var ajaxItem = this.Cache.Get(url);
if (ajaxItem) {
if (ajaxItem.beforeSend) ajaxItem.beforeSend();
ajaxItem.success(ajaxItem.content);
if (ajaxItem.complete) ajaxItem.complete();
}
else {
this.Cache.Add(item);
$.ajax(item);
}
}
else {
$.ajax(item);
}
}
MibAjaxManager.prototype.GetContent = function(url, target, useCache, beginRequest, endRequest, requestError)
{
this.Get(
url,
useCache,
beginRequest ? function() { beginRequest(); mibAjaxManager.CreateLoading(); } : this.CreateLoading,
function(content)
{
$(target).html(content);
this.content = content;
},
endRequest ? function() { endRequest(); mibAjaxManager.DestroyLoading(); } : this.DestroyLoading,
requestError == null ? mibAjaxManager.DefaultRequestError : requestError,
'html'
);
}
MibAjaxManager.prototype.GetContentAfter = function(url, target, useCache, beginRequest, endRequest, requestError) {
this.Get(
url,
useCache,
beginRequest ? function() { beginRequest(); mibAjaxManager.CreateLoading(); } : this.CreateLoading,
function(content) {
$(target).after(content);
this.content = content;
},
endRequest ? function() { endRequest(); mibAjaxManager.DestroyLoading(); } : this.DestroyLoading,
requestError == null ? mibAjaxManager.DefaultRequestError : requestError,
'html'
);
}
MibAjaxManager.prototype.GetContentBefore = function(url, target, useCache, beginRequest, endRequest, requestError) {
this.Get(
url,
useCache,
beginRequest ? function() { beginRequest(); mibAjaxManager.CreateLoading(); } : this.CreateLoading,
function(content) {
$(target).before(content);
this.content = content;
},
endRequest ? function() { endRequest(); mibAjaxManager.DestroyLoading(); } : this.DestroyLoading,
requestError == null ? mibAjaxManager.DefaultRequestError : requestError,
'html'
);
}
MibAjaxManager.prototype.GetJson = function(url, callback, useCache, beginRequest, endRequest, requestError)
{
this.Get(
url,
useCache,
beginRequest ? function() { beginRequest(); mibAjaxManager.CreateLoading(); } : this.CreateLoading,
callback,
endRequest ? function() { endRequest(); mibAjaxManager.DestroyLoading(); } : this.DestroyLoading,
requestError == null ? mibAjaxManager.DefaultRequestError : requestError,
'json'
);
}
MibAjaxManager.prototype.GetScript = function(url, callback, useCache, beginRequest, endRequest, requestError)
{
this.Get(
url,
useCache,
beginRequest ? function() { beginRequest(); mibAjaxManager.CreateLoading(); } : this.CreateLoading,
callback,
endRequest ? function() { endRequest(); mibAjaxManager.DestroyLoading(); } : this.DestroyLoading,
requestError == null ? mibAjaxManager.DefaultRequestError : requestError,
'script'
);
}
var mibAjaxManager = new MibAjaxManager();
function Url() { }
Url.Build = function(selector, url) {
url = url ? url : "";
var list = jQuery(selector);
if (url.indexOf("?", 0) < 0) {
url += "?";
}
else {
url += "&";
}
for (var i = 0; i < list.length; i++) {
url += list[i].id + "=" + list[i].value;
if (i < list.length - 1) {
url += "&";
}
}
return url;
}
function MibTranslationManager() {
MibTranslationManager.prototype.Length = this.Length = 0;
MibTranslationManager.prototype.Items = new Array();
for (var i = 0; i < arguments.Length; i += 2) {
if (typeof (arguments[i + 1]) != 'undefined') {
this.Items[arguments[i]] = arguments[i + 1];
this.Length++;
}
}
MibTranslationManager.prototype.RemoveItem = function(section, key) {
var tmpValue;
var itemId = '';
if (section != null && section != '')
itemId += section + '/';
itemId += key;
if (typeof (this.Items[itemId.toLowerCase()]) != 'undefined') {
this.Length--;
tmpValue = this.Items[itemId.toLowerCase()];
delete this.Items[itemId.toLowerCase()];
}
return tmpValue;
}
MibTranslationManager.prototype.GetItem = function(section, key) {
var itemId = '';
if (section != null && section != '')
itemId += section + '/';
itemId += key;
return this.Items[itemId.toLowerCase()];
}
MibTranslationManager.prototype.SetItem = function(section, key, value) {
if (typeof (value) != 'undefined') {
var itemId = '';
if (section != null && section != '')
itemId += section + '/';
itemId += key;
if (typeof (this.Items[itemId.toLowerCase()]) == 'undefined') {
this.Length++;
}
this.Items[itemId.toLowerCase()] = value;
}
return value;
}
MibTranslationManager.prototype.HasItem = function(section, key) {
var itemId = '';
if (section != null && section != '')
itemId += section + '/';
itemId += key;
return typeof (this.Items[itemId.toLowerCase()]) != 'undefined';
}
}
var mibTranslation = new MibTranslationManager();
/**
 * @projectDescription Monitor Font Size Changes with jQuery
 *
 * @version 1.0
 * @author Dave Cardwell
 *
 * jQuery-Em - $Revision: 24 $ ($Date: 2007-08-19 11:24:56 +0100 (Sun, 19 Aug 2007) $)
 * http://davecardwell.co.uk/javascript/jquery/plugins/jquery-em/
 *
 * Copyright ©2007 Dave Cardwell <http://davecardwell.co.uk/>
 *
 * Released under the MIT licence:
 * http://www.opensource.org/licenses/mit-license.php
 */

// Upon $(document).ready()…
jQuery(function($) {
    // Configuration…
    var eventName = 'emchange';
    
    
    // Set up default options.
    $.em = $.extend({
        /**
         * The jQuery-Em version string.
         *
         * @example $.em.version;
         * @desc '1.0a'
         *
         * @property
         * @name version
         * @type String
         * @cat Plugins/Em
         */
        version: '1.0',
        
        /**
         * The number of milliseconds to wait when polling for changes to the
         * font size.
         *
         * @example $.em.delay = 400;
         * @desc Defaults to 200.
         *
         * @property
         * @name delay
         * @type Number
         * @cat Plugins/Em
         */
        delay: 200,
        
        /**
         * The element used to detect changes to the font size.
         *
         * @example $.em.element = $('<div />')[0];
         * @desc Default is an empty, absolutely positioned, 100em-wide <div>.
         *
         * @private
         * @property
         * @name element
         * @type Element
         * @cat Plugins/Em
         */
        element: $('<div />').css({ left:     '-100em',
                                    position: 'absolute',
                                    width:    '100em' })
                             .prependTo('body')[0],
        
        /**
         * The action to perform when a change in the font size is detected.
         *
         * @example $.em.action = function() { ... }
         * @desc The default action is to trigger a global “emchange” event.
         * You probably shouldn’t change this behaviour as other plugins may
         * rely on it, but the option is here for completion.
         *
         * @example $(document).bind('emchange', function(e, cur, prev) {...})
         * @desc Any functions triggered on this event are passed the current
         * font size, and last known font size as additional parameters.
         *
         * @private
         * @property
         * @name action
         * @type Function
         * @cat Plugins/Em
         * @see current
         * @see previous
         */
        action: function() {
            var currentWidth = $.em.element.offsetWidth / 100;
            
            // If the font size has changed since we last checked…
            if ( currentWidth != $.em.current ) {
                /**
                 * The previous pixel value of the user agent’s font size. See
                 * $.em.current for caveats. Will initially be undefined until
                 * the “emchange” event is triggered.
                 *
                 * @example $.em.previous;
                 * @result 16
                 *
                 * @property
                 * @name previous
                 * @type Number
                 * @cat Plugins/Em
                 * @see current
                 */
                $.em.previous = $.em.current;
                
                /**
                 * The current pixel value of the user agent’s font size. As
                 * with $.em.previous, this value *may* be subject to minor
                 * browser rounding errors that mean you might not want to
                 * rely upon it as an absolute value.
                 *
                 * @example $.em.current;
                 * @result 14
                 *
                 * @property
                 * @name current
                 * @type Number
                 * @cat Plugins/Em
                 * @see previous
                 */
                $.em.current = currentWidth;
                
                $.event.trigger(eventName, [$.em.current, $.em.previous]);
            }
        }
    }, $.em );
    
    
    /**
     * Bind a function to the emchange event of each matched element.
     *
     * @example $("p").emchange( function() { alert("Hello"); } );
     *
     * @name emchange
     * @type jQuery
     * @param Function fn A function to bind to the emchange event.
     * @cat Plugins/Em
     */

    /**
     * Trigger the emchange event of each matched element.
     *
     * @example $("p").emchange()
     *
     * @name emchange
     * @type jQuery
     * @cat Plugins/Em
     */
    $.fn[eventName] = function(fn) { return fn ? this.bind(eventName, fn)
                                               : this.trigger(eventName); };
    
    
    // Store the initial pixel value of the user agent’s font size.
    $.em.current = $.em.element.offsetWidth / 100;
    
    /**
     * While polling for font-size changes, $.em.iid stores the intervalID in
     * case you should want to cancel with clearInterval().
     *
     * @example window.clearInterval( $.em.iid );
     * 
     * @property
     * @name iid
     * @type Number
     * @cat Plugins/Em
     */
    $.em.iid = setInterval( $.em.action, $.em.delay );
});

/*
 * jqModal - Minimalist Modaling with jQuery
 *   (http://dev.iceburg.net/jquery/jqModal/)
 *
 * Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net>
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 * 
 * $Version: 07/06/2008 +r13
 */
(function($) {
$.fn.jqm=function(o){
var p={
overlay: 50,
overlayClass: 'jqmOverlay',
closeClass: 'jqmClose',
trigger: '.jqModal',
ajax: F,
ajaxText: '',
target: F,
modal: F,
toTop: F,
onShow: F,
onHide: F,
onLoad: F
};
return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s;
H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s};
if(p.trigger)$(this).jqmAddTrigger(p.trigger);
});};

$.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');};
$.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');};
$.fn.jqmShow=function(t){return this.each(function(){$.jqm.open(this._jqm,t);});};
$.fn.jqmHide=function(t){return this.each(function(){$.jqm.close(this._jqm,t)});};

$.jqm = {
hash:{},
open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index'))),z=(z>0)?z:3000,o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z);
 if(c.modal) {if(!A[0])L('bind');A.push(s);}
 else if(c.overlay > 0)h.w.jqmAddClose(o);
 else o=F;

 h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F;
 if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}}

 if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u;
  r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});}
 else if(cc)h.w.jqmAddClose($(cc,h.w));

 if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o);	
 (c.onShow)?c.onShow(h):h.w.show();e(h);return F;
},
close:function(s){var h=H[s];if(!h.a)return F;h.a=F;
 if(A[0]){A.pop();if(!A[0])L('unbind');}
 if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove();
 if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return F;
},
params:{}};
var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),F=false,
i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),
e=function(h){if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);},
f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(_){}},
L=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);},
m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;},
hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function() {
 if(!this[c]){this[c]=[];$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F;});}this[c].push(s);});});};
})(jQuery);
/////<reference path="../Javascript/jquery-em.js">
/*
 * jQuery Form Plugin
*/
; (function($) {

    $.fn.clearForm = function(color) {
        // iterate each matching form
        return this.each(function() {
            // iterate the elements within the form
            $(':input', this).each(function() {

                var type = this.type, tag = this.tagName.toLowerCase();
                if (type == 'text' || type == 'password' || tag == 'textarea')
                    this.value = '';
                else if (type == 'checkbox' || type == 'radio')
                    this.checked = false;
                else if (tag == 'select') {
                    try {
                        if ($($(this).children("option")[0]).attr("value") == "")
                            this.selectedIndex = 0;
                        else this.selectedIndex = -1;
                    } catch (e) { this.selectedIndex = -1; }
                }

                if (color) $(this).css("background-color", color);
            });
        });
    };

})(jQuery);

/////<reference path="../Javascript/jquery-em.js">
// ************************************************************
// JQuery Dialogs
// ************************************************************

function ttvAlert(msg, callback, addClass) {
    if (addClass) $('#alert').addClass(addClass);
    
    $('#alert')
    .jqmShow()
    .find('div.content')
    .html("<span>" + msg + "</span>")
    .end()
    .find(':submit:visible, .close')
    .click(function() {
        if (addClass) $('#alert').removeClass(addClass);
        $('#alert').jqmHide();
        if (callback) {
            try {
                callback();
            } catch (e) { }
        }
    });
    $('#confirm').find('div.content').html("");
}
function ttvConfirm(msg, callback, callbackYesOnly, addClass) {    
    if (addClass) $('#alert').addClass(addClass);
    
    var result = false;
    var yesOnly = callbackYesOnly ? true : false;
    
    $('#confirm')
    .jqmShow()
    .find('div.content')
    .html("<span>" + msg + "</span>")
    .end()
    .find(':submit:visible, .close')
    .click(function() {
        if (addClass) $('#alert').removeClass(addClass);
        if ( !yesOnly || (yesOnly && this.value == Translate('YES')))
        {
            try {
                callback();
            } catch (e) { }
        }
        $('#confirm').jqmHide();
    });
    $('#confirm').find('div.content').html("");
    return result;
}
(function($) {
var ajax = $.ajax;
var pendingRequests = {};
var synced = [];
var syncedData = [];
$.ajax = function(settings) {
settings = jQuery.extend(settings, jQuery.extend({}, jQuery.ajaxSettings, settings));
var port = settings.port;
switch(settings.mode) {
case "abort":
if ( pendingRequests[port] ) {
pendingRequests[port].abort();
}
return pendingRequests[port] = ajax.apply(this, arguments);
case "queue":
var _old = settings.complete;
settings.complete = function(){
if ( _old )
_old.apply( this, arguments );
jQuery([ajax]).dequeue("ajax" + port );;
};
jQuery([ ajax ]).queue("ajax" + port, function(){
ajax( settings );
});
return;
case "sync":
var pos = synced.length;
synced[ pos ] = {
error: settings.error,
success: settings.success,
complete: settings.complete,
done: false
};
syncedData[ pos ] = {
error: [],
success: [],
complete: []
};
settings.error = function(){ syncedData[ pos ].error = arguments; };
settings.success = function(){ syncedData[ pos ].success = arguments; };
settings.complete = function(){
syncedData[ pos ].complete = arguments;
synced[ pos ].done = true;
if ( pos == 0 || !synced[ pos-1 ] )
for ( var i = pos; i < synced.length && synced[i].done; i++ ) {
if ( synced[i].error ) synced[i].error.apply( jQuery, syncedData[i].error );
if ( synced[i].success ) synced[i].success.apply( jQuery, syncedData[i].success );
if ( synced[i].complete ) synced[i].complete.apply( jQuery, syncedData[i].complete );
synced[i] = null;
syncedData[i] = null;
}
};
}
return ajax.apply(this, arguments);
};
})(jQuery);
/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', {expires: 7, path: '/', domain: 'jquery.com', secure: true});
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, key, value, options) {

    if (options.toDelete) { //if delete cookie
        value = _removeCookieValue(name, key);
        key = '';
    }

    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        var path = options.path ? '; path=' + options.path : '/';
        var domain = options.domain ? '; domain=' + options.domain : '';
        var secure = options.secure ? '; secure' : '';
        // replace its value if exist cookie
        value = _addCookieValue(name, key, encodeURIComponent(value));
        document.cookie = [name, '=', value, expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        if (cookieValue != null && typeof key != 'undefined') {
            cookieValue = cookieValue.replace(key + '=', '');
        }
        return cookieValue;
    }
};

function _addCookieValue(cookieName, key, val) {
    // Read all cookie string (the cookie value will be at array postition 1)
    result = document.cookie.match(cookieName + '=([^;]*)');
    if (result == null)
        result = "";
    else
        result = result[1];

    // if key already exists in the cookie, replace its value
    if (result.indexOf(key) > -1)
        result = result.replace(new RegExp(key + '=[^&]*'), key + '=' + val);
    else // If key does not exist int the cookie, put it
        result += ((result != '') ? '&' : '') + key + '=' + val;

    return result;
}

function _removeCookieValue(cookieName, key) {
    // Read all cookie string (the cookie value will be at array postition 1)
    result = document.cookie.match(cookieName + '=([^;]*)');
    if (result == null)
        result = "";
    else
        result = result[1];

    // if key already exists in the cookie, replace its value
    if (result.indexOf(key) > -1)
        result = result.replace(new RegExp(key + '=[^&]*'), '');

    return result;
}
/////<reference path="../Javascript/jquery-em.js">
/////<reference path="jquery.form.js">
/////<reference path="jquery.accordion.js">
/////<reference path="jsCarousel.js">
/////<reference path="translation.js">
/////<reference path="jquery.dialogs.js">
/*
 * jQuery UI Accordion 1.6
 * 
 * Copyright (c) 2007 Jörn Zaefferer
 *
 * http://docs.jquery.com/UI/Accordion
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.accordion.js 4876 2008-03-08 11:49:04Z joern.zaefferer $
 *
 */

;(function($) {

    // If the UI scope is not available, add it
    $.ui = $.ui || {};

    $.fn.extend({
        accordion: function(options, data) {

            var args = Array.prototype.slice.call(arguments, 1);

            return this.each(function() {
                if (typeof options == "string") {
                    var accordion = $.data(this, "ui-accordion");
                    accordion[options].apply(accordion, args);
                    // INIT with optional options
                } else if (!$(this).is(".ui-accordion"))
                    $.data(this, "ui-accordion", new $.ui.accordion(this, options));
            });
        },
        // deprecated, use accordion("activate", index) instead
        activate: function(index) {
            return this.accordion("activate", index);
        }
    });

    $.ui.accordion = function(container, options) {

        // setup configuration
        this.options = options = $.extend({}, $.ui.accordion.defaults, options);
        this.element = container;

        $(container).addClass("ui-accordion");

        if (options.navigation) {
            var current = $(container).children(options.header).filter(options.navigationFilter);
            if (current.length) {
                if (current.filter(options.header).length) {
                    options.active = current;
                } else {
                    options.active = current.parent().parent().prev();
                    current.addClass("current");
                }
            }
        }

        // calculate active if not specified, using the first header
        options.headers = $(container).children(options.header);
        options.active = findActive(options.headers, options.active);

        if (options.fillSpace) {
            var maxHeight = $(container).parent().height();
            options.headers.each(function() {
                maxHeight -= $(this).outerHeight();
            });
            var maxPadding = 0;
            options.headers.next(options.hide).each(function() {
                maxPadding = Math.max(maxPadding, $(this).innerHeight() - $(this).height());
            }).height(maxHeight - maxPadding);
        } else if (options.autoheight) {
            var maxHeight = 0;
            options.headers.next(options.hide).each(function() {
                maxHeight = Math.max(maxHeight, $(this).outerHeight());
            }).height(maxHeight);
        }

        options.headers
		.not(options.active || "")
		.next(options.hide)
		.hide();
        options.active.parent().andSelf().addClass(options.selectedClass);

        if (options.event)
            $(container).bind((options.event) + ".ui-accordion", clickHandler);

    };

    $.ui.accordion.prototype = {
        activate: function(index) {
            // call clickHandler with custom event
            clickHandler.call(this.element, {
                target: findActive(this.options.headers, index)[0]
            });
        },

        enable: function() {
            this.options.disabled = false;
        },
        disable: function() {
            this.options.disabled = true;
        },
        destroy: function() {
            this.options.headers.next(options.hide).css("display", "");
            if (this.options.fillSpace || this.options.autoheight) {
                this.options.headers.next(options.hide).css("height", "");
            }
            $.removeData(this.element, "ui-accordion");
            $(this.element).removeClass("ui-accordion").unbind(".ui-accordion");
        }
    }

    function scopeCallback(callback, scope) {
        return function() {
            return callback.apply(scope, arguments);
        };
    }

    function completed(cancel) {
        // if removed while animated data can be empty
        if (!$.data(this, "ui-accordion"))
            return;
        var instance = $.data(this, "ui-accordion");
        var options = instance.options;
        options.running = cancel ? 0 : --options.running;
        if (options.running)
            return;
        if (options.clearStyle) {
            options.toShow.add(options.toHide).css({
                height: "",
                overflow: ""
            });
        }
        $(this).triggerHandler("change.ui-accordion", [options.data], options.change);
    }

    function toggle(toShow, toHide, data, clickedActive, down) {

        var options = $.data(this, "ui-accordion").options;
        options.toShow = toShow;
        options.toHide = toHide;
        options.data = data;
        var complete = scopeCallback(completed, this);

        // count elements to animate
        options.running = toHide.size() == 0 ? toShow.size() : toHide.size();

        if (options.animated) {
            if (!options.alwaysOpen && clickedActive) {
                $.ui.accordion.animations[options.animated]({
                    toShow: jQuery([]),
                    toHide: toHide,
                    complete: complete,
                    down: down,
                    autoheight: options.autoheight
                });
            } else {
                $.ui.accordion.animations[options.animated]({
                    toShow: toShow,
                    toHide: toHide,
                    complete: complete,
                    down: down,
                    autoheight: options.autoheight
                });
            }
        } else {
            if (!options.alwaysOpen && clickedActive) {
                toShow.toggle();
            } else {
                toHide.hide();
                toShow.show();
            }
            complete(true);
        }
    }

    function clickHandler(event) {
        DestroyIFrame($(this).children('.selected'), "div");

        var options = $.data(this, "ui-accordion").options;
        if (options.disabled)
            return false;
        // called only when using activate(false) to close all parts programmatically
        if (!event.target && !options.alwaysOpen) {
            options.active.parent().andSelf().toggleClass(options.selectedClass);
            var toHide = options.active.next(options.hide),
			data = {
			    instance: this,
			    options: options,
			    newHeader: jQuery([]),
			    oldHeader: options.active,
			    newContent: jQuery([]),
			    oldContent: toHide
			},
			toShow = options.active = $([]);
            toggle.call(this, toShow, toHide, data);
            return false;
        }
        // get the click target
        var clicked = $(event.target);

        // due to the event delegation model, we have to check if one
        // of the parent elements is our actual header, and find that
        if (clicked.parents(options.header).length)
            while (!clicked.is(options.header))
            clicked = clicked.parent();

        var clickedActive = clicked[0] == options.active[0];

        // if animations are still active, or the active header is the target, ignore click
        if (options.running || (options.alwaysOpen && clickedActive))
            return false;
        if (!clicked.is(options.header))
            return;

        // switch classes
        options.active.parent().andSelf().toggleClass(options.selectedClass);
        if (!clickedActive) {
            clicked.parent().andSelf().addClass(options.selectedClass);
        }

        // find elements to show and hide
        var toShow = clicked.next(),
		toHide = options.active.next(options.hide),
        //data = [clicked, options.active, toShow, toHide],
		data = {
		    instance: this,
		    options: options,
		    newHeader: clicked,
		    oldHeader: options.active,
		    newContent: toShow,
		    oldContent: toHide
		},
		down = options.headers.index(options.active[0]) > options.headers.index(clicked[0]);

        // hide IFrame's
        $(toShow).find("iframe").hide();
        $(toHide).find("iframe").hide();

        options.active = clickedActive ? $([]) : clicked;
        toggle.call(this, toShow, toHide, data, clickedActive, down);

        // show IFrame's in toShow
        $(toShow).find("iframe").show();
        return false;
    };

    function findActive(headers, selector) {
        return selector != undefined
		? typeof selector == "number"
			? headers.filter(":eq(" + selector + ")")
			: headers.not(headers.not(selector))
		: selector === false
			? $([])
			: headers.filter(":eq(0)");
    }

    $.extend($.ui.accordion, {
        defaults: {
            selectedClass: "selected",
            alwaysOpen: true,
            animated: 'slide',
            event: "click",
            header: "a",
            hide: "div",
            autoheight: true,
            running: 0,
            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;
                }
                var hideHeight = options.toHide.height(),
				showHeight = options.toShow.height(),
				difference = showHeight / hideHeight;
                options.toShow.css({ height: 0, overflow: 'hidden' }).show();
                options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate({ height: "hide" }, {
                    step: function(now) {
                        var current = (hideHeight - now) * difference;
                        if ($.browser.msie || $.browser.opera) {
                            current = Math.ceil(current);
                        }
                        options.toShow.height(current);
                    },
                    duration: options.duration,
                    easing: options.easing,
                    complete: function() {
                        if (!options.autoheight) {
                            options.toShow.css("height", "auto");
                        }
                        options.complete();
                    }
                });
            },
            bounceslide: function(options) {
                this.slide(options, {
                    easing: options.down ? "bounceout" : "swing",
                    duration: options.down ? 1000 : 200
                });
            },
            easeslide: function(options) {
                this.slide(options, {
                    easing: "easeinout",
                    duration: 700
                })
            }
        }
    });

})(jQuery);

/* Copyright (c) 2006 Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
 *
 * $LastChangedDate: 2007-12-20 09:02:08 -0600 (Thu, 20 Dec 2007) $
 * $Rev: 4265 $
 *
 * Version: 3.0
 * 
 * Requires: $ 1.2.2+
 */

(function($) {

$.event.special.mousewheel = {
	setup: function() {
		var handler = $.event.special.mousewheel.handler;
		
		// Fix pageX, pageY, clientX and clientY for mozilla
		if ( $.browser.mozilla )
			$(this).bind('mousemove.mousewheel', function(event) {
				$.data(this, 'mwcursorposdata', {
					pageX: event.pageX,
					pageY: event.pageY,
					clientX: event.clientX,
					clientY: event.clientY
				});
			});
	
		if ( this.addEventListener )
			this.addEventListener( ($.browser.mozilla ? 'DOMMouseScroll' : 'mousewheel'), handler, false);
		else
			this.onmousewheel = handler;
	},
	
	teardown: function() {
		var handler = $.event.special.mousewheel.handler;
		
		$(this).unbind('mousemove.mousewheel');
		
		if ( this.removeEventListener )
			this.removeEventListener( ($.browser.mozilla ? 'DOMMouseScroll' : 'mousewheel'), handler, false);
		else
			this.onmousewheel = function(){};
		
		$.removeData(this, 'mwcursorposdata');
	},
	
	handler: function(event) {
		var args = Array.prototype.slice.call( arguments, 1 );
		
		event = $.event.fix(event || window.event);
		// Get correct pageX, pageY, clientX and clientY for mozilla
		$.extend( event, $.data(this, 'mwcursorposdata') || {} );
		var delta = 0, returnValue = true;
		
		if ( event.wheelDelta ) delta = event.wheelDelta/120;
		if ( event.detail     ) delta = -event.detail/3;
//		if ( $.browser.opera  ) delta = -event.wheelDelta;
		
		event.data  = event.data || {};
		event.type  = "mousewheel";
		
		// Add delta to the front of the arguments
		args.unshift(delta);
		// Add event to the front of the arguments
		args.unshift(event);

		return $.event.handle.apply(this, args);
	}
};

$.fn.extend({
	mousewheel: function(fn) {
		return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
	},
	
	unmousewheel: function(fn) {
		return this.unbind("mousewheel", fn);
	}
});

})(jQuery);
/* Copyright (c) 2006 Kelvin Luck (kelvin AT kelvinluck DOT com || http://www.kelvinluck.com)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * 
 * See http://kelvinluck.com/assets/jquery/jScrollPane/
 * $Id: jScrollPane.js 42 2009-01-23 20:42:14Z kelvin.luck $
 */

/**
 * Replace the vertical scroll bars on any matched elements with a fancy
 * styleable (via CSS) version. With JS disabled the elements will
 * gracefully degrade to the browsers own implementation of overflow:auto.
 * If the mousewheel plugin has been included on the page then the scrollable areas will also
 * respond to the mouse wheel.
 *
 * @example jQuery(".scroll-pane").jScrollPane();
 *
 * @name jScrollPane
 * @type jQuery
 * @param Object	settings	hash with options, described below.
 *								scrollbarWidth	-	The width of the generated scrollbar in pixels
 *								scrollbarMargin	-	The amount of space to leave on the side of the scrollbar in pixels
 *								wheelSpeed		-	The speed the pane will scroll in response to the mouse wheel in pixels
 *								showArrows		-	Whether to display arrows for the user to scroll with
 *								arrowSize		-	The height of the arrow buttons if showArrows=true
 *								animateTo		-	Whether to animate when calling scrollTo and scrollBy
 *								dragMinHeight	-	The minimum height to allow the drag bar to be
 *								dragMaxHeight	-	The maximum height to allow the drag bar to be
 *								animateInterval	-	The interval in milliseconds to update an animating scrollPane (default 100)
 *								animateStep		-	The amount to divide the remaining scroll distance by when animating (default 3)
 *								maintainPosition-	Whether you want the contents of the scroll pane to maintain it's position when you re-initialise it - so it doesn't scroll as you add more content (default true)
 *								scrollbarOnLeft	-	Display the scrollbar on the left side?  (needs stylesheet changes, see examples.html)
 *								reinitialiseOnImageLoad - Whether the jScrollPane should automatically re-initialise itself when any contained images are loaded
 * @return jQuery
 * @cat Plugins/jScrollPane
 * @author Kelvin Luck (kelvin AT kelvinluck DOT com || http://www.kelvinluck.com)
 */

(function($) {

    $.jScrollPane = {
        active: []
    };
    $.fn.jScrollPane = function(settings) {
        settings = $.extend({}, $.fn.jScrollPane.defaults, settings);

        var rf = function() { return false; };

        return this.each(
		function() {
		    var $this = $(this);
		    // Switch the element's overflow to hidden to ensure we get the size of the element without the scrollbars [http://plugins.jquery.com/node/1208]
		    $this.css('overflow', 'hidden');
		    var paneEle = this;

		    if ($(this).parent().is('.jScrollPaneContainer')) {
		        var currentScrollPosition = settings.maintainPosition ? $this.position().top : 0;
		        var $c = $(this).parent();
		        var paneWidth = $c.innerWidth();
		        var paneHeight = $c.innerHeight();
		        var trackHeight = paneHeight;
		        $('>.jScrollPaneTrack, >.jScrollArrowUp, >.jScrollArrowDown', $c).remove();
		        $this.css({ 'top': 0 });
		    } else {
		        var currentScrollPosition = 0;
		        this.originalPadding = $this.css('paddingTop') + ' ' + $this.css('paddingRight') + ' ' + $this.css('paddingBottom') + ' ' + $this.css('paddingLeft');
		        this.originalSidePaddingTotal = (parseInt($this.css('paddingLeft')) || 0) + (parseInt($this.css('paddingRight')) || 0);
		        var paneWidth = $this.innerWidth();
		        var paneHeight = $this.innerHeight();
		        var trackHeight = paneHeight;
		        $this.wrap(
					$('<div></div>').attr(
						{ 'className': 'jScrollPaneContainer' }
					).css(
						{
						    'height': paneHeight + 'px',
						    'width': paneWidth + 'px'
						}
					)
				);
		        // deal with text size changes (if the jquery.em plugin is included)
		        // and re-initialise the scrollPane so the track maintains the
		        // correct size
		        $(document).bind(
					'emchange',
					function(e, cur, prev) {
					    $this.jScrollPane(settings);
					}
				);

		    }


		    if (settings.reinitialiseOnImageLoad) {
		        // code inspired by jquery.onImagesLoad: http://plugins.jquery.com/project/onImagesLoad
		        // except we re-initialise the scroll pane when each image loads so that the scroll pane is always up to size...
		        // TODO: Do I even need to store it in $.data? Is a local variable here the same since I don't pass the reinitialiseOnImageLoad when I re-initialise?
		        var $imagesToLoad = $.data(paneEle, 'jScrollPaneImagesToLoad') || $('img', $this);
		        var loadedImages = [];

		        if ($imagesToLoad.length) {
		            $imagesToLoad.each(function(i, val) {
		                $(this).bind('load', function() {
		                    if ($.inArray(i, loadedImages) == -1) { //don't double count images
		                        loadedImages.push(val); //keep a record of images we've seen
		                        $imagesToLoad = $.grep($imagesToLoad, function(n, i) {
		                            return n != val;
		                        });
		                        $.data(paneEle, 'jScrollPaneImagesToLoad', $imagesToLoad);
		                        settings.reinitialiseOnImageLoad = false;
		                        $this.jScrollPane(settings); // re-initialise
		                    }
		                }).each(function(i, val) {
		                    if (this.complete || this.complete === undefined) {
		                        //needed for potential cached images
		                        this.src = this.src;
		                    }
		                });
		            });
		        };
		    }

		    var p = this.originalSidePaddingTotal;

		    var cssToApply = {
		        'height': 'auto',
		        'width': paneWidth - settings.scrollbarWidth - settings.scrollbarMargin - p + 'px'
		    }

		    if (settings.scrollbarOnLeft) {
		        cssToApply.paddingLeft = settings.scrollbarMargin + settings.scrollbarWidth + 'px';
		    } else {
		        cssToApply.paddingRight = settings.scrollbarMargin + 'px';
		    }

		    $this.css(cssToApply);

		    var contentHeight = $this.outerHeight();
		    var percentInView = paneHeight / contentHeight;

		    if (percentInView < .99) {
		        var $container = $this.parent();
		        $container.append(
					$('<div></div>').attr({ 'className': 'jScrollPaneTrack' }).css({ 'width': settings.scrollbarWidth + 'px' }).append(
						$('<div></div>').attr({ 'className': 'jScrollPaneDrag' }).css({ 'width': settings.scrollbarWidth + 'px' }).append(
							$('<div></div>').attr({ 'className': 'jScrollPaneDragTop' }).css({ 'width': settings.scrollbarWidth + 'px' }),
							$('<div></div>').attr({ 'className': 'jScrollPaneDragBottom' }).css({ 'width': settings.scrollbarWidth + 'px' })
						)
					)
				);

		        //alert("this: " + $container.atrr("class"));
		        var $track = $('>.jScrollPaneTrack', $container);
		        var $drag = $('>.jScrollPaneTrack .jScrollPaneDrag', $container);

		        if (settings.showArrows) {

		            var currentArrowButton;
		            var currentArrowDirection;
		            var currentArrowInterval;
		            var currentArrowInc;
		            var whileArrowButtonDown = function() {
		                if (currentArrowInc > 4 || currentArrowInc % 4 == 0) {
		                    positionDrag(dragPosition + currentArrowDirection * mouseWheelMultiplier);
		                }
		                currentArrowInc++;
		            };
		            var onArrowMouseUp = function(event) {
		                $('html').unbind('mouseup', onArrowMouseUp);
		                currentArrowButton.removeClass('jScrollActiveArrowButton');
		                clearInterval(currentArrowInterval);
		            };
		            var onArrowMouseDown = function() {
		                $('html').bind('mouseup', onArrowMouseUp);
		                currentArrowButton.addClass('jScrollActiveArrowButton');
		                currentArrowInc = 0;
		                whileArrowButtonDown();
		                currentArrowInterval = setInterval(whileArrowButtonDown, 100);
		            };
		            $container
						.append(
							$('<a></a>')
								.attr({ 'href': 'javascript:;', 'className': 'jScrollArrowUp' })
								.css({ 'width': settings.scrollbarWidth + 'px' })
								.html('Scroll up')
								.bind('mousedown', function() {
								    currentArrowButton = $(this);
								    currentArrowDirection = -1;
								    onArrowMouseDown();
								    this.blur();
								    return false;
								})
								.bind('click', rf),
							$('<a></a>')
								.attr({ 'href': 'javascript:;', 'className': 'jScrollArrowDown' })
								.css({ 'width': settings.scrollbarWidth + 'px' })
								.html('Scroll down')
								.bind('mousedown', function() {
								    currentArrowButton = $(this);
								    currentArrowDirection = 1;
								    onArrowMouseDown();
								    this.blur();
								    return false;
								})
								.bind('click', rf)
						);
		            var $upArrow = $('>.jScrollArrowUp', $container);
		            var $downArrow = $('>.jScrollArrowDown', $container);
		            if (settings.arrowSize) {
		                trackHeight = paneHeight - settings.arrowSize - settings.arrowSize;
		                $track
							.css({ 'height': trackHeight + 'px', top: settings.arrowSize + 'px' })
		            } else {
		                var topArrowHeight = $upArrow.height();
		                settings.arrowSize = topArrowHeight;
		                trackHeight = paneHeight - topArrowHeight - $downArrow.height();
		                $track
							.css({ 'height': trackHeight + 'px', top: topArrowHeight + 'px' })
		            }
		        }

		        var $pane = $(this).css({ 'position': 'absolute', 'overflow': 'visible' });

		        var currentOffset;
		        var maxY;
		        var mouseWheelMultiplier;
		        // store this in a seperate variable so we can keep track more accurately than just updating the css property..
		        var dragPosition = 0;
		        var dragMiddle = percentInView * paneHeight / 2;

		        // pos function borrowed from tooltip plugin and adapted...
		        var getPos = function(event, c) {
		            var p = c == 'X' ? 'Left' : 'Top';
		            return event['page' + c] || (event['client' + c] + (document.documentElement['scroll' + p] || document.body['scroll' + p])) || 0;
		        };

		        var ignoreNativeDrag = function() { return false; };

		        var initDrag = function() {
		            ceaseAnimation();
		            currentOffset = $drag.offset(false);
		            currentOffset.top -= dragPosition;
		            maxY = trackHeight - $drag[0].offsetHeight;
		            mouseWheelMultiplier = 2 * settings.wheelSpeed * maxY / contentHeight;
		        };

		        var onStartDrag = function(event) {
		            initDrag();
		            dragMiddle = getPos(event, 'Y') - dragPosition - currentOffset.top;
		            $('html').bind('mouseup', onStopDrag).bind('mousemove', updateScroll);
		            if ($.browser.msie) {
		                $('html').bind('dragstart', ignoreNativeDrag).bind('selectstart', ignoreNativeDrag);
		            }
		            return false;
		        };
		        var onStopDrag = function() {
		            $('html').unbind('mouseup', onStopDrag).unbind('mousemove', updateScroll);
		            dragMiddle = percentInView * paneHeight / 2;
		            if ($.browser.msie) {
		                $('html').unbind('dragstart', ignoreNativeDrag).unbind('selectstart', ignoreNativeDrag);
		            }
		        };
		        var positionDrag = function(destY) {
		            destY = destY < 0 ? 0 : (destY > maxY ? maxY : destY);
		            dragPosition = destY;
		            $drag.css({ 'top': destY + 'px' });
		            var p = destY / maxY;
		            $this.data('jScrollPanePosition', (paneHeight - contentHeight) * -p);
		            $pane.css({ 'top': ((paneHeight - contentHeight) * p) + 'px' });
		            $this.trigger('scroll');
		            if (settings.showArrows) {
		                $upArrow[destY == 0 ? 'addClass' : 'removeClass']('disabled');
		                $downArrow[destY == maxY ? 'addClass' : 'removeClass']('disabled');
		            }
		        };
		        var updateScroll = function(e) {
		            positionDrag(getPos(e, 'Y') - currentOffset.top - dragMiddle);
		        };

		        var dragH = Math.max(Math.min(percentInView * (paneHeight - settings.arrowSize * 2), settings.dragMaxHeight), settings.dragMinHeight);

		        $drag.css(
					{ 'height': dragH + 'px' }
				).bind('mousedown', onStartDrag);

		        var trackScrollInterval;
		        var trackScrollInc;
		        var trackScrollMousePos;
		        var doTrackScroll = function() {
		            if (trackScrollInc > 8 || trackScrollInc % 4 == 0) {
		                positionDrag((dragPosition - ((dragPosition - trackScrollMousePos) / 2)));
		            }
		            trackScrollInc++;
		        };
		        var onStopTrackClick = function() {
		            clearInterval(trackScrollInterval);
		            $('html').unbind('mouseup', onStopTrackClick).unbind('mousemove', onTrackMouseMove);
		        };
		        var onTrackMouseMove = function(event) {
		            trackScrollMousePos = getPos(event, 'Y') - currentOffset.top - dragMiddle;
		        };
		        var onTrackClick = function(event) {
		            initDrag();
		            onTrackMouseMove(event);
		            trackScrollInc = 0;
		            $('html').bind('mouseup', onStopTrackClick).bind('mousemove', onTrackMouseMove);
		            trackScrollInterval = setInterval(doTrackScroll, 100);
		            doTrackScroll();
		        };

		        $track.bind('mousedown', onTrackClick);

		        $container.bind(
					'mousewheel',
					function(event, delta) {
					    initDrag();
					    ceaseAnimation();
					    var d = dragPosition;
					    positionDrag(dragPosition - delta * mouseWheelMultiplier);
					    var dragOccured = d != dragPosition;
					    return !dragOccured;
					}
				);

		        var _animateToPosition;
		        var _animateToInterval;
		        function animateToPosition() {
		            var diff = (_animateToPosition - dragPosition) / settings.animateStep;
		            if (diff > 1 || diff < -1) {
		                positionDrag(dragPosition + diff);
		            } else {
		                positionDrag(_animateToPosition);
		                ceaseAnimation();
		            }
		        }
		        var ceaseAnimation = function() {
		            if (_animateToInterval) {
		                clearInterval(_animateToInterval);
		                delete _animateToPosition;
		            }
		        };
		        var scrollTo = function(pos, preventAni) {
		            if (typeof pos == "string") {
		                $e = $(pos, $this);
		                if (!$e.length) return;
		                pos = $e.offset().top - $this.offset().top;
		            }
		            $container.scrollTop(0);
		            ceaseAnimation();
		            var maxScroll = contentHeight - paneHeight;
		            pos = pos > maxScroll ? maxScroll : pos;
		            $this.data('jScrollPaneMaxScroll', maxScroll);
		            var destDragPosition = pos / maxScroll * maxY;
		            if (preventAni || !settings.animateTo) {
		                positionDrag(destDragPosition);
		            } else {
		                _animateToPosition = destDragPosition;
		                _animateToInterval = setInterval(animateToPosition, settings.animateInterval);
		            }
		        };
		        $this[0].scrollTo = scrollTo;

		        $this[0].scrollBy = function(delta) {
		            var currentPos = -parseInt($pane.css('top')) || 0;
		            scrollTo(currentPos + delta);
		        };

		        initDrag();

		        scrollTo(-currentScrollPosition, true);

		        // Deal with it when the user tabs to a link or form element within this scrollpane
		        $('*', this).bind(
					'focus',
					function(event) {
					    var $e = $(this);

					    // loop through parents adding the offset top of any elements that are relatively positioned between
					    // the focused element and the jScrollPaneContainer so we can get the true distance from the top
					    // of the focused element to the top of the scrollpane...
					    var eleTop = 0;

					    while ($e[0] != $this[0]) {
					        eleTop += $e.position().top;
					        $e = $e.offsetParent();
					    }

					    var viewportTop = -parseInt($pane.css('top')) || 0;
					    var maxVisibleEleTop = viewportTop + paneHeight;
					    var eleInView = eleTop > viewportTop && eleTop < maxVisibleEleTop;
					    if (!eleInView) {
					        var destPos = eleTop - settings.scrollbarMargin;
					        if (eleTop > viewportTop) { // element is below viewport - scroll so it is at bottom.
					            destPos += $(this).height() + 15 + settings.scrollbarMargin - paneHeight;
					        }
					        scrollTo(destPos);
					    }
					}
				)


		        if (location.hash) {
		            scrollTo(location.hash);
		        }

		        // use event delegation to listen for all clicks on links and hijack them if they are links to
		        // anchors within our content...
		        $(document).bind(
					'click',
					function(e) {
					    $target = $(e.target);
					    if ($target.is('a')) {
					        var h = $target.attr('href');
					        if (h && h.substr(0, 1) == '#') {
					            scrollTo(h);
					        }
					    }
					}
				);

		        $.jScrollPane.active.push($this[0]);

		    } else {
		        $this.css(
					{
					    'height': paneHeight + 'px',
					    'width': paneWidth - this.originalSidePaddingTotal + 'px',
					    'padding': this.originalPadding
					}
				);
		        // remove from active list?
		        $this.parent().unbind('mousewheel');
		    }

		}
	)
    };

    $.fn.jScrollPaneRemove = function() {
        $(this).each(function() {
            $this = $(this);
            var $c = $this.parent();
            if ($c.is('.jScrollPaneContainer')) {
                $this.css(
				{
				    'top': '',
				    'height': '',
				    'width': '',
				    'padding': '',
				    'overflow': '',
				    'position': ''
				}
			);
                $c.after($this).remove();
            }
        });
    }

    $.fn.jScrollPane.defaults = {
        scrollbarWidth: 10,
        scrollbarMargin: 5,
        wheelSpeed: 18,
        showArrows: false,
        arrowSize: 0,
        animateTo: false,
        dragMinHeight: 1,
        dragMaxHeight: 99999,
        animateInterval: 100,
        animateStep: 3,
        maintainPosition: true,
        scrollbarOnLeft: false,
        reinitialiseOnImageLoad: false
    };

    // clean up the scrollTo expandos
    $(window)
	.bind('unload', function() {
	    var els = $.jScrollPane.active;
	    for (var i = 0; i < els.length; i++) {
	        els[i].scrollTo = els[i].scrollBy = null;
	    }
	}
);

})(jQuery);
/////<reference path="../Javascript/jquery-em.js">
/////<reference path="JScripts.js">
/////<reference path="../Javascript/translation.js">
/////<reference path="../Javascript/jquery.dialogs.js">

/****************************************************************************
Random function
****************************************************************************/
var currentRandom = 0;
function updateRandom() {
    var seed = parseInt(Math.random() * 100000);
    currentRandom = new String(seed);
}
function replaceRandom(url) {
    url = url.replace("#random#", currentRandom);
    return url;
}
updateRandom();

/****************************************************************************
Play Item[Content Click]
****************************************************************************/
function contentPlay(url) {
    top.location.href = url;
}

/****************************************************************************
Loomia Call
****************************************************************************/
function loomiaReportClick(url) {
    var script = "<script type=\"text/javascript\" src=\"" + url + "\"></script>";
    document.write(script);
}

/****************************************************************************
Adversise Banner
****************************************************************************/
function setAdBanner(url, ownerDocument) {
    var script = "<script type=\"text/javascript\" src=\"" + replaceRandom(url) + "\"></script>";
    if(ownerDocument) ownerDocument.write(script);
    else document.write(script);
}
function setAdSponsor(url) {
    var script = "<input type=\"hidden\" value=\"" + replaceRandom(url) + "\"/>";
    document.write(script);
}
function setAdFrame(url) {
    setAdSponsor(url);
    writeFrame("");
}

/****************************************************************************
Iframe - Player 
****************************************************************************/
function getSrcSponsorScript(src) {
    var re = new RegExp("\&", "g");
    return contextFullURL + "/Ajax/GetSponsorScript" + addUrlAjaxCall + "?src=" +
        replaceRandom(src).toString().replace("?", "").replace(re, "@@");
}

function writeFrame(src, id, transparent, style) {
    var frame = "<iframe ";
    frame += "frameborder=\"no\" scrolling=\"no\"";
    frame += id != undefined ? " id=\"" + id + "\"" : "";
    frame += transparent != undefined ? " allowtransparency=\"" + transparent + "\"" : "allowtransparency=\"true\"";
    frame += style != undefined ? " style=\"" + style + "\"" : " style=\"height:100%;overflow:hidden;width:100%;\"";
    frame += src != undefined ? " src=\"" + replaceRandom(src) + "\"" : "";
    frame += "></iframe>";

    document.write(frame);
}

function createFrame(src, id, transparent, style, onload) {
    var iframe = document.createElement('iframe');
    if (id != undefined) iframe.id = id;
    iframe.scrolling = "no";
    iframe.frameBorder = "no";
    iframe.allowtransparency = transparent != undefined ? transparent : "true";
    iframe.setAttribute("style", style != undefined ? style :
                        "width:100%;" +
                        "height:100%;" +
                        "overflow:hidden;");

    if (onload != undefined) iframe.onload = onload;

    if (src != undefined) iframe.setAttribute("src", replaceRandom(src));

    return iframe;
}

function getIframeScript(src) {
    if (src) {
        return "<html><body topmargin=\"0\" leftmargin=\"0\" marginheight=\"0\" marginwidth=\"0\">" +
                       "<script type=\"text/javascript\" src=\"" + src + "\"></script>" +
                       "</body></html>";
    }
    return "";
}

function waitForIFrameIE(IFrameObj, html) {
    if (IFrameObj.document.body) {
        createIFrameCallback(IFrameObj, html);
    }
    else {
        setTimeout("waitForIFrameIE(IFrameObj, html)", 10);
    }
}

function createIFrameCallback(IFrameObj, html) {
    IFrameBody = null;
    // Prevents this method from being called multiple times
    if (!IFrameBody) {

        if (jQuery.browser.msie) // IE
        {
            IFrameBody = IFrameObj.document.body;
            IFrameBody.innerHTML = '<html><body>' + html + '</body></html>';
        }
        else // You know...
        {
            IFrameBody = IFrameObj.contentDocument.body;
            IFrameBody.innerHTML = '<html><body>' + html + '</body></html>';
        }
    }
}

/****************************************************************************
Contents - SlideShow
****************************************************************************/
var contentsSlideShow = new Array();
function createSlideShowItem(_ctId, _cnId, _src, _title, _href) {
    this.ctId = _ctId;
    this.cnId = _cnId;
    this.src = _src;
    this.title = _title;
    this.href = _href;
}
function getSlideShowItem(ctId) {
    for (var i = 0; i < contentsSlideShow.length; i++) {
        if (ctId == contentsSlideShow[i].ctId) {
            return contentsSlideShow[i];
        }
    }
    return undefined;
}
function getSlideShowItemByPostion(p) {
    if (p >= 0 && p < contentsSlideShow.length) {
        return contentsSlideShow[p];
    }
    return undefined;
}
function getSlideShowPosition(ctId) {
    for (var i = 0; i < contentsSlideShow.length; i++) {
        if (ctId == contentsSlideShow[i].ctId) {
            return i;
        }
    }
    return undefined;
}
function constainsSlideShowItem(ctId) {
    var item = getSlideShowItem(ctId)
    if (item != undefined) {
        return true;
    }
    return false;
}
function addSlideShowItem(_ctId, _cnId, _src, _title, _href) {
    var item = getSlideShowItem(_ctId)
    if (item != undefined) {
        this.ctId = _ctId;
        this.cnId = _cnId;
        this.src = _src;
        this.title = _title;
        this.href = _href;
    } else {
    item = new createSlideShowItem(_ctId, _cnId, _src, _title, _href);
        contentsSlideShow.push(item);
    }
}
/////<reference path="../Javascript/jquery-em.js">
// ************************************************************************************************
// *** Utility class to read and write cookies
// ************************************************************************************************

var cookieValue;

// This object manages cookies
function CookieManager(cookieName, expirationDate, domain) {
	// ************************************************************************************************
	// *** Interface
	// ************************************************************************************************	

	// Fields
	// ******
	this.cookieName = cookieName;
	this.expirationDate = expirationDate;
	this.domain = domain;
	
	// Methods
	// *******
	this.getValue = cm_getValue;
	this.setValue = cm_setValue;
	
	// ************************************************************************************************
	// *** Methods
	// ************************************************************************************************	
	
	// Return a cookie value (null if key is not found in the cookie)
	function cm_getValue(key) {
		var i;
		var result;

		result = document.cookie.match(key + '=([^;&]*)'); // value will be in the position 1 (first group)

		return (result != null) ? result[1] : null;
	}
	
	// Set a cookie value (create the key/value pair if it is not found in the cookie)
	function cm_setValue(key, val)
	{
		var result = '';
		var expiration = this.expirationDate == null ? '' : 'expires=' + this.expirationDate.toGMTString() + ';';

		// Read all cookie string (the cookie value will be at array postition 1)
		result = document.cookie.match(this.cookieName + '=([^;]*)');
		if(result == null)
			result = "";
		else
			result = result[1];			

		// if key already exists in the cookie, replace its value
		if(result.indexOf(key) > -1)
			result = result.replace(new RegExp(key + '=[^&]*'), key + '=' + val);
		else // If key does not exist int the cookie, put it
			result += ((result != '') ? '&' : '') + key + '=' + val;
			
		// write the cookie
		document.cookie = this.cookieName + '=' + result + ';domain=' + this.domain + ';path=/;' + expiration;
	}
	
	
}	

// Set a cookie value (create the key/value pair if it is not found in the cookie)
function CookieSave(name, key, val, domain, expiration, method)
{

	// Set for method in Web.Config	
	if ( method == null ) 
		method = ckModeWrite;
	
	expirationToString = expiration.toDateString();
			
	if ( method == 1 ) {
		new CookieManager(name, expiration, domain).setValue(key, val);
	} 
	else if ( method == 2 ) 
	{
		cookieService(name, key, val, domain, null, expirationToString, false);
	} 
	else
	{

	    if ($("#actionFrame")) return;
				
		var cHtml = '<form name="formCookie" target="cookieFrame" action="Cookies.aspx">';
		cHtml += '<input type=hidden name="name" value="' + name + '" />';
		cHtml += '<input type=hidden name="writekey" value="' + key + '" />';
		cHtml += '<input type=hidden name="writevalue" value="' + val + '" />';
		cHtml += '<input type=hidden name="writedomain" value="' + domain + '" />';
		cHtml += '<input type=hidden name="writeexpiration" value="' + expirationToString + '" />';
		cHtml += '<input type=hidden name="method" value="SAVE"/>';
		cHtml += '</form>';

		$("#actionFrame").html(cHtml);
		$("#actionFrame").submit();
	}
	
}

function CookieRestore(name, key)
{	
	cookieValue = new CookieManager(name, "", "").getValue(key);	
	return cookieValue;
}

// D'ont use this function 
// used in function from AjaxManager
function AjaxCookieSave()
{
	if(this.httpRequest.status == 200)
	{
		cookieValue = this.httpRequest.responseText;
	}
}
/**
 * --------------------------------------------------------------------
 * jQuery-Plugin "pngFix"
 * Version: 1.2, 09.03.2009
 * by Andreas Eberhard, andreas.eberhard@gmail.com
 *                      http://jquery.andreaseberhard.de/
 *
 * Copyright (c) 2007 Andreas Eberhard
 * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
 *
 * Changelog:
 *    09.03.2009 Version 1.2
 *    - Update for jQuery 1.3.x, removed @ from selectors
 *    11.09.2007 Version 1.1
 *    - removed noConflict
 *    - added png-support for input type=image
 *    - 01.08.2007 CSS background-image support extension added by Scott Jehl, scott@filamentgroup.com, http://www.filamentgroup.com
 *    31.05.2007 initial Version 1.0
 * --------------------------------------------------------------------
 * @example $(function(){$(document).pngFix();});
 * @desc Fixes all PNG's in the document on document.ready
 *
 * jQuery(function(){jQuery(document).pngFix();});
 * @desc Fixes all PNG's in the document on document.ready when using noConflict
 *
 * @example $(function(){$('div.examples').pngFix();});
 * @desc Fixes all PNG's within div with class examples
 *
 * @example $(function(){$('div.examples').pngFix( { blankgif:'ext.gif' } );});
 * @desc Fixes all PNG's within div with class examples, provides blank gif for input with png
 * --------------------------------------------------------------------
 */

(function($) {

jQuery.fn.pngFix = function(settings) {

	// Settings
	settings = jQuery.extend({
		blankgif: 'blank.gif'
	}, settings);

	var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1);
	var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);

	if (jQuery.browser.msie && (ie55 || ie6)) {

		//fix images with png-source
		jQuery(this).find("img[src$=.png]").each(function() {

			jQuery(this).attr('width',jQuery(this).width());
			jQuery(this).attr('height',jQuery(this).height());

			var prevStyle = '';
			var strNewHTML = '';
			var imgId = (jQuery(this).attr('id')) ? 'id="' + jQuery(this).attr('id') + '" ' : '';
			var imgClass = (jQuery(this).attr('class')) ? 'class="' + jQuery(this).attr('class') + '" ' : '';
			var imgTitle = (jQuery(this).attr('title')) ? 'title="' + jQuery(this).attr('title') + '" ' : '';
			var imgAlt = (jQuery(this).attr('alt')) ? 'alt="' + jQuery(this).attr('alt') + '" ' : '';
			var imgAlign = (jQuery(this).attr('align')) ? 'float:' + jQuery(this).attr('align') + ';' : '';
			var imgHand = (jQuery(this).parent().attr('href')) ? 'cursor:hand;' : '';
			if (this.style.border) {
				prevStyle += 'border:'+this.style.border+';';
				this.style.border = '';
			}
			if (this.style.padding) {
				prevStyle += 'padding:'+this.style.padding+';';
				this.style.padding = '';
			}
			if (this.style.margin) {
				prevStyle += 'margin:'+this.style.margin+';';
				this.style.margin = '';
			}
			var imgStyle = (this.style.cssText);

			strNewHTML += '<span '+imgId+imgClass+imgTitle+imgAlt;
			strNewHTML += 'style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+imgAlign+imgHand;
			strNewHTML += 'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;';
			strNewHTML += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + jQuery(this).attr('src') + '\', sizingMethod=\'scale\');';
			strNewHTML += imgStyle+'"></span>';
			if (prevStyle != ''){
				strNewHTML = '<span style="position:relative;display:inline-block;'+prevStyle+imgHand+'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;'+'">' + strNewHTML + '</span>';
			}

			jQuery(this).hide();
			jQuery(this).after(strNewHTML);

		});

		// fix css background pngs
		jQuery(this).find("*").each(function(){
			var bgIMG = jQuery(this).css('background-image');
			if(bgIMG.indexOf(".png")!=-1){
				var iebg = bgIMG.split('url("')[1].split('")')[0];
				jQuery(this).css('background-image', 'none');
				jQuery(this).get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + iebg + "',sizingMethod='scale')";
			}
		});
		
		//fix input with png-source
		jQuery(this).find("input[src$=.png]").each(function() {
			var bgIMG = jQuery(this).attr('src');
			jQuery(this).get(0).runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + bgIMG + '\', sizingMethod=\'scale\');';
   		jQuery(this).attr('src', settings.blankgif)
		});
	
	}
	
	return jQuery;

};
})(jQuery);

//PngFix for IE6
$(document).ready(function() {
	if ($.browser.msie && ($.browser.version.substr(0, 1) < 7))
		$("div.videoLab,#channelListProvider,span.ico").pngFix();
});
var dictionary = new Array();
function TranslationItem(_key, _value)
{
	this.key = _key;
	this.value = _value;
}
function Translate(key)
{
	for(var i = 0; i < dictionary.length; i++)
	{
		if(key == dictionary[i].key)
		{
			return dictionary[i].value;
		}
    }
    if (debugModeEnable) return "[" + key + "]";
    else return "";
}

var openChannels = new Array();
function openChannelItem(_id, _count, _isOpen) {
this.id = _id;
this.count = _count;
this.isOpen = _isOpen;
}
function getChannelItem(id) {
for (var i = 0; i < openChannels.length; i++) {
if (id == openChannels[i].id) {
return openChannels[i];
}
}
return undefined;
}
function getChannelCount(id) {
var item = getChannelItem(id)
if (item != undefined) {
return item.count;
}
return 0;
}
function constainsChannelItem(id) {
var item = getChannelItem(id)
if (item != undefined) {
return true;
}
return false;
}
function isOpenChannelItem(id) {
var item = getChannelItem(id)
if (item != undefined) {
return item.isOpen;
}
return false;
}
function setOpenChannelItem(id) {
var item = getChannelItem(id)
if (item != undefined) {
item.isOpen = true;
}
}
function updateChannelCount(id, count, isOpen) {
addOpenChannelItem(id, count, isOpen);
var channel = $(".channelTree").find("#" + id);
$(channel).html($(channel).attr("title") + " (" + count + ")");
}
function addOpenChannelItem(id, count, isOpen) {
var item = getChannelItem(id)
if (item != undefined) {
item.isOpen = !item.isOpen ? isOpen : item.isOpen;
item.count = count;
} else {
item = new openChannelItem(id, count, isOpen);
openChannels.push(item);
}
}
var firstSearch = true;
function SearchBoxSubmit(key, elementId) {
if ($(elementId)) {
if ($(elementId).attr("value") != Translate("SEARCH_FOR_VIDEOS")) {
var cleanSearch = SearchCleanup($(elementId).attr("value"));
if (searchMin > 0 && cleanSearch.length < searchMin) {
ttvAlert(Translate("INVALID_SEARCH"));
return false;
}
if (searchMax > 0 && cleanSearch.length > searchMax) {
ttvAlert(Translate("INVALID_SEARCH"));
return false;
}
top.location.href = contextURL + "/" + Translate(key) + "/" + escape(cleanSearch) + ".htm";
}
}
return false;
}
function SearchBoxKeyDown(elementId) {
if ($(elementId)) {
var searchPhrase = Translate("SEARCH_FOR_VIDEOS");
if ($(elementId).attr("value").indexOf(searchPhrase) >= 0) {
$(elementId).attr("value", $(elementId).attr("value").replace(searchPhrase, ''));
}
}
}
function SearchBoxEnter(elementId) {
if ($(elementId)) {
var searchPhrase = Translate("SEARCH_FOR_VIDEOS");
if (firstSearch) {
$(elementId).attr("value", searchPhrase);
} else if ($(elementId).attr("value").indexOf(searchPhrase) >= 0) {
$(elementId).attr("value", $(elementId).attr("value").replace(searchPhrase, ''));
}
firstSearch = false;
}
}
function SearchBoxExit(elementId) {
if ($(elementId)) {
if ($(elementId).attr("value") == '') {
$(elementId).attr("value", Translate("SEARCH_FOR_VIDEOS"));
}
}
}
var notUsedChannels = [];
CleanUpNotUsedChannels = function() {
if (notUsedChannels) {
if (!displayWithoutCount) {
if (notUsedChannels.length > 0) {
for (var i = 0; i < notUsedChannels.length; i++) {
notUsedChannels[i].remove();
}
notUsedChannels = [];
}
}
}
}
openNonSearchChannel = function(pChannelId) {
var chanObj = $('#' + pChannelId);
chanObj.parent().children("div").trigger("click");
}
$(document).ready(function() {
var indexSubMenu = $('.channelNav li a').index($('.channelNav li a[@class="subChannel selected"]'));
$('.channelNav li a em').subMenu('.channelNav li', menuAutoOpen, menuAutoClose, indexSubMenu, menuEventMode);
});

/****************************************************************************
formItem's Controller's
****************************************************************************/
var commentForm = new Array();
var commentParams = new Array();
var emailForm = new Array();
var emailParams = new Array();
var contactForm = new Array();
var contactParams = new Array();
function formItem(_id, _param) {
    this.id = _id;
    this.param = _param;
}
function getFormFieldItem(form, _id) {
    for (var i = 0; i < form.length; i++) {
        if (_id == form[i].id) {
            return form[i];
        }
    }
    return undefined;
}
function getFormFieldItemByParam(form, _param) {
    for (var i = 0; i < form.length; i++) {
        if (_param == form[i].param) {
            return form[i];
        }
    }
    return undefined;
}
function addFormFieldItem(form, _id, _param) {
    var item = getFormFieldItem(form, _id)
    if (item == undefined) {
        form.push(new formItem(_id, _param));
    }
}

/* **************************************************************************** *   
PlayerInfo Actions Events // - [Email, Vote]
* ***************************************************************************** */
function sendActionFormGetReturn(form, element) {
    sendActionForm(form, undefined, undefined, true, true, element);     
}

function sendActionForm(form, call, alertAddClass, useAjaxCall, useAlertDefault, element) {
    $(".videoData .loader").show().fadeTo("normal", 0.5);

    var url;
    var msgS;
    var msgE;
    if (validadeActionForm(form, call, alertAddClass, useAlertDefault)) {
        if ($(form).attr("id") == "commentdiv") {
            msgS = Translate("COMMENT_SUCCESS");
            msgE = Translate("COMMENT_ERROR");
            url = sendCommentUrl + "?";
            url += setActionFormUrl(commentForm, commentParams, "#commentdiv");
        } else if ($(form).attr("id") == "contactdiv") {
            msgS = Translate("SEND_MESSAGE_SUCCESS");
            msgE = Translate("SEND_MESSAGE_ERROR");
            url = sendContactUrl + "?";
            url += setActionFormUrl(contactForm, contactParams, "#contactdiv");
        } else if ($(form).attr("id") == "emaildiv") {
            msgS = Translate("EMAIL_SUCCESS");
            msgE = Translate("EMAIL_ERROR");
            url = sendVideoUrl + "?";
            url += setActionFormUrl(emailForm, emailParams, "#emaildiv");
        }

        // Default Content properties
        try {
            url = url.replace("content_title=&", "content_title=" + contentTitle + "&").replace("content_title=&", "content_title=" + contentTitle + "&");
        } catch (e) { }
        try {
            url = url.replace("content_link=&", "content_link=" + contentLink + "&").replace("content_link=&", "content_link=" + contentLink + "&");
        } catch (e) { }
        try {
            url = url.replace("contentid=&", "contentid=" + contentId + "&").replace("content_id=&", "content_id=" + contentId + "&");
            if (url.toLowerCase().indexOf("contentid") < 0 && url.indexOf("content_id") < 0) url += "contentid=" + contentId;
        } catch (e) { }

        // sending
        if (useAjaxCall) {
            ajaxCall(url, element)
        } else {
            callSendAction(url, function() {
                if (useAlertDefault) {
                    alert(msgS);
                    try {
                        call();
                    } catch (e) { }
                } else {
                    ttvAlert(msgS, call, alertAddClass);
                }
                clearActionForm(form);
            }, function() {
                if (useAlertDefault) {
                    alert(msgE);
                    try {
                        call();
                    } catch (e) { }
                } else {
                    ttvAlert(msgE, call, alertAddClass);
                }
                clearActionForm(form);
            });
        }
    }
}

function setActionFormUrl(formInputs, formParams, formElement) {
    var value;
    var url = "";
    for (var i = 0; i < formParams.length; i++) {
        var item = getFormFieldItemByParam(formInputs, formParams[i].id);
        if (item != undefined) {
            value = $(formElement + " #" + item.id).attr("value");
            if (value) {
                url += formParams[i].id + "=" + value;
            } else if (formParams[i].param != "") {
                url += formParams[i].id + "=" + formParams[i].param;
            } else {
                url += formParams[i].id + "=";
            }
        } else {
            if (formParams[i].param != "") {
                url += formParams[i].id + "=" + formParams[i].param;
            } else {
                url += formParams[i].id + "=";
            }
        }
        url += "&";
    }
    return url;
}

function validadeActionForm(form, call, alertAddClass, useAlertDefault) {

    var isValid = true;
    var haveError = false;
    var colorError = Translate("ERROR_FIELD_COLOR");
    if (colorError == "[ERROR_FIELD_COLOR]" || colorError == "") colorError = "yellow";
    var msgKey = Translate("INVALID_INPUT");

    $(form).children("fieldset").each(function validate() {

        var inputs = $(':input', this).not(":hidden");
        inputs.each(function() {

            $(this).css("background-color", "#ffffff");

            var input = $(this).attr("value");
            var regex = $(this).next(":hidden").attr("value");
            var lenght = $(this).next(":hidden").next(":hidden").attr("value");

            try {
                if (regex && input) {
                    if (input == '') {
                        $(this).css("background-color", colorError);
                        isValid = false;
                        msgKey = Translate("FILL_ALL_FIELDS");
                        return false;
                    } else if ((lenght) && input.length < lenght) {
                        $(this).css("background-color", colorError, alertAddClass);
                        isValid = false;
                        msgKey = Translate("ENTER_MINIMUM_CHARACTERS") + ": " + lenght;
                        return false;
                    } else if (!input.match(regex)) {
                        $(this).css("background-color", colorError, alertAddClass);
                        isValid = false;
                    } else {
                        $(this).css("background-color", "#ffffff");
                    }
                } else if (regex) {
                    $(this).css("background-color", colorError, alertAddClass);
                    isValid = false;
                    msgKey = Translate("FILL_ALL_FIELDS");
                    return false;
                } else if ((lenght) && input.length < lenght) {
                    $(this).css("background-color", colorError);
                    isValid = false;
                    msgKey = Translate("ENTER_MINIMUM_CHARACTERS") + ": " + lenght;
                    return false;
                }
            } catch (err) {
                msgKey = Translate("VALIDATE_FORM_ERROR") + "\n\n";
                msg += Translate("ERROR_DESCRIPTION") + err.description + "\n\n";
                msg += Translate("CLICK_OK_TO_CONTINUE");
                haveError = true;
                return false;
            }
        });

        if (isValid == false || haveError == true) return false;

    });

    if (isValid == false || haveError == true) {
        if (useAlertDefault) {
            alert(msgKey);
            try {
                call();
            } catch (e) { }
        } else {
            ttvAlert(msgKey, call, alertAddClass);
        }
        return false;
    }
    return true;
}

function clearActionForm(form) {
    $(form).clearForm("#FFFFFF");
}
/* **************************************************************************** */
var voteValue = 0;
function saveVoteValue(starSel) {
voteValue = starSel;
}
function restoreVoteValue() {
$("#votestars").children("div").attr("class", "star star_live");
$("#votestarsInfo").children("div").attr("class", "star star_live");
$("#votestarsEmail").children("div").attr("class", "star star_live");
for (var star = 1; star <= voteValue; star++) {
$("#starvote" + star.toString()).attr("class", 'star star_live star_hover');
$("#starvoteInfo" + star.toString()).attr("class", 'star star_live star_hover');
$("#starvoteEmail" + star.toString()).attr("class", 'star star_live star_hover');
}
if (!checkVote()) {
var TextRestore = Translate("MAKE_A_VOTE");
$("#descVoteInfo, #descVote, #descVoteEmail").empty().html(TextRestore);
}
}
function selectStarVote(starSel, idElem, idTextElem) {
var TextSelect;
switch (starSel) {
case 1: TextSelect = Translate("TERRIBLE"); break;
case 2: TextSelect = Translate("BAD"); break;
case 3: TextSelect = Translate("REGULAR"); break;
case 4: TextSelect = Translate("GOOD"); break;
case 5: TextSelect = Translate("EXCELLENT"); break;
}
if (!checkVote()) {
for (var star = 1; star <= 5; star++) {
if (star <= starSel) {
$(idElem + star.toString()).attr("class", 'star star_live star_hover');
$(idTextElem).html(TextSelect);
} else {
$(idElem + star.toString()).attr("class", 'star star_live');
}
}
}
}
function clickStarVote(starSel) {
$(".videoData .loader").show().fadeTo("normal", 0.5);
if (!checkVote()) {
disableVote(true, starSel)
var url = sendVoteUrl + "?contentid=" + contentId + "&rate= " + starSel;
callSendAction(url, function() {
callVoted("success", Translate("VOTE_SUCCESS"));
hideLayerVideoData();
}, function() {
callVoted("error", Translate("VOTE_ERROR"));
hideLayerVideoData();
});
SaveVote();
saveVoteValue(starSel);
restoreVoteValue();
}
else {
callVoted("already", Translate("ALREADY_VOTE"));
}
}
function callVoted(opt, msg) {
var votesTotal = parseInt(totalVoteCount) + 1;
$("#descVote, #descVoteEmail, #descVoteInfo").empty().html(msg);
if (opt == "success") {
$("#totalVote, #totalVoteEmail, #totalVoteInfo").empty().html("&nbsp;&nbsp;" + votesTotal.toString() + ' ' + Translate("VOTES"));
}
}
function SaveVote() {
if (contentId) {
CookieSave(cookieSettings, "alreadyVote-" + contentId, true, ckDomain, expirationDate, ckModeWrite);
}
}
function checkVote() {
try{
return Boolean(CookieRestore(cookieSettings, "alreadyVote-" + contentId));
}
catch(e) {
return false;
}
}
function disableVote(voting, starSel) {
for (var star = 1; star <= 5; star++) {
if (voting) {
if (star <= starSel) {
$("#starvote" + star.toString()).attr("class", 'star star_hover');
$("#starvoteInfo" + star.toString()).attr("class", 'star star_hover');
$("#starvoteEmail" + star.toString()).attr("class", 'star star_hover');
} else {
$("#starvote" + star.toString()).attr("class", 'star');
$("#starvoteInfo" + star.toString()).attr("class", 'star');
$("#starvoteEmail" + star.toString()).attr("class", 'star');
}
}
document.getElementById("svote" + star.toString()).disabled = true;
document.getElementById("svoteInfo" + star.toString()).disabled = true;
document.getElementById("svoteEmail" + star.toString()).disabled = true;
document.getElementById("svote" + star.toString()).onmouseout = null;
document.getElementById("svoteInfo" + star.toString()).onmouseout = null;
document.getElementById("svoteEmail" + star.toString()).onmouseout = null;
document.getElementById("svote" + star.toString()).onmouseover = null;
document.getElementById("svoteInfo" + star.toString()).onmouseover = null;
document.getElementById("svoteEmail" + star.toString()).onmouseover = null;
document.getElementById("starvote" + star.toString()).onmouseout = null;
document.getElementById("starvoteInfo" + star.toString()).onmouseout = null;
document.getElementById("starvoteEmail" + star.toString()).onmouseout = null;
document.getElementById("svote" + star.toString()).onclick = null;
document.getElementById("svoteInfo" + star.toString()).onclick = null;
document.getElementById("svoteEmail" + star.toString()).onclick = null;
$("#svote" + star.toString()).css("cursor", "default");
$("#svoteInfo" + star.toString()).css("cursor", "default");
$("#svoteEmail" + star.toString()).css("cursor", "default");
}
}
function hideLayerVideoData() {
$(".videoData .loader").hide();
}
function onPaginationClick(pParam, pOffset, pLimit, pCount, pChannelId, pChannelTree, pTemplateId, pPosition) {
SearchOffset = pOffset;
var url = contextURL + "/Ajax/ContentsSearch" + addUrlAjaxCall + "?param=" + pParam + "&offset=" +
pOffset + "&limit=" + pLimit + "&channelId=" + pChannelId + "&channelTree=" + pChannelTree +
"&templateId=" + pTemplateId + "&position=" + pPosition;
$("#listContainer .loader").show().fadeTo("normal", 0.5, function() {
$(this).height($("#contentsResult").height());
});
$.get(url, function(data, success) {
if (success) {
reloadPagination(pParam, pOffset, pLimit, pCount, pChannelId, pChannelTree, pTemplateId, pPosition);
$('#contentsResult').empty().html(data);
}
$("#listContainer .loader").fadeOut("slow", pageload);
document.getElementById("listContainer").scrollIntoView();
});
$("#uvTagScript").attr("src", $("#uvTagScript").attr("src"));
}
function reloadPagination(pParam, pOffset, pLimit, pCount, pChannelId, pChannelTree, pTemplateId, pPosition) {
var url = contextURL + "/Ajax/LoadPagination" + addUrlAjaxCall + "?param=" + pParam + "&offset=" +
pOffset + "&limit=" + pLimit + "&count=" + pCount + "&channelId=" + pChannelId + "&channelTree=" + pChannelTree;
var newPosition = 0;
var tempId = 0;
try {
if (pTemplateId) {
tempId = parseInt(pTemplateId);
}
} catch (e) { }
if (tempId == 0) {
try {
if (templateId) {
tempId = parseInt(templateId);
}
} catch (e) { }
}
if (tempId == 0) tempId = 5;
try {
if (pPosition) {
newPosition = parseInt(pPosition);
}
} catch (e) { }
if (newPosition == 0) {
try{
if (position) {
newPosition = parseInt(position);
}
}catch(e){}
}
if (newPosition == 0) newPosition = 3;
url += "&templateId=" + tempId;
url += "&position=" + newPosition;
$.get(url, function(data, success) {
if (success) {
$('#PaginationTop, #Pagination').empty().html(data).fadeIn();
}
});
}
function onChannelTreeOpen(pThis) {
if (SearchParam == null || SearchParam == '') return;
if (!externalSearchEnable) return;
var pChannelId = $(pThis).attr("id");
var pChannelTree = escape($(pThis).attr("name"));
var count = getChannelCount(pChannelId);
if (contextURL != undefined && (SearchParam != undefined && SearchParam != "") && SearchOffset != undefined &&
SearchLimit != undefined && pChannelId != undefined && pChannelTree != undefined && count != undefined && count > 0 ) {
var isOpen = isOpenChannelItem(pChannelId, SearchParam);
if (!isOpen) {
var uurl = contextURL + "/Ajax/OpenChannelTree" + addUrlAjaxCall + "?param=" + SearchParam + "&offset=" +
SearchOffset + "&limit=" + SearchLimit + "&count=" + count +
"&channelId=" + pChannelId + "&channelTree=" + pChannelTree;
if (!isOpenChannelItem(pChannelId, SearchParam)) {
$(".channelTree .loader").show().fadeTo("normal", 0.5);
$.ajax(
{
type: 'GET',
contentType: 'application/x-www-form-urlencoded; charset=ISO-8859-1',
url: uurl,
success: function(data) {
if (data) {
$(pThis).append(data.toString());
}
$(".channelTree .loader").fadeOut("slow");
}
});
}
}
}
}
function onChannelTreeClick(pChannelId, pChannelTree, pThis) {
var pCount = getChannelCount(pChannelId);
var pParam = SearchParam;
var pOffset = 1; //SearchOffset;
var pLimit = SearchLimit;
if (pChannelId == undefined) pChannelId = $(pThis).attr("id");
if (pChannelTree == undefined) pChannelTree = $(pThis).attr("name");
if (pCount == 0) pCount = SearchCount;
SearchChannelId = pChannelId;
$('.channelTree a').removeClass("selected");
var url;
var isSearch = pParam && pParam != '';
if (isSearch) {
openNonSearchChannel(pChannelId);
}
url = contextURL + "/Ajax/ContentsSearch" + addUrlAjaxCall + "?param=" + pParam + "&offset=" + pOffset + "&limit=" + pLimit + "&channelId=" + pChannelId + "&channelTree=" + pChannelTree;
if (isSearch) {
var tempId = 5;
try {
if (templateId) {
tempId = parseInt(templateId);
}
} catch (e) { }
if (tempId == 0) tempId = 5;
url += "&templateId=" + tempId;
}
$("#listContainer .loader").show().fadeTo("normal", 0.5);
$.get(url, function(data, success) {
if (success) {
reloadPagination(pParam, pOffset, pLimit, pCount, pChannelId, pChannelTree);
$('#contentsResult').empty().html(data);
}
$("#listContainer .loader").fadeOut("slow", pageload);
});
url = contextURL + "/Ajax/ContentsSearchViews" + addUrlAjaxCall + "?param=" + pParam + "&offset=" + pOffset + "&limit=" +
pLimit + "&channelId=" + pChannelId + "&channelTree=" + pChannelTree;
$("#contentsSearchViews .loader").show().fadeTo("normal", 0.5);
$.get(url, function(data, success) {
if (success) {
$('#contentsSearchViews').empty().html(data);
}
$("#contentsSearchViews .loader").fadeOut("slow", pageload);
});
url = contextURL + "/Ajax/ContentSearchVoteds" + addUrlAjaxCall + "?param=" + pParam + "&offset=" + pOffset + "&limit=" +
pLimit + "&channelId=" + pChannelId + "&channelTree=" + pChannelTree;
$("#contentsSearchVoteds .loader").show().fadeTo("normal", 0.5);
$.get(url, function(data, success) {
if (success) {
$('#contentsSearchVoteds').empty().html(data);
}
$("#contentsSearchVoteds .loader").fadeOut("slow", pageload);
});
url = contextURL + "/Ajax/ContentsSearchLatest" + addUrlAjaxCall + "?param=" + pParam + "&offset=" + pOffset + "&limit=" +
pLimit + "&channelId=" + pChannelId + "&channelTree=" + pChannelTree;
$("#contentsSearchLatest .loader").show().fadeTo("normal", 0.5);
$.get(url, function(data, success) {
if (success) {
$('#contentsSearchLatest').empty().html(data);
}
$("#contentsSearchLatest .loader").fadeOut("slow", pageload);
});
$(pThis).addClass("selected");
}
function slideShowClick(cnId, ctId) {
$(".video .loader").show();
$("#prevPlay, #nextPlay, .video a").hide();
var url = contextURL + "/Ajax/SlideShowPlay" + addUrlAjaxCall + "?channelId=" + cnId +
"&contentId=" + ctId + "&random=" + currentRandom;
contentId = ctId;
$.get(url, function(data, success) {
if (success) {
$('.playerContainer').empty().html(data).fadeIn("slow", pageload);
$(".turnOffLight").show();
} else {
$("#prevPlay, #nextPlay, .video a").show();
}
$(".video .loader").hide();
});
}
function updateContentInfo(ctId, cnId, templateMode, adMode) {
contentId = ctId;
var url;
if (adMode) {
url = contextURL + "/Ajax/SetVideoAdMode" + addUrlAjaxCall + "?contentId=" + ctId;
} else {
url = contextURL + "/Ajax/UpdateContentInfo" + addUrlAjaxCall + "?contentId=" + ctId;
}
if (cnId) {
url += "&channelId=" + cnId;
channelId = cnId;
}
else if (channelId) {
url += "&channelId=" + channelId;
}
url += "&templateMode=" + templateMode;
$('.videoData').attr("class", "videoData");
$(".videoData .loader").show().fadeTo("normal", 0.5);
$.get(url, function(data, success) {
if (success) {
$('.videoData').empty().html(data).fadeIn("slow", pageload);
}
});
}
function setVideoAdMode(ctId, cnId, templateMode) {
updateContentInfo(ctId, cnId, templateMode, true)
}
function callSendAction(url, callSuccess, callError) {
$.get(url, function(data, success) {
if (data.toString().toLowerCase() == "true" || data.toString().toLowerCase() == "") {
try {
callSuccess();
} catch (e) { }
}
else {
try {
callError();
} catch (e) { }
}
});
}
function ajaxCall(url, element, loadElement, append, call) {
try {
$(loadElement).show().fadeTo("normal", 0.5);
} catch (e) { }
$.get(url, function(data, success) {
if (success) {
if (append) $(element).appendTo(data).fadeIn("slow", call);
else $(element).empty().html(data).fadeIn("slow", call);
$(loadElement).fadeOut("slow");
} else {
$(loadElement).fadeOut("slow", call);
}
});
}
function sendTwitter() {
var login;
var senha;
var mensagem;
var Url;
login = $("#loginTwitter").attr("value");
senha = $("#passwordTwitter").attr("value");
mensagem = $("#commentTwitter").attr("value");
Url = urlSendTwitter.replace("#login#", encodeURIComponent(login)).replace("#senha#",encodeURIComponent(senha)).replace("#mensagem#", encodeURIComponent(mensagem));
if (login != "" && senha != "" && mensagem != "") {
$(".areaCont #loader").show().fadeTo("normal", 0.5);
$(".areaCont #loader").attr("class", "loader");
$("#twitter ").hide();
$.ajax(
{
type: 'GET',
url: Url,
success: function(data) {
if (data) {
ttvAlert(data, null, alertVideoDataAddClass)
$(".areaCont #loader").hide();
$(".areaCont #loader").attr("class", "");
hideDivTwitter();
}
},
error: function(){
$(".areaCont #loader").hide();
$(".areaCont #loader").attr("class", "");
hideDivTwitter();
}
});
}
else {
ttvAlert(Translate("FORM_IMCOMPLETE"), null, alertVideoDataAddClass);
}
}
function setCookieSession(mode, src) {
url = contextURL + "/Ajax/SetCookieSession" + addUrlAjaxCall + "?mode=" + mode + "&src=" + src;
$.get(url, function(data, success) {
if (success) {
$("#container").append(data);
}
});
}
/*
    _/     _/     _/_/      _/    _/  _/   _/    _/_/_/  _/
  _/ _/  _/ _/   _/  _/  _/  _/  _/  _/  _/ _/  _/      _/
 _/     _/  _/  _/_/    _/  _/  _/  _/   _/_   _/_/    _/
_/ _/  _/_/_/  _/  _/  _/  _/  _/  _/  _  _/  _/      _/ 
 _/   _/  _/  _/  _/    _/      _/     _/_/  _/_/_/  _/_/_/

*/
Array.prototype.PosElem = function(elem) { var pos = (-1); for (i = 0; i < this.length; i++) { if (this[i].elementContent == elem) { pos = i; break; } } return pos; };

var Carousel = function(ParamsArray) { try { return new Carousel.fn.init(ParamsArray); } catch (e) { alert(e.message); } };

Carousel.fn = Carousel.prototype = {

    init: function(paramsArray) {
        var posArray = paramsArray.pos;

        if (window._CAROUSEL == undefined) {
            window._CAROUSEL = new Array();
        }

        if (posArray == undefined) {
            posArray = window._CAROUSEL.length;
            paramsArray.pos = posArray;
            window._CAROUSEL[posArray] = new Carousel(paramsArray);
        }
        else {
            this.insertParams(paramsArray);
            if (paramsArray.elementHandlerLeft != "") {
                this.elemHandlerLeft = $(paramsArray.elementHandlerLeft).bind(
					this.event,
					function(e) {
					    ExecuteFuncCarrousel("#" + $("#" + this.parentNode.id).children("div").children("ul").attr("id"), "eventLeft", "");
					}
				);
                if (this.continuous == "yes") {
                    this.elemHandlerLeftOut = $(paramsArray.elementHandlerLeft).mouseout(
						function(e) {
						    var posThis = window._CAROUSEL.PosElem("#" + $("#" + this.parentNode.id).children("div").children("ul").attr("id"));
						    window._CAROUSEL[posThis].mouseEventOutLeft = true;
						}
					);
                }
            }
            if (paramsArray.elementHandlerRight != "") {
                this.elemHandlerRight = $(paramsArray.elementHandlerRight).bind(
					this.event,
					function(e) {
					    ExecuteFuncCarrousel("#" + $("#" + this.parentNode.id).children("div").children("ul").attr("id"), "eventRight", "");
					}
				);
                if (this.continuous == "yes") {
                    this.elemHandlerRightOut = $(paramsArray.elementHandlerRight).mouseout(
						function(e) {
						    var posThis = window._CAROUSEL.PosElem("#" + $("#" + this.parentNode.id).children("div").children("ul").attr("id"));
						    window._CAROUSEL[posThis].mouseEventOutRight = true;
						}
					);
                }
            }
        }
    },

    exec: function(elementContent, direction, posArray) {
        var pixels, Content, cont;
        var width = this.widthContent * this.elementsReplace;
        var position = (this.isinit) ? "0" : elementContent.css("left").replace("px", "");
        var stop = (direction == "left") ? (-width) : width;
        var piece = eval(((width - (width % this.speed)) / this.speed));

        position = (position == "auto") ? "0" : position;

        if ((eval(position - stop) == (width % this.speed)) || ((position == (-width % this.speed)) && (position != 0))) {
            piece = (width % this.speed);
        }

        if (direction == "right" && position == "0") {
            for (cont = 0; cont < this.elementsReplace; cont++) {
                Content = elementContent.children(":last");
                elementContent.children(":first").before(Content);
            }

            pixels = eval(position + "-" + stop);
            elementContent.css("left", pixels + "px");
            stop = 0;
        }
        position = (elementContent.css("left") != null && elementContent.css("left") != "auto") ? elementContent.css("left").replace("px", "") : "0";
        this.isinit = false;

        if (eval(position) != stop) {
            if (direction == "left" && (this.status == "left" || this.status == "free")) {
                pixels = eval(position + "-" + piece);
                elementContent.css("left", pixels + "px");
                setTimeout("ExecuteFuncCarrousel('" + this.elementContent + "','" + direction + "'," + posArray + ")", 50);

            }
            else if (direction == "right" && (this.status == "right" || this.status == "free")) {
                pixels = eval(position + "+" + piece);
                elementContent.css("left", pixels + "px");
                if (pixels != 0) {
                    setTimeout("ExecuteFuncCarrousel('" + this.elementContent + "','" + direction + "'," + posArray + ")", 50);
                }
                else {
                    if (this.continuous == "yes")
                        this.testMousePosition(direction, posArray);
                }
            }
        }
        else {
            if (direction == "left") {
                for (cont = 0; cont < this.elementsReplace; cont++) {
                    Content = elementContent.children(":first");
                    elementContent.children(":last").after(Content);
                }
                pixels = eval(position - stop);
                elementContent.css("left", pixels + "px");
                if (this.continuous == "yes")
                    this.testMousePosition(direction, posArray);
            }
        }
    },

    testMousePosition: function(direction, pos) {
        if (!this.mouseEventOutLeft && direction == this.directionLeft) {
            ExecuteFuncCarrousel(this.elementContent, direction, pos);
        }
        else if (!this.mouseEventOutRight && direction == this.directionRight) {
            ExecuteFuncCarrousel(this.elementContent, direction, pos);
        }
        else { 
            this.status = "free"
        }
    },

    insertParams: function(params) {
        if (params.elementContent != undefined) this.elementContent = params.elementContent;
        if (params.event != undefined) this.event = params.event;
        if (params.continuous != undefined) this.continuous = params.continuous;
        if (params.widthContent != undefined) this.widthContent = params.widthContent;
        if (params.speed != undefined) this.speed = params.speed;
        if (params.elementsReplace != undefined) this.elementsReplace = params.elementsReplace;
        if (params.directionEvent != undefined) this.directionEvent = params.directionEvent;
        if (this.directionEvent == "inverse") { this.directionLeft = "right"; this.directionRight = "left"; }
    },

    elemHandlerLeft: "",
    elemHandlerLeftOut: "",
    elemHandlerRight: "",
    elemHandlerRightOut: "",
    directionLeft: "left",
    directionRight: "right",
    event: "click",
    directionEvent: "",
    mouseEventOutLeft: "",
    mouseEventOutRight: "",
    continuous: "no",
    status: "free",
    isinit: true,
    elementContent: "",
    widthContent: 0,
    speed: 1,
    elementsReplace: 1
};

Carousel.fn.init.prototype = Carousel.fn;

function ExecuteFuncCarrousel(elementContent, direction, pos) {
    var posThis = 0;
    if (direction == "eventRight") {
        posThis = window._CAROUSEL.PosElem(elementContent);
        if (window._CAROUSEL[posThis].status == "free") {
            window._CAROUSEL[posThis].mouseEventOutRight = false;
            window._CAROUSEL[posThis].status = window._CAROUSEL[posThis].directionRight;
            window._CAROUSEL[posThis].exec($(window._CAROUSEL[posThis].elementContent), window._CAROUSEL[posThis].directionRight, posThis);
        }
    }
    else if (direction == "eventLeft") {
        posThis = window._CAROUSEL.PosElem(elementContent);
        if (window._CAROUSEL[posThis].status == "free") {
            window._CAROUSEL[posThis].mouseEventOutLeft = false;
            window._CAROUSEL[posThis].status = window._CAROUSEL[posThis].directionLeft;
            window._CAROUSEL[posThis].exec($(window._CAROUSEL[posThis].elementContent), window._CAROUSEL[posThis].directionLeft, posThis);
        }
    }
    else {
        window._CAROUSEL[pos].exec($(elementContent), direction, pos);
    }
}
/////<reference path="../Javascript/jquery-em.js">
/*
 * Treeview 1.4 - jQuery plugin to hide and show branches of a tree
 * 
 * http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
 * http://docs.jquery.com/Plugins/Treeview
 *
 * Copyright (c) 2007 Jörn Zaefferer
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.treeview.js 4684 2008-02-07 19:08:06Z joern.zaefferer $
 *
 */

;(function($) {

	$.extend($.fn, {
		swapClass: function(c1, c2) {
			var c1Elements = this.filter('.' + c1);
			this.filter('.' + c2).removeClass(c2).addClass(c1);
			c1Elements.removeClass(c1).addClass(c2);
			return this;
		},
		replaceClass: function(c1, c2) {
			return this.filter('.' + c1).removeClass(c1).addClass(c2).end();
		},
		hoverClass: function(className) {
			className = className || "hover";
			return this.hover(function() {
				$(this).addClass(className);
			}, function() {
				$(this).removeClass(className);
			});
		},
		heightToggle: function(animated, callback) {
			animated ?
				this.animate({ height: "toggle" }, animated, callback) :
				this.each(function() {
					jQuery(this)[jQuery(this).is(":hidden") ? "show" : "hide"]();
					if (callback)
						callback.apply(this, arguments);
				});
		},
		heightHide: function(animated, callback) {
			if (animated) {
				this.animate({ height: "hide" }, animated, callback);
			} else {
				this.hide();
				if (callback)
					this.each(callback);
			}
		},
		prepareBranches: function(settings) {
			if (!settings.prerendered) {
				// mark last tree items
				this.filter(":last-child:not(ul)").addClass(CLASSES.last);
				// collapse whole tree, or only those marked as closed, anyway except those marked as open
				this.filter((settings.collapsed ? "" : "." + CLASSES.closed) + ":not(." + CLASSES.open + ")").find(">ul").hide();
			}
			// return all items with sublists
			return this.filter(":has(>ul)");
		},
		applyClasses: function(settings, toggler) {
			this.filter(":has(>ul):not(:has(>a))").find(">span").click(function(event) {
				toggler.apply($(this).next());
			}).add($("a", this)).hoverClass();

			if (!settings.prerendered) {
				// handle closed ones first
				this.filter(":has(>ul:hidden)")
						.addClass(CLASSES.expandable)
						.replaceClass(CLASSES.last, CLASSES.lastExpandable);

				// handle open ones
				this.not(":has(>ul:hidden)")
						.addClass(CLASSES.collapsable)
						.replaceClass(CLASSES.last, CLASSES.lastCollapsable);

				// create hitarea
				this.prepend("<div class=\"" + CLASSES.hitarea + "\"/>").find("div." + CLASSES.hitarea).each(function() {
					var classes = "";
					$.each($(this).parent().attr("class").split(" "), function() {
						classes += this + "-hitarea ";
					});
					$(this).addClass(classes);
				});
			}

			// apply event to hitarea
			this.find("div." + CLASSES.hitarea).click(toggler);
		},
		treeview: function(settings) {

			settings = $.extend({
				cookieId: "treeview"
			}, settings);

			if (settings.add) {
				return this.trigger("add", [settings.add]);
			}

			if (settings.toggle) {
				var callback = settings.toggle;
				settings.toggle = function() {
					return callback.apply($(this).parent()[0], arguments);
				};
			}

			// factory for treecontroller
			function treeController(tree, control) {
				// factory for click handlers
				function handler(filter) {
					return function() {
						// reuse toggle event handler, applying the elements to toggle
						// start searching for all hitareas
						toggler.apply($("div." + CLASSES.hitarea, tree).filter(function() {
							// for plain toggle, no filter is provided, otherwise we need to check the parent element
							return filter ? $(this).parent("." + filter).length : true;
						}));
						return false;
					};
				}
				// click on first element to collapse tree
				$("a:eq(0)", control).click(handler(CLASSES.collapsable));
				// click on second to expand tree
				$("a:eq(1)", control).click(handler(CLASSES.expandable));
				// click on third to toggle tree
				$("a:eq(2)", control).click(handler());
			}

			// handle toggle event
			function toggler() {

				$(this)
					.parent()
				// swap classes for hitarea
					.find(">.hitarea")
						.swapClass(CLASSES.collapsableHitarea, CLASSES.expandableHitarea)
						.swapClass(CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea)
					.end()
				// swap classes for parent li
					.swapClass(CLASSES.collapsable, CLASSES.expandable)
					.swapClass(CLASSES.lastCollapsable, CLASSES.lastExpandable)
				// find child lists
					.find(">ul")
				// toggle them
					.heightToggle(settings.animated, settings.toggle);
				if (settings.unique) {
					$(this).parent()
						.siblings()
					// swap classes for hitarea
						.find(">.hitarea")
							.replaceClass(CLASSES.collapsableHitarea, CLASSES.expandableHitarea)
							.replaceClass(CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea)
						.end()
						.replaceClass(CLASSES.collapsable, CLASSES.expandable)
						.replaceClass(CLASSES.lastCollapsable, CLASSES.lastExpandable)
						.find(">ul")
						.heightHide(settings.animated, settings.toggle);
				}

				if ($(this).parent().parent().attr("class") == $(".treeview").attr("class")) {
					document.getElementById("listContainer").scrollIntoView();
				} else if ($(this).next().attr("name") != "") {
					document.getElementById("listContainer").scrollIntoView();
				} else {
				if ($(this).parent().parents(".collapsable").children("a").attr("name") != "") {
						document.getElementById("listContainer").scrollIntoView();
					} else {
						$(this).parent().show();
					}
				}

				// Reload channelTree count's
				try {
					if ($(this).parent().hasClass("collapsable")) {
						onChannelTreeOpen($(this).next("a"));
					}
				} catch (err) { }
			}

			function serialize() {
				function binary(arg) {
					return arg ? 1 : 0;
				}
				var data = [];
				branches.each(function(i, e) {
					data[i] = $(e).is(":has(>ul:visible)") ? 1 : 0;
				});
				$.cookie(settings.cookieId, data.join(""));
			}

			function deserialize() {
				var stored = $.cookie(settings.cookieId);
				if (stored) {
					var data = stored.split("");
					branches.each(function(i, e) {
						$(e).find(">ul")[parseInt(data[i]) ? "show" : "hide"]();
					});
				}
			}

			// add treeview class to activate styles
			this.addClass("treeview");

			// prepare branches and find all tree items with child lists
			var branches = this.find("li").prepareBranches(settings);

			switch (settings.persist) {
				case "cookie":
					var toggleCallback = settings.toggle;
					settings.toggle = function() {
						serialize();
						if (toggleCallback) {
							toggleCallback.apply(this, arguments);
						}
					};
					deserialize();
					break;
				case "location":
					var current = this.find("a").filter(function() { return this.href.toLowerCase() == location.href.toLowerCase(); });
					if (current.length) {
						current.addClass("selected").parents("ul, li").add(current.next()).show();
					}
					break;
				case "selected":
					var current = this.find(".selected");
					if (current.length) {
						current.addClass("selected").parents("ul, li").add(current.next()).show();
					}
					break;
			}

			branches.applyClasses(settings, toggler);

			// if control option is set, create the treecontroller and show it
			if (settings.control) {
				treeController(this, settings.control);
				$(settings.control).show();
			}

			return this.bind("add", function(event, branches) {
				$(branches).prev()
					.removeClass(CLASSES.last)
					.removeClass(CLASSES.lastCollapsable)
					.removeClass(CLASSES.lastExpandable)
				.find(">.hitarea")
					.removeClass(CLASSES.lastCollapsableHitarea)
					.removeClass(CLASSES.lastExpandableHitarea);
				$(branches).find("li").andSelf().prepareBranches(settings).applyClasses(settings, toggler);
			});
		}
	});

	// classes used by the plugin
	// need to be styled via external stylesheet, see first example
	var CLASSES = $.fn.treeview.classes = {
		open: "open",
		closed: "closed",
		expandable: "expandable",
		expandableHitarea: "expandable-hitarea",
		lastExpandableHitarea: "lastExpandable-hitarea",
		collapsable: "collapsable",
		collapsableHitarea: "collapsable-hitarea",
		lastCollapsableHitarea: "lastCollapsable-hitarea",
		lastCollapsable: "lastCollapsable",
		lastExpandable: "lastExpandable",
		last: "last",
		hitarea: "hitarea"
	};

	// provide backwards compability
	$.fn.Treeview = $.fn.treeview;

})(jQuery);
/////<reference path="../Commons/Javascript/jquery-em.js">
/////<reference path="jquery.form.js">
/////<reference path="jquery.accordion.js">
/////<reference path="jsCarousel.js">
/////<reference path="translation.js">
/////<reference path="jquery.dialogs.js">

/****************************************************************************
                Accordion Helper Functions
/***************************************************************************/

var TagClick = false;

function GetAccordionVideo(Id, VideoId) 
{
    switch (Id) {
        case "video1": return VideoId.video1; break;
        case "video2": return VideoId.video2; break;
        case "video3": return VideoId.video3; break;
        case "video4": return VideoId.video4; break;
        case "video5": return VideoId.video5; break;
        default: return "0";    
    }
}

function DestroyIFrame(elemSub,elemClear) {
    if (elemSub && TagClick)
    {
        elemSub.next(elemClear).children('span').children('iframe').hide();
        elemSub.next(elemClear).children('span').children('iframe').remove();
    }       
}

function RenderIFrame(elem, url, idvideo) {
    if (TagClick) {
        iframe = document.createElement('iframe');
        iframe.frameBorder = 0;
        iframe.height = 203;
        iframe.width = 301;
        iframe.scrolling = "no";
        elem.children('span').append(iframe);
        iframe = (iframe.frameElement) ? iframe.frameElement : iframe;
        iframe.setAttribute("src", url.replace("#contentid#", idvideo));
    }
    TagClick = false;
}
function SetTagClick(elem) {TagClick = true;}

function ShowIframe(elem) {
    elem.find("iframe").show();
}
function HideIframe(elem) {
    elem.find("iframe").hide(); 
}
/***************************************************************************/


// switch of light
var lightOn = false;
function turnOffLight() {
	if (lightOn) {
		$(".layer").hide();
		$(".playerDataContainer").show();
		$(".turnOffLight").attr("title", Translate("TURN_OFF_LIGHT")).html(Translate("TURN_OFF_LIGHT"));
		$(".playerContainer").css("width", "935px");
		$(".playerContainer iframe").css("width", "934px");
		if ($.browser.msie && $.browser.version == "6.0") {
			$().find("select").show();
		}
	} else {
		$(".layer").show();
		$(".playerDataContainer").hide();
		$(".turnOffLight").attr("title", Translate("TURN_ON_LIGHT")).html(Translate("TURN_ON_LIGHT"));
		$(".playerContainer").css("width", "729px");
		$(".playerContainer iframe").css("width", "728px");

		if ($.browser.msie && $.browser.version == "6.0") {
			$().find("select").hide();
		}
	}
	lightOn = !lightOn;
}

function updateTurnOffLight() {
	try {
		if (parent.top.lightOn) {
			parent.top.lightOn = false;
			parent.top.turnOffLight();
		}
	}
	catch (e) { }
}
/****************************************************************************/

// Update Page [Click in Relateds flash]
function updateContentView(url) {
    if ( url != undefined )
    {  
        $('.videoData .loader').show();
        location.href = contextURL + url;
    }
}

// BackImage & AdBackImage
function restoreBackImage(recursiveParent,isScriptBg) {
    try {
        if (recursiveParent) parent.parent.deleteAdBackImage(isScriptBg);
        else deleteAdBackImage(isScriptBg);
    } catch (e) { }
}
function setAdBackImage(imageSrc, height, imageLink, recursiveParent) {
    try {
        if (recursiveParent) parent.parent.updateBackImage(imageSrc, height, imageLink);
        else updateBackImage(imageSrc, height, imageLink);
    } catch (e) { }
}

function setScriptAdBackImage(imageSrc, recursiveParent,random) {
    try {
        if (recursiveParent) parent.parent.updateScriptBackImage(imageSrc,random);
        else updateScriptBackImage(imageSrc,random);
    } catch (e) { }
}


var adBgImageCalled = false;
function updateBackImage(imageSrc, height, imageLink) {
    var top = 0;
    try {
        imageSrc = replaceRandom(imageSrc);
        imageLink = replaceRandom(imageLink);
        top = parseInt(($(".top").height() - height) / 2);
        top = top > 0 ? top + 6 : top < 0 ? 0 : top;
    } catch (e) { }

    $(".adlayer").unbind("click");
    if (imageLink) {
        if (imageLink != '') {
            $(".adlayer").bind("click", function() { window.open(imageLink); });
        }
    }
    if (imageSrc) {
        if (imageSrc != '') {
            $("#bg").hide();
            $("#adbg img").removeAttr("src");
            $("#adbg img").attr("src", imageSrc);
            $("#adbg, .adlayer").css("height", height + "px").css("top", top + "px");
            $("#adbg, .adlayer").show();
        }
    }
    $('.playerContainer').css('width', '728px');
    $('.playerContainer').children('iframe').css('width', '728px');
    
    adBgImageCalled = true;
}

function updateScriptBackImage(imageSrc,random) {
    var top = 0;
    try {
        currentRandom = random;
        top = parseInt(($(".top").height() - height) / 2);
        top = top > 0 ? top + 6 : top < 0 ? 0 : top;
    } catch (e) { }

    if (imageSrc) {
        if (imageSrc != '') {
            $("#bg").hide();
            var iframe = document.createElement('iframe');
            iframe.id = "frmBgImage";
            iframe.scrolling = "no";
            iframe.frameBorder = "no";
            iframe.setAttribute("style", 
                        "width:0px;" +
                        "height:0px;" +
                        "overflow:hidden;");
            if (imageSrc != undefined) iframe.setAttribute("src", imageSrc);
            $("#imgBgframe").append(iframe);
            $("#frmBgImage").css("visibility", "hidden");

        }
    }
    $('.playerContainer').css('width', '728px');
    $('.playerContainer').children('iframe').css('width', '728px');
    
    adBgImageCalled = true;
}


function deleteAdBackImage(isScriptBg) {
    if (!adBgImageCalled) return;
    $("#adbg, .adlayer").hide();
    if (isScriptBg) {
        $("#imgBg").children().remove();
        $("#imgBgframe").children().remove();
    }
    else {
        $("#adbg img").removeAttr("src");
    }
    $('.playerContainer').css('width', '935px');
    $('.playerContainer').children('iframe').css('width', '935px');
    
    $("#bg").show();
    
    adBgImageCalled = true;
}

function appendImagBg(cont) {
    $("#imgBg").html(cont);
    $("#imgBg").css("top", "70px");
    $("#imgBg").css("position", "relative");
    $("#imgBg").show();
    $("#imgBgframe").children().remove();
}
/****************************************************************************
                Specials  Functions
****************************************************************************/
function ChangeLayers(elem, elemShow) {
    elem.children("div").each(function() { $(this).hide(); });
    elemShow.show();
}
function ChangeClassLi(elem) {
    $(".tops .nav li").attr("class", "");
    elem.attr("class", "selected");
}

/****************************************************************************
                Combo Box Event
****************************************************************************/
function RedirectComboUrl() {
    url = location.href;
    if (url) {
    	url = url.replace("#", "");
        var destiny = url;
        if (url.indexOf("?") > 0) {
            destiny = url.replace(url.substring(url.indexOf("?"), url.length), "");
        }
        destiny += "?templateId=" + $("#ComboSelect").val();
        if (url.toLowerCase().indexOf("enabletrace=true") > 0) {
            destiny += "&enabletrace=true";
        }
        window.location.href = destiny;
    }
}

/****************************************************************************
Contents - SlideShow
****************************************************************************/
function nextSlideShowItem(ctId) {
    var p = getSlideShowPosition(ctId);
    p = p < (contentsSlideShow.length - 1) ? p + 1 : 0;
    updateSlideShowItem(p);
}
function prevSlideShowItem(ctId) {
    var p = getSlideShowPosition(ctId);
    p = p > 0 ? p - 1 : contentsSlideShow.length - 1;
    updateSlideShowItem(p);
}
function updateSlideShowItem(p) {
    var item = getSlideShowItemByPostion(p)
    if (item != undefined) {

        $(".video a").unbind("click");
        $(".video a").attr("name", item.ctId)
        .attr("title", item.title)
        .bind("click", function() { slideShowClick(item.cnId, item.ctId); });

        $(".video img").unbind("load");
        $(".video img").attr("alt", item.title)
        .bind("load", function() {
            // Vertical Center
            var height = $(".video a").height();
            var top = parseInt((height - $(".video img").height()) / 2);
            top = top > 0 ? top : 0;
            $(".video img").css({ 'top': top + "px" });
            setHoverSlideShow();
        });
        $(".video img").attr("src", item.src);
    }
}

function showDivTwitter() {
    $("#twitter").show();
    $("#commentTwitter").attr("value", messageTwitterDefault.replace("#url#", contentLink));
    $("#share").hide();
 }

function hideDivTwitter() {
    $("#twitter").hide();
    $("#share").show();
    $("#loginTwitter").attr("value","");
    $("#passwordTwitter").attr("value","");
    $("#commentTwitter").attr("value","");
}


/////<reference path="../Javascript/jquery-em.js">
/////<reference path="jquery.form.js">
/////<reference path="jquery.accordion.js">
/////<reference path="JScripts.js">
/////<reference path="jsCarousel.js">
/////<reference path="translation.js">
/////<reference path="jquery.dialogs.js">
/*
    loading in body-onload
*/
var searchField = "#search";
var IFrameObj;

jQuery().ready(pageload = function() {

	// ComboBox Event
	$("#ComboSelect").change(RedirectComboUrl);

	// Video Data Vote
	$(CanVote = function() {
		try {
			if (checkVote()) {
				callVoted("success", Translate("ALREADY_VOTE"));
				disableVote(false, voteValue);
			}
		} catch (e) { }
	});

	// Open Links Externals in New Window
	$(function() { $("a[href^='http://'][target='']").not("[href^='" + contextFullURL + "']").opensNewWindow(); });

	// Scroll Events
	try {
		$(".related .scroll, .info .scroll, .comments .scroll").show().jScrollPane({ scrollbarWidth: 4, dragMinHeight: 25 });
	} catch (e) { }
	/* ************************* */

	// Accordion Events
	try {
		$('.videoData').accordion({ event: accordionScrollEvent, autoheight: false, active: "a[title='" + Translate("INFO") + "']", header: "a.areaTitle" });

		$(accordionsShow = function() {
			$(".playerDataContainer, .accordion").show().fadeTo("normal", 1);
			$(".videoData").find("*[class!='bg']").andSelf().css({ opacity: 1 });
		});
	} catch (e) { }
	/* ************************* */

	// SlideShow Hover & Click Video //
	$(setHoverSlideShow = function() {
		if (enableHoverSlideShow) {
			$(".video a").hover(function() { $(".video a span").show(); }, function() { $(".video a span").hide(); });
		} else {
			$(".video span").show();
		}
	});

	try {
		$("#prevPlay, #nextPlay").click(function() {
			//$(this).hide();
			var ctId = $(".video a").attr("name");
			if ($(this).attr("id") == "nextPlay") {
				nextSlideShowItem(ctId);
			} else {
				prevSlideShowItem(ctId);
			}
			//$(this).fadeIn("fast");
		});
	} catch (e) { }

	$(ramdomSlideShow = function() {
		var skip = 0;
		if (randomizeSlideShow) {
			var slideCount = contentsSlideShow.length - 1;
			skip = parseInt(0 + Math.random() * slideCount);
			skip = skip < 0 || skip > slideCount ? 0 : skip;
		}
		updateSlideShowItem(skip);
	});
	/* ************************* */

	// Click menu highlights //
	$(".list li").hover(function() { $(this).addClass("over"); }, function() { $(this).removeClass("over"); });
	$(".tops .nav li").click(function() { ChangeClassLi($(this)); ChangeLayers($(".tops"), $(".tops").children("div[id=" + $(this).attr("id") + "]")); return false; });

	$(".tabList .nav li").click(function() {

		if ($(this).hasClass("more")) return;
		$(this).parent().children().removeClass("selected");
		$(this).addClass("selected");
		$(this).parent().next().children().hide();

		var ulId = "ul_" + $(this).attr("id");
		var list = $(this).parent().next().children("#" + ulId);
		var div = $(this).parent().next(".cont");
		var sponsor = $(list).next(".sponsor");
		sponsor = $(sponsor).length > 0 ? sponsor : $(list).next(".allMusic").next(".sponsor");

		$(list).show();
		$(list).next(".allMusic").show();
		$(sponsor).show();

		var adUrl;
		var frame;
		var src;
		if (loadAllContentsOfTabs) {

			if (!loadAllSponsorsOfTabs) {
				if ($(sponsor).find("input").length > 0) {
					adUrl = $(sponsor).find("input").attr("value");
					frame = $(sponsor).find("iframe");
					$(sponsor).children("div").width(88);

					if ($(frame).length > 0) {
						$(frame).attr("src", adUrl);
					} else {
						src = getSrcSponsorScript(adUrl);
						frame = createFrame(src);

						$(sponsor).children("div").html(frame);
					}
				}
			}

		} else if ($(list).length == 0) {

			adUrl = $(this).find("input").attr("value");
			src = contextFullURL + "/Ajax/GetTabContents" + addUrlAjaxCall + replaceRandom(adUrl);
			frame = createFrame(src, ulId);

			$(div).append(frame);
		}
	});

	$(".highlights li").hover(function() {
		$(this).parent().children().removeClass("selected");
		$(this).parent().next().children().hide();

		$(this).addClass("selected");
		$(this).parent().next().children("#dontLoseDiv_" + $(this).attr("id")).show();
	}, function() { });
	/* ************************* */

	// Loading ajaxPlayer //
	$(".playerContainer").ajaxError(function() {
		if (!isAutoCompleteAjaxCall) {
			ttvAlert(Translate("AJAX_ERROR"));
		}
		$(".loader").hide();
		pageload();
	});
	/* ************************* */

	/* ****************** */
	// JQuery alerts //
	$('#alert').jqm({
		overlay: 60,
		overlayClass: 'overlay',
		modal: true,
		trigger: false
	});
	$('#confirm').jqm({
		overlay: 60,
		overlayClass: 'overlay',
		modal: true,
		trigger: false
	});
	/* ************************* */

	// Hide Loader's
	$(".loader").hide().css("opacity", 0);
});
/* ***************************************************************************************** */

/* 
    opensNewWindow
*/  
$.fn.opensNewWindow = function() {
    this.click(function() {
        window.open($(this).attr("href"))
        return false
    })
}
/* ******************* */

$.fn.wait = function(time, type) {
	time = time || 1000;
	type = type || "fx";
	return this.queue(type, function() {
		var self = this;
		setTimeout(function() {
			$(self).dequeue();
		}, time);
	});
};

var timeOutId = 0;

(function($) {
	$.fn.subMenu = function(jQueryObjs, initTime, endTime, index, event) {

		$.fn.subMenu.event = (event != "" && event != undefined) ? event : $.fn.subMenu.event;
		$.fn.subMenu.opacity = (menuOpacity != "" && menuOpacity != undefined) ? menuOpacity : 1;
		$.fn.subMenu.positionMode = (menuPositionMode != "" && menuPositionMode != undefined) ? menuPositionMode : 'relative';
		// set click/over function
		function _init() {
			$(".subNav").css({ display:'block' });
			$(".subNav").css({ height: 0, borderWidth: 0 });
			$(jQueryObjs).find("em").bind($.fn.subMenu.event, function() { $.fn.subMenu.change(jQueryObjs, $(this).parent().parent(), true, false); return false; });
		}
		_init();

		$.fn.subMenu.jQueryObjs = jQueryObjs;
		$.fn.subMenu.endTime = endTime;
		$.fn.subMenu.initTime = initTime;
		$.fn.subMenu.autoClose = endTime;
		$.fn.subMenu.indexCurrent = index;
		//mouseOver, mouseLeave , auto-open
		$.fn.subMenu.MouseOver();
		$.fn.subMenu.MouseLeave();
		$.fn.subMenu.setTime(jQueryObjs, index, initTime, false);
	};
	$.fn.subMenu.change = function(jQueryObjs, objClicked, isClick, isMouseLeave) {
		var objClickedIdx = $(jQueryObjs).index(objClicked);
		$.fn.subMenu.indexCurrent = objClickedIdx;

		$(".subNav").eq(objClickedIdx).css({ 'position': $.fn.subMenu.positionMode });
		$(".subNav").eq(objClickedIdx).css({ opacity: menuOpacity });
		$(jQueryObjs).find("em").removeClass('opened');

		if ($(".subNav").eq(objClickedIdx).height() > 0 || isMouseLeave) {
			$(".subNav").eq(objClickedIdx).stop().animate({ height: 0 }, menuShowHidden, function() { $(this).css({ borderWidth: 0 }) });
		} else {
			$(".subNav").stop().animate({ height: 0 }, menuShowHidden, function() { $(this).css({ borderWidth: 0 }) });
			$(".subNav").eq(objClickedIdx).css({ borderWidth: 4 }).stop().animate({ height: $(".subNav").eq(objClickedIdx).find('ul').outerHeight(true) }, menuShowHidden);
			// auto-close
			if (!isClick && !isMouseLeave) {
				$.fn.subMenu.setTime(jQueryObjs, objClickedIdx, $.fn.subMenu.autoClose, false);
				$.fn.subMenu.endTime = 0;
			}
			$(objClicked).find("em").addClass('opened');
		}
	};

	// MouseOver & MouseLeave
	$.fn.subMenu.MouseOver = function() { $(".subNav").mouseover(function() { $.fn.subMenu.clearTime(); }); };
	$.fn.subMenu.MouseLeave = function() { $(".subNav").bind("mouseleave", function() { $.fn.subMenu.setTime($.fn.subMenu.jQueryObjs, $.fn.subMenu.indexCurrent, $.fn.subMenu.autoClose, true); }); };

	// auto-close/open setTimeout
	$.fn.subMenu.setTime = function(jQueryObjs, index, time, isMouseLeave) {
		if (time > 0) {
			timeOutId = setTimeout("$('" + jQueryObjs + "').subMenu.change('" + jQueryObjs + "', $('" + jQueryObjs + "').eq(" + index + "), false, " + isMouseLeave + ")", time);
		}
	};

	// clearTimeout
	$.fn.subMenu.clearTime = function() {
		if (timeOutId != 0) { clearTimeout(timeOutId); timeOutId = 0; }
	};
	$.fn.subMenu.endTime = 0;
	$.fn.subMenu.autoClose = 0;
	$.fn.subMenu.elem = "";
	$.fn.subMenu.index = 0;
	$.fn.subMenu.indexCurrent = 0;
	$.fn.subMenu.event = "click";
	$.fn.subMenu.positionMode = 'relative';
	$.fn.subMenu.opacity = 1;
})(jQuery);
;(function($) {
$.fn.extend({
autocomplete: function(urlOrData, options) {
var isUrl = typeof urlOrData == "string";
options = $.extend({}, $.Autocompleter.defaults, {
url: isUrl ? urlOrData : null,
data: isUrl ? null : urlOrData,
delay: isUrl ? $.Autocompleter.defaults.delay : 10,
max: options && !options.scroll ? 10 : 150
}, options);
options.highlight = options.highlight || function(value) { return value; };
options.formatMatch = options.formatMatch || options.formatItem;
return this.each(function() {
new $.Autocompleter(this, options);
});
},
result: function(handler) {
return this.bind("result", handler);
},
search: function(handler) {
return this.trigger("search", [handler]);
},
flushCache: function() {
return this.trigger("flushCache");
},
setOptions: function(options) {
return this.trigger("setOptions", [options]);
},
unautocomplete: function() {
return this.trigger("unautocomplete");
}
});
$.Autocompleter = function(input, options) {
var KEY = {
UP: 38,
DOWN: 40,
DEL: 46,
TAB: 9,
RETURN: 13,
ESC: 27,
COMMA: 188,
PAGEUP: 33,
PAGEDOWN: 34,
BACKSPACE: 8
};
var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass);
var lastWordByPass = false;
var timeout;
var previousValue = "";
var cache = $.Autocompleter.Cache(options);
var hasFocus = 0;
var lastKeyPressCode;
var config = {
mouseDownOnSelect: false
};
var select = $.Autocompleter.Select(options, input, selectCurrent, config);
var blockSubmit;
$.browser.opera && $(input.form).bind("submit.autocomplete", function() {
if (blockSubmit) {
blockSubmit = false;
return false;
}
});
$input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) {
lastKeyPressCode = event.keyCode;
switch (event.keyCode) {
case KEY.UP:
event.preventDefault();
if (select.visible()) {
select.prev();
} else {
onChange(0, true);
}
break;
case KEY.DOWN:
event.preventDefault();
if (select.visible()) {
select.next();
} else {
onChange(0, true);
}
break;
case KEY.PAGEUP:
event.preventDefault();
if (select.visible()) {
select.pageUp();
} else {
onChange(0, true);
}
break;
case KEY.PAGEDOWN:
event.preventDefault();
if (select.visible()) {
select.pageDown();
} else {
onChange(0, true);
}
break;
case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA:
case KEY.TAB:
case KEY.RETURN:
if (selectCurrent()) {
}
break;
case KEY.ESC:
select.hide();
break;
default:
clearTimeout(timeout);
timeout = setTimeout(onChange, options.delay);
break;
}
}).focus(function() {
hasFocus++;
}).blur(function() {
hasFocus = 0;
if (!config.mouseDownOnSelect) {
hideResults();
}
}).click(function() {
if (hasFocus++ > 1 && !select.visible()) {
onChange(0, true);
}
}).bind("search", function() {
var fn = (arguments.length > 1) ? arguments[1] : null;
function findValueCallback(q, data) {
var result;
if (data && data.length) {
for (var i = 0; i < data.length; i++) {
if (data[i].result.toLowerCase() == q.toLowerCase()) {
result = data[i];
break;
}
}
}
if (typeof fn == "function") fn(result);
else $input.trigger("result", result && [result.data, result.value]);
}
$.each(trimWords($input.val()), function(i, value) {
request(value, findValueCallback, findValueCallback);
});
}).bind("flushCache", function() {
cache.flush();
}).bind("setOptions", function() {
$.extend(options, arguments[1]);
if ("data" in arguments[1])
cache.populate();
}).bind("unautocomplete", function() {
select.unbind();
$input.unbind();
$(input.form).unbind(".autocomplete");
});
function selectCurrent(showResults, whereTo) {
var selected = select.selected();
if (!selected)
return false;
var v = selected.result;
previousValue = v;
if (options.multiple) {
var words = trimWords($input.val());
if (words.length > 1) {
v = words.slice(0, words.length - 1).join(options.multipleSeparator) + options.multipleSeparator + v;
}
v += options.multipleSeparator;
}
$input.val(v);
if (!showResults) {
hideResultsNow();
$input.trigger("result", [selected.data, selected.value]);
}
return true;
}
function onChange(crap, skipPrevCheck) {
if (lastKeyPressCode == KEY.DEL) {
select.hide();
return;
}
var currentValue = $input.val();
if (!skipPrevCheck && currentValue == previousValue)
return;
previousValue = currentValue;
currentValue = lastWord(currentValue);
if (currentValue.length >= options.minChars) {
$input.addClass(options.loadingClass);
if (!options.matchCase)
currentValue = currentValue.toLowerCase();
request(currentValue, receiveData, hideResultsNow);
} else {
stopLoading();
select.hide();
}
};
function trimWords(value) {
if (!value) {
return [""];
}
var words = value.split(options.multipleSeparator);
var result = [];
$.each(words, function(i, value) {
if ($.trim(value))
result[i] = $.trim(value);
});
return result;
}
function lastWord(value) {
if (!options.multiple)
return value;
var words = trimWords(value);
return words[words.length - 1];
}
function autoFill(q, sValue) {
if (options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE) {
$input.val($input.val() + sValue.substring(lastWord(previousValue).length));
$.Autocompleter.Selection(input, previousValue.length, previousValue.length + sValue.length);
}
};
function hideResults() {
clearTimeout(timeout);
timeout = setTimeout(hideResultsNow, 200);
};
function hideResultsNow() {
var wasVisible = select.visible();
select.hide();
clearTimeout(timeout);
stopLoading();
if (options.mustMatch) {
$input.search(
function(result) {
if (!result) {
if (options.multiple) {
var words = trimWords($input.val()).slice(0, -1);
$input.val(words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : ""));
}
else
$input.val(" ");
}
}
);
}
if (wasVisible)
$.Autocompleter.Selection(input, input.value.length, input.value.length);
};
function receiveData(q, data) {
if (data && data.length && hasFocus) {
stopLoading();
select.display(data, q);
autoFill(q, data[0].value);
select.show();
} else {
hideResultsNow();
}
};
function request(term, success, failure) {
if (!options.matchCase)
term = term.toLowerCase();
var data = cache.load(term);
if (data && data.length) {
success(term, data);
} else if ((typeof options.url == "string") && (options.url.length > 0)) {
var extraParams = {
timestamp: +new Date()
};
$.each(options.extraParams, function(key, param) {
extraParams[key] = typeof param == "function" ? param() : param;
});
$.ajax({
mode: "abort",
port: "autocomplete" + input.name,
dataType: options.dataType,
url: options.url,
data: $.extend({
q: lastWord(term),
limit: options.max
}, extraParams),
success: function(data) {
var parsed = options.parse && options.parse(data) || parse(data);
cache.add(term, parsed);
success(term, parsed);
}
});
} else {
select.emptyList();
failure(term);
}
};
function parse(data) {
var parsed = [];
var rows = data.split("\n");
for (var i = 0; i < rows.length; i++) {
var row = $.trim(rows[i]);
if (row) {
row = row.split("|");
parsed[parsed.length] = {
data: row,
value: row[0],
result: options.formatResult && options.formatResult(row, row[0]) || row[0]
};
}
}
return parsed;
};
function stopLoading() {
$input.removeClass(options.loadingClass);
};
};
$.Autocompleter.defaults = {
inputClass: "ac_input",
resultsClass: "ac_results",
loadingClass: "ac_loading",
minChars: 1,
delay: 400,
matchCase: false,
matchSubset: true,
matchContains: false,
cacheLength: 10,
max: 100,
mustMatch: false,
extraParams: {},
selectFirst: true,
formatItem: function(row) { return row[0]; },
formatMatch: null,
autoFill: false,
width: 0,
multiple: false,
multipleSeparator: ", ",
highlight: function(value, term) {
return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
},
scroll: true,
scrollHeight: 180
};
$.Autocompleter.Cache = function(options) {
var data = {};
var length = 0;
function matchSubset(s, sub) {
if (!options.matchCase)
s = s.toLowerCase();
var i = s.indexOf(sub);
if (i == -1) return false;
return i == 0 || options.matchContains;
};
function add(q, value) {
if (length > options.cacheLength) {
flush();
}
if (!data[q]) {
length++;
}
data[q] = value;
}
function populate() {
if (!options.data) return false;
var stMatchSets = {},
nullData = 0;
if (!options.url) options.cacheLength = 1;
stMatchSets[""] = [];
for (var i = 0, ol = options.data.length; i < ol; i++) {
var rawValue = options.data[i];
rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue;
var value = options.formatMatch(rawValue, i + 1, options.data.length);
if (value === false)
continue;
var firstChar = value.charAt(0).toLowerCase();
if (!stMatchSets[firstChar])
stMatchSets[firstChar] = [];
var row = {
value: value,
data: rawValue,
result: options.formatResult && options.formatResult(rawValue) || value
};
stMatchSets[firstChar].push(row);
if (nullData++ < options.max) {
stMatchSets[""].push(row);
}
};
$.each(stMatchSets, function(i, value) {
options.cacheLength++;
add(i, value);
});
}
setTimeout(populate, 25);
function flush() {
data = {};
length = 0;
}
return {
flush: flush,
add: add,
populate: populate,
load: function(q) {
if (!options.cacheLength || !length)
return null;
if (!options.url && options.matchContains) {
var csub = [];
for (var k in data) {
if (k.length > 0) {
var c = data[k];
$.each(c, function(i, x) {
if (matchSubset(x.value, q)) {
csub.push(x);
}
});
}
}
return csub;
} else
if (data[q]) {
return data[q];
} else
if (options.matchSubset) {
for (var i = q.length - 1; i >= options.minChars; i--) {
var c = data[q.substr(0, i)];
if (c) {
var csub = [];
$.each(c, function(i, x) {
if (matchSubset(x.value, q)) {
csub[csub.length] = x;
}
});
return csub;
}
}
}
return null;
}
};
};
$.Autocompleter.Select = function(options, input, select, config) {
var CLASSES = {
ACTIVE: "ac_over"
};
var listItems,
active = -1,
data,
term = "",
needsInit = true,
element,
list;
function init() {
if (!needsInit)
return;
element = $("<div/>")
.hide()
.addClass(options.resultsClass)
.css("position", "absolute")
.appendTo(document.body);
list = $("<ul/>").appendTo(element).mouseover(function(event) {
if (target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') {
active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
$(target(event)).addClass(CLASSES.ACTIVE);
}
}).click(function(event) {
$(target(event)).addClass(CLASSES.ACTIVE);
select();
input.focus();
return false;
}).mousedown(function() {
config.mouseDownOnSelect = true;
}).mouseup(function() {
config.mouseDownOnSelect = false;
});
if (options.width > 0)
element.css("width", options.width);
needsInit = false;
}
function target(event) {
var element = event.target;
while (element && element.tagName != "LI")
element = element.parentNode;
if (!element)
return [];
return element;
}
function moveSelect(step) {
listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE);
movePosition(step);
var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE);
if (searchField == undefined) var searchField = "#search";
$(searchField).val(activeItem[0].textContent);
if (options.scroll) {
var offset = 0;
listItems.slice(0, active).each(function() {
offset += this.offsetHeight;
});
if ((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) {
list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight());
} else if (offset < list.scrollTop()) {
list.scrollTop(offset);
}
}
};
function movePosition(step) {
active += step;
if (listItems.size() == 11) {
if (active < 0) {
active = listItems.size() - 2;
} else if (active >= listItems.size() - 1) {
active = 0;
}
}
else {
if (active < 0) {
active = listItems.size() - 1;
} else if (active >= listItems.size()) {
active = 0;
}
}
}
function limitNumberOfItems(available) {
return options.max && options.max < available
? options.max
: available;
}
function fillList() {
list.empty();
var max = limitNumberOfItems(data.length);
for (var i = 0; i < max; i++) {
if (!data[i])
continue;
var formatted = options.formatItem(data[i].data, i + 1, max, data[i].value, term);
if (formatted === false)
continue;
var li = $("<li/>").html(options.highlight(formatted, term)).addClass(i % 2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0];
$.data(li, "ac_data", data[i]);
}
listItems = list.find("li");
if (options.selectFirst) {
listItems.slice(0, 1).addClass(CLASSES.ACTIVE);
active = 0;
}
if ($.fn.bgiframe)
list.bgiframe();
}
return {
display: function(d, q) {
init();
data = d;
term = q;
fillList();
},
next: function() {
moveSelect(1);
},
prev: function() {
moveSelect(-1);
},
pageUp: function() {
if (active != 0 && active - 8 < 0) {
moveSelect(-active);
} else {
moveSelect(-8);
}
},
pageDown: function() {
if (active != listItems.size() - 1 && active + 8 > listItems.size()) {
moveSelect(listItems.size() - 1 - active);
} else {
moveSelect(8);
}
},
hide: function() {
element && element.hide();
listItems && listItems.removeClass(CLASSES.ACTIVE);
active = -1;
},
visible: function() {
return element && element.is(":visible");
},
current: function() {
return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]);
},
show: function() {
var offset = $(input).offset();
element.css({
width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(),
top: offset.top + input.offsetHeight,
left: offset.left
}).show();
if (options.scroll) {
list.scrollTop(0);
list.css({
maxHeight: options.scrollHeight,
overflow: 'auto'
});
if ($.browser.msie && typeof document.body.style.maxHeight === "undefined") {
var listHeight = 0;
listItems.each(function() {
listHeight += this.offsetHeight;
});
var scrollbarsVisible = listHeight > options.scrollHeight;
list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight);
if (!scrollbarsVisible) {
listItems.width(list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")));
}
}
}
},
selected: function() {
var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);
return selected && selected.length && $.data(selected[0], "ac_data");
},
emptyList: function() {
list && list.empty();
},
unbind: function() {
element && element.remove();
}
};
};
$.Autocompleter.Selection = function(field, start, end) {
if (field.createTextRange) {
var selRange = field.createTextRange();
selRange.collapse(true);
selRange.moveStart("character", start);
selRange.moveEnd("character", end);
selRange.select();
} else if (field.setSelectionRange) {
field.setSelectionRange(start, end);
} else {
if (field.selectionStart) {
field.selectionStart = start;
field.selectionEnd = end;
}
}
field.focus();
};
})(jQuery);
dictionary.push(new TranslationItem('INFO','Informacin'));
dictionary.push(new TranslationItem('AJAX_ERROR','Se ha producido un error. Por favor, intntelo de nuevo.'));
dictionary.push(new TranslationItem('SEND','Enviar'));
dictionary.push(new TranslationItem('CANCEL','Limpiar'));
dictionary.push(new TranslationItem('CLOSE','Cerrar'));
dictionary.push(new TranslationItem('PREVIOUS','Retroceder'));
dictionary.push(new TranslationItem('NEXT','Prximo'));
dictionary.push(new TranslationItem('PLAY','Play'));
dictionary.push(new TranslationItem('SEARCH','Buscar'));
dictionary.push(new TranslationItem('SEARCH_URL','busqueda'));
dictionary.push(new TranslationItem('I_FELL_LUCKY_BUTTON','Escoge por mi'));
dictionary.push(new TranslationItem('I_FELL_LUCKY_URL','escoge'));
dictionary.push(new TranslationItem('SEARCH_FOR_VIDEOS','Busca videos en Terra TV'));
dictionary.push(new TranslationItem('INVALID_SEARCH','La bsqueda debe tener de 2 a 50 caracteres y debe contener solamente letras y nmeros'));
dictionary.push(new TranslationItem('COMMENT_ERROR','Error al grabar el comentario'));
dictionary.push(new TranslationItem('COMMENT_SUCCESS','Comentario grabado con xito'));
dictionary.push(new TranslationItem('EMAIL_ERROR','Error al enviar el e-mail'));
dictionary.push(new TranslationItem('EMAIL_SUCCESS','E-mail enviando con xito'));
dictionary.push(new TranslationItem('VOTE_ERROR','Error al procesar el voto'));
dictionary.push(new TranslationItem('VOTE_SUCCESS','Gracias por su voto'));
dictionary.push(new TranslationItem('ALREADY_VOTE','Ya votaste en este video'));
dictionary.push(new TranslationItem('TERRIBLE','Muy malo'));
dictionary.push(new TranslationItem('BAD','Malo'));
dictionary.push(new TranslationItem('REGULAR','Regular'));
dictionary.push(new TranslationItem('GOOD','Bueno'));
dictionary.push(new TranslationItem('EXCELLENT','Muy bueno'));
dictionary.push(new TranslationItem('MAKE_A_VOTE','Deje su Voto!'));
dictionary.push(new TranslationItem('VOTES','Votos'));
dictionary.push(new TranslationItem('SEND_MESSAGE_SUCCESS','Mensaje enviada con xito'));
dictionary.push(new TranslationItem('SEND_MESSAGE_ERROR',''));
dictionary.push(new TranslationItem('FILL_ALL_FIELDS','Llena todos los campos obligatorios'));
dictionary.push(new TranslationItem('VALIDATE_FORM_ERROR',''));
dictionary.push(new TranslationItem('ERROR_DESCRIPTION',''));
dictionary.push(new TranslationItem('CLICK_OK_TO_CONTINUE',''));
dictionary.push(new TranslationItem('INVALID_INPUT','Datos Invalidos'));
dictionary.push(new TranslationItem('ERROR_FIELD_COLOR',''));
dictionary.push(new TranslationItem('ENTER_MINIMUM_CHARACTERS','Inserte ms caracteres. El mnimo es'));
dictionary.push(new TranslationItem('LOADING','Cargando'));
dictionary.push(new TranslationItem('TURN_OFF_LIGHT','Apagar la Luz'));
dictionary.push(new TranslationItem('TURN_ON_LIGHT','Encender la Luz'));
dictionary.push(new TranslationItem('FORM_NOT_COMPLETE',''));
