/*!
 * jQuery JavaScript Library v1.4
 * http://jquery.com/
 *
 * Copyright 2010, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://docs.jquery.com/License
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2010, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Wed Jan 13 15:23:05 2010 -0500
 */
(function(A,w){function oa(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(oa,1);return}c.ready()}}function La(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function $(a,b,d,f,e,i){var j=a.length;if(typeof b==="object"){for(var o in b)$(a,o,b[o],f,e,d);return a}if(d!==w){f=!i&&f&&c.isFunction(d);for(o=0;o<j;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,i);return a}return j?
e(a[0],b):null}function K(){return(new Date).getTime()}function aa(){return false}function ba(){return true}function pa(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function qa(a){var b=true,d=[],f=[],e=arguments,i,j,o,p,n,t=c.extend({},c.data(this,"events").live);for(p in t){j=t[p];if(j.live===a.type||j.altLive&&c.inArray(a.type,j.altLive)>-1){i=j.data;i.beforeFilter&&i.beforeFilter[a.type]&&!i.beforeFilter[a.type](a)||f.push(j.selector)}else delete t[p]}i=c(a.target).closest(f,a.currentTarget);
n=0;for(l=i.length;n<l;n++)for(p in t){j=t[p];o=i[n].elem;f=null;if(i[n].selector===j.selector){if(j.live==="mouseenter"||j.live==="mouseleave")f=c(a.relatedTarget).closest(j.selector)[0];if(!f||f!==o)d.push({elem:o,fn:j})}}n=0;for(l=d.length;n<l;n++){i=d[n];a.currentTarget=i.elem;a.data=i.fn.data;if(i.fn.apply(i.elem,e)===false){b=false;break}}return b}function ra(a,b){return["live",a,b.replace(/\./g,"`").replace(/ /g,"&")].join(".")}function sa(a){return!a||!a.parentNode||a.parentNode.nodeType===
11}function ta(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var i in f)for(var j in f[i])c.event.add(this,i,f[i][j],f[i][j].data)}}})}function ua(a,b,d){var f,e,i;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&a[0].indexOf("<option")<0){e=true;if(i=c.fragments[a[0]])if(i!==1)f=i}if(!f){b=b&&b[0]?b[0].ownerDocument||b[0]:s;f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=
i?f:1;return{fragment:f,cacheable:e}}function T(a){for(var b=0,d,f;(d=a[b])!=null;b++)if(!c.noData[d.nodeName.toLowerCase()]&&(f=d[H]))delete c.cache[f]}function L(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ma=A.jQuery,Na=A.$,s=A.document,U,Oa=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Pa=/^.[^:#\[\.,]*$/,Qa=/\S/,
Ra=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Sa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],M,ca=Object.prototype.toString,da=Object.prototype.hasOwnProperty,ea=Array.prototype.push,R=Array.prototype.slice,V=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(typeof a==="string")if((d=Oa.exec(a))&&(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Sa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];
c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=ua([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return U.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a)}else return!b||b.jquery?(b||U).find(a):c(b).find(a);else if(c.isFunction(a))return U.ready(a);if(a.selector!==w){this.selector=a.selector;
this.context=a.context}return c.isArray(a)?this.setArray(a):c.makeArray(a,this)},selector:"",jquery:"1.4",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){a=c(a||null);a.prevObject=this;a.context=this.context;if(b==="find")a.selector=this.selector+(this.selector?" ":"")+d;else if(b)a.selector=this.selector+"."+b+"("+d+")";return a},setArray:function(a){this.length=
0;ea.apply(this,a);return this},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||
c(null)},push:ea,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,i,j,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(i in e){j=a[i];o=e[i];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){j=j&&(c.isPlainObject(j)||c.isArray(j))?j:c.isArray(o)?[]:{};a[i]=c.extend(f,j,o)}else if(o!==w)a[i]=
o}return a};c.extend({noConflict:function(a){A.$=Na;if(a)A.jQuery=Ma;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded",M,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",
M);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&oa()}}},isFunction:function(a){return ca.call(a)==="[object Function]"},isArray:function(a){return ca.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||ca.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!da.call(a,"constructor")&&!da.call(a.constructor.prototype,"isPrototypeOf"))return false;var b;for(b in a);return b===w||da.call(a,b)},
isEmptyObject:function(a){for(var b in a)return false;return true},noop:function(){},globalEval:function(a){if(a&&Qa.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,i=a.length,j=i===w||c.isFunction(a);
if(d)if(j)for(f in a){if(b.apply(a[f],d)===false)break}else for(;e<i;){if(b.apply(a[e++],d)===false)break}else if(j)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<i&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Ra,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ea.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=
0,f=b.length;d<f;d++)if(b[d]===a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,i=a.length;e<i;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,i=0,j=a.length;i<j;i++){e=b(a[i],i,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b===
"string"){d=a;a=d[b];b=w}else if(b&&!c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){var b={browser:""};a=a.toLowerCase();if(/webkit/.test(a))b={browser:"webkit",version:/webkit[\/ ]([\w.]+)/};else if(/opera/.test(a))b={browser:"opera",version:/version/.test(a)?/version[\/ ]([\w.]+)/:/opera[\/ ]([\w.]+)/};else if(/msie/.test(a))b={browser:"msie",version:/msie ([\w.]+)/};else if(/mozilla/.test(a)&&
!/compatible/.test(a))b={browser:"mozilla",version:/rv:([\w.]+)/};b.version=(b.version&&b.version.exec(a)||[0,"0"])[1];return b},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari=true;if(V)c.inArray=function(a,b){return V.call(b,a)};U=c(s);if(s.addEventListener)M=function(){s.removeEventListener("DOMContentLoaded",M,false);c.ready()};else if(s.attachEvent)M=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",
M);c.ready()}};if(V)c.inArray=function(a,b){return V.call(b,a)};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+K();d.style.display="none";d.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var e=d.getElementsByTagName("*"),i=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!i)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,
htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(i.getAttribute("style")),hrefNormalized:i.getAttribute("href")==="/a",opacity:/^0.55$/.test(i.style.opacity),cssFloat:!!i.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(j){}a.insertBefore(b,
a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function o(){c.support.noCloneEvent=false;d.detachEvent("onclick",o)});d.cloneNode(true).fireEvent("onclick")}c(function(){var o=s.createElement("div");o.style.width=o.style.paddingLeft="1px";s.body.appendChild(o);c.boxModel=c.support.boxModel=o.offsetWidth===2;s.body.removeChild(o).style.display="none"});a=function(o){var p=s.createElement("div");o="on"+o;var n=o in
p;if(!n){p.setAttribute(o,"return;");n=typeof p[o]==="function"}return n};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=i=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var H="jQuery"+K(),Ta=0,ya={},Ua={};c.extend({cache:{},expando:H,noData:{embed:true,object:true,applet:true},data:function(a,
b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?ya:a;var f=a[H],e=c.cache;if(!b&&!f)return null;f||(f=++Ta);if(typeof b==="object"){a[H]=f;e=e[f]=c.extend(true,{},b)}else e=e[f]?e[f]:typeof d==="undefined"?Ua:(e[f]={});if(d!==w){a[H]=f;e[b]=d}return typeof b==="string"?e[b]:e}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?ya:a;var d=a[H],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{try{delete a[H]}catch(i){a.removeAttribute&&
a.removeAttribute(H)}delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,
a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,
a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var za=/[\n\t]/g,fa=/\s+/,Va=/\r/g,Wa=/href|src|style/,Xa=/(button|input)/i,Ya=/(button|input|object|select|textarea)/i,Za=/^(a|area)$/i,Aa=/radio|checkbox/;c.fn.extend({attr:function(a,
b){return $(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(p){var n=c(this);n.addClass(a.call(this,p,n.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(fa),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className)for(var i=" "+e.className+" ",j=0,o=b.length;j<o;j++){if(i.indexOf(" "+b[j]+" ")<0)e.className+=
" "+b[j]}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(p){var n=c(this);n.removeClass(a.call(this,p,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(fa),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var i=(" "+e.className+" ").replace(za," "),j=0,o=b.length;j<o;j++)i=i.replace(" "+b[j]+" "," ");e.className=i.substring(1,i.length-1)}else e.className=""}return this},toggleClass:function(a,
b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var i=c(this);i.toggleClass(a.call(this,e,i.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,i=0,j=c(this),o=b,p=a.split(fa);e=p[i++];){o=f?o:!j.hasClass(e);j[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=
" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(za," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var i=b?d:0;for(d=b?d+1:e.length;i<d;i++){var j=e[i];if(j.selected){a=c(j).val();if(b)return a;f.push(a)}}return f}if(Aa.test(b.type)&&
!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Va,"")}return w}var o=c.isFunction(a);return this.each(function(p){var n=c(this),t=a;if(this.nodeType===1){if(o)t=a.call(this,p,n.val());if(typeof t==="number")t+="";if(c.isArray(t)&&Aa.test(this.type))this.checked=c.inArray(n.val(),t)>=0;else if(c.nodeName(this,"select")){var z=c.makeArray(t);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),z)>=0});if(!z.length)this.selectedIndex=
-1}else this.value=t}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var i=Wa.test(b);if(b in a&&f&&!i){if(e){if(b==="type"&&Xa.test(a.nodeName)&&a.parentNode)throw"type property can't be changed";a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;
if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:Ya.test(a.nodeName)||Za.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&i?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var $a=function(a){return a.replace(/[^\w\s\.\|`]/g,function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===
3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;if(!d.guid)d.guid=c.guid++;if(f!==w){d=c.proxy(d);d.data=f}var e=c.data(a,"events")||c.data(a,"events",{}),i=c.data(a,"handle"),j;if(!i){j=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(j.elem,arguments):w};i=c.data(a,"handle",j)}if(i){i.elem=a;b=b.split(/\s+/);for(var o,p=0;o=b[p++];){var n=o.split(".");o=n.shift();d.type=n.slice(0).sort().join(".");var t=e[o],z=this.special[o]||{};if(!t){t=e[o]={};
if(!z.setup||z.setup.call(a,f,n,d)===false)if(a.addEventListener)a.addEventListener(o,i,false);else a.attachEvent&&a.attachEvent("on"+o,i)}if(z.add)if((n=z.add.call(a,d,f,n,t))&&c.isFunction(n)){n.guid=n.guid||d.guid;d=n}t[d.guid]=d;this.global[o]=true}a=null}}},global:{},remove:function(a,b,d){if(!(a.nodeType===3||a.nodeType===8)){var f=c.data(a,"events"),e,i,j;if(f){if(b===w||typeof b==="string"&&b.charAt(0)===".")for(i in f)this.remove(a,i+(b||""));else{if(b.type){d=b.handler;b=b.type}b=b.split(/\s+/);
for(var o=0;i=b[o++];){var p=i.split(".");i=p.shift();var n=!p.length,t=c.map(p.slice(0).sort(),$a);t=new RegExp("(^|\\.)"+t.join("\\.(?:.*\\.)?")+"(\\.|$)");var z=this.special[i]||{};if(f[i]){if(d){j=f[i][d.guid];delete f[i][d.guid]}else for(var B in f[i])if(n||t.test(f[i][B].type))delete f[i][B];z.remove&&z.remove.call(a,p,j);for(e in f[i])break;if(!e){if(!z.teardown||z.teardown.call(a,p)===false)if(a.removeEventListener)a.removeEventListener(i,c.data(a,"handle"),false);else a.detachEvent&&a.detachEvent("on"+
i,c.data(a,"handle"));e=null;delete f[i]}}}}for(e in f)break;if(!e){if(B=c.data(a,"handle"))B.elem=null;c.removeData(a,"events");c.removeData(a,"handle")}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[H]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();this.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===
8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;var i=c.data(d,"handle");i&&i.apply(d,b);var j,o;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()])){j=d[e];o=d["on"+e]}}catch(p){}i=c.nodeName(d,"a")&&e==="click";if(!f&&j&&!a.isDefaultPrevented()&&!i){this.triggered=true;try{d[e]()}catch(n){}}else if(o&&d["on"+e].apply(d,b)===false)a.result=false;this.triggered=false;if(!a.isPropagationStopped())(d=d.parentNode||d.ownerDocument)&&c.event.trigger(a,b,d,true)},
handle:function(a){var b,d;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;d=a.type.split(".");a.type=d.shift();b=!d.length&&!a.exclusive;var f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)");d=(c.data(this,"events")||{})[a.type];for(var e in d){var i=d[e];if(b||f.test(i.type)){a.handler=i;a.data=i.data;i=i.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}return a.result},
props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[H])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||
s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&
a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a,b){c.extend(a,b||{});a.guid+=b.selector+b.live;c.event.add(this,b.live,qa,b)},remove:function(a){if(a.length){var b=0,d=new RegExp("(^|\\.)"+a[0]+"(\\.|$)");c.each(c.data(this,"events").live||{},function(){d.test(this.type)&&b++});b<1&&c.event.remove(this,a[0],qa)}},special:{}},beforeunload:{setup:function(a,
b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=a;this.type=a.type}else this.type=a;this.timeStamp=K();this[H]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=ba;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=
ba;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ba;this.stopPropagation()},isDefaultPrevented:aa,isPropagationStopped:aa,isImmediatePropagationStopped:aa};var Ba=function(a){for(var b=a.relatedTarget;b&&b!==this;)try{b=b.parentNode}catch(d){break}if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}},Ca=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",
mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ca:Ba,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ca:Ba)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(a,b,d){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit."+d.guid,function(f){var e=f.target,i=e.type;if((i==="submit"||i==="image")&&c(e).closest("form").length)return pa("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit."+
d.guid,function(f){var e=f.target,i=e.type;if((i==="text"||i==="password")&&c(e).closest("form").length&&f.keyCode===13)return pa("submit",this,arguments)})}else return false},remove:function(a,b){c.event.remove(this,"click.specialSubmit"+(b?"."+b.guid:""));c.event.remove(this,"keypress.specialSubmit"+(b?"."+b.guid:""))}};if(!c.support.changeBubbles){var ga=/textarea|input|select/i;function Da(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>
-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d}function ha(a,b){var d=a.target,f,e;if(!(!ga.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Da(d);if(e!==f){if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",e);if(d.type!=="select"&&(f!=null||e)){a.type="change";return c.event.trigger(a,b,this)}}}}c.event.special.change={filters:{focusout:ha,click:function(a){var b=a.target,d=b.type;if(d===
"radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return ha.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return ha.call(this,a)},beforeactivate:function(a){a=a.target;a.nodeName.toLowerCase()==="input"&&a.type==="radio"&&c.data(a,"_change_data",Da(a))}},setup:function(a,b,d){for(var f in W)c.event.add(this,f+".specialChange."+d.guid,W[f]);return ga.test(this.nodeName)},
remove:function(a,b){for(var d in W)c.event.remove(this,d+".specialChange"+(b?"."+b.guid:""),W[d]);return ga.test(this.nodeName)}};var W=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a,d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,
f,e){if(typeof d==="object"){for(var i in d)this[b](i,f,d[i],e);return this}if(c.isFunction(f)){thisObject=e;e=f;f=w}var j=b==="one"?c.proxy(e,function(o){c(this).unbind(o,j);return e.apply(this,arguments)}):e;return d==="unload"&&b!=="one"?this.one(d,f,e,thisObject):this.each(function(){c.event.add(this,d,j,f)})}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&!a.preventDefault){for(var d in a)this.unbind(d,a[d]);return this}return this.each(function(){c.event.remove(this,a,b)})},trigger:function(a,
b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||
a)},live:function(a,b,d){if(c.isFunction(b)){d=b;b=w}c(this.context).bind(ra(a,this.selector),{data:b,selector:this.selector,live:a},d);return this},die:function(a,b){c(this.context).unbind(ra(a,this.selector),b?{guid:b.guid+this.selector+a}:null);return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){c.fn[b]=function(d){return d?
this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",k,m=0;g[m];m++){k=g[m];if(k.nodeType===3||k.nodeType===4)h+=k.nodeValue;else if(k.nodeType!==8)h+=a(k.childNodes)}return h}function b(g,h,k,m,r,q){r=0;for(var v=m.length;r<v;r++){var u=m[r];if(u){u=u[g];for(var y=false;u;){if(u.sizcache===
k){y=m[u.sizset];break}if(u.nodeType===1&&!q){u.sizcache=k;u.sizset=r}if(u.nodeName.toLowerCase()===h){y=u;break}u=u[g]}m[r]=y}}}function d(g,h,k,m,r,q){r=0;for(var v=m.length;r<v;r++){var u=m[r];if(u){u=u[g];for(var y=false;u;){if(u.sizcache===k){y=m[u.sizset];break}if(u.nodeType===1){if(!q){u.sizcache=k;u.sizset=r}if(typeof h!=="string"){if(u===h){y=true;break}}else if(p.filter(h,[u]).length>0){y=u;break}}u=u[g]}m[r]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
e=0,i=Object.prototype.toString,j=false,o=true;[0,0].sort(function(){o=false;return 0});var p=function(g,h,k,m){k=k||[];var r=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return k;for(var q=[],v,u,y,S,I=true,N=x(h),J=g;(f.exec(""),v=f.exec(J))!==null;){J=v[3];q.push(v[1]);if(v[2]){S=v[3];break}}if(q.length>1&&t.exec(g))if(q.length===2&&n.relative[q[0]])u=ia(q[0]+q[1],h);else for(u=n.relative[q[0]]?[h]:p(q.shift(),h);q.length;){g=q.shift();if(n.relative[g])g+=q.shift();
u=ia(g,u)}else{if(!m&&q.length>1&&h.nodeType===9&&!N&&n.match.ID.test(q[0])&&!n.match.ID.test(q[q.length-1])){v=p.find(q.shift(),h,N);h=v.expr?p.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:q.pop(),set:B(m)}:p.find(q.pop(),q.length===1&&(q[0]==="~"||q[0]==="+")&&h.parentNode?h.parentNode:h,N);u=v.expr?p.filter(v.expr,v.set):v.set;if(q.length>0)y=B(u);else I=false;for(;q.length;){var E=q.pop();v=E;if(n.relative[E])v=q.pop();else E="";if(v==null)v=h;n.relative[E](y,v,N)}}else y=[]}y||(y=u);if(!y)throw"Syntax error, unrecognized expression: "+
(E||g);if(i.call(y)==="[object Array]")if(I)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&F(h,y[g])))k.push(u[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&k.push(u[g]);else k.push.apply(k,y);else B(y,k);if(S){p(S,r,k,m);p.uniqueSort(k)}return k};p.uniqueSort=function(g){if(D){j=o;g.sort(D);if(j)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};p.matches=function(g,h){return p(g,null,null,h)};p.find=function(g,h,k){var m,r;if(!g)return[];
for(var q=0,v=n.order.length;q<v;q++){var u=n.order[q];if(r=n.leftMatch[u].exec(g)){var y=r[1];r.splice(1,1);if(y.substr(y.length-1)!=="\\"){r[1]=(r[1]||"").replace(/\\/g,"");m=n.find[u](r,h,k);if(m!=null){g=g.replace(n.match[u],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};p.filter=function(g,h,k,m){for(var r=g,q=[],v=h,u,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var I in n.filter)if((u=n.leftMatch[I].exec(g))!=null&&u[2]){var N=n.filter[I],J,E;E=u[1];y=false;u.splice(1,1);if(E.substr(E.length-
1)!=="\\"){if(v===q)q=[];if(n.preFilter[I])if(u=n.preFilter[I](u,v,k,q,m,S)){if(u===true)continue}else y=J=true;if(u)for(var X=0;(E=v[X])!=null;X++)if(E){J=N(E,u,X,v);var Ea=m^!!J;if(k&&J!=null)if(Ea)y=true;else v[X]=false;else if(Ea){q.push(E);y=true}}if(J!==w){k||(v=q);g=g.replace(n.match[I],"");if(!y)return[];break}}}if(g===r)if(y==null)throw"Syntax error, unrecognized expression: "+g;else break;r=g}return v};var n=p.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},
relative:{"+":function(g,h){var k=typeof h==="string",m=k&&!/\W/.test(h);k=k&&!m;if(m)h=h.toLowerCase();m=0;for(var r=g.length,q;m<r;m++)if(q=g[m]){for(;(q=q.previousSibling)&&q.nodeType!==1;);g[m]=k||q&&q.nodeName.toLowerCase()===h?q||false:q===h}k&&p.filter(h,g,true)},">":function(g,h){var k=typeof h==="string";if(k&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,r=g.length;m<r;m++){var q=g[m];if(q){k=q.parentNode;g[m]=k.nodeName.toLowerCase()===h?k:false}}}else{m=0;for(r=g.length;m<r;m++)if(q=g[m])g[m]=
k?q.parentNode:q.parentNode===h;k&&p.filter(h,g,true)}},"":function(g,h,k){var m=e++,r=d;if(typeof h==="string"&&!/\W/.test(h)){var q=h=h.toLowerCase();r=b}r("parentNode",h,m,g,q,k)},"~":function(g,h,k){var m=e++,r=d;if(typeof h==="string"&&!/\W/.test(h)){var q=h=h.toLowerCase();r=b}r("previousSibling",h,m,g,q,k)}},find:{ID:function(g,h,k){if(typeof h.getElementById!=="undefined"&&!k)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var k=[];
h=h.getElementsByName(g[1]);for(var m=0,r=h.length;m<r;m++)h[m].getAttribute("name")===g[1]&&k.push(h[m]);return k.length===0?null:k}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,k,m,r,q){g=" "+g[1].replace(/\\/g,"")+" ";if(q)return g;q=0;for(var v;(v=h[q])!=null;q++)if(v)if(r^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))k||m.push(v);else if(k)h[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},
CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,k,m,r,q){h=g[1].replace(/\\/g,"");if(!q&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,k,m,r){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=p(g[3],null,null,h);else{g=p.filter(g[3],h,k,true^r);k||m.push.apply(m,
g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,k){return!!p(k[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},
text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},
setFilters:{first:function(g,h){return h===0},last:function(g,h,k,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,k){return h<k[3]-0},gt:function(g,h,k){return h>k[3]-0},nth:function(g,h,k){return k[3]-0===h},eq:function(g,h,k){return k[3]-0===h}},filter:{PSEUDO:function(g,h,k,m){var r=h[1],q=n.filters[r];if(q)return q(g,k,h,m);else if(r==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(r==="not"){h=
h[3];k=0;for(m=h.length;k<m;k++)if(h[k]===g)return false;return true}else throw"Syntax error, unrecognized expression: "+r;},CHILD:function(g,h){var k=h[1],m=g;switch(k){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(k==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":k=h[2];var r=h[3];if(k===1&&r===0)return true;h=h[0];var q=g.parentNode;if(q&&(q.sizcache!==h||!g.nodeIndex)){var v=0;for(m=q.firstChild;m;m=
m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;q.sizcache=h}g=g.nodeIndex-r;return k===0?g===0:g%k===0&&g/k>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var k=h[1];g=n.attrHandle[k]?n.attrHandle[k](g):g[k]!=null?g[k]:g.getAttribute(k);k=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m===
"="?k===h:m==="*="?k.indexOf(h)>=0:m==="~="?(" "+k+" ").indexOf(h)>=0:!h?k&&g!==false:m==="!="?k!==h:m==="^="?k.indexOf(h)===0:m==="$="?k.substr(k.length-h.length)===h:m==="|="?k===h||k.substr(0,h.length+1)===h+"-":false},POS:function(g,h,k,m){var r=n.setFilters[h[2]];if(r)return r(g,k,h,m)}}},t=n.match.POS;for(var z in n.match){n.match[z]=new RegExp(n.match[z].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[z]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[z].source.replace(/\\(\d+)/g,function(g,
h){return"\\"+(h-0+1)}))}var B=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){B=function(g,h){h=h||[];if(i.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var k=0,m=g.length;k<m;k++)h.push(g[k]);else for(k=0;g[k];k++)h.push(g[k]);return h}}var D;if(s.documentElement.compareDocumentPosition)D=function(g,h){if(!g.compareDocumentPosition||
!h.compareDocumentPosition){if(g==h)j=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)j=true;return g};else if("sourceIndex"in s.documentElement)D=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)j=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)j=true;return g};else if(s.createRange)D=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)j=true;return g.ownerDocument?-1:1}var k=g.ownerDocument.createRange(),m=
h.ownerDocument.createRange();k.setStart(g,0);k.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=k.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)j=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var k=s.documentElement;k.insertBefore(g,k.firstChild);if(s.getElementById(h)){n.find.ID=function(m,r,q){if(typeof r.getElementById!=="undefined"&&!q)return(r=r.getElementById(m[1]))?r.id===m[1]||typeof r.getAttributeNode!=="undefined"&&
r.getAttributeNode("id").nodeValue===m[1]?[r]:w:[]};n.filter.ID=function(m,r){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===r}}k.removeChild(g);k=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,k){k=k.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;k[m];m++)k[m].nodeType===1&&h.push(k[m]);k=h}return k};g.innerHTML="<a href='#'></a>";
if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=p,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){p=function(m,r,q,v){r=r||s;if(!v&&r.nodeType===9&&!x(r))try{return B(r.querySelectorAll(m),q)}catch(u){}return g(m,r,q,v)};for(var k in g)p[k]=g[k];h=null}}();
(function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,k,m){if(typeof k.getElementsByClassName!=="undefined"&&!m)return k.getElementsByClassName(h[1])};g=null}}})();var F=s.compareDocumentPosition?function(g,h){return g.compareDocumentPosition(h)&16}:function(g,
h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ia=function(g,h){var k=[],m="",r;for(h=h.nodeType?[h]:h;r=n.match.PSEUDO.exec(g);){m+=r[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;r=0;for(var q=h.length;r<q;r++)p(g,h[r],k);return p.filter(m,k)};c.find=p;c.expr=p.selectors;c.expr[":"]=c.expr.filters;c.unique=p.uniqueSort;c.getText=a;c.isXMLDoc=x;c.contains=F})();var ab=/Until$/,bb=/^(?:parents|prevUntil|prevAll)/,
cb=/,/;R=Array.prototype.slice;var Fa=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,i){return!!b.call(e,i,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Pa.test(b))return c.filter(b,f,!d);else b=c.filter(b,a)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;
c.find(a,this[f],b);if(f>0)for(var i=d;i<b.length;i++)for(var j=0;j<d;j++)if(b[j]===b[i]){b.splice(i--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Fa(this,a,false),"not",a)},filter:function(a){return this.pushStack(Fa(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,i=
{},j;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){j=a[e];i[j]||(i[j]=c.expr.match.POS.test(j)?c(j,b||this.context):j)}for(;f&&f.ownerDocument&&f!==b;){for(j in i){e=i[j];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:j,elem:f});delete i[j]}}f=f.parentNode}}return d}var p=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,t){for(;t&&t.ownerDocument&&t!==b;){if(p?p.index(t)>-1:c(t).is(a))return t;t=t.parentNode}return null})},index:function(a){if(!a||typeof a===
"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(sa(a[0])||sa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",
d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?
a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);ab.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||cb.test(f))&&bb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||!c(a).is(d));){a.nodeType===
1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ga=/ jQuery\d+="(?:\d+|null)"/g,Y=/^\s+/,db=/(<([\w:]+)[^>]*?)\/>/g,eb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,Ha=/<([\w:]+)/,fb=/<tbody/i,gb=/<|&\w+;/,hb=function(a,b,d){return eb.test(d)?a:b+"></"+d+">"},G={option:[1,"<select multiple='multiple'>","</select>"],
legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};G.optgroup=G.option;G.tbody=G.tfoot=G.colgroup=G.caption=G.thead;G.th=G.td;if(!c.support.htmlSerialize)G._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=c(this);
return d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.getText(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
wrapInner:function(a){return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&
this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,
"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ga,"").replace(Y,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ta(this,b);ta(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===
1?this[0].innerHTML.replace(Ga,""):null;else if(typeof a==="string"&&!/<script/i.test(a)&&(c.support.leadingWhitespace||!Y.test(a))&&!G[(Ha.exec(a)||["",""])[1].toLowerCase()])try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){T(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}else c.isFunction(a)?this.each(function(e){var i=c(this),j=i.html();i.empty().append(function(){return a.call(this,e,j)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&
this[0].parentNode){c.isFunction(a)||(a=c(a).detach());return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(t){return c.nodeName(t,"table")?t.getElementsByTagName("tbody")[0]||t.appendChild(t.ownerDocument.createElement("tbody")):t}var e,i,j=a[0],o=[];if(c.isFunction(j))return this.each(function(t){var z=
c(this);a[0]=j.call(this,t,b?z.html():w);return z.domManip(a,b,d)});if(this[0]){e=a[0]&&a[0].parentNode&&a[0].parentNode.nodeType===11?{fragment:a[0].parentNode}:ua(a,this,o);if(i=e.fragment.firstChild){b=b&&c.nodeName(i,"tr");for(var p=0,n=this.length;p<n;p++)d.call(b?f(this[p],i):this[p],e.cacheable||this.length>1||p>0?e.fragment.cloneNode(true):e.fragment)}o&&c.each(o,La)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},
function(a,b){c.fn[a]=function(d){var f=[];d=c(d);for(var e=0,i=d.length;e<i;e++){var j=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),j);f=f.concat(j)}return this.pushStack(f,a,d.selector)}});c.each({remove:function(a,b){if(!a||c.filter(a,[this]).length){if(!b&&this.nodeType===1){T(this.getElementsByTagName("*"));T([this])}this.parentNode&&this.parentNode.removeChild(this)}},empty:function(){for(this.nodeType===1&&T(this.getElementsByTagName("*"));this.firstChild;)this.removeChild(this.firstChild)}},
function(a,b){c.fn[a]=function(){return this.each(b,arguments)}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;var e=[];c.each(a,function(i,j){if(typeof j==="number")j+="";if(j){if(typeof j==="string"&&!gb.test(j))j=b.createTextNode(j);else if(typeof j==="string"){j=j.replace(db,hb);var o=(Ha.exec(j)||["",""])[1].toLowerCase(),p=G[o]||G._default,n=p[0];i=b.createElement("div");for(i.innerHTML=p[1]+j+p[2];n--;)i=i.lastChild;
if(!c.support.tbody){n=fb.test(j);o=o==="table"&&!n?i.firstChild&&i.firstChild.childNodes:p[1]==="<table>"&&!n?i.childNodes:[];for(p=o.length-1;p>=0;--p)c.nodeName(o[p],"tbody")&&!o[p].childNodes.length&&o[p].parentNode.removeChild(o[p])}!c.support.leadingWhitespace&&Y.test(j)&&i.insertBefore(b.createTextNode(Y.exec(j)[0]),i.firstChild);j=c.makeArray(i.childNodes)}if(j.nodeType)e.push(j);else e=c.merge(e,j)}});if(d)for(a=0;e[a];a++)if(f&&c.nodeName(e[a],"script")&&(!e[a].type||e[a].type.toLowerCase()===
"text/javascript"))f.push(e[a].parentNode?e[a].parentNode.removeChild(e[a]):e[a]);else{e[a].nodeType===1&&e.splice.apply(e,[a+1,0].concat(c.makeArray(e[a].getElementsByTagName("script"))));d.appendChild(e[a])}return e}});var ib=/z-?index|font-?weight|opacity|zoom|line-?height/i,Ia=/alpha\([^)]*\)/,Ja=/opacity=([^)]*)/,ja=/float/i,ka=/-([a-z])/ig,jb=/([A-Z])/g,kb=/^-?\d+(?:px)?$/i,lb=/^-?\d/,mb={position:"absolute",visibility:"hidden",display:"block"},nb=["Left","Right"],ob=["Top","Bottom"],pb=s.defaultView&&
s.defaultView.getComputedStyle,Ka=c.support.cssFloat?"cssFloat":"styleFloat",la=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return $(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!ib.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""===
"NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=Ia.test(a)?a.replace(Ia,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Ja.exec(f.filter)[1])/100+"":""}if(ja.test(b))b=Ka;b=b.replace(ka,la);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,i=b==="width"?nb:ob;function j(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(i,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=
parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,"border"+this+"Width",true))||0})}a.offsetWidth!==0?j():c.swap(a,mb,j);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Ja.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ja.test(b))b=Ka;if(!d&&e&&e[b])f=e[b];else if(pb){if(ja.test(b))b="float";b=b.replace(jb,"-$1").toLowerCase();e=
a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ka,la);f=a.currentStyle[b]||a.currentStyle[d];if(!kb.test(f)&&lb.test(f)){b=e.left;var i=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=i}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=
f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var qb=K(),rb=/<script(.|\s)*?\/script>/gi,sb=/select|textarea/i,tb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,O=/=\?(&|$)/,ma=/\?/,ub=/(\?|&)_=.*?(&|$)/,vb=/^(\w+:)?\/\/([^\/?#]+)/,
wb=/%20/g;c.fn.extend({_load:c.fn.load,load:function(a,b,d){if(typeof a!=="string")return this._load(a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}c.ajax({url:a,type:f,dataType:"html",data:b,context:this,complete:function(i,j){if(j==="success"||j==="notmodified")this.html(e?c("<div />").append(i.responseText.replace(rb,
"")).find(e):i.responseText);d&&this.each(d,[i.responseText,j,i])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||sb.test(this.nodeName)||tb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});
c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},
ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",
text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&&e.success.call(p,o,j,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(p,x,j);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(r,q){(e.context?c(e.context):c.event).trigger(r,q)}var e=c.extend(true,{},c.ajaxSettings,a),i,j,o,p=e.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,
e.traditional);if(e.dataType==="jsonp"){if(n==="GET")O.test(e.url)||(e.url+=(ma.test(e.url)?"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!O.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&O.test(e.data)||O.test(e.url))){i=e.jsonpCallback||"jsonp"+qb++;if(e.data)e.data=(e.data+"").replace(O,"="+i+"$1");e.url=e.url.replace(O,"="+i+"$1");e.dataType="script";A[i]=A[i]||function(r){o=r;b();d();A[i]=w;try{delete A[i]}catch(q){}B&&
B.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===false&&n==="GET"){var t=K(),z=e.url.replace(ub,"$1_="+t+"$2");e.url=z+(z===e.url?(ma.test(e.url)?"&":"?")+"_="+t:"")}if(e.data&&n==="GET")e.url+=(ma.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");t=(t=vb.exec(e.url))&&(t[1]&&t[1]!==location.protocol||t[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&t){var B=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");
C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!i){var D=false;C.onload=C.onreadystatechange=function(){if(!D&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){D=true;b();d();C.onload=C.onreadystatechange=null;B&&C.parentNode&&B.removeChild(C)}}}B.insertBefore(C,B.firstChild);return w}var F=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",
e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since",c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}t||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ia){}if(e.beforeSend&&e.beforeSend.call(p,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",
[x,e]);var g=x.onreadystatechange=function(r){if(!x||x.readyState===0){F||d();F=true;if(x)x.onreadystatechange=c.noop}else if(!F&&x&&(x.readyState===4||r==="timeout")){F=true;x.onreadystatechange=c.noop;j=r==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";if(j==="success")try{o=c.httpData(x,e.dataType,e)}catch(q){j="parsererror"}if(j==="success"||j==="notmodified")i||b();else c.handleError(e,x,j);d();r==="timeout"&&x.abort();if(e.async)x=
null}};try{var h=x.abort;x.abort=function(){if(x){h.call(x);if(x)x.readyState=0}g()}}catch(k){}e.async&&e.timeout>0&&setTimeout(function(){x&&!F&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||A,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol===
"file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;if(e&&a.documentElement.nodeName==="parsererror")throw"parsererror";if(d&&
d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&f.indexOf("json")>=0)if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))a=A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+a))();else throw"Invalid JSON: "+a;else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(e,i){i=
c.isFunction(i)?i():i;f[f.length]=encodeURIComponent(e)+"="+encodeURIComponent(i)}var f=[];if(b===w)b=c.ajaxSettings.traditional;c.isArray(a)||a.jquery?c.each(a,function(){d(this.name,this.value)}):c.each(a,function e(i,j){if(c.isArray(j))c.each(j,function(o,p){b?d(i,p):e(i+"["+(typeof p==="object"||c.isArray(p)?o:"")+"]",p)});else!b&&j!=null&&typeof j==="object"?c.each(j,function(o,p){e(i+"["+o+"]",p)}):d(i,j)});return f.join("&").replace(wb,"+")}});var na={},xb=/toggle|show|hide/,yb=/^([+-]=)?([\d+-.]+)(.*)$/,
Z,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a!=null)return this.animate(L("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(na[d])f=na[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();
na[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a!=null)return this.animate(L("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&
c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(L("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var i=c.extend({},e),j,o=this.nodeType===1&&c(this).is(":hidden"),
p=this;for(j in a){var n=j.replace(ka,la);if(j!==n){a[n]=a[j];delete a[j];j=n}if(a[j]==="hide"&&o||a[j]==="show"&&!o)return i.complete.call(this);if((j==="height"||j==="width")&&this.style){i.display=c.css(this,"display");i.overflow=this.style.overflow}if(c.isArray(a[j])){(i.specialEasing=i.specialEasing||{})[j]=a[j][1];a[j]=a[j][0]}}if(i.overflow!=null)this.style.overflow="hidden";i.curAnim=c.extend({},a);c.each(a,function(t,z){var B=new c.fx(p,i,t);if(xb.test(z))B[z==="toggle"?o?"show":"hide":z](a);
else{var C=yb.exec(z),D=B.cur(true)||0;if(C){z=parseFloat(C[2]);var F=C[3]||"px";if(F!=="px"){p.style[t]=(z||1)+F;D=(z||1)/B.cur(true)*D;p.style[t]=D+F}if(C[1])z=(C[1]==="-="?-1:1)*z+D;B.custom(D,z,F)}else B.custom(D,z,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:L("show",1),slideUp:L("hide",1),slideToggle:L("toggle",
1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration==="number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,
b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==
null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(i){return e.step(i)}this.startTime=K();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!Z)Z=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop===
"width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=K(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=
this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=
c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||c.fx.stop()},stop:function(){clearInterval(Z);Z=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=
null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement?function(a){var b=this[0];if(!b||!b.ownerDocument)return null;if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),
f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(!b||!b.ownerDocument)return null;if(a)return this.each(function(t){c.offset.setOffset(this,a,t)});if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=
b,e=b.ownerDocument,i,j=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var p=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==j;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;i=e?e.getComputedStyle(b,null):b.currentStyle;p-=b.scrollTop;n-=b.scrollLeft;if(b===d){p+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){p+=parseFloat(i.borderTopWidth)||
0;n+=parseFloat(i.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&i.overflow!=="visible"){p+=parseFloat(i.borderTopWidth)||0;n+=parseFloat(i.borderLeftWidth)||0}f=i}if(f.position==="relative"||f.position==="static"){p+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&&f.position==="fixed"){p+=Math.max(j.scrollTop,o.scrollTop);n+=Math.max(j.scrollLeft,o.scrollLeft)}return{top:p,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),
d,f,e,i=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.insertBefore(b,a.firstChild);
d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i;a.removeChild(b);c.offset.initialize=c.noop},
bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),i=parseInt(c.curCSS(a,"top",true),10)||0,j=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,d,e);d={top:b.top-e.top+i,left:b.left-
e.left+j};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=
this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],i;if(!e)return null;if(f!==w)return this.each(function(){if(i=wa(this))i.scrollTo(!a?f:c(i).scrollLeft(),a?f:c(i).scrollTop());else this[d]=f});else return(i=wa(e))?"pageXOffset"in i?i[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&i.document.documentElement[d]||i.document.body[d]:e[d]}});
c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;return"scrollTo"in e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+
b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window);/*
 * jquery.tools 1.1.2 - The missing UI library for the Web
 * 
 * [tools.tabs-1.0.4]
 * 
 * Copyright (c) 2009 Tero Piirainen
 * http://flowplayer.org/tools/
 *
 * Dual licensed under MIT and GPL 2+ licenses
 * http://www.opensource.org/licenses
 * 
 * -----
 * 
 * File generated: Thu Mar 11 19:37:48 GMT 2010
 */
(function(d){d.tools=d.tools||{};d.tools.tabs={version:"1.0.4",conf:{tabs:"a",current:"current",onBeforeClick:null,onClick:null,effect:"default",initialIndex:0,event:"click",api:false,rotate:false},addEffect:function(e,f){c[e]=f}};var c={"default":function(f,e){this.getPanes().hide().eq(f).show();e.call()},fade:function(g,e){var f=this.getConf(),j=f.fadeOutSpeed,h=this.getPanes();if(j){h.fadeOut(j)}else{h.hide()}h.eq(g).fadeIn(f.fadeInSpeed,e)},slide:function(f,e){this.getPanes().slideUp(200);this.getPanes().eq(f).slideDown(400,e)},ajax:function(f,e){this.getPanes().eq(0).load(this.getTabs().eq(f).attr("href"),e)}};var b;d.tools.tabs.addEffect("horizontal",function(f,e){if(!b){b=this.getPanes().eq(0).width()}this.getCurrentPane().animate({width:0},function(){d(this).hide()});this.getPanes().eq(f).animate({width:b},function(){d(this).show();e.call()})});function a(g,h,f){var e=this,j=d(this),i;d.each(f,function(k,l){if(d.isFunction(l)){j.bind(k,l)}});d.extend(this,{click:function(k,n){var o=e.getCurrentPane();var l=g.eq(k);if(typeof k=="string"&&k.replace("#","")){l=g.filter("[href*="+k.replace("#","")+"]");k=Math.max(g.index(l),0)}if(f.rotate){var m=g.length-1;if(k<0){return e.click(m,n)}if(k>m){return e.click(0,n)}}if(!l.length){if(i>=0){return e}k=f.initialIndex;l=g.eq(k)}if(k===i){return e}n=n||d.Event();n.type="onBeforeClick";j.trigger(n,[k]);if(n.isDefaultPrevented()){return}c[f.effect].call(e,k,function(){n.type="onClick";j.trigger(n,[k])});n.type="onStart";j.trigger(n,[k]);if(n.isDefaultPrevented()){return}i=k;g.removeClass(f.current);l.addClass(f.current);return e},getConf:function(){return f},getTabs:function(){return g},getPanes:function(){return h},getCurrentPane:function(){return h.eq(i)},getCurrentTab:function(){return g.eq(i)},getIndex:function(){return i},next:function(){return e.click(i+1)},prev:function(){return e.click(i-1)},bind:function(k,l){j.bind(k,l);return e},onBeforeClick:function(k){return this.bind("onBeforeClick",k)},onClick:function(k){return this.bind("onClick",k)},unbind:function(k){j.unbind(k);return e}});g.each(function(k){d(this).bind(f.event,function(l){e.click(k,l);return false})});if(location.hash){e.click(location.hash)}else{if(f.initialIndex===0||f.initialIndex>0){e.click(f.initialIndex)}}h.find("a[href^=#]").click(function(k){e.click(d(this).attr("href"),k)})}d.fn.tabs=function(i,f){var g=this.eq(typeof f=="number"?f:0).data("tabs");if(g){return g}if(d.isFunction(f)){f={onBeforeClick:f}}var h=d.extend({},d.tools.tabs.conf),e=this.length;f=d.extend(h,f);this.each(function(l){var j=d(this);var k=j.find(f.tabs);if(!k.length){k=j.children()}var m=i.jquery?i:j.children(i);if(!m.length){m=e==1?d(i):j.parent().find(i)}g=new a(k,m,f);j.data("tabs",g)});return f.api?g:this}})(jQuery);


/*!
 * jQuery UI 1.8rc3
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI
 */
/*
 * jQuery UI 1.8rc3
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI
 */
jQuery.ui||(function(b){var a=b.browser.mozilla&&(parseFloat(b.browser.version)<1.9);b.ui={version:"1.8rc3",plugin:{add:function(d,e,g){var f=b.ui[d].prototype;for(var c in g){f.plugins[c]=f.plugins[c]||[];f.plugins[c].push([e,g[c]])}},call:function(c,e,d){var g=c.plugins[e];if(!g||!c.element[0].parentNode){return}for(var f=0;f<g.length;f++){if(c.options[g[f][0]]){g[f][1].apply(c.element,d)}}}},contains:function(d,c){return document.compareDocumentPosition?d.compareDocumentPosition(c)&16:d!==c&&d.contains(c)},hasScroll:function(f,d){if(b(f).css("overflow")=="hidden"){return false}var c=(d&&d=="left")?"scrollLeft":"scrollTop",e=false;if(f[c]>0){return true}f[c]=1;e=(f[c]>0);f[c]=0;return e},isOverAxis:function(d,c,e){return(d>c)&&(d<(c+e))},isOver:function(h,d,g,f,c,e){return b.ui.isOverAxis(h,g,c)&&b.ui.isOverAxis(d,f,e)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};b.fn.extend({_focus:b.fn.focus,focus:function(c,d){return typeof c==="number"?this.each(function(){var e=this;setTimeout(function(){b(e).focus();(d&&d.call(e))},c)}):this._focus.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var c;if((b.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){c=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(b.curCSS(this,"position",1))&&(/(auto|scroll)/).test(b.curCSS(this,"overflow",1)+b.curCSS(this,"overflow-y",1)+b.curCSS(this,"overflow-x",1))}).eq(0)}else{c=this.parents().filter(function(){return(/(auto|scroll)/).test(b.curCSS(this,"overflow",1)+b.curCSS(this,"overflow-y",1)+b.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!c.length?b(document):c},zIndex:function(f){if(f!==undefined){return this.css("zIndex",f)}if(this.length){var d=b(this[0]),c,e;while(d.length&&d[0]!==document){c=d.css("position");if(c=="absolute"||c=="relative"||c=="fixed"){e=parseInt(d.css("zIndex"));if(!isNaN(e)&&e!=0){return e}}d=d.parent()}}return 0}});b.extend(b.expr[":"],{data:function(e,d,c){return !!b.data(e,c[3])},focusable:function(d){var e=d.nodeName.toLowerCase(),c=b.attr(d,"tabindex");return(/input|select|textarea|button|object/.test(e)?!d.disabled:"a"==e||"area"==e?d.href||!isNaN(c):!isNaN(c))&&!b(d)["area"==e?"parents":"closest"](":hidden").length},tabbable:function(d){var c=b.attr(d,"tabindex");return(isNaN(c)||c>=0)&&b(d).is(":focusable")}})})(jQuery);;/*
 * jQuery UI Datepicker 1.8rc3
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Datepicker
 *
 * Depends:
 *	jquery.ui.core.js
 */
(function($){$.extend($.ui,{datepicker:{version:"1.8rc3"}});var PROP_NAME="datepicker";var dpuuid=new Date().getTime();function Datepicker(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass="ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"show",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"_default",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false};$.extend(this._defaults,this.regional[""]);this.dpDiv=$('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>')}$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",log:function(){if(this.debug){console.log.apply("",arguments)}},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase();var inline=(nodeName=="div"||nodeName=="span");if(!target.id){target.id="dp"+(++this.uuid)}var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{});if(nodeName=="input"){this._connectDatepicker(target,inst)}else{if(inline){this._inlineDatepicker(target,inst)}}},_newInst:function(target,inline){var id=target[0].id.replace(/([^A-Za-z0-9_])/g,"\\\$1");return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:$('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}},_connectDatepicker:function(target,inst){var input=$(target);inst.append=$([]);inst.trigger=$([]);if(input.hasClass(this.markerClassName)){return}this._attachments(input,inst);input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});this._autoSize(inst);$.data(target,PROP_NAME,inst)},_attachments:function(input,inst){var appendText=this._get(inst,"appendText");var isRTL=this._get(inst,"isRTL");if(inst.append){inst.append.remove()}if(appendText){inst.append=$('<span class="'+this._appendClass+'">'+appendText+"</span>");input[isRTL?"before":"after"](inst.append)}input.unbind("focus",this._showDatepicker);if(inst.trigger){inst.trigger.remove()}var showOn=this._get(inst,"showOn");if(showOn=="focus"||showOn=="both"){input.focus(this._showDatepicker)}if(showOn=="button"||showOn=="both"){var buttonText=this._get(inst,"buttonText");var buttonImage=this._get(inst,"buttonImage");inst.trigger=$(this._get(inst,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage==""?buttonText:$("<img/>").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](inst.trigger);inst.trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput==input[0]){$.datepicker._hideDatepicker()}else{$.datepicker._showDatepicker(input[0])}return false})}},_autoSize:function(inst){if(this._get(inst,"autoSize")&&!inst.inline){var date=new Date(2009,12-1,20);var dateFormat=this._get(inst,"dateFormat");if(dateFormat.match(/[DM]/)){var findMax=function(names){var max=0;var maxI=0;for(var i=0;i<names.length;i++){if(names[i].length>max){max=names[i].length;maxI=i}}return maxI};date.setMonth(findMax(this._get(inst,(dateFormat.match(/MM/)?"monthNames":"monthNamesShort"))));date.setDate(findMax(this._get(inst,(dateFormat.match(/DD/)?"dayNames":"dayNamesShort")))+20-date.getDay())}inst.input.attr("size",this._formatDate(inst,date).length)}},_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)){return}divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst),true);this._updateDatepicker(inst);this._updateAlternate(inst)},_dialogDatepicker:function(input,date,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){var id="dp"+(++this.uuid);this._dialogInput=$('<input type="text" id="'+id+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');this._dialogInput.keydown(this._doKeyDown);$("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],PROP_NAME,inst)}extendRemove(inst.settings,settings||{});date=(date&&date.constructor==Date?this._formatDate(inst,date):date);this._dialogInput.val(date);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){var browserWidth=document.documentElement.clientWidth;var browserHeight=document.documentElement.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY]}this._dialogInput.css("left",(this._pos[0]+20)+"px").css("top",this._pos[1]+"px");inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI){$.blockUI(this.dpDiv)}$.data(this._dialogInput[0],PROP_NAME,inst);return this},_destroyDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();$.removeData(target,PROP_NAME);if(nodeName=="input"){inst.append.remove();inst.trigger.remove();$target.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)}else{if(nodeName=="div"||nodeName=="span"){$target.removeClass(this.markerClassName).empty()}}},_enableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=false;inst.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().removeClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)})},_disableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=true;inst.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().addClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)});this._disabledInputs[this._disabledInputs.length]=target},_isDisabledDatepicker:function(target){if(!target){return false}for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]==target){return true}}return false},_getInst:function(target){try{return $.data(target,PROP_NAME)}catch(err){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(target,name,value){var inst=this._getInst(target);if(arguments.length==2&&typeof name=="string"){return(name=="defaults"?$.extend({},$.datepicker._defaults):(inst?(name=="all"?$.extend({},inst.settings):this._get(inst,name)):null))}var settings=name||{};if(typeof name=="string"){settings={};settings[name]=value}if(inst){if(this._curInst==inst){this._hideDatepicker()}var date=this._getDateDatepicker(target,true);extendRemove(inst.settings,settings);this._attachments($(target),inst);this._autoSize(inst);this._setDateDatepicker(target,date);this._updateDatepicker(inst)}},_changeDatepicker:function(target,name,value){this._optionDatepicker(target,name,value)},_refreshDatepicker:function(target){var inst=this._getInst(target);if(inst){this._updateDatepicker(inst)}},_setDateDatepicker:function(target,date){var inst=this._getInst(target);if(inst){this._setDate(inst,date);this._updateDatepicker(inst);this._updateAlternate(inst)}},_getDateDatepicker:function(target,noDefault){var inst=this._getInst(target);if(inst&&!inst.inline){this._setDateFromField(inst,noDefault)}return(inst?this._getDate(inst):null)},_doKeyDown:function(event){var inst=$.datepicker._getInst(event.target);var handled=true;var isRTL=inst.dpDiv.is(".ui-datepicker-rtl");inst._keyEvent=true;if($.datepicker._datepickerShowing){switch(event.keyCode){case 9:$.datepicker._hideDatepicker();handled=false;break;case 13:var sel=$("td."+$.datepicker._dayOverClass,inst.dpDiv).add($("td."+$.datepicker._currentClass,inst.dpDiv));if(sel[0]){$.datepicker._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0])}else{$.datepicker._hideDatepicker()}return false;break;case 27:$.datepicker._hideDatepicker();break;case 33:$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M");break;case 34:$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M");break;case 35:if(event.ctrlKey||event.metaKey){$.datepicker._clearDate(event.target)}handled=event.ctrlKey||event.metaKey;break;case 36:if(event.ctrlKey||event.metaKey){$.datepicker._gotoToday(event.target)}handled=event.ctrlKey||event.metaKey;break;case 37:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,(isRTL?+1:-1),"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M")}break;case 38:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,-7,"D")}handled=event.ctrlKey||event.metaKey;break;case 39:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,(isRTL?-1:+1),"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M")}break;case 40:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,+7,"D")}handled=event.ctrlKey||event.metaKey;break;default:handled=false}}else{if(event.keyCode==36&&event.ctrlKey){$.datepicker._showDatepicker(this)}else{handled=false}}if(handled){event.preventDefault();event.stopPropagation()}},_doKeyPress:function(event){var inst=$.datepicker._getInst(event.target);if($.datepicker._get(inst,"constrainInput")){var chars=$.datepicker._possibleChars($.datepicker._get(inst,"dateFormat"));var chr=String.fromCharCode(event.charCode==undefined?event.keyCode:event.charCode);return event.ctrlKey||(chr<" "||!chars||chars.indexOf(chr)>-1)}},_doKeyUp:function(event){var inst=$.datepicker._getInst(event.target);if(inst.input.val()!=inst.lastVal){try{var date=$.datepicker.parseDate($.datepicker._get(inst,"dateFormat"),(inst.input?inst.input.val():null),$.datepicker._getFormatConfig(inst));if(date){$.datepicker._setDateFromField(inst);$.datepicker._updateAlternate(inst);$.datepicker._updateDatepicker(inst)}}catch(event){$.datepicker.log(event)}}return true},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!="input"){input=$("input",input.parentNode)[0]}if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input){return}var inst=$.datepicker._getInst(input);if($.datepicker._curInst&&$.datepicker._curInst!=inst){$.datepicker._curInst.dpDiv.stop(true,true)}var beforeShow=$.datepicker._get(inst,"beforeShow");extendRemove(inst.settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));inst.lastVal=null;$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog){input.value=""}if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight}var isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css("position")=="fixed";return !isFixed});if(isFixed&&$.browser.opera){$.datepicker._pos[0]-=document.documentElement.scrollLeft;$.datepicker._pos[1]-=document.documentElement.scrollTop}var offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});$.datepicker._updateDatepicker(inst);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:($.datepicker._inDialog&&$.blockUI?"static":(isFixed?"fixed":"absolute")),display:"none",left:offset.left+"px",top:offset.top+"px"});if(!inst.inline){var showAnim=$.datepicker._get(inst,"showAnim");var duration=$.datepicker._get(inst,"duration");var postProcess=function(){$.datepicker._datepickerShowing=true;var borders=$.datepicker._getBorders(inst.dpDiv);inst.dpDiv.find("iframe.ui-datepicker-cover").css({left:-borders[0],top:-borders[1],width:inst.dpDiv.outerWidth(),height:inst.dpDiv.outerHeight()})};inst.dpDiv.zIndex($(input).zIndex()+1);if($.effects&&$.effects[showAnim]){inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[showAnim||"show"]((showAnim?duration:null),postProcess)}if(!showAnim){postProcess()}if(inst.input.is(":visible")&&!inst.input.is(":disabled")){inst.input.focus()}$.datepicker._curInst=inst}},_updateDatepicker:function(inst){var self=this;var borders=$.datepicker._getBorders(inst.dpDiv);inst.dpDiv.empty().append(this._generateHTML(inst)).find("iframe.ui-datepicker-cover").css({left:-borders[0],top:-borders[1],width:inst.dpDiv.outerWidth(),height:inst.dpDiv.outerHeight()}).end().find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){$(this).removeClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).removeClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).removeClass("ui-datepicker-next-hover")}}).bind("mouseover",function(){if(!self._isDisabledDatepicker(inst.inline?inst.dpDiv.parent()[0]:inst.input[0])){$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");$(this).addClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).addClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).addClass("ui-datepicker-next-hover")}}}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end();var numMonths=this._getNumberOfMonths(inst);var cols=numMonths[1];var width=17;if(cols>1){inst.dpDiv.addClass("ui-datepicker-multi-"+cols).css("width",(width*cols)+"em")}else{inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("")}inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst==$.datepicker._curInst&&$.datepicker._datepickerShowing&&inst.input&&inst.input.is(":visible")&&!inst.input.is(":disabled")){inst.input.focus()}},_getBorders:function(elem){var convert=function(value){return{thin:1,medium:2,thick:3}[value]||value};return[parseFloat(convert(elem.css("border-left-width"))),parseFloat(convert(elem.css("border-top-width")))]},_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth();var dpHeight=inst.dpDiv.outerHeight();var inputWidth=inst.input?inst.input.outerWidth():0;var inputHeight=inst.input?inst.input.outerHeight():0;var viewWidth=document.documentElement.clientWidth+$(document).scrollLeft();var viewHeight=document.documentElement.clientHeight+$(document).scrollTop();offset.left-=(this._get(inst,"isRTL")?(dpWidth-inputWidth):0);offset.left-=(isFixed&&offset.left==inst.input.offset().left)?$(document).scrollLeft():0;offset.top-=(isFixed&&offset.top==(inst.input.offset().top+inputHeight))?$(document).scrollTop():0;offset.left-=Math.min(offset.left,(offset.left+dpWidth>viewWidth&&viewWidth>dpWidth)?Math.abs(offset.left+dpWidth-viewWidth):0);offset.top-=Math.min(offset.top,(offset.top+dpHeight>viewHeight&&viewHeight>dpHeight)?Math.abs(dpHeight+inputHeight):0);return offset},_findPos:function(obj){var inst=this._getInst(obj);var isRTL=this._get(inst,"isRTL");while(obj&&(obj.type=="hidden"||obj.nodeType!=1)){obj=obj[isRTL?"previousSibling":"nextSibling"]}var position=$(obj).offset();return[position.left,position.top]},_hideDatepicker:function(input){var inst=this._curInst;if(!inst||(input&&inst!=$.data(input,PROP_NAME))){return}if(this._datepickerShowing){var showAnim=this._get(inst,"showAnim");var duration=this._get(inst,"duration");var postProcess=function(){$.datepicker._tidyDialog(inst);this._curInst=null};if($.effects&&$.effects[showAnim]){inst.dpDiv.hide(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[(showAnim=="slideDown"?"slideUp":(showAnim=="fadeIn"?"fadeOut":"hide"))]((showAnim?duration:null),postProcess)}if(!showAnim){postProcess()}var onClose=this._get(inst,"onClose");if(onClose){onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():""),inst])}this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if($.blockUI){$.unblockUI();$("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(event){if(!$.datepicker._curInst){return}var $target=$(event.target);if($target[0].id!=$.datepicker._mainDivId&&$target.parents("#"+$.datepicker._mainDivId).length==0&&!$target.hasClass($.datepicker.markerClassName)&&!$target.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)){$.datepicker._hideDatepicker()}},_adjustDate:function(id,offset,period){var target=$(id);var inst=this._getInst(target[0]);if(this._isDisabledDatepicker(target[0])){return}this._adjustInstDate(inst,offset+(period=="M"?this._get(inst,"showCurrentAtPos"):0),period);this._updateDatepicker(inst)},_gotoToday:function(id){var target=$(id);var inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear}else{var date=new Date();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear()}this._notifyChange(inst);this._adjustDate(target)},_selectMonthYear:function(id,select,period){var target=$(id);var inst=this._getInst(target[0]);inst._selectingMonthYear=false;inst["selected"+(period=="M"?"Month":"Year")]=inst["draw"+(period=="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target)},_clickMonthYear:function(id){var target=$(id);var inst=this._getInst(target[0]);if(inst.input&&inst._selectingMonthYear&&!$.browser.msie){inst.input.focus()}inst._selectingMonthYear=!inst._selectingMonthYear},_selectDay:function(id,month,year,td){var target=$(id);if($(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return}var inst=this._getInst(target[0]);inst.selectedDay=inst.currentDay=$("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))},_clearDate:function(id){var target=$(id);var inst=this._getInst(target[0]);this._selectDate(target,"")},_selectDate:function(id,dateStr){var target=$(id);var inst=this._getInst(target[0]);dateStr=(dateStr!=null?dateStr:this._formatDate(inst));if(inst.input){inst.input.val(dateStr)}this._updateAlternate(inst);var onSelect=this._get(inst,"onSelect");if(onSelect){onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst])}else{if(inst.input){inst.input.trigger("change")}}if(inst.inline){this._updateDatepicker(inst)}else{this._hideDatepicker();this._lastInput=inst.input[0];if(typeof(inst.input[0])!="object"){inst.input.focus()}this._lastInput=null}},_updateAlternate:function(inst){var altField=this._get(inst,"altField");if(altField){var altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");var date=this._getDate(inst);var dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));$(altField).each(function(){$(this).val(dateStr)})}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),""]},iso8601Week:function(date){var checkDate=new Date(date.getTime());checkDate.setDate(checkDate.getDate()+4-(checkDate.getDay()||7));var time=checkDate.getTime();checkDate.setMonth(0);checkDate.setDate(1);return Math.floor(Math.round((time-checkDate)/86400000)/7)+1},parseDate:function(format,value,settings){if(format==null||value==null){throw"Invalid arguments"}value=(typeof value=="object"?value.toString():value+"");if(value==""){return null}var shortYearCutoff=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff;var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var year=-1;var month=-1;var day=-1;var doy=-1;var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var getNumber=function(match){lookAhead(match);var size=(match=="@"?14:(match=="!"?20:(match=="y"?4:(match=="o"?3:2))));var digits=new RegExp("^\\d{1,"+size+"}");var num=value.substring(iValue).match(digits);if(!num){throw"Missing number at position "+iValue}iValue+=num[0].length;return parseInt(num[0],10)};var getName=function(match,shortNames,longNames){var names=(lookAhead(match)?longNames:shortNames);for(var i=0;i<names.length;i++){if(value.substr(iValue,names[i].length)==names[i]){iValue+=names[i].length;return i+1}}throw"Unknown name at position "+iValue};var checkLiteral=function(){if(value.charAt(iValue)!=format.charAt(iFormat)){throw"Unexpected literal at position "+iValue}iValue++};var iValue=0;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{checkLiteral()}}else{switch(format.charAt(iFormat)){case"d":day=getNumber("d");break;case"D":getName("D",dayNamesShort,dayNames);break;case"o":doy=getNumber("o");break;case"m":month=getNumber("m");break;case"M":month=getName("M",monthNamesShort,monthNames);break;case"y":year=getNumber("y");break;case"@":var date=new Date(getNumber("@"));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"!":var date=new Date((getNumber("!")-this._ticksTo1970)/10000);year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'")){checkLiteral()}else{literal=true}break;default:checkLiteral()}}}if(year==-1){year=new Date().getFullYear()}else{if(year<100){year+=new Date().getFullYear()-new Date().getFullYear()%100+(year<=shortYearCutoff?0:-100)}}if(doy>-1){month=1;day=doy;do{var dim=this._getDaysInMonth(year,month-1);if(day<=dim){break}month++;day-=dim}while(true)}var date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day){throw"Invalid date"}return date},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(((1970-1)*365+Math.floor(1970/4)-Math.floor(1970/100)+Math.floor(1970/400))*24*60*60*10000000),formatDate:function(format,date,settings){if(!date){return""}var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var formatNumber=function(match,value,len){var num=""+value;if(lookAhead(match)){while(num.length<len){num="0"+num}}return num};var formatName=function(match,value,shortNames,longNames){return(lookAhead(match)?longNames[value]:shortNames[value])};var output="";var literal=false;if(date){for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{output+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":output+=formatNumber("d",date.getDate(),2);break;case"D":output+=formatName("D",date.getDay(),dayNamesShort,dayNames);break;case"o":output+=formatNumber("o",(date.getTime()-new Date(date.getFullYear(),0,0).getTime())/86400000,3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=(lookAhead("y")?date.getFullYear():(date.getYear()%100<10?"0":"")+date.getYear()%100);break;case"@":output+=date.getTime();break;case"!":output+=date.getTime()*10000+this._ticksTo1970;break;case"'":if(lookAhead("'")){output+="'"}else{literal=true}break;default:output+=format.charAt(iFormat)}}}}return output},_possibleChars:function(format){var chars="";var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{chars+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":case"m":case"y":case"@":chars+="0123456789";break;case"D":case"M":return null;case"'":if(lookAhead("'")){chars+="'"}else{literal=true}break;default:chars+=format.charAt(iFormat)}}}return chars},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name]},_setDateFromField:function(inst,noDefault){if(inst.input.val()==inst.lastVal){return}var dateFormat=this._get(inst,"dateFormat");var dates=inst.lastVal=inst.input?inst.input.val():null;var date,defaultDate;date=defaultDate=this._getDefaultDate(inst);var settings=this._getFormatConfig(inst);try{date=this.parseDate(dateFormat,dates,settings)||defaultDate}catch(event){this.log(event);dates=(noDefault?"":dates)}inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=(dates?date.getDate():0);inst.currentMonth=(dates?date.getMonth():0);inst.currentYear=(dates?date.getFullYear():0);this._adjustInstDate(inst)},_getDefaultDate:function(inst){return this._restrictMinMax(inst,this._determineDate(inst,this._get(inst,"defaultDate"),new Date()))},_determineDate:function(inst,date,defaultDate){var offsetNumeric=function(offset){var date=new Date();date.setDate(date.getDate()+offset);return date};var offsetString=function(offset){try{return $.datepicker.parseDate($.datepicker._get(inst,"dateFormat"),offset,$.datepicker._getFormatConfig(inst))}catch(e){}var date=(offset.toLowerCase().match(/^c/)?$.datepicker._getDate(inst):null)||new Date();var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,$.datepicker._getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,$.datepicker._getDaysInMonth(year,month));break}matches=pattern.exec(offset)}return new Date(year,month,day)};date=(date==null?defaultDate:(typeof date=="string"?offsetString(date):(typeof date=="number"?(isNaN(date)?defaultDate:offsetNumeric(date)):date)));date=(date&&date.toString()=="Invalid Date"?defaultDate:date);if(date){date.setHours(0);date.setMinutes(0);date.setSeconds(0);date.setMilliseconds(0)}return this._daylightSavingAdjust(date)},_daylightSavingAdjust:function(date){if(!date){return null}date.setHours(date.getHours()>12?date.getHours()+2:0);return date},_setDate:function(inst,date,noChange){var clear=!(date);var origMonth=inst.selectedMonth;var origYear=inst.selectedYear;date=this._restrictMinMax(inst,this._determineDate(inst,date,new Date()));inst.selectedDay=inst.currentDay=date.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=date.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=date.getFullYear();if((origMonth!=inst.selectedMonth||origYear!=inst.selectedYear)&&!noChange){this._notifyChange(inst)}this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst))}},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=="")?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return startDate},_generateHTML:function(inst){var today=new Date();today=this._daylightSavingAdjust(new Date(today.getFullYear(),today.getMonth(),today.getDate()));var isRTL=this._get(inst,"isRTL");var showButtonPanel=this._get(inst,"showButtonPanel");var hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext");var navigationAsDateFormat=this._get(inst,"navigationAsDateFormat");var numMonths=this._getNumberOfMonths(inst);var showCurrentAtPos=this._get(inst,"showCurrentAtPos");var stepMonths=this._get(inst,"stepMonths");var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var currentDate=this._daylightSavingAdjust((!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");var drawMonth=inst.drawMonth-showCurrentAtPos;var drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--}if(maxDate){var maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-(numMonths[0]*numMonths[1])+1,maxDate.getDate()));maxDraw=(minDate&&maxDraw<minDate?minDate:maxDraw);while(this._daylightSavingAdjust(new Date(drawYear,drawMonth,1))>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--}}}inst.drawMonth=drawMonth;inst.drawYear=drawYear;var prevText=this._get(inst,"prevText");prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)));var prev=(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+dpuuid+".datepicker._adjustDate('#"+inst.id+"', -"+stepMonths+", 'M');\" title=\""+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>":(hideIfNoPrevNext?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>"));var nextText=this._get(inst,"nextText");nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)));var next=(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+dpuuid+".datepicker._adjustDate('#"+inst.id+"', +"+stepMonths+", 'M');\" title=\""+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>":(hideIfNoPrevNext?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>"));var currentText=this._get(inst,"currentText");var gotoDate=(this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today);currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));var controls=(!inst.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+dpuuid+'.datepicker._hideDatepicker();">'+this._get(inst,"closeText")+"</button>":"");var buttonPanel=(showButtonPanel)?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(isRTL?controls:"")+(this._isInRange(inst,gotoDate)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+dpuuid+".datepicker._gotoToday('#"+inst.id+"');\">"+currentText+"</button>":"")+(isRTL?"":controls)+"</div>":"";var firstDay=parseInt(this._get(inst,"firstDay"),10);firstDay=(isNaN(firstDay)?0:firstDay);var showWeek=this._get(inst,"showWeek");var dayNames=this._get(inst,"dayNames");var dayNamesShort=this._get(inst,"dayNamesShort");var dayNamesMin=this._get(inst,"dayNamesMin");var monthNames=this._get(inst,"monthNames");var monthNamesShort=this._get(inst,"monthNamesShort");var beforeShowDay=this._get(inst,"beforeShowDay");var showOtherMonths=this._get(inst,"showOtherMonths");var selectOtherMonths=this._get(inst,"selectOtherMonths");var calculateWeek=this._get(inst,"calculateWeek")||this.iso8601Week;var defaultDate=this._getDefaultDate(inst);var html="";for(var row=0;row<numMonths[0];row++){var group="";for(var col=0;col<numMonths[1];col++){var selectedDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,inst.selectedDay));var cornerClass=" ui-corner-all";var calender="";if(isMultiMonth){calender+='<div class="ui-datepicker-group';if(numMonths[1]>1){switch(col){case 0:calender+=" ui-datepicker-group-first";cornerClass=" ui-corner-"+(isRTL?"right":"left");break;case numMonths[1]-1:calender+=" ui-datepicker-group-last";cornerClass=" ui-corner-"+(isRTL?"left":"right");break;default:calender+=" ui-datepicker-group-middle";cornerClass="";break}}calender+='">'}calender+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+cornerClass+'">'+(/all|left/.test(cornerClass)&&row==0?(isRTL?next:prev):"")+(/all|right/.test(cornerClass)&&row==0?(isRTL?prev:next):"")+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,row>0||col>0,monthNames,monthNamesShort)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var thead=(showWeek?'<th class="ui-datepicker-week-col">'+this._get(inst,"weekHeader")+"</th>":"");for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;thead+="<th"+((dow+firstDay+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+dayNames[day]+'">'+dayNamesMin[day]+"</span></th>"}calender+=thead+"</tr></thead><tbody>";var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)}var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var numRows=(isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7));var printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(var dRow=0;dRow<numRows;dRow++){calender+="<tr>";var tbody=(!showWeek?"":'<td class="ui-datepicker-week-col">'+this._get(inst,"calculateWeek")(printDate)+"</td>");for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,""]);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=(otherMonth&&!selectOtherMonths)||!daySettings[0]||(minDate&&printDate<minDate)||(maxDate&&printDate>maxDate);tbody+='<td class="'+((dow+firstDay+6)%7>=5?" ui-datepicker-week-end":"")+(otherMonth?" ui-datepicker-other-month":"")+((printDate.getTime()==selectedDate.getTime()&&drawMonth==inst.selectedMonth&&inst._keyEvent)||(defaultDate.getTime()==printDate.getTime()&&defaultDate.getTime()==selectedDate.getTime())?" "+this._dayOverClass:"")+(unselectable?" "+this._unselectableClass+" ui-state-disabled":"")+(otherMonth&&!showOtherMonths?"":" "+daySettings[1]+(printDate.getTime()==currentDate.getTime()?" "+this._currentClass:"")+(printDate.getTime()==today.getTime()?" ui-datepicker-today":""))+'"'+((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':"")+(unselectable?"":' onclick="DP_jQuery_'+dpuuid+".datepicker._selectDay('#"+inst.id+"',"+printDate.getMonth()+","+printDate.getFullYear()+', this);return false;"')+">"+(otherMonth&&!showOtherMonths?"&#xa0;":(unselectable?'<span class="ui-state-default">'+printDate.getDate()+"</span>":'<a class="ui-state-default'+(printDate.getTime()==today.getTime()?" ui-state-highlight":"")+(printDate.getTime()==currentDate.getTime()?" ui-state-active":"")+(otherMonth?" ui-priority-secondary":"")+'" href="#">'+printDate.getDate()+"</a>"))+"</td>";printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate)}calender+=tbody+"</tr>"}drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++}calender+="</tbody></table>"+(isMultiMonth?"</div>"+((numMonths[0]>0&&col==numMonths[1]-1)?'<div class="ui-datepicker-row-break"></div>':""):"");group+=calender}html+=group}html+=buttonPanel+($.browser.msie&&parseInt($.browser.version,10)<7&&!inst.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':"");inst._keyEvent=false;return html},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,secondary,monthNames,monthNamesShort){var changeMonth=this._get(inst,"changeMonth");var changeYear=this._get(inst,"changeYear");var showMonthAfterYear=this._get(inst,"showMonthAfterYear");var html='<div class="ui-datepicker-title">';var monthHtml="";if(secondary||!changeMonth){monthHtml+='<span class="ui-datepicker-month">'+monthNames[drawMonth]+"</span>"}else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);monthHtml+='<select class="ui-datepicker-month" onchange="DP_jQuery_'+dpuuid+".datepicker._selectMonthYear('#"+inst.id+"', this, 'M');\" onclick=\"DP_jQuery_"+dpuuid+".datepicker._clickMonthYear('#"+inst.id+"');\">";for(var month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())){monthHtml+='<option value="'+month+'"'+(month==drawMonth?' selected="selected"':"")+">"+monthNamesShort[month]+"</option>"}}monthHtml+="</select>"}if(!showMonthAfterYear){html+=monthHtml+(secondary||!(changeMonth&&changeYear)?"&#xa0;":"")}if(secondary||!changeYear){html+='<span class="ui-datepicker-year">'+drawYear+"</span>"}else{var years=this._get(inst,"yearRange").split(":");var thisYear=new Date().getFullYear();var determineYear=function(value){var year=(value.match(/c[+-].*/)?drawYear+parseInt(value.substring(1),10):(value.match(/[+-].*/)?thisYear+parseInt(value,10):parseInt(value,10)));return(isNaN(year)?thisYear:year)};var year=determineYear(years[0]);var endYear=Math.max(year,determineYear(years[1]||""));year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);html+='<select class="ui-datepicker-year" onchange="DP_jQuery_'+dpuuid+".datepicker._selectMonthYear('#"+inst.id+"', this, 'Y');\" onclick=\"DP_jQuery_"+dpuuid+".datepicker._clickMonthYear('#"+inst.id+"');\">";for(;year<=endYear;year++){html+='<option value="'+year+'"'+(year==drawYear?' selected="selected"':"")+">"+year+"</option>"}html+="</select>"}html+=this._get(inst,"yearSuffix");if(showMonthAfterYear){html+=(secondary||!(changeMonth&&changeYear)?"&#xa0;":"")+monthHtml}html+="</div>";return html},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=="Y"?offset:0);var month=inst.drawMonth+(period=="M"?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period=="D"?offset:0);var date=this._restrictMinMax(inst,this._daylightSavingAdjust(new Date(year,month,day)));inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=="M"||period=="Y"){this._notifyChange(inst)}},_restrictMinMax:function(inst,date){var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);return date},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst])}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return(numMonths==null?[1,1]:(typeof numMonths=="number"?[1,numMonths]:numMonths))},_getMinMaxDate:function(inst,minMax){return this._determineDate(inst,this._get(inst,minMax+"Date"),null)},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate()},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[0]*numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},_isInRange:function(inst,date){var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");return((!minDate||date.getTime()>=minDate.getTime())&&(!maxDate||date.getTime()<=maxDate.getTime()))},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}var date=(day?(typeof day=="object"?day:this._daylightSavingAdjust(new Date(year,month,day))):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))}});function extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null||props[name]==undefined){target[name]=props[name]}}return target}function isArray(a){return(a&&(($.browser.safari&&typeof a=="object"&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))))}$.fn.datepicker=function(options){if(!$.datepicker.initialized){$(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv);$.datepicker.initialized=true}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=="string"&&(options=="isDisabled"||options=="getDate"||options=="widget")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}if(options=="option"&&arguments.length==2&&typeof arguments[1]=="string"){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}return this.each(function(){typeof options=="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options)})};$.datepicker=new Datepicker();$.datepicker.initialized=false;$.datepicker.uuid=new Date().getTime();$.datepicker.version="1.8rc3";window["DP_jQuery_"+dpuuid]=$})(jQuery);;/*
 * jQuery Tools 1.2.4 - The missing UI library for the Web
 * 
 * [tooltip, tooltip.slide, tooltip.dynamic]
 * 
 * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
 * 
 * http://flowplayer.org/tools/
 * 
 * File generated: Mon Aug 30 09:38:50 GMT 2010
 */
(function(f){function p(a,b,c){var h=c.relative?a.position().top:a.offset().top,e=c.relative?a.position().left:a.offset().left,i=c.position[0];h-=b.outerHeight()-c.offset[0];e+=a.outerWidth()+c.offset[1];var j=b.outerHeight()+a.outerHeight();if(i=="center")h+=j/2;if(i=="bottom")h+=j;i=c.position[1];a=b.outerWidth()+a.outerWidth();if(i=="center")e-=a/2;if(i=="left")e-=a;return{top:h,left:e}}function u(a,b){var c=this,h=a.add(c),e,i=0,j=0,m=a.attr("title"),q=a.attr("data-tooltip"),r=n[b.effect],l,s=
a.is(":input"),v=s&&a.is(":checkbox, :radio, select, :button, :submit"),t=a.attr("type"),k=b.events[t]||b.events[s?v?"widget":"input":"def"];if(!r)throw'Nonexistent effect "'+b.effect+'"';k=k.split(/,\s*/);if(k.length!=2)throw"Tooltip: bad events configuration for "+t;a.bind(k[0],function(d){clearTimeout(i);if(b.predelay)j=setTimeout(function(){c.show(d)},b.predelay);else c.show(d)}).bind(k[1],function(d){clearTimeout(j);if(b.delay)i=setTimeout(function(){c.hide(d)},b.delay);else c.hide(d)});if(m&&
b.cancelDefault){a.removeAttr("title");a.data("title",m)}f.extend(c,{show:function(d){if(!e){if(q)e=f(q);else if(m)e=f(b.layout).addClass(b.tipClass).appendTo(document.body).hide().append(m);else if(b.tip)e=f(b.tip).eq(0);else{e=a.next();e.length||(e=a.parent().next())}if(!e.length)throw"Cannot find tooltip for "+a;}if(c.isShown())return c;e.stop(true,true);var g=p(a,e,b);d=d||f.Event();d.type="onBeforeShow";h.trigger(d,[g]);if(d.isDefaultPrevented())return c;g=p(a,e,b);e.css({position:"absolute",
top:g.top,left:g.left});l=true;r[0].call(c,function(){d.type="onShow";l="full";h.trigger(d)});g=b.events.tooltip.split(/,\s*/);e.bind(g[0],function(){clearTimeout(i);clearTimeout(j)});g[1]&&!a.is("input:not(:checkbox, :radio), textarea")&&e.bind(g[1],function(o){o.relatedTarget!=a[0]&&a.trigger(k[1].split(" ")[0])});return c},hide:function(d){if(!e||!c.isShown())return c;d=d||f.Event();d.type="onBeforeHide";h.trigger(d);if(!d.isDefaultPrevented()){l=false;n[b.effect][1].call(c,function(){d.type="onHide";
h.trigger(d)});return c}},isShown:function(d){return d?l=="full":l},getConf:function(){return b},getTip:function(){return e},getTrigger:function(){return a}});f.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(d,g){f.isFunction(b[g])&&f(c).bind(g,b[g]);c[g]=function(o){f(c).bind(g,o);return c}})}f.tools=f.tools||{version:"1.2.4"};f.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,position:["top","center"],offset:[0,0],relative:false,cancelDefault:true,
events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,b,c){n[a]=[b,c]}};var n={toggle:[function(a){var b=this.getConf(),c=this.getTip();b=b.opacity;b<1&&c.css({opacity:b});c.show();a.call()},function(a){this.getTip().hide();a.call()}],fade:[function(a){var b=this.getConf();this.getTip().fadeTo(b.fadeInSpeed,b.opacity,a)},function(a){this.getTip().fadeOut(this.getConf().fadeOutSpeed,
a)}]};f.fn.tooltip=function(a){var b=this.data("tooltip");if(b)return b;a=f.extend(true,{},f.tools.tooltip.conf,a);if(typeof a.position=="string")a.position=a.position.split(/,?\s/);this.each(function(){b=new u(f(this),a);f(this).data("tooltip",b)});return a.api?b:this}})(jQuery);
(function(d){var i=d.tools.tooltip;d.extend(i.conf,{direction:"up",bounce:false,slideOffset:10,slideInSpeed:200,slideOutSpeed:200,slideFade:!d.browser.msie});var e={up:["-","top"],down:["+","top"],left:["-","left"],right:["+","left"]};i.addEffect("slide",function(g){var a=this.getConf(),f=this.getTip(),b=a.slideFade?{opacity:a.opacity}:{},c=e[a.direction]||e.up;b[c[1]]=c[0]+"="+a.slideOffset;a.slideFade&&f.css({opacity:0});f.show().animate(b,a.slideInSpeed,g)},function(g){var a=this.getConf(),f=a.slideOffset,
b=a.slideFade?{opacity:0}:{},c=e[a.direction]||e.up,h=""+c[0];if(a.bounce)h=h=="+"?"-":"+";b[c[1]]=h+"="+f;this.getTip().animate(b,a.slideOutSpeed,function(){d(this).hide();g.call()})})})(jQuery);
(function(g){function j(a){var c=g(window),d=c.width()+c.scrollLeft(),h=c.height()+c.scrollTop();return[a.offset().top<=c.scrollTop(),d<=a.offset().left+a.width(),h<=a.offset().top+a.height(),c.scrollLeft()>=a.offset().left]}function k(a){for(var c=a.length;c--;)if(a[c])return false;return true}var i=g.tools.tooltip;i.dynamic={conf:{classNames:"top right bottom left"}};g.fn.dynamic=function(a){if(typeof a=="number")a={speed:a};a=g.extend({},i.dynamic.conf,a);var c=a.classNames.split(/\s/),d;this.each(function(){var h=
g(this).tooltip().onBeforeShow(function(e,f){e=this.getTip();var b=this.getConf();d||(d=[b.position[0],b.position[1],b.offset[0],b.offset[1],g.extend({},b)]);g.extend(b,d[4]);b.position=[d[0],d[1]];b.offset=[d[2],d[3]];e.css({visibility:"hidden",position:"absolute",top:f.top,left:f.left}).show();f=j(e);if(!k(f)){if(f[2]){g.extend(b,a.top);b.position[0]="top";e.addClass(c[0])}if(f[3]){g.extend(b,a.right);b.position[1]="right";e.addClass(c[1])}if(f[0]){g.extend(b,a.bottom);b.position[0]="bottom";e.addClass(c[2])}if(f[1]){g.extend(b,
a.left);b.position[1]="left";e.addClass(c[3])}if(f[0]||f[2])b.offset[0]*=-1;if(f[1]||f[3])b.offset[1]*=-1}e.css({visibility:"visible"}).hide()});h.onBeforeShow(function(){var e=this.getConf();this.getTip();setTimeout(function(){e.position=[d[0],d[1]];e.offset=[d[2],d[3]]},0)});h.onHide(function(){var e=this.getTip();e.removeClass(a.classNames)});ret=h});return a.api?ret:this}})(jQuery);
/*
 * jqTransform
 * by mathieu vilaplana mvilaplana@dfc-e.com
 * Designer ghyslain armand garmand@dfc-e.com
 *
 *
 * Version 1.0 25.09.08
 * Version 1.1 06.08.09
 * Add event click on Checkbox and Radio
 * Auto calculate the size of a select element
 * Can now, disabled the elements
 * Correct bug in ff if click on select (overflow=hidden)
 * No need any more preloading !!
 * 
 ******************************************** */


/* #######################################################*/
/* ############### bug-fix in row 315 ####################*/
/* #######################################################*/

(function(jQueryWinRace){

	var defaultOptions = {preloadImg:true};
	var jqTransformImgPreloaded = false;

	var jqTransformPreloadHoverFocusImg = function(strImgUrl) {
		//guillemets to remove for ie
		strImgUrl = strImgUrl.replace(/^url\((.*)\)/,'$1').replace(/^\"(.*)\"$/,'$1');
		var imgHover = new Image();
		imgHover.src = strImgUrl.replace(/\.([a-zA-Z]*)$/,'-hover.$1');
		var imgFocus = new Image();
		imgFocus.src = strImgUrl.replace(/\.([a-zA-Z]*)$/,'-focus.$1');				
	};

	
	/***************************
	  Labels
	***************************/
	var jqTransformGetLabel = function(objfield){
		var selfForm = jQueryWinRace(objfield.get(0).form);
		var oLabel = objfield.next();
		if(!oLabel.is('label')) {
			oLabel = objfield.prev();
			if(oLabel.is('label')){
				var inputname = objfield.attr('id');
				if(inputname){
					oLabel = selfForm.find('label[for="'+inputname+'"]');
				} 
			}
		}
		if(!oLabel.hasClass('no_pointer')){
		  oLabel.css('cursor','pointer');
		}
		if(oLabel.is('label')){return oLabel;}
		return false;
	};
	
	/* Hide all open selects */
	var jqTransformHideSelect = function(oTarget){
		var ulVisible = jQueryWinRace('.jqTransformSelectWrapper ul:visible');
		ulVisible.each(function(){
			var oSelect = jQueryWinRace(this).parents(".jqTransformSelectWrapper:first").find("select").get(0);
			//do not hide if click on the label object associated to the select
			if( !(oTarget && oSelect.oLabel && oSelect.oLabel.get(0) == oTarget.get(0)) ){jQueryWinRace(this).hide();}
		});
	};
	/* Check for an external click */
	var jqTransformCheckExternalClick = function(event) {
		if (jQueryWinRace(event.target).parents('.jqTransformSelectWrapper').length === 0) { jqTransformHideSelect(jQueryWinRace(event.target)); }
	};

	/* Apply document listener */
	var jqTransformAddDocumentListener = function (){
		jQueryWinRace(document).mousedown(jqTransformCheckExternalClick);
	};	
			
	/* Add a new handler for the reset action */
	var jqTransformReset = function(f){
		var sel;
		jQueryWinRace('.jqTransformSelectWrapper select', f).each(function(){sel = (this.selectedIndex<0) ? 0 : this.selectedIndex; jQueryWinRace('ul', jQueryWinRace(this).parent()).each(function(){jQueryWinRace('a:eq('+ sel +')', this).click();});});
		jQueryWinRace('a.jqTransformCheckbox, a.jqTransformRadio', f).removeClass('jqTransformChecked');
		jQueryWinRace('a.jqTransformCheckbox_alert, a.jqTransformRadio_alert', f).removeClass('jqTransformChecked_alert');
		jQueryWinRace('input:checkbox, input:radio', f).each(function(){if(this.checked){jQueryWinRace('a', jQueryWinRace(this).parent()).addClass('jqTransformChecked');}});
	};

	/***************************
	  Buttons
	 ***************************/
	jQueryWinRace.fn.jqTransInputButton = function(){
		return this.each(function(){
			var newBtn = jQueryWinRace('<button id="'+ this.id +'" name="'+ this.name +'" type="'+ this.type +'" class="'+ this.className +' jqTransformButton"><span><span>'+ jQueryWinRace(this).attr('value') +'</span></span>')
				.hover(function(){newBtn.addClass('jqTransformButton_hover');},function(){newBtn.removeClass('jqTransformButton_hover')})
				.mousedown(function(){newBtn.addClass('jqTransformButton_click')})
				.mouseup(function(){newBtn.removeClass('jqTransformButton_click')})
			;
			jQueryWinRace(this).replaceWith(newBtn);
		});
	};
	
	/***************************
	  Text Fields 
	 ***************************/
	jQueryWinRace.fn.jqTransInputText = function(){
		return this.each(function(){
			var _input = jQueryWinRace(this);
	
			if(_input.hasClass('jqtranformdone') || !_input.is('input')) {return;}
			_input.addClass('jqtranformdone');
	
			var oLabel = jqTransformGetLabel(jQueryWinRace(this));
			oLabel && oLabel.bind('click',function(){_input.focus();});
	
			//var inputSize=_input.width();
			
			// for some datepicker-fields width is setted by css 
			var datepicker_from = jQueryWinRace('#datepicker_from');
			var datepicker_to = jQueryWinRace('#datepicker_to');
			if((datepicker_from.length > 0) || (datepicker_from.length > 0))
				{ var datepicker = 1; }
			
			if(!(datepicker))
				{ var inputSize=_input.width(); }
			
			/*
			if(_input.attr('size')){
				inputSize = _input.attr('size')*10;
				_input.css('width',inputSize);
			}*/
			
			var input_class;

			if(_input.hasClass("input_border_trigger"))
				{ input_class = "jqTransformInputWrapper input_border"; }
			else
				{
				if(datepicker == 1)
					{ input_class = "jqTransformInputWrapper input_datepicker"; }
				else
					{ input_class = "jqTransformInputWrapper"; }
				}
				
			var wrapper_html = 	'<div class="' + input_class + '"><div class="jqTransformInputInner"><div></div></div></div>';
			_input.addClass("jqTransformInput").wrap(wrapper_html);
			
			var _wrapper = _input.parent().parent().parent();
			if(!(datepicker))
				{ _wrapper.css("width", inputSize); }
				
			if(datepicker == 1)
				{
				_input
					.focus(function(){_wrapper.addClass("jqTransformInputWrapper_focus_datepicker");})
					.blur(function(){_wrapper.removeClass("jqTransformInputWrapper_focus_datepicker");})
					.hover(
						function(){_wrapper.addClass("jqTransformInputWrapper_hover_datepicker");},
						function(){_wrapper.removeClass("jqTransformInputWrapper_hover_datepicker");}
						);
				}
			else
				{
				_input
					.focus(function(){_wrapper.addClass("jqTransformInputWrapper_focus");})
					.blur(function(){_wrapper.removeClass("jqTransformInputWrapper_focus");})
					.hover(
						function(){_wrapper.addClass("jqTransformInputWrapper_hover");},
						function(){_wrapper.removeClass("jqTransformInputWrapper_hover");}
						);
				}
	
			/* If this is safari we need to add an extra class */
			//jQueryWinRace.browser.safari && _wrapper.addClass('jqTransformSafari');
			//jQueryWinRace.browser.safari && _input.css('width',_wrapper.width());
			this._wrapper = _wrapper;
			
		});
	};
	
	/***************************
	  Check Boxes 
	 ***************************/	

		jQueryWinRace.fn.jqTransCheckBox = function(){
			return this.each(function(){
				if(jQueryWinRace(this).hasClass('jqTransformHidden')) {return;}
	
				var _input = jQueryWinRace(this);
				var inputSelf = this;
	
				//set the click on the label
				var oLabel=jqTransformGetLabel(_input);
				oLabel && oLabel.click(function(){aLink.trigger('click');});
				
				//var aLink = jQueryWinRace('<a href="#" class="jqTransformCheckbox"></a>');
				
				if(_input.hasClass('checkbox_alert_trigger'))
					{
					var aLink = jQueryWinRace('<a href="#" class="jqTransformCheckbox_alert"></a>');
					var checkClass = 'jqTransformChecked_alert';
					}
				else
					{
					var aLink = jQueryWinRace('<a href="#" class="jqTransformCheckbox"></a>');
					var checkClass = 'jqTransformChecked';
					}
					
				//wrap and add the link
				_input.addClass('jqTransformHidden').wrap('<span class="jqTransformCheckboxWrapper"></span>').parent().prepend(aLink);
				//on change, change the class of the link
				_input.change(function(){
					this.checked && aLink.addClass(checkClass) || aLink.removeClass(checkClass);
					return true;
				});
				
				// Click Handler, trigger the click and change event on the input
				aLink.click(function(){
					//do nothing if the original input is disabled
					if(_input.attr('disabled')){return false;}
					//trigger the envents on the input object
					_input.trigger('click').trigger('change');	
					return false;
				});
	
				// set the default state
				this.checked && aLink.addClass(checkClass);		
			});
		};

	/***************************
	  Radio Buttons 
	 ***************************/
	jQueryWinRace.fn.jqTransRadio = function(){
		return this.each(function(){
			if(jQueryWinRace(this).hasClass('jqTransformHidden')) {return;}

			var _input = jQueryWinRace(this);
			var inputSelf = this;
				
			oLabel = jqTransformGetLabel(_input);
			oLabel && oLabel.click(function(){aLink.trigger('click');});
	
			if(_input.hasClass('radio_alert_trigger'))
				{
				var aLink = jQueryWinRace('<a href="#" class="jqTransformRadio_alert" rel="'+ this.name +'"></a>');
				}
			else
				{
				var aLink = jQueryWinRace('<a href="#" class="jqTransformRadio" rel="'+ this.name +'"></a>');
				}
				
			_input.addClass('jqTransformHidden').wrap('<span class="jqTransformRadioWrapper"></span>').parent().prepend(aLink);

			_input.change(function(){
				inputSelf.checked && aLink.addClass('jqTransformChecked') || aLink.removeClass('jqTransformChecked');
				return true;
			});
			
			// Click Handler
			aLink.click(function(){
				if(_input.attr('disabled')){return false;}
				_input.trigger('click').trigger('change');
	
				// uncheck all others of same name input radio elements
				jQueryWinRace('input[name="'+_input.attr('name')+'"]',inputSelf.form).not(_input).each(function(){
					jQueryWinRace(this).attr('type')=='radio' && jQueryWinRace(this).trigger('change');
				});
	
				return false;					
			});
			// set the default state
			inputSelf.checked && aLink.addClass('jqTransformChecked');
		});
	};

	/***************************
	  TextArea 
	 ***************************/	
	jQueryWinRace.fn.jqTransTextarea = function(){
		return this.each(function(){
			var textarea = jQueryWinRace(this);
	
			if(textarea.hasClass('jqtransformdone')) {return;}
			textarea.addClass('jqtransformdone');
	
			oLabel = jqTransformGetLabel(textarea);
			oLabel && oLabel.click(function(){textarea.focus();});
			
			var strTable = '<table cellspacing="0" cellpadding="0" border="0" class="jqTransformTextarea">';
			strTable +='<tr><td id="jqTransformTextarea-tl"></td><td id="jqTransformTextarea-tm"></td><td id="jqTransformTextarea-tr"></td></tr>';
			strTable +='<tr><td id="jqTransformTextarea-ml">&nbsp;</td><td id="jqTransformTextarea-mm"><div></div></td><td id="jqTransformTextarea-mr">&nbsp;</td></tr>';	
			strTable +='<tr><td id="jqTransformTextarea-bl"></td><td id="jqTransformTextarea-bm"></td><td id="jqTransformTextarea-br"></td></tr>';
			strTable +='</table>';					
			var oTable = jQueryWinRace(strTable)
					.insertAfter(textarea)
					.hover(function(){
						!oTable.hasClass('jqTransformTextarea-focus') && oTable.addClass('jqTransformTextarea-hover');
					},function(){
						oTable.removeClass('jqTransformTextarea-hover');					
					})
				;
				
			textarea
				.focus(function(){oTable.removeClass('jqTransformTextarea-hover').addClass('jqTransformTextarea-focus');})
				.blur(function(){oTable.removeClass('jqTransformTextarea-focus');})
				.appendTo(jQueryWinRace('#jqTransformTextarea-mm div',oTable))
			;
			this.oTable = oTable;
			if(jQueryWinRace.browser.safari){
				jQueryWinRace('#jqTransformTextarea-mm',oTable)
					.addClass('jqTransformSafariTextarea')
					.find('div')
						.css('height',textarea.height())
						.css('width',textarea.width())
				;
			}
		});
	};
	
	/***************************
	  Select 
	 ***************************/	
	jQueryWinRace.fn.jqTransSelect = function(){
		return this.each(function(index){
			var _select = jQueryWinRace(this);

			if(_select.hasClass('jqTransformHidden')) {return;}
			if(_select.attr('multiple')) {return;}
			
			//var oLabel  =  jqTransformGetLabel(_select); // -> label-funktion for selects is buggy! dont use it!
			/* First thing we do is Wrap it */
			var _wrapper = _select
				.addClass('jqTransformHidden')
				.wrap('<div class="jqTransformSelectWrapper"></div>')
				.parent()
				.css({zIndex: 200-index});
			_wrapper.css('margin',_select.css('margin'));		
			_select.css({zIndex: 200-index});
			/* Now add the html for the select */
			var wi   = _select.width();
			_wrapper.prepend('<div><span></span><a href="#" class="jqTransformSelectOpen"></a></div><ul></ul>');
			var _ul = jQueryWinRace('ul', _wrapper).css('width',_select.width()).hide();
			/* Now we add the options */
			jQueryWinRace('option', this).each(function(i){
				var oLi = jQueryWinRace('<li><a href="#" index="'+ (i) +'">'+ jQueryWinRace(this).html() +'</a></li>');
				var optionId = jQueryWinRace(this).attr('id');
				if (optionId != null && optionId != undefined && optionId != ''){
					jQueryWinRace(oLi).attr('id', 'li' + optionId);
				}
				_ul.append(oLi);
			});
			
			//if(jQueryWinRace.browser.safari){ wi = wi+20; _select.css('width',wi); };
			
			//fix width for safari 5 on windows
			if(BrowserDetect.browser == "Safari" && BrowserDetect.OS == "Windows" && BrowserDetect.version == 5) {
				wi = wi+23;
				_select.css('width',wi);
			}
			//overwrite the margin-right that somebody set for IE and Opera for whatever reason
			_wrapper.css('margin-right','23px');
			_wrapper.css('margin-top',_select.css('margin-top'));
			
			/* Add click handler to the a */
			_ul.find('a').click(function(){
					jQueryWinRace('a.selected', _wrapper).removeClass('selected');
					jQueryWinRace(this).addClass('selected');	
					/* Fire the onchange event -> was buggy */
					
					/* ########## remove this ##########*/
					/*
					if (_select[0].selectedIndex != jQueryWinRace(this).attr('index') && _select[0].onchange) {
						_select[0].selectedIndex = jQueryWinRace(this).attr('index'); _select[0].onchange(); 
						}
					*/
					/* ########## replace with this ##########*/
					if (_select[0].selectedIndex != jQueryWinRace(this).attr('index') ) {
						_select[0].selectedIndex = jQueryWinRace(this).attr('index');
						_select.trigger('change');
						}
					_select[0].selectedIndex = jQueryWinRace(this).attr('index');
					jQueryWinRace('span:eq(0)', _wrapper).html(jQueryWinRace(this).html());
					_ul.hide();
					
					//_select.change();
					return false;
			});
			/* Set the default */
			jQueryWinRace('a:eq('+ this.selectedIndex +')', _ul).click();
			jQueryWinRace('span:first', _wrapper).click(function(){jQueryWinRace("a.jqTransformSelectOpen",_wrapper).trigger('click');});
			//oLabel && oLabel.click(function(){jQueryWinRace("a.jqTransformSelectOpen",_wrapper).trigger('click');});
			//this.oLabel = oLabel;
			
			/* Apply the click handler to the Open */
			var oLinkOpen = jQueryWinRace('a.jqTransformSelectOpen', _wrapper)
				.click(function(){
					//Check if box is already open to still allow toggle, but close all other selects
					if( _ul.css('display') == 'none' ) {jqTransformHideSelect();} 
					if(_select.attr('disabled')){return false;}

					_ul.slideToggle('fast', function(){					
						var offSet = (jQueryWinRace('a.selected', _ul).offset().top - _ul.offset().top);
						_ul.animate({scrollTop: offSet});
					});
					return false;
				})
			;

			// Set the new width
            var oSpan = jQueryWinRace('span:first',_wrapper);
			if(_select.css('width')=='auto'){
	            var iSelectWidth = _select.outerWidth();
                dbg(iSelectWidth);
	            var newWidth = (iSelectWidth > oSpan.innerWidth())?iSelectWidth+oLinkOpen.outerWidth():_wrapper.width();
                dbg(newWidth);
	            newWidth -= 20;
	            _wrapper.css('width',newWidth - 50);
	            // hier kann die breite der popups eingestellt werden
	            _ul.css('width',(newWidth-32));
	            oSpan.css({width:newWidth-50});
				// _ul.css('width','auto');
			}else{
                _wrapper.width(wi);
                //css('width',wi+"px");
                // hier kann die breite der popups eingestellt werden
                _ul.width(wi+17);
                oSpan.width(wi);
			}
			//alert(" newWidth: "+(newWidth-32));
			// Calculate the height if necessary, less elements that the default height
			//show the ul to calculate the block, if ul is not displayed li height value is 0
			_ul.css({display:'block',visibility:'hidden'});
			var iSelectHeight = (jQueryWinRace('li',_ul).length)*(jQueryWinRace('li:first',_ul).height());//+1 else bug ff
			if(jQuery.browser.mozilla) (iSelectHeight < _ul.height()) && _ul.css({height:iSelectHeight,'overflow-y':'auto'}); //hidden else bug with ff
			else (iSelectHeight < _ul.height()) && _ul.css({height:iSelectHeight,'overflow-y':'hidden'}); //auto else bug with ie }
			_ul.css({display:'none',visibility:'visible'});
			
		});
	};
	
	
	jQueryWinRace.fn.jqTransform = function(options){
		var opt = jQueryWinRace.extend({},defaultOptions,options);
		
		if(jQueryWinRace('form').hasClass('no_checkboxes'))
			{ var checkbox_excl = 1; }
		if(jQueryWinRace('form').hasClass('no_text_fields'))
			{ var text_fields_excl = 1; }
		/* each form */
		 return this.each(function(){
			var selfForm = jQueryWinRace(this);
			if(selfForm.hasClass('jqtransformdone')) {return;}
			selfForm.addClass('jqtransformdone');
			
			//jQueryWinRace('input:submit, input:reset, input[type="button"]', this).jqTransInputButton();	
			if(!(text_fields_excl))
				{jQueryWinRace('input:text, input:password', this).jqTransInputText();}
			if(!(checkbox_excl))
				{jQueryWinRace('input:checkbox', this).jqTransCheckBox();}
			jQueryWinRace('input:radio', this).jqTransRadio();
			jQueryWinRace('textarea', this).jqTransTextarea();
			
			if( jQueryWinRace('select', this).jqTransSelect().length > 0 ){jqTransformAddDocumentListener();}
			selfForm.bind('reset',function(){var action = function(){jqTransformReset(this);}; window.setTimeout(action, 10);});
			
			//preloading dont needed anymore since normal, focus and hover image are the same one
			/*if(opt.preloadImg && !jqTransformImgPreloaded){
				jqTransformImgPreloaded = true;
				var oInputText = $('input:text:first', selfForm);
				if(oInputText.length > 0){
					//pour ie on eleve les ""
					var strWrapperImgUrl = oInputText.get(0).wrapper.css('background-image');
					jqTransformPreloadHoverFocusImg(strWrapperImgUrl);					
					var strInnerImgUrl = $('div.jqTransformInputInner',$(oInputText.get(0).wrapper)).css('background-image');
					jqTransformPreloadHoverFocusImg(strInnerImgUrl);
				}
				
				var oTextarea = $('textarea',selfForm);
				if(oTextarea.length > 0){
					var oTable = oTextarea.get(0).oTable;
					$('td',oTable).each(function(){
						var strImgBack = $(this).css('background-image');
						jqTransformPreloadHoverFocusImg(strImgBack);
					});
				}
			}*/
			
			
		}); /* End Form each */
				
	};/* End the Plugin */

})(jQuery);
				     /* List Ticker by Alex Fish ** copyed on 07.09.2011
  //www.alexefish.com
  //
  //options:
  //
  //effect: fade/slide
  //speed: milliseconds
  */
(function($){
  $.fn.list_ticker = function(options){
   var defaults = {
   speed:4000,
   effect:'slide',
   run_once:false
   };
   var options = $.extend(defaults, options);
   
   return this.each(function(){
     var obj = $(this);
     var list = obj.children();
     var count = list.length - 1;
     list.not(':first').hide();
     var interval = setInterval(function(){
       list = obj.children();
       list.not(':first').hide();
       var first_li = list.eq(0)
       var second_li = list.eq(1)
   if(options.effect == 'slide'){
     first_li.slideUp();
     second_li.slideDown(function(){
       first_li.remove().appendTo(obj);
     });
   } else if(options.effect == 'fade'){
     first_li.fadeOut(function(){
       obj.css('height',second_li.height());
       second_li.fadeIn();
       first_li.remove().appendTo(obj);
     });
   }
   count--;
   if(count == 0 && options.run_once){
     clearInterval(interval);
   }
     }, options.speed)
   });
  };
  })(jQuery);/*
 * jquery.socialshareprivacy.js | 2 Klicks fuer mehr Datenschutz
 *
 * http://www.heise.de/extras/socialshareprivacy/
 * http://www.heise.de/ct/artikel/2-Klicks-fuer-mehr-Datenschutz-1333879.html
 *
 * Copyright (c) 2011 Hilko Holweg, Sebastian Hilbig, Nicolas Heiringhoff, Juergen Schmidt,
 * Heise Zeitschriften Verlag GmbH & Co. KG, http://www.heise.de
 *
 * is released under the MIT License http://www.opensource.org/licenses/mit-license.php
 *
 * Spread the word, link to us if you can.
 */
(function ($) {

    "use strict";

	/*
	 * helper functions
	 */ 

    // abbreviate at last blank before length and add "\u2026" (horizontal ellipsis)
    function abbreviateText(text, length) {
        var abbreviated = decodeURIComponent(text);
        if (abbreviated.length <= length) {
            return text;
        }

        var lastWhitespaceIndex = abbreviated.substring(0, length - 1).lastIndexOf(' ');
        abbreviated = encodeURIComponent(abbreviated.substring(0, lastWhitespaceIndex)) + "\u2026";

        return abbreviated;
    }

    // returns content of <meta name="" content=""> tags or '' if empty/non existant
    function getMeta(name) {
        var metaContent = $('meta[name="' + name + '"]').attr('content');
        return metaContent || '';
    }
    
    // create tweet text from content of <meta name="DC.title"> and <meta name="DC.creator">
    // fallback to content of <title> tag
    function getTweetText() {
        var title = getMeta('DC.title');
        var creator = getMeta('DC.creator');

        if (title.length > 0 && creator.length > 0) {
            title += ' - ' + creator;
        } else {
            title = $('title').text();
        }

        return encodeURIComponent(title);
    }

    // build URI from rel="canonical" or document.location
    function getURI() {
        var uri = document.location.href;
        var canonical = $("link[rel=canonical]").attr("href");

        if (canonical && canonical.length > 0) {
            if (canonical.indexOf("http") < 0) {
                canonical = document.location.protocol + "//" + document.location.host + canonical;
            }
            uri = canonical;
        }

        return uri;
    }

    function cookieSet(name, value, days, path, domain) {
        var expires = new Date();
        expires.setTime(expires.getTime() + (days * 24 * 60 * 60 * 1000));
        document.cookie = name + '=' + value + '; expires=' + expires.toUTCString() + '; path=' + path + '; domain=' + domain;
    }
    function cookieDel(name, value, path, domain) {
        var expires = new Date();
        expires.setTime(expires.getTime() - 100);
        document.cookie = name + '=' + value + '; expires=' + expires.toUTCString() + '; path=' + path + '; domain=' + domain;
    }

    // extend jquery with our plugin function
    $.fn.socialSharePrivacy = function (settings) {
        var defaults = {
            'services' : {
                'facebook' : {
                    'status'            : 'on',
                    'dummy_img'         : 'socialshareprivacy/images/dummy_facebook.png',
                    'txt_info'          : '2 Klicks f&uuml;r mehr Datenschutz: Erst wenn Sie hier klicken, wird der Button aktiv und Sie k&ouml;nnen Ihre Empfehlung an Facebook senden. Schon beim Aktivieren werden Daten an Dritte &uuml;bertragen.',
                    'txt_fb_off'        : 'nicht mit Facebook verbunden',
                    'txt_fb_on'         : 'mit Facebook verbunden',
                    'perma_option'      : 'on',
                    'display_name'      : 'Facebook',
                    'referrer_track'    : '',
                    'language'          : 'de_DE',
                    'action'            : 'recommend'
                }, 
                'twitter' : {
                    'status'            : 'on', 
                    'dummy_img'         : 'socialshareprivacy/images/dummy_twitter.png',
                    'txt_info'          : '2 Klicks f&uuml;r mehr Datenschutz: Erst wenn Sie hier klicken, wird der Button aktiv und Sie k&ouml;nnen Ihre Empfehlung an Twitter senden. Schon beim Aktivieren werden Daten an Dritte &uuml;bertragen.',
                    'txt_twitter_off'   : 'nicht mit Twitter verbunden',
                    'txt_twitter_on'    : 'mit Twitter verbunden',
                    'perma_option'      : 'on',
                    'display_name'      : 'Twitter',
                    'referrer_track'    : '', 
                    'tweet_text'        : getTweetText,
                    'language'          : 'en'
                },
                'gplus' : {
                    'status'            : 'on',
                    'dummy_img'         : 'socialshareprivacy/images/dummy_gplus.png',
                    'txt_info'          : '2 Klicks f&uuml;r mehr Datenschutz: Erst wenn Sie hier klicken, wird der Button aktiv und Sie k&ouml;nnen Ihre Empfehlung an Google+ senden. Schon beim Aktivieren werden Daten an Dritte &uuml;bertragen.',
                    'txt_gplus_off'     : 'nicht mit Google+ verbunden',
                    'txt_gplus_on'      : 'mit Google+ verbunden',
                    'perma_option'      : 'on',
                    'display_name'      : 'Google+',
                    'referrer_track'    : '',
                    'language'          : 'de'
                }
            },
            'info_link'         : 'http://www.heise.de/ct/artikel/2-Klicks-fuer-mehr-Datenschutz-1333879.html',
            'txt_help'          : 'Wenn Sie diese Felder durch einen Klick aktivieren, werden Informationen an Facebook, Twitter oder Google in die USA &uuml;bertragen und unter Umst&auml;nden auch dort gespeichert.',
            'settings_perma'    : 'Dauerhaft aktivieren und Daten&uuml;ber&shy;tragung zustimmen:',
            'cookie_path'       : '/',
            'cookie_domain'     : document.location.host,
            'cookie_expires'    : '365',
            'css_path'          : 'socialshareprivacy/socialshareprivacy.css',
            'uri'               : getURI
        };

        // Standardwerte des Plug-Ings mit den vom User angegebenen Optionen ueberschreiben
        var options = $.extend(true, defaults, settings);

        var facebook_on = (options.services.facebook.status === 'on');
        var twitter_on  = (options.services.twitter.status  === 'on');
        var gplus_on    = (options.services.gplus.status    === 'on');

        // check if at least one service is "on"
        if (!facebook_on && !twitter_on && !gplus_on) {
            return;
        }

        // insert stylesheet into document and prepend target element
        if (options.css_path.length > 0) {
            // IE fix (noetig fuer IE < 9 - wird hier aber fuer alle IE gemacht)
            if (document.createStyleSheet) {
                document.createStyleSheet(options.css_path);
            } else {
                $('head').append('<link rel="stylesheet" type="text/css" href="' + options.css_path + '" />');
            }
        }

        return this.each(function () {

            $(this).prepend('<ul class="social_share_privacy_area"></ul>');
            var context = $('.social_share_privacy_area', this);

            // canonical uri that will be shared
            var uri = options.uri;
            if (typeof uri === 'function') {
                uri = uri(context);
            }

            //
            // Facebook
            //
            if (facebook_on) {
                var fb_enc_uri = encodeURIComponent(uri + options.services.facebook.referrer_track);
                var fb_code = '<iframe src="http://www.facebook.com/plugins/like.php?locale=' + options.services.facebook.language + '&amp;href=' + fb_enc_uri + '&amp;send=false&amp;layout=button_count&amp;width=120&amp;show_faces=false&amp;action=' + options.services.facebook.action + '&amp;colorscheme=light&amp;font&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:145px; height:21px;" allowTransparency="true"></iframe>';
                var fb_dummy_btn = '<img src="' + options.services.facebook.dummy_img + '" alt="Facebook &quot;Like&quot;-Dummy" class="fb_like_privacy_dummy" />';

                context.append('<li class="facebook help_info"><span class="info">' + options.services.facebook.txt_info + '</span><span class="switch off">' + options.services.facebook.txt_fb_off + '</span><div class="fb_like dummy_btn">' + fb_dummy_btn + '</div></li>');

                var $container_fb = $('li.facebook', context);

                $('li.facebook div.fb_like img.fb_like_privacy_dummy,li.facebook span.switch', context).live('click', function () {
                    if ($container_fb.find('span.switch').hasClass('off')) {
                        $container_fb.addClass('info_off');
                        $container_fb.find('span.switch').addClass('on').removeClass('off').html(options.services.facebook.txt_fb_on);
                        $container_fb.find('img.fb_like_privacy_dummy').replaceWith(fb_code);
                    } else {
                        $container_fb.removeClass('info_off');
                        $container_fb.find('span.switch').addClass('off').removeClass('on').html(options.services.facebook.txt_fb_off);
                        $container_fb.find('.fb_like').html(fb_dummy_btn);
                    }
                });
            }

            //
            // Twitter
            //
            if (twitter_on) {
                var text = options.services.twitter.tweet_text;
                if (typeof text === 'function') {
                    text = text();
                }
                // 120 is the max character count left after twitters automatic url shortening with t.co
                text = abbreviateText(text, '120');

                var twitter_enc_uri = encodeURIComponent(uri + options.services.twitter.referrer_track);
                var twitter_count_url = encodeURIComponent(uri);
                var twitter_code = '<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?url=' + twitter_enc_uri + '&amp;counturl=' + twitter_count_url + '&amp;text=' + text + '&amp;count=horizontal&amp;lang=' + options.services.twitter.language + '" style="width:130px; height:25px;"></iframe>';
                var twitter_dummy_btn = '<img src="' + options.services.twitter.dummy_img + '" alt="&quot;Tweet this&quot;-Dummy" class="tweet_this_dummy" />';

                context.append('<li class="twitter help_info"><span class="info">' + options.services.twitter.txt_info + '</span><span class="switch off">' + options.services.twitter.txt_twitter_off + '</span><div class="tweet dummy_btn">' + twitter_dummy_btn + '</div></li>');

                var $container_tw = $('li.twitter', context);

                $('li.twitter div.tweet img,li.twitter span.switch', context).live('click', function () {
                    if ($container_tw.find('span.switch').hasClass('off')) {
                        $container_tw.addClass('info_off');
                        $container_tw.find('span.switch').addClass('on').removeClass('off').html(options.services.twitter.txt_twitter_on);
                        $container_tw.find('img.tweet_this_dummy').replaceWith(twitter_code);
                    } else {
                        $container_tw.removeClass('info_off');
                        $container_tw.find('span.switch').addClass('off').removeClass('on').html(options.services.twitter.txt_twitter_off);
                        $container_tw.find('.tweet').html(twitter_dummy_btn);
                    }
                });
            }

            //
            // Google+
            //
            if (gplus_on) {
                // fuer G+ wird die URL nicht encoded, da das zu einem Fehler fuehrt
                var gplus_uri = uri + options.services.gplus.referrer_track;
                
                // we use the Google+ "asynchronous" code, standard code is flaky if inserted into dom after load
                // edit by JB: async not working correctly for i8 and lower ie
                var gplus_code = '<div class="g-plusone" data-size="medium" data-href="' + gplus_uri + '"></div><script type="text/javascript">window.___gcfg = {lang: "' + options.services.gplus.language + '"}; (function() { var po = document.createElement("script"); po.type = "text/javascript"; po.async = false; po.src = "https://apis.google.com/js/plusone.js"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(po, s); })(); </script>';
                var gplus_dummy_btn = '<img src="' + options.services.gplus.dummy_img + '" alt="&quot;Google+1&quot;-Dummy" class="gplus_one_dummy" />';

                context.append('<li class="gplus help_info"><span class="info">' + options.services.gplus.txt_info + '</span><span class="switch off">' + options.services.gplus.txt_gplus_off + '</span><div class="gplusone dummy_btn">' + gplus_dummy_btn + '</div></li>');

                var $container_gplus = $('li.gplus', context);

                $('li.gplus div.gplusone img,li.gplus span.switch', context).live('click', function () {
                    if ($container_gplus.find('span.switch').hasClass('off')) {
                        $container_gplus.addClass('info_off');
                        $container_gplus.find('span.switch').addClass('on').removeClass('off').html(options.services.gplus.txt_gplus_on);
                        $container_gplus.find('img.gplus_one_dummy').replaceWith(gplus_code);
                    } else {
                        $container_gplus.removeClass('info_off');
                        $container_gplus.find('span.switch').addClass('off').removeClass('on').html(options.services.gplus.txt_gplus_off);
                        $container_gplus.find('.gplusone').html(gplus_dummy_btn);
                    }
                });
            }

            //
            // Der Info/Settings-Bereich wird eingebunden
            //
            context.append('<li class="settings_info"><div class="settings_info_menu off perma_option_off"><a href="' + options.info_link + '"><span class="help_info icon"><span class="info">' + options.txt_help + '</span></span></a></div></li>');

            // Info-Overlays mit leichter Verzoegerung einblenden
            $('.help_info:not(.info_off)', context).live('mouseenter', function () {
                var $info_wrapper = $(this);
                var timeout_id = window.setTimeout(function () { $($info_wrapper).addClass('display'); }, 500);
                $(this).data('timeout_id', timeout_id);
            });
            $('.help_info', context).live('mouseleave', function () {
                var timeout_id = $(this).data('timeout_id');
                window.clearTimeout(timeout_id);
                if ($(this).hasClass('display')) {
                    $(this).removeClass('display');
                }
            });

            var facebook_perma = (options.services.facebook.perma_option === 'on');
            var twitter_perma  = (options.services.twitter.perma_option  === 'on');
            var gplus_perma    = (options.services.gplus.perma_option    === 'on');

            // Menue zum dauerhaften Einblenden der aktiven Dienste via Cookie einbinden
            // Die IE7 wird hier ausgenommen, da er kein JSON kann und die Cookies hier ueber JSON-Struktur abgebildet werden
            if (((facebook_on && facebook_perma)
                || (twitter_on && twitter_perma)
                || (gplus_on && gplus_perma))
                    && (!$.browser.msie || ($.browser.msie && $.browser.version > 7.0))) {

                // Cookies abrufen
                var cookie_list = document.cookie.split(';');
                var cookies = '{';
                var i = 0;
                for (; i < cookie_list.length; i += 1) {
                    var foo = cookie_list[i].split('=');
                    cookies += '"' + $.trim(foo[0]) + '":"' + $.trim(foo[1]) + '"';
                    if (i < cookie_list.length - 1) {
                        cookies += ',';
                    }
                }
                cookies += '}';
                cookies = JSON.parse(cookies);

                // Container definieren
                var $container_settings_info = $('li.settings_info', context);

                // Klasse entfernen, die das i-Icon alleine formatiert, da Perma-Optionen eingeblendet werden
                $container_settings_info.find('.settings_info_menu').removeClass('perma_option_off');

                // Perma-Optionen-Icon (.settings) und Formular (noch versteckt) einbinden
                $container_settings_info.find('.settings_info_menu').append('<span class="settings">Einstellungen</span><form><fieldset><legend>' + options.settings_perma + '</legend></fieldset></form>');


                // Die Dienste mit <input> und <label>, sowie checked-Status laut Cookie, schreiben
                var checked = ' checked="checked"';
                if (facebook_on && facebook_perma) {
                    var perma_status_facebook = cookies.socialSharePrivacy_facebook === 'perma_on' ? checked : '';
                    $container_settings_info.find('form fieldset').append(
                        '<input type="checkbox" name="perma_status_facebook" id="perma_status_facebook"'
                            + perma_status_facebook + ' /><label for="perma_status_facebook">'
                            + options.services.facebook.display_name + '</label>'
                    );
                }

                if (twitter_on && twitter_perma) {
                    var perma_status_twitter = cookies.socialSharePrivacy_twitter === 'perma_on' ? checked : '';
                    $container_settings_info.find('form fieldset').append(
                        '<input type="checkbox" name="perma_status_twitter" id="perma_status_twitter"'
                            + perma_status_twitter + ' /><label for="perma_status_twitter">'
                            + options.services.twitter.display_name + '</label>'
                    );
                }

                if (gplus_on && gplus_perma) {
                    var perma_status_gplus = cookies.socialSharePrivacy_gplus === 'perma_on' ? checked : '';
                    $container_settings_info.find('form fieldset').append(
                        '<input type="checkbox" name="perma_status_gplus" id="perma_status_gplus"'
                            + perma_status_gplus + ' /><label for="perma_status_gplus">'
                            + options.services.gplus.display_name + '</label>'
                    );
                }

                // Cursor auf Pointer setzen fuer das Zahnrad
                $container_settings_info.find('span.settings').css('cursor', 'pointer');

                // Einstellungs-Menue bei mouseover ein-/ausblenden
                $($container_settings_info.find('span.settings'), context).live('mouseenter', function () {
                    var timeout_id = window.setTimeout(function () { $container_settings_info.find('.settings_info_menu').removeClass('off').addClass('on'); }, 500);
                    $(this).data('timeout_id', timeout_id);
                }); 
                $($container_settings_info, context).live('mouseleave', function () {
                    var timeout_id = $(this).data('timeout_id');
                    window.clearTimeout(timeout_id);
                    $container_settings_info.find('.settings_info_menu').removeClass('on').addClass('off');
                });

                // Klick-Interaktion auf <input> um Dienste dauerhaft ein- oder auszuschalten (Cookie wird gesetzt oder geloescht)
                $($container_settings_info.find('fieldset input')).live('click', function (event) {
                    var click = event.target.id;
                    var service = click.substr(click.lastIndexOf('_') + 1, click.length);
                    var cookie_name = 'socialSharePrivacy_' + service;

                    if ($('#' + event.target.id + ':checked').length) {
                        cookieSet(cookie_name, 'perma_on', options.cookie_expires, options.cookie_path, options.cookie_domain);
                        $('form fieldset label[for=' + click + ']', context).addClass('checked');
                    } else {
                        cookieDel(cookie_name, 'perma_on', options.cookie_path, options.cookie_domain);
                        $('form fieldset label[for=' + click + ']', context).removeClass('checked');
                    }
                });

                // Dienste automatisch einbinden, wenn entsprechendes Cookie vorhanden ist
                if (facebook_on && facebook_perma && cookies.socialSharePrivacy_facebook === 'perma_on') {
                    $('li.facebook span.switch', context).click();
                }
                if (twitter_on && twitter_perma && cookies.socialSharePrivacy_twitter === 'perma_on') {
                    $('li.twitter span.switch', context).click();
                }
                if (gplus_on && gplus_perma && cookies.socialSharePrivacy_gplus === 'perma_on') {
                    $('li.gplus span.switch', context).click();
                }
            }
        }); // this.each(function ()
    };      // $.fn.socialSharePrivacy = function (settings) {
}(jQuery));

/*
 * DBG+ERROR - Functions
 */
var fAlertDbgs      = false; 
var fLogDbgs        = true;
var fFirebugEnabled = false;

if(typeof console == "object" && console && console.firebug){
    fFirebugEnabled = true;
}

function dbg(ss){
    if(fAlertDbgs) alert(ss);
    if(fLogDbgs && fFirebugEnabled) console.log(ss);
} 
 
function showProps(node, valsPerAlert, valsPerRow){
	if(fLogDbgs) printConsole(node, true);
	if(fAlertDbgs){
	    var ss             = "";
	    var valsPerRow     = (valsPerRow>0) ? valsPerRow : 2;
	    var valsPerAlert   = (valsPerAlert>0) ? valsPerAlert : 50;
	    var a              = 0;
	    for(var i in node){
	        a++;
	        ss    += i+":"+node[i];
	        ss    += (a%valsPerRow == 0) ? "\n" : " - ";
	        if(a%valsPerAlert == 0){
	            dbg(ss);
	            ss   = "";
	        }
	    }
	    dbg(ss);
	}
}

function printError(code){
    alert(errorTab[code]);
}

function printConsole(ss, fDir){
    if(fFirebugEnabled){
        if(fDir) console.dir(ss); else console.log(ss);
    }
}
/*
 * ENDE - DBG - Functions
 */
/*
 * Helper - Functions
 */
//zaehlt nodes mit unterschiedlichen Attributen //von betslip nicht gebraucht //@todo
function countDistinctAttrs(arr, attr, fIsJQueryObj){
    var count   = 0;
    var d       = new Array();
    if(!fIsJQueryObj){
        for(var i in arr){
            if(!d[jQueryWinRace(arr[i]).attr(attr)]){
               d[jQueryWinRace(arr[i]).attr(attr)] = true;
               count++;
            }
         }
    }else{
        arr.each(function(){
            if(!d[jQueryWinRace(this).attr(attr)]){
               d[jQueryWinRace(this).attr(attr)] = true;
               count++;
            }
        });
    }
    return count;
}            

function showDialog(id, step){
	var i  = 1;
	var d = jQueryWinRace("#"+id+"_"+i);
	while(d.length){
		if(i==step){
			d.show();
		}else{
            d.hide();
		}
		i++;
		d = jQueryWinRace("#"+id+"_"+i);
	}
}

function getAttr(node, attrName, defaultVal){
    var d    = jQueryWinRace(node).attr(attrName);
    alert('getAttr '+d);
    return (d) ? d : defaultVal;
}

function value2Number(value){
    value   = (value) ? parseFloat(String(value).replace(/,/gi, '.')) : parseFloat(String(jQueryWinRace("input.einsatz").attr('value')).replace(/,/gi, '.'));
    return (value>0) ? value.toFixed(2) : 1;
}

function value2NumberOrZero(value){
    value   = (value) ? parseFloat(String(value).replace(/,/gi, '.')) : parseFloat(String(jQueryWinRace("input.einsatz").attr('value')).replace(/,/gi, '.'));
    var zeroValue = 0;
    return (value>0) ? value.toFixed(2) : zeroValue.toFixed(2);
}

function getMinValue(value, minStake, userMinStake){
    value   = (value) ? parseFloat(String(value).replace(/,/gi, '.')) : parseFloat(String(jQueryWinRace("input.einsatz").attr('value')).replace(/,/gi, '.'));
    var result = null;
    if (value != null && value != undefined && value > 0){
    	result = value;
    }else{
    	if (userMinStake != null && userMinStake != undefined){
    		result = userMinStake;
    	}else{
    		result = 0;
    	}
    }
    if (minStake != null && minStake != undefined && result < minStake){
    	result = minStake;
    }
    if (result <= 0){
    	result = 1;
    }
    return result;
}

function switchDotsToCommas(value) {
	return String(value).replace(/\./g, ",");
}

function switchCommasToDots(value) {
	return String(value).replace(/,/g, ".");
}

function getThousandDots(value) {
	if (String(value).length > 3) {
		start = String(value).substring(0 ,String(value).length);
		start = switchCommasToDots(start);
		if (!String(start).match(/\./g)) {
			var newStart = '';
			var newEnd = '';
			var i = String(value).length;
			var counter = 0;
			while (i > 3) {
				var subEnd = String(start).substring(String(start).length - (3 * (counter + 1)), String(start).length - (3 * counter));
				var subStart = String(start).substring(0, String(start).length - (3 * (counter + 1)));
				newStart = String(subStart).concat('.').concat(subEnd);
				if (counter > 0) {
					newEnd = String(start).substring(String(start).length - (3 * counter), String(start).length);
					newStart = String(newStart).concat('.').concat(newEnd);
				}
				i = i - 3;
				counter = counter + 1;
			}
			if (String(start).length > 3) {
				start = newStart;
			}
		}
		value = start;
	}
	return value;
}

function getThousandCommas(value) {
	if (String(value).length > 3) {
		start = String(value).substring(0 ,String(value).length);
		start = switchDotsToCommas(start);
		if (!String(start).match(/\,/g)) {
			var newStart = '';
			var newEnd = '';
			var i = String(value).length;
			var counter = 0;
			while (i > 3) {
				var subEnd = String(start).substring(String(start).length - (3 * (counter + 1)), String(start).length - (3 * counter));
				var subStart = String(start).substring(0, String(start).length - (3 * (counter + 1)));
				newStart = String(subStart).concat(',').concat(subEnd);
				if (counter > 0) {
					newEnd = String(start).substring(String(start).length - (3 * counter), String(start).length);
					newStart = String(newStart).concat(',').concat(newEnd);
				}
				i = i - 3;
				counter = counter + 1;
			}
			if (String(start).length > 3) {
				start = newStart;
			}
		}
		value = start;
	}
	return value;
}

function getGermanNumberFormat(value) {
	var result = value;
	if (value != null && value != undefined && isFinite(value)) {
		value = Number(value).toFixed(2);
		var end = '';
		if (String(value).length >= 3) {
			end = String(value).substring(String(value).length - 3, String(value).length);
			end = switchDotsToCommas(end);
		}
		var start = '';
		start = String(value).substring(0 ,String(value).length - 3);
		start = getThousandDots(start);
		result = String(start).concat(end);
	}
	return result;
}

function getEnglishNumberFormat(value) {
	var result = value;
	if (value != null && value != undefined && !isFinite(value)) {
		var end = '';
		if (String(value).length >= 3) {
			end = String(value).substring(String(value).length - 3, String(value).length);
			if (String(end).match(/,/)) {
				if (String(end).lastIndexOf(",") + 3 != String(end).length) {
					value = String(end).substring(0, String(end).lastIndexOf(",")).concat(',00')
				}
			} else {
				value = String(end).concat(',00');
			}
		}
		end = switchCommasToDots(end);
		var start = '';
		start = String(value).substring(0, String(value).length - 3);
		start = getThousandCommas(start);
		result = String(start).concat(end);
	}
	return result;
}

/*
 * X-Browser-functions
 * 
 * Voererst hier X-Browser-Fkts hier sammeln
 */


/*
 * Browser detection
 * 
 * Browser name: BrowserDetect.browser ("identity" in dataBrowser)
 * Browser version: BrowserDetect.version (major versions, i.e. "5" for Safari 5.0.2)
 * OS name: BrowserDetect.OS ("identity" in dataOS)
 * 
 * source: http://www.quirksmode.org/js/detect.html
 */
var BrowserDetect = {
		init: function () {
			this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
			this.version = this.searchVersion(navigator.userAgent)
				|| this.searchVersion(navigator.appVersion)
				|| "an unknown version";
			this.OS = this.searchString(this.dataOS) || "an unknown OS";
		},
		searchString: function (data) {
			for (var i=0;i<data.length;i++)	{
				var dataString = data[i].string;
				var dataProp = data[i].prop;
				this.versionSearchString = data[i].versionSearch || data[i].identity;
				if (dataString) {
					if (dataString.indexOf(data[i].subString) != -1)
						return data[i].identity;
				}
				else if (dataProp)
					return data[i].identity;
			}
		},
		searchVersion: function (dataString) {
			var index = dataString.indexOf(this.versionSearchString);
			if (index == -1) return;
			return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
		},
		dataBrowser: [
			{
				string: navigator.userAgent,
				subString: "Chrome",
				identity: "Chrome"
			},
			{ 	string: navigator.userAgent,
				subString: "OmniWeb",
				versionSearch: "OmniWeb/",
				identity: "OmniWeb"
			},
			{
				string: navigator.vendor,
				subString: "Apple",
				identity: "Safari",
				versionSearch: "Version"
			},
			{
				prop: window.opera,
				identity: "Opera"
			},
			{
				string: navigator.vendor,
				subString: "iCab",
				identity: "iCab"
			},
			{
				string: navigator.vendor,
				subString: "KDE",
				identity: "Konqueror"
			},
			{
				string: navigator.userAgent,
				subString: "Firefox",
				identity: "Firefox"
			},
			{
				string: navigator.vendor,
				subString: "Camino",
				identity: "Camino"
			},
			{		// for newer Netscapes (6+)
				string: navigator.userAgent,
				subString: "Netscape",
				identity: "Netscape"
			},
			{
				string: navigator.userAgent,
				subString: "MSIE",
				identity: "Explorer",
				versionSearch: "MSIE"
			},
			{
				string: navigator.userAgent,
				subString: "Gecko",
				identity: "Mozilla",
				versionSearch: "rv"
			},
			{ 		// for older Netscapes (4-)
				string: navigator.userAgent,
				subString: "Mozilla",
				identity: "Netscape",
				versionSearch: "Mozilla"
			}
		],
		dataOS : [
			{
				string: navigator.platform,
				subString: "Win",
				identity: "Windows"
			},
			{
				string: navigator.platform,
				subString: "Mac",
				identity: "Mac"
			},
			{
				   string: navigator.userAgent,
				   subString: "iPhone",
				   identity: "iPhone/iPod"
		    },
			{
				string: navigator.platform,
				subString: "Linux",
				identity: "Linux"
			}
		]

	};
	BrowserDetect.init();/**
 * webtrekkConfig
 * 
 * globale webtrekk konfiguration
 * global webtrekk config
 * @type Object
 */
var webtrekkConfig = {
	trackId : "343946512166723",
	trackDomain : "winrace01.webtrekk.net",
	domain : "www.winrace.de",
	linkTrack : "link",
  linkTrackDownloads : "exe;zip;wav;mp3;mov;mpg;avi;wmv;pdf;doc;docx;xls;xlsx;ppt;pptx",
  mediaCode: "wt_mc;wt_ic"/*,
  ACHTUNG: Bevor dies wieder eingebaut wird, sollte geprüft werden, ob es in den IE Browsern funktioniert (Wettabgabe zB betroffen)!!!
  cookie : "1"*/
};


/*
 ********************* definition ihrer eigenen funktionen ********************
 ********************* define your own functions here ********************
*/

/**
 * beforeWebtrekk ist eine Demo-Funktion zum Testen der Schnittstellen
 * @type Function
 */
var beforeWebtrekk = function(){
	
};
/**
 * afterWebtrekk ist eine Demo-Funktion zum Testen der Schnittstellen
 * @type Function
 */
var afterWebtrekk = function(){
	
};
/**
 * beforeUnloadPixel ist eine Demo-Funktion zum Testen der Schnittstellen
 * @type Function
 */
var beforeUnloadPixel = function(){
	
};
/**
 * afterUnload ist eine Dmo-Funktion zum Testen der Schnittstellen
 * @type Function
 */
var afterUnloadPixel = function(){
	
};




/*
 ********************* Ab hier nichts ändern ********************
 ********************* Don't change anything beyond this line ********************
 */
 
var webtrekkUnloadObjects=[];var webtrekkLinktrackObjects=[];var webtrekkHeatmapObjects=[];function webtrekkUnload($a){for(i=0;i<webtrekkUnloadObjects.length;i++){if(webtrekkUnloadObjects[i].beforeUnloadPixel!=false){webtrekkUnloadObjects[i].beforeUnloadPixel();};var p="";if(webtrekkUnloadObjects[i].config.linkId){p+="&ct="+webtrekkUnloadObjects[i].wtEscape(webtrekkUnloadObjects[i].maxlen(webtrekkUnloadObjects[i].config.linkId,255));if(p){if(webtrekkUnloadObjects[i].linktrackOut){p+="&ctx=1";};var $b=webtrekkUnloadObjects[i].ccParams;if(typeof($b)=='string'&&$b!=''){p+=$b;}}};if(webtrekkUnloadObjects[i].wtEp){if(webtrekkUnloadObjects[i].wtEpEncoded){p+=webtrekkUnloadObjects[i].wtEp;}else{var $c=webtrekkUnloadObjects[i].wtEp;if(typeof($c)=='string'&&$c!=''){$c=$c.split(/;/);for(var z=0;z<$c.length;z++){if(webtrekkUnloadObjects[i].wtTypeof($c[z])){var $d=$c[z].split(/=/);if(webtrekkUnloadObjects[i].checkSC('custom')){$d[1]=webtrekkUnloadObjects[i].decrypt($d[1]);};$d[1]=webtrekkUnloadObjects[i].wtEscape($d[1]);p+='&'+$d[0]+'='+$d[1];}}}}};if(webtrekkUnloadObjects[i].formObject&&$a!="noForm"){var gatherFormsP=webtrekkUnloadObjects[i].gatherForm();if(gatherFormsP){p+="&fn="+(webtrekkUnloadObjects[i].formName?webtrekkUnloadObjects[i].formName:webtrekkUnloadObjects[i].contentId.split(";")[0])+'|'+(webtrekkUnloadObjects[i].formSubmit?"1":"0");p+="&ft="+webtrekkUnloadObjects[i].wtEscape(gatherFormsP);}};if(p!=""||webtrekkUnloadObjects[i].config.sendOnUnload){webtrekkUnloadObjects[i].quicksend(webtrekkUnloadObjects[i].wtEscape(webtrekkUnloadObjects[i].contentId.split(";")[0])+",1,"+webtrekkUnloadObjects[i].baseparams(),p);webtrekkUnloadObjects[i].config.linkId="";webtrekkUnloadObjects[i].ccParams="";webtrekkUnloadObjects[i].wtEp="";};if(webtrekkUnloadObjects[i].afterUnloadPixel!=false){webtrekkUnloadObjects[i].afterUnloadPixel();}}};function webtrekkLinktrack(e){for(z=0;z<webtrekkLinktrackObjects.length;z++){if((e.which&&e.which==1)||(e.button&&e.button==1)){var a=document.all?window.event.srcElement:this;for(var i=0;i<4;i++){if(a.tagName&&a.tagName.toLowerCase()!="a"&&a.tagName.toLowerCase()!="area"){a=a.parentElement;}};a.lname=(a.getAttribute('name')?a.getAttribute('name'):"");webtrekkLinktrackObjects[z].getCCParams(a);if(webtrekkLinktrackObjects[z].linkTrackAttribute){var $e="";eval("tmp = (a.getAttribute(webtrekkLinktrackObjects[z].linkTrackAttribute)?a.getAttribute(webtrekkLinktrackObjects[z].linkTrackAttribute):'')");if($e){a.lname=$e;}};a.lpos=0;if(!webtrekkLinktrackObjects[z].wtLength(a.lpos)&&a.tagName){c=document.links;for(d=0;d<webtrekkLinktrackObjects[z].wtLength(c);d++){if(a==c[d]){a.lpos=d+1;break;}}};if(a.lpos){if(webtrekkLinktrackObjects[z].linkTrack=="link"){var y=a.href.indexOf("//");y=(y>=0?a.href.substr(y+2):a.href);if(webtrekkLinktrackObjects[z].linkTrackPattern){if(!webtrekkLinktrackObjects[z].linkTrackReplace){webtrekkLinktrackObjects[z].linkTrackReplace="";};y=y.replace(webtrekkLinktrackObjects[z].linkTrackPattern,webtrekkLinktrackObjects[z].linkTrackReplace);};webtrekkLinktrackObjects[z].config.linkId=(a.lname?(a.lname+"."):"")+y.split("?")[0].replace(/\//g,".");var p="";if(webtrekkLinktrackObjects[z].linkTrackParams){p=webtrekkLinktrackObjects[z].linkTrackParams.replace(/;/g,",").split(",");};for(var i=0;i<p.length;i++){var v=webtrekkLinktrackObjects[z].urlParam(y,p[i],"");if(v){webtrekkLinktrackObjects[z].config.linkId+="."+p[i]+"."+v;}}}else if(webtrekkLinktrackObjects[z].linkTrack=="standard"&&a.lname){webtrekkLinktrackObjects[z].config.linkId=a.lname;};var $f=false;if(webtrekkLinktrackObjects[z].linkTrackDownloads){var $g=a.href.split(".");$g=$g.pop();var $h=webtrekkLinktrackObjects[z].linkTrackDownloads.split(";");for(i=0;i<$h.length;i++){if($h[i]==$g){$f=true;break;}}};if(webtrekkLinktrackObjects[z].config.linkId){if(webtrekkLinktrackObjects[z].domain&&!webtrekkLinktrackObjects[z].isOwnDomain(a.href)){webtrekkLinktrackObjects[z].linktrackOut=true;}};if(webtrekkLinktrackObjects[z].isSafari||webtrekkLinktrackObjects[z].isOpera||webtrekkLinktrackObjects[z].isChrome||webtrekkLinktrackObjects[z].isDownloadFile||(webtrekkLinktrackObjects[z].linktrack_p&&a.target!=""&&a.target!="_self")){webtrekkLinktrackObjects[z].sendinfo(webtrekkLinktrackObjects[z].config);}}}}};function webtrekkHeatmapClick(e){var isOpera=(navigator.userAgent.indexOf('Opera')!=-1);var isIE=(!isOpera&&navigator.userAgent.indexOf('MSIE')!=-1);for(z=0;z<webtrekkHeatmapObjects.length;z++){var $i={left:-1,top:-1};if(document.getElementById(webtrekkHeatmapObjects[z].heatmapRefpoint)){var $j=document.getElementById(webtrekkHeatmapObjects[z].heatmapRefpoint);if(webtrekkHeatmapObjects[z].wtTypeof($j.offsetLeft)){while($j){$i.left+=$j.offsetLeft;$i.top+=$j.offsetTop;$j=$j.offsetParent;}}};var $k=0;var $l=0;if(!e){var e=window.event;};if(e.pageX||e.pageY){$k=e.pageX;$l=e.pageY;}else{if(e.clientX||e.clientY){$k=e.clientX;$l=e.clientY;if(isIE){if(document.body.scrollLeft>0||document.body.scrollTop>0){$k+=document.body.scrollLeft;$l+=document.body.scrollTop;}else{if(document.documentElement.scrollLeft>0||document.documentElement.scrollTop>0){$k+=document.documentElement.scrollLeft;$l+=document.documentElement.scrollTop;}}}}};var $m=0;if(isIE){$m=document.body.clientWidth;}else{$m=self.innerWidth-16;};var $n=true;if($k>=$m||!webtrekkHeatmapObjects[z].sentFullPixel){$n=false;};if(($i.top>=0||$i.left>=0)&&$k>$i.left&&$l>$i.top){$k='-'+($k-$i.left);$l='-'+($l-$i.top);};if($n){webtrekkHeatmapObjects[z].quicksend(webtrekkHeatmapObjects[z].wtEscape(webtrekkHeatmapObjects[z].contentId.split(";")[0])+","+$k+","+$l,'',"hm");}}};function webtrekkStartHeatmap(){if(typeof(wt_heatmap)!="undefined"){window.setTimeout("wt_heatmap()",1000);}else{if(typeof($o)=="undefined")$o=0;$o++;if($o<60)window.setTimeout("webtrekkStartHeatmap()",1000);}};function webtrekkStartOverlay(){if(typeof(wt_overlay)!="undefined"){wt_overlay();}else{if(typeof($p)=="undefined")$p=0;$p++;if($p<60)window.setTimeout("webtrekkStartOverlay()",1000);}};function webtrekkFormTrackInstall(){for(i=0;i<webtrekkUnloadObjects.length;i++){webtrekkUnloadObjects[i].findForm();if(!webtrekkUnloadObjects[i].formObject){continue;};for(var j=0;j<webtrekkUnloadObjects[i].formObject.elements.length;j++){var e=webtrekkUnloadObjects[i].formObject.elements[j];webtrekkUnloadObjects[i].registerEvent(e,"focus",webtrekkFormFocus);};webtrekkUnloadObjects[i].registerEvent(webtrekkUnloadObjects[i].formObject,"submit",webtrekkFormSubmit);}};function webtrekkFormSubmit(e){for(i=0;i<webtrekkUnloadObjects.length;i++){if(!webtrekkUnloadObjects[i].form){continue;};if(e.target==webtrekkUnloadObjects[i].formObject||e.srcElement==webtrekkUnloadObjects[i].formObject){webtrekkUnloadObjects[i].formSubmit=true;}}};function webtrekkFormFocus(e){var a=document.all?window.event.srcElement:e.target;if(!a.name||a.type=="submit"||a.type=="image"){return;};for(i=0;i<webtrekkUnloadObjects.length;i++){var f=webtrekkUnloadObjects[i].formObject.getAttribute('name')?webtrekkUnloadObjects[i].formObject.getAttribute('name'):webtrekkUnloadObjects[i].contentId.split(";")[0];if(webtrekkUnloadObjects[i].formAttribute){var $e="";eval("tmp = (webtrekkUnloadObjects["+i+"].formObject.getAttribute(webtrekkUnloadObjects["+i+"].formAttribute) ? webtrekkUnloadObjects["+i+"].formObject.getAttribute(webtrekkUnloadObjects["+i+"].formAttribute):'')");if($e){f=$e;}};webtrekkUnloadObjects[i].formFocus=a.name;}};function webtrekkV3($q){if(!$q){var $q=webtrekkConfig;};this.trackId=($q.trackId)?$q.trackId:(webtrekkConfig.trackId)?webtrekkConfig.trackId:false;this.trackDomain=($q.trackDomain)?$q.trackDomain:(webtrekkConfig.trackDomain)?webtrekkConfig.trackDomain:false;this.domain=($q.domain)?$q.domain:(webtrekkConfig.domain)?webtrekkConfig.domain:false;this.linkTrack=($q.linkTrack)?$q.linkTrack:(webtrekkConfig.linkTrack)?webtrekkConfig.linkTrack:false;this.linkTrackAttribute=($q.linkTrackAttribute)?$q.linkTrackAttribute:(webtrekkConfig.linkTrackAttribute)?webtrekkConfig.linkTrackAttribute:false;this.linkTrackPattern=($q.linkTrackPattern)?$q.linkTrackPattern:(webtrekkConfig.linkTrackPattern)?webtrekkConfig.linkTrackPattern:false;this.linkTrackReplace=($q.linkTrackReplace)?$q.linkTrackReplace:(webtrekkConfig.linkTrackReplace)?webtrekkConfig.linkTrackReplace:false;this.linkTrackDownloads=($q.linkTrackDownloads)?$q.linkTrackDownloads:(webtrekkConfig.linkTrackDownloads)?webtrekkConfig.linkTrackDownloads:false;this.customParameter=($q.customParameter)?$q.customParameter:(webtrekkConfig.customParameter)?webtrekkConfig.customParameter:false;this.customClickParameter=($q.customClickParameter)?$q.customClickParameter:(webtrekkConfig.customClickParameter)?webtrekkConfig.customClickParameter:false;this.customSessionParameter=($q.customSessionParameter)?$q.customSessionParameter:(webtrekkConfig.customSessionParameter)?webtrekkConfig.customSessionParameter:false;this.customTimeParameter=($q.customTimeParameter)?$q.customTimeParameter:(webtrekkConfig.customTimeParameter)?webtrekkConfig.customTimeParameter:false;this.customCampaignParameter=($q.customCampaignParameter)?$q.customCampaignParameter:(webtrekkConfig.customCampaignParameter)?webtrekkConfig.customCampaignParameter:false;this.customEcommerceParameter=($q.customEcommerceParameter)?$q.customEcommerceParameter:(webtrekkConfig.customEcommerceParameter)?webtrekkConfig.customEcommerceParameter:false;this.orderValue=($q.orderValue)?$q.orderValue:(webtrekkConfig.orderValue)?webtrekkConfig.orderValue:false;this.orderCurrency=($q.orderCurrency)?$q.orderCurrency:(webtrekkConfig.orderCurrency)?webtrekkConfig.orderCurrency:false;this.orderId=($q.orderId)?$q.orderId:(webtrekkConfig.orderId)?webtrekkConfig.orderId:false;this.product=($q.product)?$q.product:(webtrekkConfig.product)?webtrekkConfig.product:false;this.productCost=($q.productCost)?$q.productCost:(webtrekkConfig.productCost)?webtrekkConfig.productCost:false;this.productQuantity=($q.productQuantity)?$q.productQuantity:(webtrekkConfig.productQuantity)?webtrekkConfig.productQuantity:false;this.productCategory=($q.productCategory)?$q.productCategory:(webtrekkConfig.productCategory)?webtrekkConfig.productCategory:false;this.productStatus=($q.productStatus)?$q.productStatus:(webtrekkConfig.productStatus)?webtrekkConfig.productStatus:false;this.customerId=($q.customerId)?$q.customerId:(webtrekkConfig.customerId)?webtrekkConfig.customerId:false;this.customerCategory=($q.customerCategory)?$q.customerCategory:(webtrekkConfig.customerCategory)?webtrekkConfig.customerCategory:false;this.contentGroup=($q.contentGroup)?$q.contentGroup:(webtrekkConfig.contentGroup)?webtrekkConfig.contentGroup:false;this.mediaCode=($q.mediaCode)?$q.mediaCode:(webtrekkConfig.mediaCode)?webtrekkConfig.mediaCode:false;this.mediaCodeValue=($q.mediaCodeValue)?$q.mediaCodeValue:(webtrekkConfig.mediaCodeValue)?webtrekkConfig.mediaCodeValue:false;this.mediaCodeCookie=($q.mediaCodeCookie)?$q.mediaCodeCookie:(webtrekkConfig.mediaCodeCookie)?webtrekkConfig.mediaCodeCookie:false;this.campaignId=($q.campaignId)?$q.campaignId:(webtrekkConfig.campaignId)?webtrekkConfig.campaignId:false;this.campaignAction=($q.campaignAction)?$q.campaignAction:(webtrekkConfig.campaignAction)?webtrekkConfig.campaignAction:"click";this.internalSearch=($q.internalSearch)?$q.internalSearch:(webtrekkConfig.internalSearch)?webtrekkConfig.internalSearch:false;this.customSid=($q.customSid)?$q.customSid:(webtrekkConfig.customSid)?webtrekkConfig.customSid:false;this.customEid=($q.customEid)?$q.customEid:(webtrekkConfig.customEid)?webtrekkConfig.customEid:false;this.cookie=($q.cookie)?$q.cookie:(webtrekkConfig.cookie)?webtrekkConfig.cookie:"3";this.cookieEidTimeout=($q.cookieEidTimeout)?$q.cookieEidTimeout:(webtrekkConfig.cookieEidTimeout)?webtrekkConfig.cookieEidTimeout:false;this.cookieSidTimeout=($q.cookieSidTimeout)?$q.cookieSidTimeout:(webtrekkConfig.cookieSidTimeout)?webtrekkConfig.cookieSidTimeout:false;this.forceNewSession=($q.forceNewSession)?$q.forceNewSession:(webtrekkConfig.forceNewSession)?webtrekkConfig.forceNewSession:false;this.xwtip=($q.xwtip)?$q.xwtip:(webtrekkConfig.xwtip)?webtrekkConfig.xwtip:false;this.xwtua=($q.xwtua)?$q.xwtua:(webtrekkConfig.xwtua)?webtrekkConfig.xwtua:false;this.xwtrq=($q.xwtrq)?$q.xwtrq:(webtrekkConfig.xwtrq)?webtrekkConfig.xwtrq:false;this.mediaCodeFrames=($q.mediaCodeFrames)?$q.mediaCodeFrames:(webtrekkConfig.mediaCodeFrames)?webtrekkConfig.mediaCodeFrames:false;this.framesetReferrer=($q.framesetReferrer)?$q.framesetReferrer:(webtrekkConfig.framesetReferrer)?webtrekkConfig.framesetReferrer:false;this.plugins=($q.plugins&&$q.plugins!='')?$q.plugins:(webtrekkConfig.plugins&&webtrekkConfig.plugins!='')?webtrekkConfig.plugins:['Adobe Acrobat','Windows Media Player','Shockwave Flash','RealPlayer','QuickTime','Java','Silverlight'];if(typeof(this.plugins)=="string"){this.plugins=this.plugins.split(";");};this.forceHTTPS=($q.forceHTTPS)?$q.forceHTTPS:(webtrekkConfig.forceHTTPS)?webtrekkConfig.forceHTTPS:false;this.secureConfig=($q.secureConfig)?$q.secureConfig:(webtrekkConfig.secureConfig)?webtrekkConfig.secureConfig:false;this.heatmap=($q.heatmap)?$q.heatmap:(webtrekkConfig.heatmap)?webtrekkConfig.heatmap:false;this.heatmapRefpoint=($q.heatmapRefpoint)?$q.heatmapRefpoint:(webtrekkConfig.heatmapRefpoint)?webtrekkConfig.heatmapRefpoint:"wt_refpoint";this.pixelSampling=($q.pixelSampling)?$q.pixelSampling:(webtrekkConfig.pixelSampling)?webtrekkConfig.pixelSampling:false;this.form=($q.form)?$q.form:(webtrekkConfig.form)?webtrekkConfig.form:false;this.formAttribute=($q.formAttribute)?$q.formAttribute:(webtrekkConfig.formAttribute)?webtrekkConfig.formAttribute:false;this.formFieldAttribute=($q.formFieldAttribute)?$q.formFieldAttribute:(webtrekkConfig.formFieldAttribute)?webtrekkConfig.formFieldAttribute:false;this.formFullContent=($q.formFullContent)?$q.formFullContent:(webtrekkConfig.formFullContent)?webtrekkConfig.formFullContent:false;this.formAnonymous=($q.formAnonymous)?$q.formAnonymous:(webtrekkConfig.formAnonymous)?webtrekkConfig.formAnonymous:false;this.reporturl=($q.reporturl)?$q.reporturl:(webtrekkConfig.reporturl)?webtrekkConfig.reporturl:'report2.webtrekk.de/cgi-bin/wt';this.disableOverlayView=($q.disableOverlayView)?$q.disableOverlayView:(webtrekkConfig.disableOverlayView)?webtrekkConfig.disableOverlayView:false;this.version=311;this.beforeSendinfoPixel=false;this.afterSendinfoPixel=false;this.beforeUnloadPixel=false;this.afterUnloadPixel=false;this.deactivatePixel=false;this.optOut=false;this.eid=false;this.sampleCookieString=false;this.cookieOne=false;this.linkId=false;this.linktrackOut=false;this.linktrackNamedlinksOnly=true;this.ccParams=false;this.sentFullPixel=false;this.sentCampaignIds={};this.wtEp=false;this.wtEpEncoded=false;this.trackingSwitchMediaCode=false;this.trackingSwitchMediaCodeValue=false;this.trackingSwitchMediaCodeTimestamp=false;this.heatmapOn=false;this.overlayOn=false;this.gatherFormsP=false;this.formObject=false;this.formName=false;this.formFocus=false;this.formSubmit=false;this.browserLang=false;this.config=false;this.unloadInstance=webtrekkUnloadObjects.length;if(typeof(navigator.language)=="string"){this.browserLang=navigator.language.substring(0,2);}else if(typeof(navigator.userLanguage)=="string"){this.browserLang=navigator.userLanguage.substring(0,2);};this.getConfig=function(){var c={"contentId":this.contentId,"linkId":this.linkId,"sendOnUnload":false,"customParameter":this.customParameter,"customClickParameter":this.customClickParameter,"customSessionParameter":this.customSessionParameter,"customTimeParameter":this.customTimeParameter,"customCampaignParameter":this.customCampaignParameter,"customEcommerceParameter":this.customEcommerceParameter,"orderValue":this.orderValue,"orderCurrency":this.orderCurrency,"orderId":this.orderId,"product":this.product,"productCost":this.productCost,"productQuantity":this.productQuantity,"productCategory":this.productCategory,"productStatus":this.productStatus,"customerId":this.customerId,"customerCategory":this.customerCategory,"contentGroup":this.contentGroup,"campaignId":this.campaignId,"campaignAction":this.campaignAction,"internalSearch":this.internalSearch,"customSid":this.customSid,"customEid":this.customEid,"forceNewSession":this.forceNewSession,"xwtip":this.xwtip,"xwtua":this.xwtua,"xwtrq":this.xwtrq,"framesetReferrer":this.framesetReferrer,"forceHTTPS":this.forceHTTPS,"beforeSendinfoPixel":this.beforeSendinfoPixel,"afterSendinfoPixel":this.afterSendinfoPixel,"beforeUnloadPixel":this.beforeUnloadPixel,"afterUnloadPixel":this.afterUnloadPixel};return c;};this.indexOf=function(a,b,c){return a.indexOf(b,c?c:0);};this.wtTypeof=function(v){return(typeof v!="undefined")?1:0;};this.wtLength=function(a){return a!="undefined"?a.length:0;};this.getTimezone=function(){return Math.round((new Date().getTimezoneOffset()/60)*(-1));};this.wtHref=function(){return this.wtLocation().href;};this.wtLocation=function(){var r=document.location;if(!document.layers&&document.getElementById){eval("try {r=top.document.location;}catch(e){r=document.location;};");}else{r=top.document.location;};return r;};this.getWebtrekkPath=function(){if(!document.layers&&document.getElementById){var $r=document.getElementsByTagName('script');for(var i=0;i<$r.length;i++){if($r[i].src.match(/webtrekk[a-z|A-Z|0-9|_]*\.js/g)){return $r[i].src.replace(/webtrekk[a-z|A-Z|0-9|_]*\.js/g,'');}}};return '';};this.include=function(s){if(!document.createElement){return false;};var $s=document.getElementsByTagName('head').item(0);var js=document.createElement('script');js.setAttribute('language','javascript');js.setAttribute('type','text/javascript');js.setAttribute('src',s);$s.appendChild(js);return true;};this.isIE=this.indexOf(navigator.appName,"Microsoft")?false:true;if(!this.isIE){this.isOpera=this.indexOf(navigator.appName,"Opera")?false:true;if(!this.isOpera){this.isSafari=(navigator.vendor.toLowerCase().indexOf("apple")!=-1)?true:false;this.isChrome=(navigator.vendor.toLowerCase().indexOf("google")!=-1)?true:false;}};this.url2contentId=function($t){if(!$t){return "no_content";};var $e=new RegExp("//(.*)").exec($t);if($e.length<1){return "no_content";};var $u=$e[1].split("?")[0].replace(/\./g,"_").replace(/\//g, ".").replace(/\.{2,};/g,".").toLowerCase();return $u.split(";")[0];};this.contentId=($q.contentId)?$q.contentId:this.url2contentId(document.location.href);this.registerEvent=function($j,e,f){if($j.addEventListener){$j.addEventListener(e,f,false);}else{if($j.attachEvent){$j.attachEvent("on"+e,f);}}};this.unregisterEvent=function($j,e,f){if($j.removeEventListener){$j.removeEventListener(e,f,false);}else{if($j.detachEvent){$j.detachEvent("on"+e,f);}}};this.maxlen=function(v,l){if(v&&v.length>l){return v.substring(0,l-1);};return v;};this.wtEscape=function(u){if(typeof(encodeURIComponent)=='function'){return encodeURIComponent(u);};return escape(u);};this.wtUnescape=function(u){if(typeof(decodeURIComponent)=='function'){return decodeURIComponent(u);};return unescape(u);};this.decrypt=function(x){if(x){return eval("try {this.wtUnescape(x.replace(/([0-9a-fA-F][0-9a-fA-F])/g,'%$1'));}catch(e){''};");}};this.checkSC=function(x){if(typeof(this.secureConfig)!='string'){return false;};var sc=this.secureConfig.split(';');for(var i=0;i<sc.length;i++){if(sc[i]==x){return true;}};return false;};this.zeroPad=function(n,$v){var $w="000000000000"+n;return $w.substring(($w.length-$v),$w.length);};this.generateEid=function(){return '2'+this.zeroPad(Math.floor(new Date().getTime()/1000),10)+this.zeroPad(Math.floor(Math.random()*1000000),8);};this.getexpirydate=function($x){var $y;var $z=new Date();var $A=Date.parse($z);$z.setTime($A+$x*60*1000);$y=$z.toUTCString();return $y;};this.setCookie=function(name,$B,$C){var d=location.hostname;var $D="^[0-9]{1,3"+String.fromCharCode(125)+"\.[0-9]{1,3"+String.fromCharCode(125)+"\.[0-9]{1,3"+String.fromCharCode(125)+"\.[0-9]{1,3"+String.fromCharCode(125)+"$";if(d.search($D)==-1){d=location.hostname.split(".");d=d[d.length-2]+"."+d[d.length-1];};var c;if(d.split('.')[1].length<3&&this.isIE&&$C){c=name+"="+escape($B)+";path=/;expires="+getexpirydate($C);}else if(d.split('.')[1].length<3&&this.isIE){c=name+"="+escape($B)+";path=/";}else if($C){c=name+"="+escape($B)+";domain="+d+";path=/;expires="+this.getexpirydate($C);}else{c=name+"="+escape($B)+";path=/;domain="+d;};document.cookie=c;};this.getCookie=function($E){var $F=""+document.cookie;var $G=$F.indexOf($E);if($G==-1||$E==""){return "";};var $H=$F.indexOf(';',$G);if($H==-1){$H=$F.length;};return unescape($F.substring($G+$E.length+1,$H));};this.optOut=(this.getCookie("webtrekkOptOut"))?true:false;if(this.optOut){this.deactivatePixel=true;};this.urlParam=function($t,$I,$J){var p=new Array();if($t.indexOf("?")>0){p=$t.substring($t.indexOf("?")+1).replace(/&amp;/g,"&").split("&");};for(var i=0;i<p.length;i++){if(p[i].indexOf($I+"=")==0){return this.wtUnescape(p[i].substring($I.length+1).replace(/\+/g,"%20"));}};return $J;};this.allUrlParam=function($I,$J){if(this.mediaCodeFrames&&this.mediaCodeFrames!=''){var lf=this.mediaCodeFrames.split(";");for(var i=0;i<lf.length;i++){var $K=false;eval("try { lFrame = eval(lf[i]) }catch(e){};");if($K&&$K!=top&&$K.location){var $L=this.urlParam($K.location.href,$I,$J);if($L!=$J){return $L;}}};return $J;}else{var topLocation="";eval("try {topLocation = top.location.href;}catch(e){topLocation=document.location.href;};");return this.urlParam(topLocation,$I,$J);}};this.linkTrackInit=function(){for(i=0;i<webtrekkLinktrackObjects.length;i++){if(this==webtrekkLinktrackObjects[i]){return;}};webtrekkLinktrackObjects.push(this);if(this.linkTrack&&this.linkTrack=="link"){this.linktrackNamedlinksOnly=false;};for(c=0;c<document.links.length;c++){var name=document.links[c].getAttribute('name');if(this.linkTrackAttribute&&this.linkTrackAttribute!=""){var $e="";eval("tmp = (document.links[c].getAttribute(this.linkTrackAttribute)?document.links[c].getAttribute(this.linkTrackAttribute):'')");if($e){name=$e;}};if(name||!this.linktrackNamedlinksOnly){this.registerEvent(document.links[c],'mousedown',webtrekkLinktrack);}}};if(this.linkTrack){this.linkTrackInit();};this.getCCParams=function(a){var p='';if(this.config.customClickParameter){var $M=(this.config.customClickParameter[a.getAttribute('name')])?this.config.customClickParameter[a.getAttribute('name')]:this.config.customClickParameter[a.id];if(!$M){$M=this.config.customClickParameter;};for(var z in $M){if(!isNaN(z)&&this.wtTypeof($M[z])&&typeof($M[z])=='string'&&$M[z]!=''){if(this.checkSC('custom')){$M[z]=this.decrypt($M[z]);};p+='&ck'+z+'='+this.wtEscape($M[z]);}}};this.ccParams=p;return;};this.plugInArray=function($N,$O){if(typeof($N)!='object'){return false;};for(var i=0;i<$N.length;i++){var $P=new RegExp($N[i].toLowerCase(),'g');if($O.toLowerCase().search($P)!=-1){return $N[i];}};return false;};this.quicksend=function($Q,$R,$S){if(!this.trackDomain||!this.trackId||this.deactivatePixel){return;};if(!$S){$S="wt";};if(this.cookie=="1"){$R="&eid="+this.eid+"&one="+(this.cookieOne?"1":"0")+"&fns="+(this.forceNewSession?"1":"0")+$R;};if(this.cookie!="1"&&(this.wtTypeof(this.cookieEidTimeout)||this.wtTypeof(this.cookieSidTimeout))){if(this.wtTypeof(this.cookieEidTimeout)&&this.cookieEidTimeout!=''){$R="&cet="+this.cookieEidTimeout+$R;};if(this.wtTypeof(this.cookieSidTimeout)&&this.cookieSidTimeout!=''){$R="&cst="+this.cookieSidTimeout+$R;}};if(this.pixelSampling>0){$R+="&ps="+this.pixelSampling;};$R="&tz="+this.getTimezone()+$R;var $T=(location.protocol=="https:"?"https:":"http:");if(this.forceHTTPS){$T="https:";};var $U=$T+"//"+this.trackDomain+"/"+this.trackId+"/"+$S+"?p="+this.version+","+$Q+$R+"&eor=1";if(document.images){if(!this.wtTypeof($V)){var $V=new Array();};var ii=$V.length;$V[ii]=new Image();$V[ii].src=$U;$V[ii].onload=function(){};}else{document.write("<img src='"+$U+"' height='1' width='1'>");};if($S!='hm'){this.cookieOne=false;this.sentFullPixel=1;}};this.send=function(p,$W,ep){if($W=="link"){this.config.linkId=p;this.linkTrack="manual";this.wtEp=ep;if(this.isChrome||this.isOpera||this.isSafari){webtrekkUnload('noForm');}else{this.registerEvent(window,(this.isIE&&this.wtTypeof(window.onbeforeunload))?"beforeunload":"unload",webtrekkUnload);};return;};if($W=="click"){this.config.linkId=p;this.wtEp=ep;webtrekkUnload('noForm');return;};var $X=(p)?p:this.config.contentId;if(!$X){$X="no_content";};var $Y="";var $Z=this.wtEscape($X)+",1,";$Z+=this.baseparams();var $00=navigator.plugins.length;var $01="";if($00>0){var $02=Array();for(var i=0;i<$00;i++){if(navigator.plugins&&navigator.appName!='Microsoft Internet Explorer'){if(navigator.plugins[i].name=="Shockwave Flash"){$01=navigator.plugins[i].description;}else{$01=navigator.plugins[i].name;};var $03=this.plugInArray(this.plugins,$01);if($03&&!this.plugInArray($02,$03)){$02.push($03);}}};$01=$02.join("|");};if(typeof(ep)=="string"&&ep!=""){ep=ep.split(/;/);for(var z=0;z<ep.length;z++){if(this.wtTypeof(ep[z])){$d=ep[z].split(/=/);if(this.checkSC('custom')){$d[1]=this.decrypt($d[1]);};$d[1]=this.wtEscape($d[1]);$Y+='&'+$d[0]+'='+$d[1];}}}else{this.wtEpEncoded=false;var $04='';if(typeof(this.config.customParameter)=='object'){for(var z in this.config.customParameter){if(!isNaN(z)&&this.wtTypeof(this.config.customParameter[z])&&typeof(this.config.customParameter[z])=='string'&&this.config.customParameter[z]!=''){if(this.checkSC('custom')){this.config.customParameter[z]=this.decrypt(this.config.customParameter[z]);};$04+='&cp'+z+'='+this.wtEscape(this.config.customParameter[z]);}}};var $05='';if(typeof(this.config.customSessionParameter)=='object'){for(var z in this.config.customSessionParameter){if(!isNaN(z)&&this.wtTypeof(this.config.customSessionParameter[z])&&typeof(this.config.customSessionParameter[z])=='string'&&this.config.customSessionParameter[z]!=''){if(this.checkSC('custom')){this.config.customSessionParameter[z]=this.decrypt(this.config.customSessionParameter[z]);};$05+='&cs'+z+'='+this.wtEscape(this.config.customSessionParameter[z]);}}};var $06='';if(typeof(this.config.customTimeParameter)=='object'){for(var z in this.config.customTimeParameter){if(!isNaN(z)&&this.wtTypeof(this.config.customTimeParameter[z])&&typeof(this.config.customTimeParameter[z])=='string'&&this.config.customTimeParameter[z]!=''){if(this.checkSC('custom')){this.config.customTimeParameter[z]=this.decrypt(this.config.customTimeParameter[z]);};$06+='&ce'+z+'='+this.wtEscape(this.config.customTimeParameter[z]);}}};var $07='';if(typeof(this.config.customEcommerceParameter)=='object'){for(var z in this.config.customEcommerceParameter){if(!isNaN(z)&&this.wtTypeof(this.config.customEcommerceParameter[z])&&typeof(this.config.customEcommerceParameter[z])=='string'&&this.config.customEcommerceParameter[z]!=''){if(this.checkSC('custom')){this.config.customEcommerceParameter[z]=this.decrypt(this.config.customEcommerceParameter[z]);};$07+='&cb'+z+'='+this.wtEscape(this.config.customEcommerceParameter[z]);}}};if(this.config.orderValue){if(this.checkSC('order')){$Y+="&ov="+this.wtEscape(this.decrypt(this.config.orderValue));}else{$Y+="&ov="+this.wtEscape(this.config.orderValue);}};if(this.config.orderCurrency){if(this.checkSC('order')){$Y+="&cr="+this.wtEscape(this.decrypt(this.config.orderCurrency));}else{$Y+="&cr="+this.wtEscape(this.config.orderCurrency);}};if(this.config.orderId){$Y+="&oi="+this.wtEscape(this.config.orderId);};if(this.config.product){$Y+="&ba="+this.wtEscape(this.config.product);if(this.config.productCost){$Y+="&co="+this.wtEscape(this.config.productCost);};if(this.config.productQuantity){$Y+="&qn="+this.wtEscape(this.config.productQuantity);};if(typeof(this.config.productCategory)=='object'){for(var z in this.config.productCategory){if(!isNaN(z)&&typeof(this.config.productCategory[z])=='string'&&this.config.productCategory[z]!=''){$Y+="&ca"+z+"="+this.wtEscape(this.config.productCategory[z]);}}};if(this.config.productStatus){$Y+="&st="+this.wtEscape(this.config.productStatus);}};if(this.config.customerId){$Y+="&cd="+this.wtEscape(this.config.customerId);};if(typeof(this.config.customerCategory)=='object'){for(var z in this.config.customerCategory){if(!isNaN(z)&&typeof(this.config.customerCategory[z])=='string'&&this.config.customerCategory[z]!=''){$Y+="&vc"+z+"="+this.wtEscape(this.config.customerCategory[z]);}}};if(this.browserLang){$Y+="&la="+this.wtEscape(this.browserLang);};if(typeof(this.config.contentGroup)=='object'){for(var z in this.config.contentGroup){if(!isNaN(z)&&typeof(this.config.contentGroup[z])=='string'&&this.config.contentGroup[z]!=''){$Y+="&cg"+z+"="+this.wtEscape(this.config.contentGroup[z]);}}};var $08='';if(this.config.campaignId&&!(this.config.campaignId in this.sentCampaignIds)){$Y+="&mc="+this.wtEscape(this.config.campaignId);$Y+="&mca="+this.config.campaignAction.substring(0,1);this.sentCampaignIds[this.config.campaignId]=true;if(typeof(this.config.customCampaignParameter)=='object'){for(var z in this.config.customCampaignParameter){if(!isNaN(z)&&this.wtTypeof(this.config.customCampaignParameter[z])&&typeof(this.config.customCampaignParameter[z])=='string'&&this.config.customCampaignParameter[z]!=''){if(this.checkSC('custom')){this.config.customCampaignParameter[z]=this.decrypt(this.config.customCampaignParameter[z]);};$08+='&cc'+z+'='+this.wtEscape(this.config.customCampaignParameter[z]);}}}};if(this.trackingSwitchMediaCode){$Y+="&tmc="+this.wtEscape(this.trackingSwitchMediaCode);};if(this.trackingSwitchMediaCodeValue){$Y+="&tmcv="+this.wtEscape(this.trackingSwitchMediaCodeValue);};if(this.trackingSwitchMediaCodeTimestamp){$Y+="&tmct="+this.wtEscape(this.trackingSwitchMediaCodeTimestamp);};var $09="";var $0a;if(typeof(wt_vt)!="undefined"){$0a=wt_vt;};if(!this.wtTypeof($0a)){$0a=this.urlParam(location.href,'wt_vt',false);};if($0a){var $0b=this.getCookie('wt_vt').split(";");for(var i=0;i<$0b.length;i++){if($0b[i].indexOf($0a+'v')!=-1){$09='&wt_vt='+$0b[i].split('t')[0].split('v')[1];}}};if($09){$Y+=$09;};if(this.config.internalSearch){$Y+="&is="+this.wtEscape(this.maxlen(this.config.internalSearch,255));};if($04){$Y+=$04;};if($08){$Y+=$08;};if($06){$Y+=$06;};if($07){$Y+=$07;};if($05){$Y+=$05;};if(this.wtTypeof(this.config.customSid)&&this.config.customSid!=''){$Y+="&csid="+this.config.customSid;};if(this.wtTypeof(this.config.customEid)&&this.config.customEid!=''){$Y+="&ceid="+this.config.customEid;};if(this.wtTypeof(this.config.xwtip)&&this.config.xwtip!=''){$Y+="&X-WT-IP="+this.wtEscape(this.config.xwtip);};if(this.wtTypeof(this.config.xwtua)&&this.config.xwtua!=''){$Y+="&X-WT-UA="+this.wtEscape(this.config.xwtua);};if(this.wtTypeof(this.config.xwtrq)&&this.config.xwtrq!=''){$Y+="&X-WT-RQ="+this.wtEscape(this.config.xwtrq);}};if(this.config.linkId&&this.config.customClickParameter){var $M=(this.config.customClickParameter[this.config.linkId])?this.config.customClickParameter[this.config.linkId]:this.config.customClickParameter;for(var z in $M){if(!isNaN(z)&&this.wtTypeof($M[z])&&typeof($M[z])=='string'&&$M[z]!=''){if(this.checkSC('custom')){$M[z]=this.decrypt($M[z]);};$Y+='&ck'+z+'='+this.wtEscape($M[z]);}};this.ccParams=false;};if(this.config.linkId&&this.config.sendOnUnload){this.linkTrack="manual";this.wtEp=$Y;this.wtEpEncoded=true;if(this.isChrome||this.isOpera||this.isSafari){webtrekkUnload('noForm');}else{this.registerEvent(window,(this.isIE&&this.wtTypeof(window.onbeforeunload))?"beforeunload":"unload",webtrekkUnload);};return;}else if(this.config.linkId){this.wtEp=$Y;this.wtEpEncoded=true;webtrekkUnload('noForm');return;}else if(!this.config.contentId&&!this.config.linkId){this.config.contentId=this.contentId;this.config.linkId="wt_ignore";this.wtEp=$Y;this.wtEpEncoded=true;webtrekkUnload('noForm');return;}else if(this.config.sendOnUnload){this.wtEp=$Y;this.wtEpEncoded=true;if(this.isChrome||this.isOpera||this.isSafari){webtrekkUnload('noForm');}else{this.registerEvent(window,(this.isIE&&this.wtTypeof(window.onbeforeunload))?"beforeunload":"unload",webtrekkUnload);};return;};if(this.cookie=="1"){if(this.cookieOne){$Y+="&np="+this.wtEscape($01);}}else{$Y+="&np="+this.wtEscape($01);};this.quicksend($Z,$Y);};this.sendinfo=function(c,p,$W,ep){if(this.cookie=="1"&&!this.optOut&&!this.deactivatePixel){this.firstParty();};if(this.urlParam(location.href,'fb_xd_fragment',false)){return;};if(typeof(c)=='object'){this.config=c;}else{this.config=this.getConfig();};if(!this.config.campaignId&&this.mediaCode){this.getMediaCode();};if(this.beforeSendinfoPixel!=false){this.beforeSendinfoPixel();};if(this.contentId!=""||p!=""||document.layers){this.send(p,$W,ep);};if(this.afterSendinfoPixel!=false){this.afterSendinfoPixel();}};this.sendinfo_media=function($0c,mk,$0d,$0e,mg,bw,$0f,$0g){if(this.wtTypeof($0h)){$0h($0c,mk,$0d,$0e,mg,bw,$0f,$0g,this.unloadInstance);}};this.isOwnDomain=function(l){var pt='';if(this.domain){if(this.domain.toUpperCase().indexOf("REGEXP:")==0){pt=new RegExp(this.domain.substring(7),"i");if(pt.test(this.getDomain(l))){return true;}}else{var $0i=this.domain.split(';');var $0j=this.getDomain(l);for(var i=0;i<$0i.length;i++){if($0j==$0i[i]){return true;}}}}else{return false;};return false;};this.getDomain=function(l){if(typeof(l)!='string'){return '';};l=this.wtUnescape(l);l=l.split('://')[1];var rx=new RegExp('^(?:[^\/]+:\/\/)?([^\/:]+)','g');l=l.match(rx);if(l[0]){return l[0].toLowerCase();};return '';};this.baseparams=function(){var $0k=screen.width+"x"+screen.height+","+(navigator.appName!='Netscape'?screen.colorDepth:screen.pixelDepth)+",";$0k+=((navigator.cookieEnabled==true)?"1,":((navigator.cookieEnabled==false)?"0,":((document.cookie.indexOf("=")!=-1)?"1,":"0,")));$0k+=new Date().getTime()+",";var $0l=0;if(this.framesetReferrer){$0l=this.wtEscape(this.framesetReferrer);}else{if(document.referrer.length>0){$0l=this.wtEscape(document.referrer);}};if(this.sentFullPixel){$0k+="2";}else if(!this.isOwnDomain($0l)){$0k+=$0l;}else if(this.isOwnDomain($0l)){$0k+="1";}else{$0k+=$0l;};var h=0;if(!document.layers&&document.getElementById){eval("try {h = top.window.innerHeight;}catch(e){};");}else{h=top.window.innerHeight;};if(!h){eval("try {h = top.document.documentElement.clientHeight;}catch(e){};");};if(!h){eval("try {h = top.document.body.clientHeight;}catch(e){};");};var w=0;if(!document.layers&&document.getElementById){eval("try {w = top.window.innerWidth;}catch(e){};");}else{w=top.window.innerWidth;};if(!w){eval("try {w = top.document.documentElement.clientWidth;}catch(e){};");};if(!w){eval("try {w = top.document.body.clientWidth;}catch(e){};");};if(h&&h>screen.height){h=screen.height;};if(w&&w>screen.width){w=screen.width;};if(typeof(w)=='undefined'){w=-1;};if(typeof(h)=='undefined'){h=-1;};$0k+=","+w+"x"+h;$0k+=","+(navigator.javaEnabled()?"1":"0");return $0k;};this.getMediaCode=function(mc){if(!mc){if(!this.mediaCode){return false;};mc=this.mediaCode;};var m=mc.split(";");this.config.campaignId="";for(var i=0;i<m.length;i++){if(this.config.campaignId!=""){this.config.campaignId+=";";};if(this.mediaCodeCookie){if(this.getCookie('wt_'+m[i].toLowerCase()+this.allUrlParam(m[i],"").toLowerCase())==''){this.config.campaignId+=m[i]+this.wtEscape("="+this.allUrlParam(m[i],""));}else{this.config.campaignId+=m[i]+"=ignore";};var $0m='';if(this.mediaCodeCookie=='eid'){$0m=60*30*24*60;};this.setCookie('wt_'+m[i].toLowerCase()+this.allUrlParam(m[i],"").toLowerCase(),1,$0m);}else{if(this.allUrlParam(m[i],"")!=""){this.config.campaignId+=m[i]+this.wtEscape("="+this.allUrlParam(m[i],""));}}}};this.heatmapOn=(this.wtHref().indexOf("wt_heatmap=1")>=0);this.overlayOn=(this.wtHref().indexOf("wt_overlay=1")>=0||document.cookie.indexOf("wt_overlay=1")>=0);if(this.wtHref().indexOf("wt_overlay=0")>=0){this.overlayOn=false;this.setCookie("wt_overlay","",-1);};var $0n=false;for(i=0;i<webtrekkHeatmapObjects.length;i++){if(this==webtrekkHeatmapObjects[i]){$0n=true;}};if(!$0n){webtrekkHeatmapObjects.push(this);};if(this.heatmap&&this.heatmap=="1"&&!this.heatmapOn){this.registerEvent(document,"mousedown",webtrekkHeatmapClick);};if(this.heatmapOn&&!this.disableOverlayView){if(this.include(location.protocol+"//"+this.reporturl+"/heatmap.pl?wt_contentId="+this.wtEscape(this.contentId.split(";")[0])+"&x="+new Date().getTime())){if(navigator.userAgent.indexOf('MSIE 6')!=-1&&navigator.userAgent.indexOf('Windows NT 5.0')!=-1){alert("Click OK to start heatmap.");};this.registerEvent(window,"load",webtrekkStartHeatmap);}};if(this.overlayOn&&!this.disableOverlayView){this.setCookie("wt_overlay","1");if(this.include(location.protocol+"//"+this.reporturl+"/overlay.pl?wt_contentId="+this.wtEscape(this.contentId.split(";")[0])+"&x="+new Date().getTime()))this.registerEvent(window,"load",webtrekkStartOverlay);};this.setPixelSampling=function($0o){if(!$0o){var $0o=this.pixelSampling;};var trackId=this.trackId.split(",")[0];var $0p=this.getCookie("wt3_sample").split(";");var $0q=false;for(var i=0;i<$0p.length;i++){if(this.indexOf($0p[i],trackId+"|"+$0o)!=-1){$0q=true;}else if(this.indexOf($0p[i],trackId+"|")!=-1){$0p[i]="";}};if(!$0q){if(Math&&Math.random&&parseInt(Math.random()*$0o)==0){$0p.push(trackId+"|"+$0o+"|1");}else{$0p.push(trackId+"|"+$0o+"|0");};var $0r=60;if(this.cookieEidTimeout){$0r=this.cookieEidTimeout;};this.setCookie("wt3_sample",$0p.join(";"),$0r*30*24*60);$0p=this.getCookie("wt3_sample");};if(this.indexOf($0p,trackId+"|"+$0o+"|1")==-1){this.deactivatePixel=true;}};if(this.pixelSampling&&!this.optOut){this.setPixelSampling();};this.firstParty=function(){var $0s=this.getCookie("wt3_sid").split(";");var $0t=this.getCookie("wt3_eid").split(";");var $0u=(this.cookieSidTimeout)?this.cookieSidTimeout:30;var $0r=(this.cookieEidTimeout)?this.cookieEidTimeout:60;var trackId=this.trackId.split(",")[0];var $0v=false;var $0w=false;for(var i=0;i<$0s.length;i++){if($0s[i].indexOf(trackId)!=-1){$0v=i;break;}};for(var i=0;i<$0t.length;i++){if($0t[i].indexOf(trackId+"|")!=-1){$0w=i;break;}};if(!$0v){$0s.push(trackId);if($0w){this.forceNewSession=true;}};if(!$0w){this.eid=this.generateEid();this.cookieOne=true;$0t.push(trackId+"|"+this.eid);this.setCookie("wt3_eid",$0t.join(";"),$0r*30*24*60);}else{this.eid=$0t[$0w].replace(trackId+"|","");};this.setCookie("wt3_sid",$0s.join(";"));};var $0x=false;for(i=0;i<webtrekkUnloadObjects.length;i++){if(this==webtrekkUnloadObjects[i]){$0x=true;}};if(!$0x){webtrekkUnloadObjects.push(this);this.registerEvent(window,(this.wtTypeof(window.onbeforeunload))?"beforeunload":"unload",webtrekkUnload);};this.findForm=function(){var f=document.forms;for(var i=0;i<f.length;i++){var cf=f[i];if(this.wtTypeof(cf.elements["wt_form"])){this.formObject=cf;return;}}};this.checkFormFocus=function($0y){if($0y==this.formFocus){return 1;};return 0;};this.getFormFieldValue=function(ff){var p=ff.name;if(this.formFieldAttribute){p='';var $e=false;eval("tmp = (ff.getAttribute(this.formFieldAttribute) ? ff.getAttribute(this.formFieldAttribute) : '')");if($e){p=$e;};if(p){p=p.replace(/[\.|;]/g,"_");}};return p;};this.gatherForm=function(){var $0z=";";if(!this.formObject){return;};var f=this.formObject;var p=f.getAttribute('name')?f.getAttribute('name'):this.contentId.split(";")[0];if(this.formAttribute){var $e="";eval("tmp = (f.getAttribute(this.formAttribute) ? f.getAttribute(this.formAttribute) : '')");if($e){p=$e;}};this.formName=p;var fl="";if(this.wtTypeof(f.elements["wt_fields"])){fl=f.elements["wt_fields"].value;};if(!fl){for(var i=0;i<f.elements.length;i++){var e=f.elements[i];if(this.getFormFieldValue(e)){fl+=this.getFormFieldValue(e)+$0z;}};fl=fl.substring(0,fl.lastIndexOf($0z))};var $0A=fl.split($0z);var $0B=$0A.length;var $0C="";if(this.formFullContent){$0C=this.formFullContent.split($0z);};var pa="";var $0D=new Array();for(var i=0;i<f.elements.length;i++){var e=f.elements[i],$B,$0E,$0F=false;if(fl){for(var j=0;j<$0B;j++){if(this.getFormFieldValue(e)==$0A[j]){$0F=true;}}}else{if(this.getFormFieldValue(e)){$0F=true;}};if($0F){$B=null;if(e.type=='select-multiple'){for(var j=0;j<e.options.length;j++){var $0G=false;if(e.options[j].selected){$0G=true;pa+=";"+this.getFormFieldValue(e).replace(/[\.|;]/g,"_")+"."+e.type+"|"+((this.formAnonymous)?"anon":e.options[j].value.replace(/[\.|;]/g,"_"))+"|"+this.checkFormFocus(e.name);};if(!$0G){$B="empty";}}};if(e.type=='select-one'){if(e.selectedIndex!=-1){$B=e.options[e.selectedIndex].value.replace(/[\.|;]/,"_");if(!$B){$B="empty";}}};if(e.type=='checkbox'){if(!e.checked){$B="empty";}else{$B=e.value.replace(/[\.|;]/,"_");}};if(e.type=='radio'){if(e.checked){$B=e.value.replace(/[\.|;]/g,"_");};$0D[$0D.length]=this.getFormFieldValue(e);};if(e.type=="password"||e.type=="text"||e.type=="textarea"){$B=(e.value?"filled_out":"empty");for(var k=0;k<$0C.length;k++){if($0C[k]==this.getFormFieldValue(e)){$B=this.maxlen(e.value,30);}};if(!$B){$B="empty";}};if($B){name=this.getFormFieldValue(e).replace(/[\.|;]/g,"_");$0E=";"+name+"."+e.type+"|";if(pa.indexOf($0E)==-1){pa+=$0E+((this.formAnonymous)?"anon":$B)+"|"+this.checkFormFocus(e.name);}}}};for(var i=0;i<$0D.length;i++){var n=";"+$0D[i].replace(/[\.|;]/g,"_")+".radio|";if(pa.indexOf(n)==-1){pa+=n+((this.formAnonymous)?"anon":"empty")+"|"+this.checkFormFocus(e.name);}};if(pa){pa=pa.substring(1);};return pa;};this.formTrackInstall=function(f){if(f){this.formObject=f;};this.form=1;webtrekkFormTrackInstall();};if(this.form){webtrekkFormTrackInstall();};this.cookieManager=function(name,$0H,$0I){var i,j;this.name=name;this.keySeperator="~";this.fieldSeparator="#";this.durationSeperator="|";this.found=false;this.expires=$0H;this.accessPath=$0I;this.rawValue="";this.fields=[];this.fieldsDuration=[];this.fieldnames=[];this.read=function(){var $0J=this.name+"=";var $0K=document.cookie;this.rawValue=null;this.found=false;if($0K.length>0){$0L=$0K.indexOf($0J);if($0L!=-1){$0L+=$0J.length;end=$0K.indexOf(";",$0L);if(end==-1){end=$0K.length};this.rawValue=$0K.substring($0L,end);this.found=true;}};if(this.rawValue!=null){var sl=this.rawValue.length;var $0M=0;var $0N=0;var i=0;do{$0N=this.rawValue.indexOf(this.fieldSeparator,$0M);if($0N!=-1){var $0O=this.rawValue.substring($0M,$0N).split(this.durationSeperator);var rV=$0O[0].split(this.keySeperator);this.fields[rV[0]]=unescape(rV[1]);this.fieldsDuration[rV[0]]=parseInt(unescape($0O[1]));i++;$0M=$0N+1;}}while($0N!=-1&$0N!=(this.rawValue.length-1));};return this.found;};this.getSize=function(){var $0P=new Date().getTime();var $0Q="";for(i in this.fields){if(this.fieldsDuration[i]>=$0P){$0Q+=escape(i)+this.keySeperator+escape(this.fields[i])+this.durationSeperator+escape(this.fieldsDuration[i])+this.fieldSeparator;}};return $0Q.length;};this.write=function(){var $0P=new Date().getTime();var $0R=true;var $0Q=this.name+"=";for(i in this.fields){if(this.fieldsDuration[i]>=$0P){$0Q+=escape(i)+this.keySeperator+escape(this.fields[i])+this.durationSeperator+escape(this.fieldsDuration[i])+this.fieldSeparator;$0R=false;}};var $0S=($0R)?-99999:this.expires;if($0S!=""){if(typeof($0S)=="number"){var $0T=new Date();var $0U=new Date();$0U.setTime($0T.getTime()+1000*60*60*24*$0S);$0Q+="; expires="+$0U.toGMTString();}else{$0Q+="; expires="+$0S.toGMTString();}};if(this.accessPath!=null){$0Q+="; PATH="+this.accessPath;};var d=location.hostname;var $D="^[0-9]{1,3"+String.fromCharCode(125)+"\.[0-9]{1,3"+String.fromCharCode(125)+"\.[0-9]{1,3"+String.fromCharCode(125)+"\.[0-9]{1,3"+String.fromCharCode(125)+"$";if(d.search($D)==-1){d=location.hostname.split(".");d=d[d.length-2]+"."+d[d.length-1];};$0Q+="; DOMAIN="+d;document.cookie=$0Q;return null;};this.remove=function(){this.expires=-10;this.write();return this.read();};this.get=function($0V){var $0P=new Date().getTime();if(this.fieldsDuration[$0V]>=$0P){return this.fields[$0V];};return "";};this.set=function($0V,$0W,$C,$W,$0X){if(!$C){$C=31536000;};if(!$W){$W="";};var $0P=new Date().getTime();if($W=="first"&&this.fields[$0V]!=""&&this.fields[$0V]!=null&&this.fieldsDuration[$0V]>=$0P){return this.fields[$0V];};this.fields[$0V]=$0W;this.fieldsDuration[$0V]=$0P+(parseInt($C)*1000);if(!$0X){this.write();};return $0W;};this.prepare=function($0V,$0W,$C,$W){this.set($0V,$0W,$C,$W,true);};this.read();};};
var webtrekkPixel = false;if (typeof(webtrekk) == "object") {webtrekkConfig = webtrekk;webtrekkPixel = new webtrekkV3();}function wt_sendinfo(p, mode, ep) {if (webtrekkPixel) {for (i in webtrekk) {if (i != "plugins" && i != "sendinfo") {webtrekkPixel[i] = webtrekk[i];}}webtrekkPixel.sendinfo(false, p, mode, ep);}}
			
/* Ende der webtrekk.js */
var jQueryWinRace   = jQuery.noConflict();

jQueryWinRace(document).ready( function() {
						
					
						
});
var CONST_WIN = "WIN";
var CONST_PLACE = "PLACE";
var CONST_EXACTA = "EXACTA";
var CONST_TRIFECTA = "TRIFECTA"
var CONST_TRIFECTA_FLEX = "TRIFECTA_FLEX";	

var finalOdds1 = new Object();
var finalOdds2 = new Object();
var finalOdds3 = new Object();
var finalOdds4 = new Object();

var currentExtraToggleClass= "#WinInfoExtra";

/* Add openWindow function to open a url with width and height in a popup */
function openWindow(url, width, height) {
	if (!width) {
		width=600;
	}
	if (!height) {
		height=400;
	}
	fenster=window.open(url, "_blank", "width=" + width + ",height="  + height + ",status=yes,scrollbars=yes,resizable=yes");
	fenster.focus();
	return false;
}

/* Add Watermark to all Input-Field that have the Attribute watermark */
jQueryWinRace(document).ready(function() {
	addWatermarkToAllInputFields();
});


function addWatermarkToAllInputFields(){
	jQueryWinRace('input').each(function() {
		if(jQueryWinRace(this).attr('watermark') != undefined || jQueryWinRace(this).attr('watermark') != null){
			jQueryWinRace(this).watermark(jQueryWinRace(this).attr('watermark'),"watermarkInput");
		}
		
	});
}

/**
 * hides all startercards in the right box your choice.
 * 
 * @return
 */
function hideAndDeselectAllStarterSelections(){
	var allCards = jQueryWinRace("#easybet_step3").find(".selectedStarter");
	
	var allSelectedSectionStarterFields = jQueryWinRace(".starterSelectedField");
	allSelectedSectionStarterFields.each(function() { 
		allSelectedSectionStarterFields.val('false');
	});
	
	allCards.each(function() {
			var current = jQueryWinRace(this);
			current.hide();
	});	
	
}


function hideAllEmptySelectedStarterCards(){
	jQueryWinRace(".empty_starter").hide();

}

function showEmptySelectedStarterCards(count){
	hideAllEmptySelectedStarterCards();
	jQueryWinRace(".empty_starter").each(function(index,value) { 
		if(index < count){
			jQueryWinRace(this).show();
		}
	});
}

function calculatePossibleWinAmount(){
	var startNr = jQueryWinRace("#lastSelectedWinStarter").html();
	if(startNr != null && startNr != undefined && startNr != ""){
		var mlOddDiv = jQueryWinRace('#mlOdd_' + startNr);
		var mlOdd = mlOddDiv.html();
		if(mlOdd != null && mlOdd != undefined && mlOdd != ""){
			var mlOddNumber = new Number(mlOdd);
			var betAmount = jQueryWinRace('#einsatzDoubleValue').val();
			var possibleWinAmount = mlOddNumber * betAmount;
			jQueryWinRace('.winamount').html(getGermanNumberFormat(possibleWinAmount) + " EUR" );
		}
	}
}

function updateSelectedWinChanceSlider(){
	var startNr = jQueryWinRace("#lastSelectedWinStarter").html();
	var percent = jQueryWinRace("#percent_"+startNr).html();
	jQueryWinRace("#percent_selected").html(percent);
	var selectedSliderLevel = jQueryWinRace("#sliderlevel_"+startNr);
	jQueryWinRace("#sliderlevel_selected").width(selectedSliderLevel.width());
}


function hideAllExtraInformationInfoBoxes(){
	jQueryWinRace("#WinInfoExtra").hide();
	 
	 jQueryWinRace("#PlaceInfo").hide();
	 jQueryWinRace("#PlaceInfoExtra").hide();
	 
	 jQueryWinRace("#ExactaInfo").hide();
	 jQueryWinRace("#ExactaInfoExtra").hide();
	 
	 jQueryWinRace("#TrifektaInfo").hide();
	 jQueryWinRace("#TrifektaInfoExtra").hide();
	 	 
	 jQueryWinRace("#TrifektaFlexInfo").hide();
	 jQueryWinRace("#TrifektaFlexInfoExtra").hide();
}

function handleEasyBetMoreInfoButtonClicked(){
	jQueryWinRace("#EasyBetMoreInfoButton").click(function () {
		 jQueryWinRace(getCurrentExtraToggleClass()).slideToggle("slow");;
		 jQueryWinRace("#EasyBetMoreInfoButton").toggleClass("easybet_expander_close");
   });
}

function handleEasyBetTypeClicked(){
	/**
	 * Selection of easybet type. on the left side
	 */
	var bettype_selector = jQueryWinRace("#selection_bettype_radio li");
	bettype_selector.click( function() { 
		var eachBox = jQueryWinRace(".starter_checkbox");
		eachBox.attr('checked', false);
		jQueryWinRace(".choiceBoxWinCheckBox").attr('checked',false);
		hideAndDeselectAllStarterSelections();
		
		var easyBetStarterCard = jQueryWinRace(".starterCard");
		easyBetStarterCard.removeClass();
		easyBetStarterCard.addClass('starter_not_active starterCard');
		
		if(!(jQueryWinRace(this).hasClass("selected"))){
			bettype_selector.removeClass("selected");
			jQueryWinRace(this).addClass("selected");
			var radioButton = jQueryWinRace(this).find("input:radio");
			radioButton.click();
		}
		
		
		
		handleElementChanged(this);
	});	
}

function handleEasyBetStarterCardClicked(){
	/*
	 * starter card is clicked - middle
	 */
	 jQueryWinRace(".starter_overlay_hidden").click( function() {
		
		var easyBetType = jQueryWinRace("#selection_bettype_radio").find("input:radio[name=bettype]:checked");
		var maxSelectionCount = getStarterCardSelectionCountFromBetType(easyBetType);
		var selectedBoxes = jQueryWinRace(".starter_no").next("input:checkbox:checked");
		
		var element = jQueryWinRace(this);
		var startNr = jQueryWinRace(this).attr("startNr");
		var easyBetStarterCard = jQueryWinRace("#easyBetStarterCard_"+startNr);
		var checkBox = jQueryWinRace("#starterCardCheckBox_"+startNr);
		

		if(checkBox.attr('checked') || selectedBoxes.length < maxSelectionCount ){
		
			
			
			if(!checkIfSelectedWinnerExists()){
				jQueryWinRace("#choiceBoxWinCheckBox_"+startNr).attr('checked',true);
				jQueryWinRace("#choiceBoxPlaceCheckBox_"+startNr).attr('checked',false);
			}
			if(!checkBox.attr('checked')){
				jQueryWinRace("#starterCardCheckBox_"+startNr).attr('checked',true);
			}else{
				jQueryWinRace("#starterCardCheckBox_"+startNr).attr('checked',false);
			}
			if(checkBox.attr('checked')){
				easyBetStarterCard.removeClass();
				easyBetStarterCard.addClass('starter_active starterCard');
			}else{
				easyBetStarterCard.removeClass();
				easyBetStarterCard.addClass('starter_not_active starterCard');
			}
			handleElementChanged(this);
		} else if (!checkBox.attr('checked')){
			deSelectAllStarterCheckboxes();
			jQueryWinRace("#starterCardCheckBox_"+startNr).attr('checked',true);
			easyBetStarterCard.removeClass();
			easyBetStarterCard.addClass('starter_active starterCard');
			handleElementChanged(this);
		}
		
		checkValidBetSlip();
		
	 }); 
}

function handleStarterCardCheckboxClicked(){
	/**
	 * deprecated
	 */
	jQueryWinRace(".starter_checkbox").click( function() {
		var element = jQueryWinRace(this);
		var startNr = jQueryWinRace(this).attr("startNr");
		var easyBetStarterCard = jQueryWinRace("#easyBetStarterCard_"+startNr);
		
		
		if(!checkIfSelectedWinnerExists()){
			jQueryWinRace("#choiceBoxWinCheckBox_"+startNr).attr('checked',true);
			jQueryWinRace("#choiceBoxPlaceCheckBox_"+startNr).attr('checked',false);
		}
		if(!element.attr('checked')){
			jQueryWinRace("#choiceBoxWinCheckBox_"+startNr).attr('checked',false);
		}
		if(element.attr('checked')){
			easyBetStarterCard.removeClass();
			easyBetStarterCard.addClass('starter_active starterCard');
		}else{
			easyBetStarterCard.removeClass();
			easyBetStarterCard.addClass('starter_not_active starterCard');
		}
		handleElementChanged(this);
	});
}

function handleRemoveSelectedEasyBetStarterClicked(){
	/**
	 * to remove a selected starter on the right side
	 */
	jQueryWinRace(".removeSelectedStarter").click( function() {
		var startNr = jQueryWinRace(this).attr("startNr");
		var easyBetStarterCard = jQueryWinRace("#easyBetStarterCard_"+startNr);
		var checkBox = easyBetStarterCard.find(".starter_checkbox");
		checkBox.attr('checked', false);
		jQueryWinRace("#choiceBoxWinCheckBox_"+startNr).attr('checked',false);
		if(checkBox.attr('checked')){
			easyBetStarterCard.removeClass();
			easyBetStarterCard.addClass('starter_active starterCard');
		}else{
			easyBetStarterCard.removeClass();
			easyBetStarterCard.addClass('starter_not_active starterCard');
		}
		jQueryWinRace("#choiceBoxWinCheckBox_"+startNr).attr('checked',false);
		jQueryWinRace("#choiceBoxPlaceCheckBox_"+startNr).attr('checked',true);
		handleElementChanged(checkBox);
	});
	
}

function checkIfSelectedWinnerExists(){
	if(getWinSelectionCount() == 1){
		return true;
	}
	
	return false;
}

function getWinSelectionCount(){
	var selectedWinCheckBoxesCount = 0;
	jQueryWinRace(".choiceBoxWinCheckBox").each(function(){
		if(jQueryWinRace(this).attr('checked')){
			selectedWinCheckBoxesCount+=1;
		}
	});
	return selectedWinCheckBoxesCount;
}



function resetPossibleWinAmountField(){
	jQueryWinRace('.winamount').html("0 EUR" );
}

function handleElementChanged(clickedElement){
	var easyBetType = jQueryWinRace("#selection_bettype_radio").find("input:radio[name=bettype]:checked");
	
	var reachedMaximumStarterCardSelection = false;
	var maximumStarterCount = getStarterCardSelectionCountFromBetType(easyBetType);
	
	jQueryWinRace("#selectedEasyBetType").val(easyBetType.val());
	jQueryWinRace("#selectedEasyBetType2").val(easyBetType.val());
	hideAllExtraInformationBoxes();
	clearAllPermutations();
	hideAllChoiceBoxes();
	resetPossibleWinAmountField();
	jQueryWinRace("#EasyBet_Step3_Overlay").show();	
	jQueryWinRace("#percent_selected").html("k.A.");
	jQueryWinRace("#sliderlevel_selected").attr('width','70px');
	
	var sections = jQueryWinRace(".EB_Race_Info_Header").find("div.Sections");
	var two = sections.find(".two");
	var tree = sections.find(".tree");
	two.addClass("two_on");
	tree.removeClass("tree_on");
	
	switch(easyBetType.val()){
		case CONST_WIN: {
			changeEasyBetInfoData("Sieg-Wette","3,00","3,00","1");
			var status = handleEasyBetTypeSelection(clickedElement,maximumStarterCount,easyBetType.val());
			
			if(status){
				reachedMaximumStarterCardSelection = true;
				calcPermutations(easyBetType.val());
				showEasyBetSubmitForm(easyBetType);
				jQueryWinRace("#EasyBet_Step3_Overlay").hide();	
				jQueryWinRace(".EB_AlertBox").show();
				two.removeClass("two_on");
				tree.addClass("tree_on");
				var startNr = jQueryWinRace(clickedElement).attr("startNr");
				jQueryWinRace("#lastSelectedWinStarter").html(startNr);
				calculatePossibleWinAmount();
				updateSelectedWinChanceSlider();
			}else{
				hideEasyBetSubmitForm();
				jQueryWinRace(".combinationDropDownBox").html(0);
			}
			updateFinalOdds(finalOdds1.win,finalOdds2.win,finalOdds3.win,finalOdds4.win);
			
			
			jQueryWinRace("#WinInfo").show();
			setCurrentExtraToggleClass("#WinInfoExtra");
			break;
		}
		case CONST_PLACE: {
			changeEasyBetInfoData("Platz-Wette","5,00","5,00","1");
			var status = handleEasyBetTypeSelection(clickedElement,maximumStarterCount,easyBetType.val());
			
			if(status){
				reachedMaximumStarterCardSelection = true;
				calcPermutations(easyBetType.val());
				showEasyBetSubmitForm(easyBetType);
				jQueryWinRace("#EasyBet_Step3_Overlay").hide();	
				jQueryWinRace(".EB_AlertBox").show();
				two.removeClass("two_on");
				tree.addClass("tree_on");
			}else{
				hideEasyBetSubmitForm();
				jQueryWinRace(".combinationDropDownBox").html(0);
			}
			
			updateFinalOdds(finalOdds1.place,finalOdds2.place,finalOdds3.place,finalOdds4.place);
			
			jQueryWinRace("#PlaceInfo").show();
			setCurrentExtraToggleClass("#PlaceInfoExtra");
			break;
		}
		case CONST_EXACTA: {
			changeEasyBetInfoData("Zweier-Wette","2,00","4,00","2");
			var status = handleEasyBetTypeSelection(clickedElement,maximumStarterCount,easyBetType.val());
			
			if(status){
				reachedMaximumStarterCardSelection = true;
				calcPermutations(easyBetType.val());
				showEasyBetSubmitForm(easyBetType);
				jQueryWinRace("#EasyBet_Step3_Overlay").hide();
				jQueryWinRace(".EB_AlertBox").show();
				two.removeClass("two_on");
				tree.addClass("tree_on");
			}else{
				hideEasyBetSubmitForm();
				jQueryWinRace(".combinationDropDownBox").html(0);
			}
			
			updateFinalOdds(finalOdds1.exacta,finalOdds2.exacta,finalOdds3.exacta,finalOdds4.exacta);
			
			jQueryWinRace("#ExactaInfo").show();
			setCurrentExtraToggleClass("#ExactaInfoExtra");
			break;
		}
		case CONST_TRIFECTA: {
			changeEasyBetInfoData("Dreier-Wette","1,00","6,00","6");
			var status = handleEasyBetTypeSelection(clickedElement,maximumStarterCount,easyBetType.val());
			
			if(status){
				reachedMaximumStarterCardSelection = true;
				calcPermutations(easyBetType.val());
				showEasyBetSubmitForm(easyBetType);
				jQueryWinRace("#EasyBet_Step3_Overlay").hide();
				jQueryWinRace(".EB_AlertBox").show();
				two.removeClass("two_on");
				tree.addClass("tree_on");
			}else{
				hideEasyBetSubmitForm();
				jQueryWinRace(".combinationDropDownBox").html(0);
			}
			
			updateFinalOdds(finalOdds1.trifecta,finalOdds2.trifecta,finalOdds3.trifecta,finalOdds4.trifecta);
			
			
			jQueryWinRace("#TrifektaInfo").show();
			setCurrentExtraToggleClass("#TrifektaInfoExtra");
			break;
		}
		case CONST_TRIFECTA_FLEX: {
			changeEasyBetInfoData("Dreier-Flex","0,50","6,00","12");
			var status = handleEasyBetTypeSelection(clickedElement,maximumStarterCount,easyBetType.val());
			
			if(status){
				if(getWinSelectionCount() == 1){
					reachedMaximumStarterCardSelection = true;
					showEasyBetSubmitForm(easyBetType);
					jQueryWinRace("#EasyBet_Step3_Overlay").hide();
					jQueryWinRace(".EB_AlertBox").show();
					two.removeClass("two_on");
					tree.addClass("tree_on");
				}else{
					hideEasyBetSubmitForm();
					jQueryWinRace(".combinationDropDownBox").html(0);
				}
			}else{
				hideEasyBetSubmitForm();
				jQueryWinRace(".combinationDropDownBox").html(0);
			}
			
			updateFinalOdds(finalOdds1.trifecta,finalOdds2.trifecta,finalOdds3.trifecta,finalOdds4.trifecta);
			
			jQueryWinRace("#TrifektaFlexInfo").show();
			setCurrentExtraToggleClass("#TrifektaFlexInfoExtra");
			showAllChoiceBoxes();
			
			if(status){
				if(getWinSelectionCount() == 1){
					calcPermutations(easyBetType.val());
				}
			}
			
			break;
		}
	}
	
	return reachedMaximumStarterCardSelection;
}

function getStarterCardSelectionCountFromBetType(betType){
	switch(betType.val()){
		case CONST_WIN: {
			return 1;
		}
		case CONST_PLACE: {
			return 1;
		}
		case CONST_EXACTA: {
			return 2;
		}
		case CONST_TRIFECTA: {
			return 3;
		}
		case CONST_TRIFECTA_FLEX: {
			return 5;
		}
	}
}

function getCurrentExtraToggleClass(){
	return currentExtraToggleClass;
}

function setCurrentExtraToggleClass(toggleClass){
	currentExtraToggleClass = toggleClass;
}
 

function hideAllChoiceBoxes(){
	jQueryWinRace(".choiceCheckbox").hide();
}

function showAllChoiceBoxes(){
	jQueryWinRace(".choiceCheckbox").show();
}

function calcPermutations(betType){
	var myPermuteArray = getPermutations(betType);
	
	
	var resultValue = "";
	if(betType == "TRIFECTA_FLEX"){
		jQueryWinRace(myPermuteArray).each(function() {
				
			  while(jQueryWinRace(this).size() >2){
				  this.pop();
			  }
		});
		jQueryWinRace.unique(myPermuteArray);
		var newArray = new Array();
		jQueryWinRace(myPermuteArray).each(function() {
			if(!checkPermuteExistsInArray(this, newArray)){
				newArray.push(this);
			}
		});
		myPermuteArray = newArray;
		jQueryWinRace(".choiceBoxWinCheckBox").each(function() {
			if(jQueryWinRace(this).attr('checked')){
				resultValue+=jQueryWinRace(this).attr('startNr')+",";
			}
		});
	}
	
	
	jQueryWinRace(myPermuteArray).each(function() {
		var permutation = jQueryWinRace(this);
		if(permutation != null && permutation != ''){
			var value= "";
			
			jQueryWinRace(permutation).each(function() {
				if(value != ""){
					value += ",";
				}
				value += this;
			});
			
			var xx = resultValue+value;
			addPermutationToPermutationBox(xx);
			
		}
	});
}

function checkPermuteExistsInArray(elemntToCheck, arrayToCheck){
	var elementExists = false;
	jQueryWinRace(arrayToCheck).each(function() {
		if(arrayMatch(elemntToCheck,this)){
			elementExists =  true;
		}
	});
	return elementExists;
}

function arrayMatch( x, y ) {
	var objectsAreSame = true;
	   for(var propertyName in x) {
	      if(x[propertyName] !== y[propertyName]) {
	         objectsAreSame = false;
	         break;
	      }
	   }
	   return objectsAreSame;

   }

function clearAllPermutations(){
	var permutationBox = jQueryWinRace(".easybet_step3_combi");
	permutationBox.html('');
}

function addPermutationToPermutationBox(permutation){
	var permutationBox = jQueryWinRace(".easybet_step3_combi");
	permutationBox.append('<span>' + permutation + '</span>')
}

jQueryWinRace("#test").submit( function() {
	// Die markierten Elemente selektieren
	var elements = jQueryWinRace("input:checked");
	 
	// Schleife ueber die einzelnen Elemente
	jQueryWinRace.each(elements, function(index, item) { 
		alert(jQueryWinRace(this).attr("name") + ": " + jQueryWinRace(this).val());
	});
});

function updateFinalOdds(finalOddsFirst, finalOddsSecond, finalOddsThird, finalOddsFourth){
	var amount1 = jQueryWinRace("#payoutBoxAmount1");
	var amount2 = jQueryWinRace("#payoutBoxAmount2");
	var amount3 = jQueryWinRace("#payoutBoxAmount3");
	var amount4 = jQueryWinRace("#payoutBoxAmount4");
	if(finalOddsFirst != null && finalOddsFirst != undefined){
		amount1.html(finalOddsFirst.toFixed(2).replace(".",","));
	}
	if(finalOddsSecond != null && finalOddsSecond != undefined){
		amount2.html(finalOddsSecond.toFixed(2).replace(".",","));
	}
	if(finalOddsThird != null && finalOddsThird != undefined){
		amount3.html(finalOddsThird.toFixed(2).replace(".",","));
	}
	if(finalOddsFourth != null && finalOddsFourth != undefined){
		amount4.html(finalOddsFourth.toFixed(2).replace(".",","));
	}
	
}

function getPermutations(betType){
	
	var permuteArray = new Array();
	
	var eachBox = jQueryWinRace(".starterCard").find("input:checkbox[name=starter]:checked");
	
	eachBox.each(function() {
		var current = jQueryWinRace(this);
		var startNr = current.attr('startNr');
		if(betType == "TRIFECTA_FLEX"){
			// one horse is hardcoded on the first place. check if the place
			// checkbox is selected
			var placeCheckBox = jQueryWinRace("#choiceBoxPlaceCheckBox_"+startNr);
			if(placeCheckBox.attr('checked')){
				permuteArray.push(startNr);
			}
		}else{
			permuteArray.push(startNr);
		}
		
	});
	
	return permute(permuteArray);
}

permute = function(v, m){
    for(var p = -1, j, k, f, r, l = v.length, q = 1, i = l + 1; --i; q *= i);
    for(x = [new Array(l), new Array(l), new Array(l), new Array(l)], j = q, k = l + 1, i = -1;
        ++i < l; x[2][i] = i, x[1][i] = x[0][i] = j /= --k);
    for(r = new Array(q); ++p < q;)
        for(r[p] = new Array(l), i = -1; ++i < l; !--x[1][i] && (x[1][i] = x[0][i],
            x[2][i] = (x[2][i] + 1) % l), r[p][i] = m ? x[3][i] : v[x[3][i]])
            for(x[3][i] = x[2][i], f = 0; !f; f = !f)
                for(j = i; j; x[3][--j] == x[2][i] && (x[3][i] = x[2][i] = (x[2][i] + 1) % l, f = 1));
    return r;
};


function hideAllExtraInformationBoxes(){
	jQueryWinRace("#WinInfo").hide();
	jQueryWinRace("#WinInfoExtra").hide();
	 
	jQueryWinRace("#PlaceInfo").hide();
	jQueryWinRace("#PlaceInfoExtra").hide();
	 
	jQueryWinRace("#ExactaInfo").hide();
	jQueryWinRace("#ExactaInfoExtra").hide();
	 
	jQueryWinRace("#TrifektaInfo").hide();
	jQueryWinRace("#TrifektaInfoExtra").hide();
	 	 
	jQueryWinRace("#TrifektaFlexInfo").hide();
	jQueryWinRace("#TrifektaFlexInfoExtra").hide();
	
} 



function changeEasyBetInfoData(betTypText, baseAmount, stakeTotal, combination){
	jQueryWinRace("#choosenBetTypeText").html(betTypText);
	jQueryWinRace(".easybet_step3_currentBettype").html(betTypText);
	
	jQueryWinRace(".baseAmount").html(baseAmount+" EUR");
	jQueryWinRace(".stakeTotal").html(stakeTotal+" EUR");
	jQueryWinRace(".combination").html(combination);
	jQueryWinRace(".combinationDropDownBox").html(combination);
}

function handleEasyBetTypeSelection(clickedElement, count, easyBetType){
	var starterToDisplayCount = count;
	var thisBox = jQueryWinRace(clickedElement).next("input:checkbox");
	var selectedBoxes = jQueryWinRace(".starter_no").next("input:checkbox:checked");
	
	var otherBoxes = jQueryWinRace(".starter_no").next("input:checkbox").not(selectedBoxes);
	if(checkElementIsInArray(thisBox,selectedBoxes )){
		// tooggleSelectBox(thisBox, otherBoxes);
		hideAndDeselectAllStarterSelections();
		showAllStarterSelections();
	}else{
		if(selectedBoxes.length > starterToDisplayCount){
			alert(unescape("Bitte wählen Sie genau " + starterToDisplayCount + " Pferde aus!"));
		}else{
			// tooggleSelectBox(thisBox, otherBoxes);
			hideAndDeselectAllStarterSelections();
			showAllStarterSelections();
		}
		if(selectedBoxes.length >= starterToDisplayCount){
			disableNotSelectedCheckBoxes();
		}else{
			enableNotSelectedCheckBoxes();
		}
	}
	var selectedBoxes = jQueryWinRace(".starter_no").next("input:checkbox:checked");
	var emptyItemsCount = starterToDisplayCount - selectedBoxes.length;
	showEmptySelectedStarterCards(emptyItemsCount);
	
	if(emptyItemsCount == 0){
		return true;
	}else{
		return false;
	}
	
	
}


function showEasyBetSubmitForm(constBetType){
	jQueryWinRace("#easyBetIsOk").show();
	jQueryWinRace("#easyBetIsOk .button_big_arrow_actice input").removeAttr('disabled');
	jQueryWinRace("#easyBetIsNotOk").hide();
}

function hideEasyBetSubmitForm(){
	jQueryWinRace("#easyBetIsOk .button_big_arrow_actice input").attr('disabled', 'true');
	jQueryWinRace("#easyBetIsOk").hide();
	jQueryWinRace("#easyBetIsNotOk").show();
}




function checkElementIsInArray(thisBox,selectedBoxes){
	var isInArray = false;
	selectedBoxes.each(function() { 
			if(thisBox.attr("id") == jQueryWinRace(this).attr("id")){
				isInArray = true;
			}
		});
	return isInArray;
}

function disableNotSelectedCheckBoxes(){
	var selectedBoxes = jQueryWinRace(".starter_no").next("input:checkbox:checked");
	var otherBoxes = jQueryWinRace(".starter_no").next("input:checkbox").not(selectedBoxes);
	otherBoxes.attr('disabled', true);
}

function enableNotSelectedCheckBoxes(){
	var selectedBoxes = jQueryWinRace(".starter_no").next("input:checkbox:checked");
	var otherBoxes = jQueryWinRace(".starter_no").next("input:checkbox").not(selectedBoxes);
	otherBoxes.attr('disabled', false);
}

function tooggleSelectBox(selectBox, otherBoxes){
	
	if(selectBox.attr('disabled') == true && selectBox.attr('checked') == false){
		otherBoxes.attr('disabled', true);
		otherBoxes.attr('checked', false);
		selectBox.attr('disabled', false);
		selectBox.attr('checked', true);
		return;
	}
	if(selectBox.attr('disabled') == false && selectBox.attr('checked') == false){
		otherBoxes.attr('disabled', true);
		otherBoxes.attr('checked', false);
		selectBox.attr('disabled', false);
		selectBox.attr('checked', true);
		return;
	}
	if(selectBox.attr('disabled') == false && selectBox.attr('checked') == true){
		otherBoxes.attr('disabled', false);
		selectBox.attr('checked', false);
		return;
	}
}

/**
 * 
 */
function showAllStarterSelections(){
	var eachBox = jQueryWinRace(".starterCard").find("input:checkbox[name=starter]:checked");
	eachBox.each(function() {
		var current = jQueryWinRace(this);
		var startNr = current.attr('startNr');
		var mappedStarter = jQueryWinRace("#selectedStarter_" +  startNr);
		mappedStarter.show();
		var hiddenFieldStarter = jQueryWinRace("#starterSelectedField_" +  startNr);
		hiddenFieldStarter.val("true")
	});
}

function handleSelectedStarterChoiceBoxClicked(){
	/**
	 * this method is called after the win checkbox in the selected starter is
	 * clicked all other win checkboxes has to be unchecked.
	 * 
	 * used for trifecta flex
	 */
	jQueryWinRace(".choiceBoxWinCheckBox").click( function() {
		var startNr = jQueryWinRace(this).attr("startNr");
		var isChecked = jQueryWinRace(this).attr('checked');
		var placeCheckBox = jQueryWinRace("#choiceBoxPlaceCheckBox_"+startNr);
		jQueryWinRace(".choiceBoxWinCheckBox").attr('checked',false);
		jQueryWinRace(".choiceBoxPlaceCheckBox").attr('checked',true);
		
		
		if(isChecked){
			jQueryWinRace(this).attr('checked',true);
		}else{
			jQueryWinRace(this).attr('checked',false);
		}
		placeCheckBox.attr('checked',false);

		var middleCheckBox = jQueryWinRace("#starter"+startNr);
		handleElementChanged(middleCheckBox);
	});
}

function handleHarryBoyToggle(){
  jQueryWinRace("input.harry_boy").click(function(){
    if (jQueryWinRace(this).hasClass('isHarryBoyChecked')){
      jQueryWinRace(this).removeClass('isHarryBoyChecked');
      jQueryWinRace(this).next("input[type=hidden]").attr('value', false);
      jQueryWinRace(this).css({color:'white'});
    }else{
      jQueryWinRace(this).addClass('isHarryBoyChecked');
      jQueryWinRace(this).next("input[type=hidden]").attr('value', true);
      jQueryWinRace(this).css({color:'#D60000'});
    }
    checkValidBetSlip();
  });
}

function handleVBetDigitClicked(){
	/* set checkbox on click on button */
	var vbet_digit = jQueryWinRace("#vbetslip input.vbet_digit:not(:disabled)");
	vbet_digit.click( function() {
			var current = jQueryWinRace(this);
			var alt = current.attr("alt");
			var nonRunner = current.attr("nonRunner");
			var id = "#" + alt;
			var alt = "[alt=" + alt + "]";
			if(nonRunner == "false"){
				if(jQueryWinRace(id).attr('checked') == true || jQueryWinRace(id).attr('checked') == 'checked'){
					jQueryWinRace(id).removeAttr('checked');
					jQueryWinRace(alt).removeClass("selected");
					jQueryWinRace(alt).addClass("default");
				} else{
					jQueryWinRace(id).attr('checked', 'checked');
					jQueryWinRace(alt).removeClass("default");
					jQueryWinRace(alt).addClass("selected");
				}
				
		        doBet(document.getElementById(jQueryWinRace(this).attr("alt")));
		        checkValidBetSlip();
			}
	});
}

function handleRaceInfoOpenerClicked(){
	/* open box when race is selected */
	jQueryWinRace("#vbetslip a.opener_raceinfo").click( function() {
		var clicked = jQueryWinRace(this);
		// get alt-attr of clicked element
		var alt = jQueryWinRace(this).attr('rel');
		if(jQueryWinRace(this).parents(".flap_box_active").size() > 0) {
			// related box is open already, close it, remove "open" style classes
			var altID = '#'+alt;
			jQueryWinRace(altID).hide();
			jQueryWinRace(".flap_box_active").removeClass("flap_box_active");
		} else {
			// open related box and save object
			openBox(alt,"vbetslip",clicked);
		}
		
		// alert(parent);
		});
}

function handleToggleForFlapBoxOpener(){
	/* ************ Betslip - openAll **************** */
	var betslip_openAll_trigger 	= jQueryWinRace("#openAll");
	var betslip_eachFlapBox 		= jQueryWinRace("#betslip .flap_box_content");
	var betslip_eachFlapBox_parent 	= jQueryWinRace("#betslip .flap_opener_parent");
	
	betslip_openAll_trigger.toggle(function() {
		betslip_eachFlapBox_parent.addClass('flap_box_active');
		betslip_openAll_trigger.css({"background-position":"bottom"});
		betslip_openAll_trigger.attr("title", "alle schließen");
		betslip_eachFlapBox.show();
	}, function() {
		betslip_eachFlapBox_parent.removeClass('flap_box_active');
		betslip_openAll_trigger.css({"background-position":"top"});
		betslip_openAll_trigger.attr("title", "alle öffnen");
		betslip_eachFlapBox.hide();
	});
}

function handleDatePickerFromAndTo(){
	var datepicker_range = jQueryWinRace("#datepicker_from, #datepicker_to");
	if(datepicker_range.length > 0)
		{
		datepicker_range.datepicker({
			firstDay:           1,
			changeMonth:        false,
			changeYear:         true,
			dateFormat: 		'dd.mm.yy',
			dayNames:           ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
			dayNamesShort:      ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
			dayNamesMin:        ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
			maxDate:            '+1y',
			minDate:            '-1y',
			monthNames:         ['Januar','Februar','M\u00E4rz','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'],
			monthNamesShort:    ['Jan','Feb','Mar','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Dez'],
			navigationAsDateFormat: false,
			nextText:			'',
			prevText:			'',	
			buttonText:			'Kalender \u00D6ffnen',
			showOn: 			'button',
			buttonImage: 		configRaceCalendarImage,
			buttonImageOnly: 	true,
			constrainInput: 	true
			
			/*
			 * onSelect: function(selectedDate) { var option = this.id ==
			 * "datepicker_from" ? "minDate" : "maxDate"; var instance =
			 * jQueryWinRace(this).data("datepicker"); var date =
			 * jQueryWinRace.datepicker.parseDate(instance.settings.dateFormat ||
			 * jQueryWinRace.datepicker._defaults.dateFormat, selectedDate,
			 * instance.settings); date.not(this).datepicker("option",
			 * option, date);
			 * 
			 */
			});
		}
}


function handleDatePickerRaceCalender(){
	var datepicker_simple = jQueryWinRace("#datepicker");
	if(datepicker_simple.length > 0)
		{
		datepicker_simple.datepicker({
			altField:           "#getDate",
			altFormat:          'dd.mm.yy',
			firstDay:           1,
			changeMonth:        false,
			changeYear:         true,
			dayNames:           ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
			dayNamesShort:      ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
			dayNamesMin:        ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
			maxDate:            '+1y',
			minDate:            '-1y',
			monthNames:         ['Januar','Februar','M\u00E4rz','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'],
			monthNamesShort:    ['Jan','Feb','Mar','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Dez'],
			navigationAsDateFormat: false,
			nextText: '',
			prevText: ''
			});
		}
}

function handleRaceNavigation(){
	var race_navi_opener = jQueryWinRace('#race_navi_1 .flap_box_opener_rel');
	var race_navi_items = jQueryWinRace('#race_navi_1 .flap_box_content li');

	race_navi_opener.click( function() {
		// get id of clicked element
		var clicked = jQueryWinRace(this).attr('rel');
		// open related box and save object
		openBox(clicked,"race_navi_1");
		});
	
	race_navi_items.click( function() {
		var active = jQueryWinRace(this).attr('id');
		// alert(clicked);
		selectItem(active,"race_navi_1");
		});
}

function handleTooltipLayouting(){
	/* ************ mini tooltip for inputs **************** */
	var inputTooltip_visible;
	var inputTooltip_trigger;
	var toolTipDefId   = "mini_tooltip";
	var toolTipId      = toolTipDefId;
	
	jQueryWinRace("input:text,input:password").focus(function(){	
		inputTooltip_trigger = jQueryWinRace(this);
			// save text of title-tag
		var title = inputTooltip_trigger.attr('title');
		
			// only if title-tag is existing, go on
			// (simple method to exclude single fields of this function)
		if(title != undefined && title != null && title.length > 0)
			{
				// get position of trigger
			var position = inputTooltip_trigger.offset();
	
				// get size of trigger
			var width = inputTooltip_trigger.width();
			var height = inputTooltip_trigger.height();
				// set left-position of tooltip-container
		    var dPos  = parseInt(inputTooltip_trigger.attr('data-toolTipOffsetLeft'));
		    dPos  = (dPos) ? dPos : 0;
			var positionLeft    = position.left+width-10+dPos;
            toolTipId           = inputTooltip_trigger.attr('data-toolTipId');
            if(!toolTipId) toolTipId = toolTipDefId;
// var toolTipId
				// reset content of tooltipp and set title-text as new content
			jQueryWinRace("#"+toolTipId+" p")
				.empty()
				.html(title);
				
				// get new height of tooltip
			var height_tooltip = jQueryWinRace("#"+toolTipId).height();
			
				// set top-position (top-position of trigger + height of trigger
				// - height of tooltip)
			var positionTop = position.top + height - height_tooltip;
			
				// sum up css-values
			var cssObj = {
			'top'		: positionTop,
			'left'		: positionLeft,
			'display'	: 'block'
			}
	
    		// set css-options for tooltip
			jQueryWinRace("#"+toolTipId).css(cssObj);
			
			// for resize-action
			inputTooltip_visible = true;
			
			}
		});	
	
		// on blur set title-tag-content back and tooltip invisible
		jQueryWinRace("input:text,input:password").blur(function(){
			jQueryWinRace("#"+toolTipId).css({"display":"none"});
			inputTooltip_visible = false;
			});

		// on click on tooltip itself, set title-tag-content back and tooltip
		// invisible
		jQueryWinRace("#"+toolTipId).click( function() {
			jQueryWinRace(this).css({"display":"none"});
			inputTooltip_visible = false;
			});
				
		// on resize set new tooltip-position
	jQueryWinRace(window).resize(function() {
 		if(inputTooltip_visible == true)
			{
				// get position of trigger
			var position = inputTooltip_trigger.offset();
	
				// get size of trigger
			var width = inputTooltip_trigger.width();
			var height = inputTooltip_trigger.height();
				// set left-position of tooltip-container
			var positionLeft = position.left + width - 10;
				// get new height of tooltip
			var height_tooltip = jQueryWinRace("#"+toolTipId).height();
			
				// set top-position (top-position of trigger + height of trigger
				// - height of tooltip)
			var positionTop = position.top + height - height_tooltip;
			
				// sum up css-values
			var cssObj = {
			'top'		: positionTop,
			'left'		: positionLeft
			}
			
			jQueryWinRace("#"+toolTipId).css(cssObj);
			
			}
	
		});
	
/* ************ mini hover-tooltip **************** */	
	var smallTooltip_visible;
	var smallTooltip_trigger;
	jQueryWinRace(".tooltip_small").hover(function(){	
		smallTooltip_trigger = jQueryWinRace(this);
			// save text of title-tag
		var title = smallTooltip_trigger.attr('title');
		
			// only if title-tag is existing, go on
			// (simple method to exclude single fields of this function)
		if(title.length > 0)
			{
				// get position of trigger
			var position = smallTooltip_trigger.offset();
	
				// get size of trigger
			var width = smallTooltip_trigger.width();
			var height = smallTooltip_trigger.height();

				// reset content of tooltipp and set title-text as new content
			jQueryWinRace("#tooltip_small p")
				.empty()
				.html(title);
				
				// get (new) size of tooltip
			var width_tooltip = jQueryWinRace("#tooltip_small").width();
			var height_tooltip = jQueryWinRace("#tooltip_small").height();
			
				// set top-position
			var positionTop = position.top + height - 2;
				// set left-position
			var positionLeft = position.left - 10;
			
				// sum up css-values
			var cssObj = {
			'top'		: positionTop,
			'left'		: positionLeft,
			'display'	: 'block'
			}
	
				// set css-options for tooltip
			jQueryWinRace("#tooltip_small").css(cssObj);
			
				// for resize-action
			smallTooltip_visible = true;
			
			}
		});	
	
		// on blur set title-tag-content back and tooltip invisible
		jQueryWinRace(".tooltip_small").mouseout(function(){
			jQueryWinRace("#tooltip_small").css({"display":"none"});
			smallTooltip_visible = false;
			});
		
}

function handleLayerOpener(){
	var layer         = jQueryWinRace("div#layer");
	var layer_trigger = jQueryWinRace(".layer_opener");
	var layer_msg     = false;
	var def_layer_msg = jQueryWinRace("div.layer_msgbox").first();
	var layer_class   = null;
	
	layer_trigger.click( function() {
		// var layer_id = jQueryWinRace(this).attr("id");
		layer_class  = jQueryWinRace(this).attr("rel");
        layer_msg    = jQueryWinRace(this).attr('data-layerId');
        layer_msg = (layer_msg) ? jQueryWinRace("#"+layer_msg) : def_layer_msg;
		layer.show();
		layer_msg.addClass(layer_class);
		layer_msg.show();
		
		var width = layer_msg.width();
		var halfWidth = (width/2)*(-1);
		var height = layer_msg.height();
		var halfHeight = ((height/2)*(-1));
		
		layer_msg.css({"margin-top":halfHeight});
		layer_msg.css({"margin-left":halfWidth});
		});
	
	jQueryWinRace('.layer_closer').click( function() {
		if(fHidePopUpOnClick || jQueryWinRace(this).get(0).nodeName=="SPAN"){
            // layer_msg.removeClass(layer_class);
            // layer_msg.hide();
            layer.hide();
		}
		});
	
}

function updateZIndexOnUlWrapper(){
	if((jQueryWinRace("form:not(.no_transform)").length > 0)){
		jQueryWinRace('form:not(.no_transform)').jqTransform();
		
		// eliminates a stacking-context-bug with jqtransform
		var select_wrapper = jQueryWinRace(".jqTransformSelectWrapper ul");
		var select_wrapper_parent = select_wrapper.parents("div.content_box");
		select_wrapper_parent.find(".bottom_left").css({"z-index":"1"});
	}
}

function handleBigTooltipp(){
	var tooltip_layer 	= jQueryWinRace("div#dynatip");
	var tooltip_trigger = jQueryWinRace(".tooltip_big");
	var tooltip_width   = null;


	// initialize tooltip
    jQueryWinRace(".tooltip_big").each(function(){
        jQueryWinRace(this).tooltip({
            tip:                    (jQueryWinRace(this).attr('data-toolTipSelector')) ? jQueryWinRace(this).attr('data-toolTipSelector') : '#dynatip', // use
																																						// single
																																						// tooltip
																																						// element
																																						// for
																																						// all
																																						// tips
            position:               'top right',        // custom
														// positioning
			offset:					[0, -38-jQueryWinRace(this).width()/2],
            lazy:                   false,
            events: {
                    def:    "click, mouseout",
                    input:  "click, mouseout"
                    }
    
            // add dynamic plugin
            }).dynamic( { 
                // customized configuration on bottom edge
                bottom: { 
                   direction: 'down', // slide downwards
                   bounce: true // bounce back when closed
                }
            });
    });
	
	
	tooltip_trigger.click( function() {										
		tooltip_width  = jQueryWinRace(this).attr("rel");
		tooltip_layer.css({"width":tooltip_width + "px"});;
		});
}




function handleFlapBox(){
	/* simple flap-boxes */
	// get some objects
	var flap_box_content = jQueryWinRace('.flap_box_content');
	var article_list =  jQueryWinRace("div#content_row ul.article_list");
	var message_list =  jQueryWinRace("div#content_row ul.message_list");
	var betslip_info_list =  jQueryWinRace("div#content_row ul.betslip_info_list");
	
	// hide all
    flap_box_content.hide();
	
	// open the first one of article_list and message_list
	if((article_list.length > 0) || (message_list.length > 0))
		{
		jQueryWinRace(".flap_box").each(function () {
			jQueryWinRace('.flap_box').children(":first-child").addClass('flap_box_active');
			jQueryWinRace('.flap_box_active .flap_box_content').show();
			});
		}

	jQueryWinRace('.flap_box_opener').click( function() {
		var clicked = jQueryWinRace(this);
		// if clicked is active one and open ...
		if (clicked.parent().hasClass('flap_box_active'))
			{
			// set clicked inactive
			clicked.siblings('.flap_box_content').hide();
			clicked.parent().removeClass('flap_box_active');
			}
		else
			{
			// set other active ones inactive
			// but not for betslip_info_list
			if (!(clicked.parents().hasClass('betslip_info_list')))
				{
				var siblings = clicked.parent().siblings();
				siblings.removeClass('flap_box_active');
				siblings.children('.flap_box_content').hide();;			
				}
			// ... the clicked one active
			clicked.parent().addClass('flap_box_active');
			clicked.siblings('.flap_box_content').show();
			}
		});
	
	jQueryWinRace('.flap_box_closer').click( function() {
			// for close-buttons included in flap-box-content-box
			jQueryWinRace('.flap_box_active .flap_box_content').hide();
			jQueryWinRace('.flap_box_active').removeClass('flap_box_active');
		});
	
/* flap-boxes with direct relation */
	var flap_box_opener_rel = jQueryWinRace('.flap_box_opener_rel').not('#race_navi_1 .flap_box_opener_rel');
	
	flap_box_opener_rel.click( function() {
		var clicked = jQueryWinRace(this);
		var clicked_parent = clicked.parents(".flap_opener_parent");
		
		// get rel-attribute of clicked element
		var id = clicked.attr("rel");
		// get element where id = rel
		var related = jQueryWinRace('#' + id);

		// is identified element the flap_box itself?
		if(related.hasClass('flap_box_content'))
			{
			if (clicked_parent.hasClass('flap_box_active'))
				{
				clicked_parent.removeClass('flap_box_active');
				related.hide();
				}
			else
				{ 
				if (clicked.parents().hasClass('race_navi'))
					{
					var siblings = clicked.parent().siblings();
					siblings.removeClass('flap_box_active');
					siblings.children('.flap_box_content').hide();;			
					}
				clicked_parent.addClass('flap_box_active');
				related.show();
				}	
			}
		else
			{
			related_content = related.parents(".flap_box_content");
			if(clicked_parent.hasClass('flap_box_active'))
				{
				clicked_parent.removeClass('flap_box_active');
				related_content.hide();
				}
			else
				{ 
				clicked_parent.addClass('flap_box_active');
				related_content.show();
				}	
			}
		});
}

function handleVbetSlipFlapBoxCloserClick(){
	/* closer */
	var vbetslip = jQueryWinRace("#vbetslip");
	jQueryWinRace('.flap_box_closer_rel').click( function() {
		// for close-buttons included in flap-box-content-box
		var clicked_closer = jQueryWinRace(this);
		var clicked_closer_parent = clicked_closer.parents(".flap_box_content");
		clicked_closer_parent.hide();
		if(vbetslip.length > 0)
			{ jQueryWinRace("#vbetslip .flap_box_active").removeClass('flap_box_active'); }
		else
			{ clicked_closer_parent.prev(".flap_box_active").removeClass('flap_box_active'); }
		});
}

function createTabAnimations(){
	 /* section for animation */
    // get objects
    var pane = jQueryWinRace("div#content_row div.panes");
    var pane_img = pane.find("a");
    var _tabs = jQueryWinRace("div#content_row ul.tabs");
    var _tabs_items = jQueryWinRace("div#content_row ul.tabs li");
    if(pane.length > 0)
        {
        // get biggest img-height ...
        var biggestHeight = 0;
        var paneHeight = 0;
    
        pane_img.each(function (index) {
            if(jQueryWinRace(this).height() > biggestHeight) {
            	paneHeight = jQueryWinRace(this).height();
            }
            biggestHeight = paneHeight;
        });
        
        // height is 3 px to much. whyever??
        paneHeight = paneHeight - 3;
        
        // ... and allocate it to img-container (pane)
        pane.height(paneHeight);
        
        // ... and stretch every img in container on biggest height
        pane_img.height(paneHeight);
    
        // add action-classes ('active' for images an 'current' for tabs to
		// first element
        pane.find("a:first").addClass('active');
        _tabs.find("li:first").addClass('current'); 
        
        // visibility-and tab-switcher
        var slideSwitch = function(){
        	
            	// get current action-element (depends on classes)
                var _active = pane.find('a.active');
                var _activeTab = _tabs.find('li.current');
            
                // if there's no current element, get the last
                if ( _active.length == 0 ) _active = jQueryWinRace('.panes a:last');
                if ( _activeTab.length == 0 ) _activeTab = jQueryWinRace('.tabs li:last');
            
                // use this to pull the divs in the order they appear in the
				// markup
                var _next = _active.next().length ? _active.next() : jQueryWinRace('.panes a:first');
                var _nextTab = _activeTab.next().length ? _activeTab.next() : jQueryWinRace('.tabs li:first');
            
                // uncomment below to pull the divs randomly
                // var $sibs = _active.siblings();
                // var rndNum = Math.floor(Math.random() * $sibs.length );
                // var _next = $( $sibs[ rndNum ] );
            
                // set identifier for the last active img to set opacity
                // not necessary for tabs, because there's no opacity switch
                _active.addClass('last-active');
            
                // opacity- and class-switch for images
                _next.css({opacity: 0.0})
                    .addClass('active')
                    .animate({opacity: 1.0}, 800, function() {
                        _active.removeClass('active last-active');
                        return _active;
                    });
                    
                // class-switch for images
                _nextTab.addClass('current');
                _activeTab.delay(800).removeClass('current');
        }   
    
        
    /* section for start/stop-functionality and jquery-tab-init */
        jQueryWinRace(function(){
            // start onload intervall
        	var pane = jQueryWinRace("div#content_row div.panes");
        	if(_tabs_items.length > 1){
        		var aktiv = window.setInterval(slideSwitch, 5000);
        	}
            // onclick on tab-navigation ...
            jQueryWinRace('ul.tabs li').click( function() {
                // ... stop intervall ...
            	var pane = jQueryWinRace("div#content_row div.panes");
            	if(_tabs_items.length > 1){
            		window.clearInterval(aktiv);
            	}
            	
                // set opacity for all images on 1
                pane_img.css({"opacity":"1"});
                
                // and start standard jquery tab-plugin
                _tabs.tabs("div.panes > a", { 
                    // tabs configuration
                    event: 'click', 
                    tabs:   'li',
                    effect: 'default'
                    });
                
                // get clicked element
                var index = _tabs_items.index(this);
                
                // reset images (set all invisible)
                pane_img.css({"display":"none"});
                // reset tabs (remove 'current')
                _tabs.find(".current").removeClass('current');
                // remove class 'active' (not needed any more)
                pane.find(".active").removeClass('active');
                
                // set 'current' for clicked tab
                _tabs_items.eq(index).addClass('current');
                // set clicked image visible
                pane_img.eq(index).css({"display":"inline"});
                });
            });
        }

// tab-navi for viedeolisting
jQueryWinRace("ul.video_listing_tabs").tabs("div.videofield > div");
}

function styleNavigation(){
	/* ************* navigation - simple styles ************* */			
	// get jquery-objects of mainnav
	var mainnav = jQueryWinRace("ul#mainnav");
	var current_subnav = mainnav.find("li#current > div.subnav");
	var current_subnav_item = current_subnav.find("ul li");

    // different images for first an last item of mainnav
		var mainnav_first_img = "url(" + configMainNavItemFirstImage + ")";
		var mainnav_last_img = "url(" + configMainNavItemLastImage + ")";
		
		mainnav.find("> li:first > a > span")
			.css({"background-image":mainnav_first_img})
			.css({"margin-left":"-1px"})
		mainnav.find("> li:last > a")
			.css({"background-image":mainnav_last_img});

    // different images for first an last item of current-subnav */
		var subnav_first_img = "url(" + congifSubNavItemFirstLastImage + ")";
		var subnav_last_img = "url(" + configSubNavItemFirstLast2Image + ")";
		
		current_subnav.find("li:first a span")
			.css({"background-image":subnav_first_img})
			.css({"background-position":"left 0"});
		current_subnav.find("li:last a")
			.css({"background-image":subnav_last_img})
			.css({"background-position":"right -25px"});
    
    // different background and position for hover-subnav of last item from
	// mainnav */
		var subnav_back = "url(" + configDropDownBackRightImage + ")";
		mainnav.find("> li:last > div.subnav")
			.css({"right":"-2px"})
			.css({"left":"auto"})
			.css({"background-image":subnav_back});
		
		// fix the style bug introduced by the above code when the last mainnav item is active
		// comparing .get(0) because jQuery doesn't have a compare/equals function
		if(mainnav.children("li#current").get(0) === mainnav.children("li:last").get(0)) {
			current_subnav.css({"background-image":"none"});
		}
}

function styleSubNavigation(){
	// get current_item-object
	var mainnav = jQueryWinRace("ul#mainnav");
	var mainnav_current_item = mainnav.find("> li#current");
	var current_subnav = mainnav.find("li#current > div.subnav");
	var current_subnav_item = current_subnav.find("ul li");
	if(mainnav_current_item.length > 0)
		{
		// some vars
		var my_subnav_width = 0;
		
		// calculate subnav width
		current_subnav_item.each(function(){
		  subTerms = jQueryWinRace(this).width();
		  my_subnav_width = subTerms + my_subnav_width;
		  // fix broken width calculation for IE7
		   if( (BrowserDetect.browser == 'MSIE'  ||  BrowserDetect.browser == 'Explorer' ) && (BrowserDetect.version == "7" || BrowserDetect.version == "9")) {
			  my_subnav_width = 9 + my_subnav_width;
		   } else if (BrowserDetect.browser == 'Firefox') {
			   my_subnav_width = 2 + my_subnav_width;
		   }
		});
		
		// allocate subnav width
		current_subnav.css({"width":my_subnav_width});
		
		// get mainnav width and position
		var my_mainnav_width = mainnav.width();
		var my_mainnav_position = mainnav.position().left; 
		
		// get current_item-object
		var mainnav_current_item = mainnav.find("> li#current");
		// get current_item position
		var mainnav_current_item_position = mainnav_current_item.position().left; 
		
		// calculate parent related position of current_item
		mainnav_current_item_position = mainnav_current_item_position - my_mainnav_position;
		// calculate subnav-width + subnav-position
		var position_fix = mainnav_current_item_position + my_subnav_width;
		
		// change start-position, if subnav would overflow mainnav on left
		if(position_fix > my_mainnav_width)
			{ 
			current_subnav
				.css({"right":"-2px"})
				.css({"left":"auto"})
				.css({"background-image":"none"});
			} 
		}
}

function styleBetSlip(betslip_tbody, general_board_tbody,general_board_payment){
	
	var general_board_tbody = jQueryWinRace("div#content_row table.general_board > tbody");
	var general_board_prefs = jQueryWinRace("div#content_row form.prefs_general table.general_board");
	var general_board_payment = jQueryWinRace("div#content_row div.payment_overview table.general_board");
	var betslip_tbody = jQueryWinRace("div#content_row table.betslip > tbody");
	
	if(general_board_tbody.length > 0)
	{
	// set different colors for even and odd rows
	// ... but not for betslip-table (has different styles)
	// ... and not for payment-overview (has different styles)
	if(betslip_tbody.length == 0 && general_board_payment.length == 0)
		{
		general_board_tbody.find("> tr:even").css({"background-color":"#f1f1f1"});
		general_board_tbody.find("> tr:odd").css({"background-color":"#d0dee4"});	
		}
	// and as bug fix special allocation for ie7 (not for
	// payment-overview)
	if(general_board_payment.length == 0)
		{
		var general_board_tbody_td = general_board_tbody.find("> tr:first-child > td");
		general_board_tbody_td.css({"background-color":"#f1f1f1"});
		}

	// no border for last row
	// ... but not for prefs_general
	if(general_board_prefs.length == 0)
		{
		general_board_tbody.find("> tr:last > td").css({"border-bottom":"none"});
		}

	// set different background-img (-positions) for first and last to
	// set table-head-shadow
	general_board_tbody.find("> tr:first-child > td:first-child").css({"background-position":"top left"})
	general_board_tbody.find("> tr:first-child > td:last-child").css({"background-position":"top right"});
	}
}

function styleSimpleOverview(){
	var simple_overview_ul = jQueryWinRace("div#content_row ul.simple_overview");
	if(simple_overview_ul.length > 0)
		{
		// set different colors for even and odd items if direct childs
		simple_overview_ul.find("> li:even").css({"background-color":"#f1f1f1"});
		simple_overview_ul.find("> li:odd").css({"background-color":"#d0dee4"});
		
		// border-specials for first and last item if direct childs
		simple_overview_ul.find("> li:first").css({"border-top":"none"});
		simple_overview_ul.find("> li:last").css({"border-bottom":"none"});
		}
}

function styleRaceOverview(){
	var race_overview_ul = jQueryWinRace("div#content_row ul.race_overview");

	if(race_overview_ul.length > 0){
		// set different colors for even and odd items if direct childs
		race_overview_ul.find("> li:even").css({"background-color":"#f1f1f1"});
		race_overview_ul.find("> li:odd").css({"background-color":"#d0dee4"});
		
		// border-specials for first and last item if direct childs
		race_overview_ul.find("> li:first").css({"border-top":"none"});
		race_overview_ul.find("> li:last").css({"border-bottom":"none"});
		
		// remove background-color for active items (they get bg-images by
		// simple css)
		race_overview_ul.find("> li.flap_box_active:even").css({"background-color":"none"});
		race_overview_ul.find("> li.flap_box_active:odd").css({"background-color":"none"});
		
		// race-details
		var race_details_thead = jQueryWinRace("div#content_row ul.race_overview table.race_details > thead");
		var race_details_tbody = jQueryWinRace("div#content_row ul.race_overview table.race_details > tbody");
		
		// set different background-img (-positions) for first and last to
		// set table-head-shadow
		race_details_thead.find("> tr:first-child > th:first-child").css({"background-position":"top left"});
		race_details_thead.find("> tr:first-child > th:last-child").css({"background-position":"top right"});
		
		// set different colors for even and odd rows
		race_details_tbody.find("> tr:even").css({"background-color":"#fff"});
		race_details_tbody.find("> tr:odd").css({"background-color":"#f8f8f8"});
	}
}

function addedEvenClassToEvenElementsInRaceCalender(){
	var race_calendar_ul = jQueryWinRace("div#content_row div.race_calendar ul");
		if(race_calendar_ul.length > 0){ 
			race_calendar_ul.find("> li:even").addClass("even");
		}		
}

function styleFlapBox(){
	var general_board_tbody = jQueryWinRace("div#content_row table.general_board > tbody");
	var general_board_prefs = jQueryWinRace("div#content_row form.prefs_general  table.general_board");
	var general_board_payment = jQueryWinRace("div#content_row div.payment_overview  table.general_board");
	var betslip_tbody = jQueryWinRace("div#content_row table.betslip > tbody");
	
	if(betslip_tbody.length > 0)
	{
	// get table-cells of first row
	var general_board_tbody_td = general_board_tbody.find("> tr:first-child > td");
		
	// set different padding for last cell in each row (contains
	// flap-box-trigger-img)
	betslip_tbody.find("> tr > td:last-child").css({"padding":"0"});
	
	// set different bg-img-positions for first and last cell of row
	// with active flap-box-trigger
	betslip_tbody.find("> tr.flap_box_active > td:first-child").css({"background-position":"top left"});
	betslip_tbody.find("> tr.flap_box_active > td:last-child").css({"background-position":"top right"});
	
	// set different bg-img-positions for first and last cell of row
	// with active flap-box-trigger
	betslip_tbody.find("> tr.flap_box_active > td:first-child").css({"background-position":"top left"});
	betslip_tbody.find("> tr.flap_box_active > td:last-child").css({"background-position":"top right"});
	
	// set different colors for even and odd rows (for flap-box-tables
	// simple odd/even-selector isn's usable)
	// get each row without flap-box
	var no_flap_box_tr = betslip_tbody.find("> tr").not("tr.flap_box_content");
	no_flap_box_tr.children("td").css({"background-color":"#f1f1f1"});
	var i = -1;
		// color for every row is set by normal css - now overwrite
		// every second one with new color
	no_flap_box_tr.each(function () {
		i = i + 2;
		// alert(i);
		no_flap_box_tr.eq(i).children("td").css({"background-color":"#d0dee4"});
		});
	
	var flapbox_content_tbody_betslip = jQueryWinRace("div#content_row #betslip tr.flap_box_content > td > table > tbody");
	var flapbox_content_tbody_vbetslip = jQueryWinRace("div#content_row #vbetslip div.flap_box_content > table > tbody");
	
	// styles for inner table
	flapbox_content_tbody_betslip.find("> tr td").css({"border":"none"});
	flapbox_content_tbody_betslip.find("> tr:even").css({"background-color":"#fff"});
	flapbox_content_tbody_betslip.find("> tr:odd").css({"background-color":"#f8f8f8"});	
	flapbox_content_tbody_betslip.find("> tr:first-child > td").css({"background-color":"#fff"});
	
	// styles for inner table
	var white = true;
	flapbox_content_tbody_vbetslip.find("> tr").each(function(){
	  if (!jQueryWinRace(this).hasClass('standingStartBackGround') && !jQueryWinRace(this).hasClass('flap_opener_parent')){
	    if (white == true){
	      white = false;
	      jQueryWinRace(this).css('background-color', '#ffffff');
	    }else{
	      white = true;
	      jQueryWinRace(this).css('background-color', '#f8f8f8');
	    }
	  }
	});
	
	}	
}

function handleNonRunnerOnBetSlip(){
	var non_starter_ul_l2 = jQueryWinRace("div#content_row table.non_starter ul > li > ul");

		if(non_starter_ul_l2.length > 0)
		{ 
		var non_starter_ul_l2_eachLi = jQueryWinRace("div#content_row table.non_starter ul > li > ul li");
		var max_li = non_starter_ul_l2_eachLi.length;
		// alert(max_li);
		
		non_starter_ul_l2.find("li:even").css({"background-position":"0 -30px"});
		non_starter_ul_l2.find("li:odd").css({"background-position":"0 -60px"});
		non_starter_ul_l2_eachLi.eq(0).css({"background-position":"0 0"});
		non_starter_ul_l2_eachLi.eq(max_li).css({"background-position":"0 -90px"});

		
		}
}

function addAjaxLoaderClickEventForMessageBox(){
    jQueryWinRace("div.layer_msg_help_body").each(function(){
        var layer_content    = jQueryWinRace(this); 
        var src              = layer_content.attr('data-src');
        if(src){
            var d = jQueryWinRace.ajax({
                url: src,
                async: false,
                cache: false,
                success: function(html){
                    jQueryWinRace(layer_content).append(html);
                }
            });
        }
    });
}

// used for tooltipp?
function addAjaxLoaderClickEvent(){
    jQueryWinRace("a.ajaxLoader").click(function(){
        var layer_id    = jQueryWinRace(this).attr('data-layerId');
        var src         = jQueryWinRace(this).attr('href');
        if(layer_id && src){
        	var body       = jQueryWinRace("#"+layer_id);
        	if(body){
                var d = jQueryWinRace.ajax({
                    url: src,
                    async: false,
                    cache: false,
                    success: function(html){
                        jQueryWinRace(body).html(html);
                    }
                });
        	}
        } 
        return false;
    });	
}

function addClickEventToAHrefButton(){
    // globaler Schalter für das Auslösen von ClickEvents auf A
    var fTriggerClick   = true;

    jQueryWinRace("span[class^=button] a, span[class^=button] input").click(function(){
    	// Ausloesen von ClickEvents AUS, sonst wird es doppelt gemacht
         fTriggerClick   = false;
    });

    jQueryWinRace("span[class^=button]").click(function(){
       var d = jQueryWinRace("input,a", this);
       if(d && fTriggerClick){
           fTriggerClick     = false;
//dbg(d);
//console.dir(jQueryWinRace("input,a", this));
           d.trigger('click');
           var href = d.attr('href');
           if(href!= undefined && href!="#"){
               var target   = d.attr('target');
               if(target){
                   window.open(href, target);
               }else{
                   window.location.href = href;
               }
               
           }
       }
       fTriggerClick     = true;
    });
}

function clearValueOnStartUp(){
    // leert "value" beim ersten mal
    jQueryWinRace(".fct_clearFirstValue").focus(function(){
        if(this.valueCounter == undefined) this.valueCounter  = 0;
        this.valueCounter++;
        if(this.valueCounter<2){
        	this.value="";
        }
    });	
}
		

function openBox(boxId,boxElementId,trigger){
	var currentElementId = "#" + boxElementId;
	var currentElement = jQueryWinRace(currentElementId);
	var currentBox = currentElement.find('#' + boxId);
	if(!(trigger))
		{ trigger = currentBox; }
	
	// select current open box and items
	var prevCurrentActive = jQueryWinRace(currentElementId + " .flap_box_active");
	var prevCurrentBox = jQueryWinRace(currentElementId + " .flap_box_content"); // currentElement.children('.flap_box_content');
	var prevCurrentActiveItem= jQueryWinRace(currentElementId + " .active");

	// remove active-class and close each open flap-box
	prevCurrentActive.removeClass("flap_box_active");
	prevCurrentActiveItem.removeClass("active");
	prevCurrentBox.hide();

	// add active-class and open selected flap-box
	trigger.parents(".flap_opener_parent").addClass("flap_box_active");
	currentBox.show();
	};
	
function selectItem(item_id,boxElementId){
	var currentRaceNavi = jQueryWinRace('#' + boxElementId);
	var activeItem = currentRaceNavi.find('#' + item_id);
	var siblings = jQueryWinRace(activeItem).siblings();

	for(var i = 0; i < siblings.length; i++){
		var sibling = siblings[i];
		if (jQueryWinRace(sibling).hasClass('active')){
			jQueryWinRace(sibling).removeClass('active');
			var siblingTitle = jQueryWinRace(sibling).attr('title');
			if (siblingTitle != null && siblingTitle != undefined && siblingTitle.length > 0){
				jQueryWinRace(sibling).find('a').html(siblingTitle);
				jQueryWinRace(sibling).removeAttr('title');
			}
		}
	}
	
	activeItem.addClass('active');
	
	var raceString = jQueryWinRace(activeItem).find('a').html();
	if (raceString != null && raceString != undefined && raceString.length > 23){
		activeItem.attr('title', raceString);
		var shortRaceString = raceString.substr(0, (raceString.length-7));
		if (shortRaceString.length > 22){
			shortRaceString = shortRaceString.substr(0, 22) + '&hellip;';
		}
		jQueryWinRace(activeItem.find('a').html(shortRaceString));
	}
	
	jQueryWinRace("td.standingStartBackGround").css('background-color','#000000');
	
};

		
jQueryWinRace(window).load(function(){

	openBox("country_fr","race_navi_1");
	selectItem("2_2","race_navi_1");
	
//	openBox("leg_1","vbetslip");
//	jQueryWinRace("#vbetslip .flap_opener_parent:first").addClass('flap_box_active');
	
});


jQueryWinRace(document).ready( function() {	
	
	/* removes outline onFocus */																		
	jQueryWinRace(".button_small input").focus( function() {
		jQueryWinRace(this).blur();													  
	});
	
	hideEasyBetSubmitForm();
	updateFinalOdds(finalOdds1.win,finalOdds2.win,finalOdds3.win,finalOdds4.win);
	hideAllExtraInformationInfoBoxes();
	handleEasyBetMoreInfoButtonClicked(); 
/* ************ easybet **************** */
	handleEasyBetTypeClicked();
	handleEasyBetStarterCardClicked();
	handleStarterCardCheckboxClicked();
	handleRemoveSelectedEasyBetStarterClicked();
	handleSelectedStarterChoiceBoxClicked();
/* ************ vBetslip **************** */
	handleHarryBoyToggle();
	handleVBetDigitClicked();
	handleRaceInfoOpenerClicked();
	handleToggleForFlapBoxOpener();
/* ************ Race Navigation **************** */
	handleRaceNavigation();
	handleTooltipLayouting();
/* *********** layer msg ************ */								
	handleLayerOpener();
/* *********** jqTransform ************ */
	updateZIndexOnUlWrapper();
	
/* *********** tooltip ************ */
	handleBigTooltipp();	
/* ************* datepicker ************* */	   
    /* simple calendar */
	handleDatePickerRaceCalender();
	/* calendar with range */
	handleDatePickerFromAndTo();
/* ************* flap-boxes ************* */
	handleFlapBox();
    handleVbetSlipFlapBoxCloserClick();
/* ************* tab-animation ************* */ 
	createTabAnimations();
 /* ##################### jqery css-styles ################################# */
	styleNavigation();
/**
 * ****** navigation - calculation width and dynamic position of
 * current-subnav *******
 */
	styleSubNavigation();
/* *********** account-board-design (msg and bet) ************ */
	// get rows of general-board (main-class for every table, should be
	// complemented with specific class)
	styleBetSlip();	
/* *********** simple overview ************ */
	styleSimpleOverview();
/* *********** race_overview/simple_overview ************ */
	styleRaceOverview();
/* *********** race-calender ************ */			
	addedEvenClassToEvenElementsInRaceCalender();
/* *********** betslip ************ */
	/* some simple css-styles */
	styleFlapBox();
	jQueryWinRace("div.simple_article_teaser:last").css({"margin-right":"0"});	
	jQueryWinRace("div.simple_article_teaser:first").css({"margin-left":"1px"});	
/* *********** nonstarter ************ */
	handleNonRunnerOnBetSlip();
	addAjaxLoaderClickEventForMessageBox();
    addAjaxLoaderClickEvent();
    addClickEventToAHrefButton();
	jQueryWinRace("body").children().last().append(jQueryWinRace("span.putToDocEnd"));
});
/**
 * 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. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @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
 */
jQueryWinRace.cookie = function(name, value, options) {
    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
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(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 = jQueryWinRace.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;
                }
            }
        }
        return cookieValue;
    }
};/******************************************************************************************************

	jQuery.ThreeDots

	Author Jeremy Horn
	Version 1.0.10 (Developed in Aptana Studio 1.5.1)
	Date: 1/25/2010

	Copyright (c) 2010 Jeremy Horn- jeremydhorn(at)gmail(dot)c0m | http://tpgblog.com
	Dual licensed under MIT and GPL.

	For more detailed documentation, including the latest updates and links to more usage and 
	examples, go to:
	
			http://tpgblog.com/ThreeDots/

	KNOWN BUGS
		None

	DESCRIPTION

		Sometimes the text ...
			... is too long ...
			... won't fit within the number of rows you have available.
		
		Sometimes all you need is ... ThreeDots!
		
		ThreeDots is a customizable jQuery plugin for the smart truncation of text.  It shortens 
		provided text to fit specified dimensions and appends the desired ellipsis style
		if/when truncation occurs.  		
		
		For example ---
		
			This:
				There was once a brown fox
				that liked to eat chocolate
				pudding.
			
			When restricted to 2 lines by ThreeDots, can become:
				There was once a brown fox
				that liked to eat ...
				
			Or:
				There was once a brown fox
				that liked to (click for more)

			... and most any other permutation you desire.


	BY DEFAULT
		The three dots ellipsis ("...") is used, as shown in the prior example, and limits
		text to a maximum of 2 lines.  These and many other characteristics are fully customizable,
		and fully itemized and explained below.


	IMPLEMENTATION

		HTML:		<div class='text_here'><span class='ellipsis_text'>TEXT</span></div>
		JS:			jQueryWinRace('.text_here').ThreeDots(); // USE DEFAULTS
					jQueryWinRace('.text_here2').ThreeDots({ { max_rows:3 });
		

	COMPATIBILITY

		Tested in FF3.5, IE7, Chrome
		With jQuery 1.3.x, 1.4

	METHODS

		ThreeDots()
		
		When intialized the ThreeDots plugin creates and assigns the full set of provided text 
		to each container element as a publically accessible attribute, 'threedots'.  Method 
		implementation supports chaining and returns jQuery object.

		Note that to implement, the text that you wish to ellipsize must be wrapped in a span
		assigned either the default class 'ellipsis_text' or other custom class of your 
		preference -- customizable via the options/settings.
		
		If the text becomes truncated to fit within the constrained space defined by the 
		container element that holds the 'ellipsis_text' span then an additional span is
		appended within the container object, and after the 'ellipsis_text' span.
		
		Note, that the span class of 'threedots_ellipsis' can also be customized via the 
		options/settings and have it's own CSS/jQuery styles/actions/etc. applied to it as
		desired.
		
		If any of the specified settings are invalid or the 'ellipsis_text' span is missing
		nothing will happen.

		IMPORTANT:	The horizontal constrains placed upon each row are controled by the 
					container object.  The container object is the object specified in the 
					primary selector.
					
						e.g. jQueryWinRace('container_object').ThreeDots();
					
					So, remember to set container_object's WIDTH.
						
		ThreeDots.update()
			Refreshes the contents of the text within the target object inline with the
			options provided. Note, that the current implementation of options/settings
			are destructive.  This means that whenever OPTIONS are specified they are
			merged with the DEFAULT options and applied to the current object(s), and 
			destroy/override any previously specified options/settings.
			
				example:
					var obj = jQueryWinRace('.text_here').ThreeDots();  // uses DEFAULT: max_rows = 2
					obj.update({max_rows:3});				// update the text with max_rows = 3

	CUSTOMIZATION

		ThreeDots(OPTIONS)
		e.g. jQueryWinRace('.text_here').ThreeDots({ max_rows: 4 });
					
		
		valid_delimiters:	character array of special characters upon which the text string may be broken up;
							defines what characters can be used to express the bounds of a word
							
							all elements in this array must be 1 character in length; any delimiter less than 
							or greater than	1 character will be ignored
														
							
		ellipsis_string: 	defines what to display at the tail end of the text provided if the text becomes 
							truncated to fit within the space defined by the container object
												
							
		max_rows:			specifies the upper limit for the number of rows that the object's text can use
				
		
		text_span_class:	by default ThreeDots will look within the specified object(s) for a span
							of the class 'ellipsis_text'
							
		
		e_span_class:		if an ellipsis_string is displayed at the tail end of the selected object's
							text due to truncation of that text then it will be displayed wrapped within
							a span associated with the class defined by e_span_class and immediately
							following the text_span_class' span
		
		
		whole_word:			when fitting the provided text to the max_rows within the container object
							this boolean setting defines whether or not the 
							
								if true
									THEN	don't truncate any words; ellipsis can ONLY be placed after 
											the last whole word that fits within the provided space, OR
											
								if false
									THEN	maximuze the text within the provided space, allowing the 
											PARTIAL display of words before the ellipsis
		
		
		allow_dangle:		a dangling ellipsis is an ellipsis that typically occurs due to words that
							are longer than a single row of text, resulting, upon text truncation in
							the ellipsis being displayed on a row all by itself
													
							if allow_dangle is set to false, whole_words is overridden ONLY in the 
							circumstances where a dangling ellipsis occurs and the displayed text
							is adjusted to minimize the occurence of such dangling
									
		
		alt_text_e: 		alt_text_e is a shortcut to enabling the user of the product that 
							made use of ThreeDots to see the full text, prior to truncation
							
							if the value is set to true, then the ellipsis span's title property
							is set to the full, original text (pre-truncation)
		
		
		alt_text_t: 		alt_text_t is a shortcut to enabling the user of the product that 
							made use of ThreeDots to see the full text, prior to truncation
							
							if the value is set to true AND the ellipsis is displayed, then the 
							text span's title property is set to the full, original text 
							(pre-truncation) 
	

	MORE

		For latest updates and links to more usage and examples, go to:
			http://tpgblog.com/ThreeDots/
			
	FUTURE NOTE
	
		Do not write any code dependent on the c_settings variable.  If you don't know what this is
		cool -- you don't need to. ;-)  c_settings WILL BE DEPRECATED.
		
		Further optimizations in progress...

******************************************************************************************************/


(function(jQueryWinRace) {

	/**********************************************************************************

		METHOD
			ThreeDots {PUBLIC}

		DESCRIPTION
			ThreeDots method constructor
			
			allows for the customization of ellipsis, delimiters, etc., and smart 
			truncation of provided objects' text
					
				e.g. jQueryWinRace(something).ThreeDots();

	**********************************************************************************/

	jQueryWinRace.fn.ThreeDots = function(options) {
		var return_value = this;

		// check for new & valid options
		if ((typeof options == 'object') || (options == undefined)) {
			jQueryWinRace.fn.ThreeDots.the_selected = this;

			var return_value = jQueryWinRace.fn.ThreeDots.update(options);

		}
		
		return return_value;
	};


	/**********************************************************************************

		METHOD
			ThreeDots.update {PUBLIC}

		DESCRIPTION
			applies the core logic of ThreeDots
			
			allows for the customization of ellipsis, delimiters, etc., and smart 
			truncation of provided objects' text
			
			updates the objects' visible text to fit within its container(s)
		
		TODO
			instead of having all options/settings calls be constructive have 
			settings associated w/ object returned also accessible from HERE 
			[STATIC settings, associated w/ the initial call] 

	**********************************************************************************/

	jQueryWinRace.fn.ThreeDots.update = function(options) {
		// initialize local variables
		var curr_this, last_word = null;
		var lineh, paddingt, paddingb, innerh, temp_height;
		var curr_text_span, lws; /* last word structure */
		var last_text, three_dots_value, last_del;

		// check for new & valid options
		if ((typeof options == 'object') || (options == undefined)) {

			// then update the settings
			// CURRENTLY, settings are not CONSTRUCTIVE, but merged with the DEFAULTS every time
			jQueryWinRace.fn.ThreeDots.c_settings = jQueryWinRace.extend({}, jQueryWinRace.fn.ThreeDots.settings, options);
			var max_rows = jQueryWinRace.fn.ThreeDots.c_settings.max_rows;
			if (max_rows < 1) {
				return jQueryWinRace.fn.ThreeDots.the_selected;
			}

			// make sure at least 1 valid delimiter
			var valid_delimiter_exists = false;
			jQuery.each(jQueryWinRace.fn.ThreeDots.c_settings.valid_delimiters, function(i, curr_del) {
				if (((new String(curr_del)).length == 1)) {
					valid_delimiter_exists = true; 
				}
			});
			if (valid_delimiter_exists == false) {
				return jQueryWinRace.fn.ThreeDots.the_selected;
			}
			
			// process all provided objects
			jQueryWinRace.fn.ThreeDots.the_selected.each(function() {

				// element-specific code here
				curr_this = jQueryWinRace(this);
		
				// obtain the text span
				if (jQueryWinRace(curr_this).children('.'+jQueryWinRace.fn.ThreeDots.c_settings.text_span_class).length == 0) { 
					// if span doesnt exist, then go to next
					return true;
				}
				curr_text_span = jQueryWinRace(curr_this).children('.'+jQueryWinRace.fn.ThreeDots.c_settings.text_span_class).get(0);

				// pre-calc fixed components of num_rows
				var nr_fixed = num_rows(curr_this, true);

				// remember where it all began so that we can see if we ended up exactly where we started
				var init_text_span = jQueryWinRace(curr_text_span).text();

				// preprocessor
				the_bisector(curr_this, curr_text_span, nr_fixed);
				var init_post_b = jQueryWinRace(curr_text_span).text();

				// if the object has been initialized, then user must be calling UPDATE
				// THEREFORE refresh the text area before re-operating
				if ((three_dots_value = jQueryWinRace(curr_this).attr('threedots')) != undefined) {
					jQueryWinRace(curr_text_span).text(three_dots_value);						
					jQueryWinRace(curr_this).children('.'+jQueryWinRace.fn.ThreeDots.c_settings.e_span_class).remove();
				}

				last_text = jQueryWinRace(curr_text_span).text();
				if (last_text.length <= 0) {
					last_text = '';
				}
				jQueryWinRace(curr_this).attr('threedots', init_text_span);

				if (num_rows(curr_this, nr_fixed) > max_rows) {
					// append the ellipsis span & remember the original text
					curr_ellipsis = jQueryWinRace(curr_this).append('<span style="white-space:nowrap" class="'	
														+ jQueryWinRace.fn.ThreeDots.c_settings.e_span_class + '">'
														+ jQueryWinRace.fn.ThreeDots.c_settings.ellipsis_string 
														+ '</span>');
	
					// remove 1 word at a time UNTIL max_rows
					while (num_rows(curr_this, nr_fixed) > max_rows) {
						
						lws = the_last_word(jQueryWinRace(curr_text_span).text());// HERE
						jQueryWinRace(curr_text_span).text(lws.updated_string);
						last_word = lws.word;
						last_del = lws.del;

						if (last_del == null) {
							break;					
						}
					} // while (num_rows(curr_this, nr_fixed) > max_rows)

					// check for super long words
					if (last_word != null) {
						var is_dangling = dangling_ellipsis(curr_this, nr_fixed);

						if ((num_rows(curr_this, nr_fixed) <= max_rows - 1) 
							|| (is_dangling) 
							|| (!jQueryWinRace.fn.ThreeDots.c_settings.whole_word)) {

							last_text = jQueryWinRace(curr_text_span).text();
							if (lws.del != null) {
								jQueryWinRace(curr_text_span).text(last_text + last_del);
							}
									
							if (num_rows(curr_this, nr_fixed) > max_rows) {
								// undo what i just did and stop
								jQueryWinRace(curr_text_span).text(last_text);
							} else {
								// keep going
								jQueryWinRace(curr_text_span).text(jQueryWinRace(curr_text_span).text() + last_word);
								
								// break up the last word IFF (1) word is longer than a line, OR (2) whole_word == false
								if ((num_rows(curr_this, nr_fixed) > max_rows + 1) 
									|| (!jQueryWinRace.fn.ThreeDots.c_settings.whole_word)
									|| (init_post_b == last_word)
									|| is_dangling) {
									// remove 1 char at a time until it all fits
									while ((num_rows(curr_this, nr_fixed) > max_rows)) {
										if (jQueryWinRace(curr_text_span).text().length > 0) {
											jQueryWinRace(curr_text_span).text(
												jQueryWinRace(curr_text_span).text().substr(0, jQueryWinRace(curr_text_span).text().length - 1)
											);
										} else {
											/* 
											 there is no hope for you; you are crazy;
											 either pick a shorter ellipsis_string OR
											 use a wider object --- geeze!
											 */
											break;
										}
									}							
								}
							}
						}
					}
				}	
				
				// if nothing has changed, remove the ellipsis
				if (init_text_span == jQueryWinRace(jQueryWinRace(curr_this).children('.' + jQueryWinRace.fn.ThreeDots.c_settings.text_span_class).get(0)).text()) {
					jQueryWinRace(curr_this).children('.' + jQueryWinRace.fn.ThreeDots.c_settings.e_span_class).remove();
				} else {				
					// only add any title text if the ellipsis is visible
					if ((jQueryWinRace(curr_this).children('.' + jQueryWinRace.fn.ThreeDots.c_settings.e_span_class)).length > 0) {
						if (jQueryWinRace.fn.ThreeDots.c_settings.alt_text_t) {
							jQueryWinRace(curr_this).children('.' + jQueryWinRace.fn.ThreeDots.c_settings.text_span_class).attr('title', init_text_span);
						}
						
						if (jQueryWinRace.fn.ThreeDots.c_settings.alt_text_e) {
							jQueryWinRace(curr_this).children('.' + jQueryWinRace.fn.ThreeDots.c_settings.e_span_class).attr('title', init_text_span);
						}
						
					}
				}
			}); // jQueryWinRace.fn.ThreeDots.the_selected.each(function() 
		}

		return jQueryWinRace.fn.ThreeDots.the_selected;
	};


	/**********************************************************************************

		METHOD
			ThreeDots.settings {PUBLIC}

		DESCRIPTION
			data structure containing the max_rows, ellipsis string, and other
			behavioral settings
			
			can be directly accessed by 'jQueryWinRace.fn.ThreeDots.settings = ...... ;'

	**********************************************************************************/

	jQueryWinRace.fn.ThreeDots.settings = {
		valid_delimiters: 	[' ', ',', '.'],		// what defines the bounds of a word to you?
		ellipsis_string: 	'...',
		max_rows:			2,
		text_span_class:	'ellipsis_text',
		e_span_class:		'threedots_ellipsis',
		whole_word:			true,
		allow_dangle:		false,
		alt_text_e: 		false,					// if true, mouse over of ellipsis displays the full text
		alt_text_t: 		false  					// if true & if ellipsis displayed, mouse over of text displays the full text
	};


	/**********************************************************************************

		METHOD
			dangling_ellipsis {private}

		DESCRIPTION
			determines whether or not the currently calculated ellipsized text
			is displaying a dangling ellipsis (= an ellipsis on a line by itself)
			
			returns true if ellipsis is dangling, otherwise false

	**********************************************************************************/

	function dangling_ellipsis(obj, nr_fixed){
		if (jQueryWinRace.fn.ThreeDots.c_settings.allow_dangle == true) {
			return false; // why do when no doing need be done?
		}

		// initialize variables
		var ellipsis_obj 		= jQueryWinRace(obj).children('.'+jQueryWinRace.fn.ThreeDots.c_settings.e_span_class).get(0);
		var remember_display 	= jQueryWinRace(ellipsis_obj).css('display');
		var num_rows_before 	= num_rows(obj, nr_fixed);

		// temporarily hide ellipsis
		jQueryWinRace(ellipsis_obj).css('display','none');
		var num_rows_after 		= num_rows(obj, nr_fixed);

		// restore ellipsis
		jQueryWinRace(ellipsis_obj).css('display',remember_display);
		
		if (num_rows_before > num_rows_after) {
			return true; 	// ASSUMPTION: 	removing the ellipsis changed the height
							// 				THEREFORE the ellipsis was on a row all by its lonesome
		} else {
			return false;	// nothing dangling here
		}
	}


	/**********************************************************************************

		METHOD
			num_rows {private}

		DESCRIPTION
			returns the number of rows/lines that the current object's text covers if
			cstate is an object
			
			this function can be initially called to pre-calculate values that will 
			stay fixed throughout the truncation process for the current object so
			that the values do not have to be called every time; to do this the
			num_rows function is called with a boolean value within the cstate
			
			when boolean cstate, an object is returned containing padding and line
			height information that is then passed in as the cstate object on
			subsequent calls to the function

	**********************************************************************************/

	function num_rows(obj, cstate){	
		var the_type = typeof cstate;
	
		if (	(the_type == 'object') 
			||	(the_type == undefined)	) {

			// do the math & return
			return jQueryWinRace(obj).height() / cstate.lh;
			
		} else if (the_type == 'boolean') {
			var lineheight	= lineheight_px(jQueryWinRace(obj));

			return {
				lh: lineheight
			};
		} 
	}

	
	/**********************************************************************************

		METHOD
			the_last_word {private}

		DESCRIPTION
			return a data structure containing...
			 
				[word] 				the last word within the specified text	defined 
									by the specified valid_delimiters, 
				[del] 				the delimiter occurring	directly before the 
									word, and 
				[updated_string] 	the updated text minus the last word 
			
			[del] is null if the last word is the first and/or only word in the text 
			string

	**********************************************************************************/

	function the_last_word(str){
		var temp_word_index;
		var v_del = jQueryWinRace.fn.ThreeDots.c_settings.valid_delimiters;
		
		// trim the string
		str = jQuery.trim(str);
		
		// initialize variables
		var lastest_word_idx = -1;
		var lastest_word = null;
		var lastest_del = null;

		// for all given delimiters, determine which delimiter results in the smallest word cut
		jQuery.each(v_del, function(i, curr_del){
			if (((new String(curr_del)).length != 1)
				|| (curr_del == null)) {  // implemented to handle IE NULL condition; if only typeof could say CHAR :(
				return false; // INVALID delimiter; must be 1 character in length
			}

			var tmp_word_index = str.lastIndexOf(curr_del);
			if (tmp_word_index != -1) {
				if (tmp_word_index > lastest_word_idx) {
					lastest_word_idx 	= tmp_word_index;
					lastest_word 		= str.substring(lastest_word_idx+1);
					lastest_del			= curr_del;
				}
			}
		});
		
		// return data structure of word reduced string and the last word
		if (lastest_word_idx > 0) {
			return {
				updated_string:	jQuery.trim(str.substring(0, lastest_word_idx/*-1*/)),
				word: 			lastest_word,
				del: 			lastest_del
			};
		} else { // the lastest word
			return {
				updated_string:	'',
				word: 			jQuery.trim(str),
				del: 			null
			};
		}
	}

			
	/**********************************************************************************

		METHOD
			lineheight_px {private}

		DESCRIPTION
			returns the line height of a row of the provided text (within the text 
			span) in pixels

	**********************************************************************************/

	function lineheight_px(obj) {
		// shhhh... show
		jQueryWinRace(obj).append("<div id='temp_ellipsis_div' style='position:absolute; visibility:hidden'>H</div>");
		// measure
		var temp_height = jQueryWinRace('#temp_ellipsis_div').height();
		// cut
		jQueryWinRace('#temp_ellipsis_div').remove();

		return temp_height;
	}
	
	/**********************************************************************************

		METHOD
			the_bisector (private)

		DESCRIPTION
			updates the target objects current text to shortest overflowing string 
			length (if overflowing is occurring) by adding/removing halves (like
			binary search)

			because...
				taking some bigger steps at the beginning should save us some real 
				time in the end

	**********************************************************************************/
	
	function the_bisector(obj, curr_text_span, nr_fixed){
		var init_text = jQueryWinRace(curr_text_span).text();
		var curr_text = init_text;
		var max_rows = jQueryWinRace.fn.ThreeDots.c_settings.max_rows;
		var front_half, back_half, front_of_back_half, middle, back_middle;
		var start_index;
		
		if (num_rows(obj, nr_fixed) <= max_rows) {
			// do nothing
			return;
		} else {
			// zero in on the solution
			start_index = 0;
			curr_length = curr_text.length;

			curr_middle = Math.floor((curr_length - start_index) / 2);
			front_half = init_text.substring(start_index, start_index+curr_middle);
			back_half = init_text.substring(start_index + curr_middle);
				
			while (curr_middle != 0) {
				jQueryWinRace(curr_text_span).text(front_half);
				
				if (num_rows(obj, nr_fixed) <= (max_rows)) {
					// text = text + front half of back-half
					back_middle 		= Math.floor(back_half.length/2);
					front_of_back_half 	= back_half.substring(0, back_middle);
					
					start_index = front_half.length;
					curr_text 	= front_half+front_of_back_half;
					curr_length = curr_text.length;

					jQueryWinRace(curr_text_span).text(curr_text);
				} else {
					// text = front half (which it already is)
					curr_text = front_half;
					curr_length = curr_text.length;
				}
				
				curr_middle = Math.floor((curr_length - start_index) / 2);
				front_half = init_text.substring(0, start_index+curr_middle);
				back_half = init_text.substring(start_index + curr_middle);
			}
		}
	}
	
})(jQuery);/*	
	Watermark plugin for jQuery
	Version: 3.0.6
	http://jquery-watermark.googlecode.com/

	Copyright (c) 2009-2010 Todd Northrop
	http://www.speednet.biz/
	
	June 21, 2010

	Requires:  jQuery 1.2.3+
	
	Dual licensed under the MIT or GPL Version 2 licenses.
	See mit-license.txt and gpl2-license.txt in the project root for details.
------------------------------------------------------*/

(function (jQueryWinRace) {

var
	// Will speed up references to undefined
	undefined,

	// String constants for data names
	dataFlag = "watermark",
	dataClass = "watermarkClass",
	dataFocus = "watermarkFocus",
	dataFormSubmit = "watermarkSubmit",
	dataMaxLen = "watermarkMaxLength",
	dataPassword = "watermarkPassword",
	dataText = "watermarkText",
	
	// Includes only elements with watermark defined
	selWatermarkDefined = ":data(" + dataFlag + ")",

	// Includes only elements capable of having watermark
	selWatermarkAble = ":text,:password,:search,textarea",
	
	// triggerFns:
	// Array of function names to look for in the global namespace.
	// Any such functions found will be hijacked to trigger a call to
	// hideAll() any time they are called.  The default value is the
	// ASP.NET function that validates the controls on the page
	// prior to a postback.
	// 
	// Am I missing other important trigger function(s) to look for?
	// Please leave me feedback:
	// http://code.google.com/p/jquery-watermark/issues/list
	triggerFns = [
		"Page_ClientValidate"
	],
	
	// Holds a value of true if a watermark was displayed since the last
	// hideAll() was executed. Avoids repeatedly calling hideAll().
	pageDirty = false;

// Extends jQuery with a custom selector - ":data(...)"
// :data(<name>)  Includes elements that have a specific name defined in the jQuery data collection. (Only the existence of the name is checked; the value is ignored.)
// :data(<name>=<value>)  Includes elements that have a specific jQuery data name defined, with a specific value associated with it.
// :data(<name>!=<value>)  Includes elements that have a specific jQuery data name defined, with a value that is not equal to the value specified.
// :data(<name>^=<value>)  Includes elements that have a specific jQuery data name defined, with a value that starts with the value specified.
// :data(<name>$=<value>)  Includes elements that have a specific jQuery data name defined, with a value that ends with the value specified.
// :data(<name>*=<value>)  Includes elements that have a specific jQuery data name defined, with a value that contains the value specified.
jQueryWinRace.extend(jQueryWinRace.expr[":"], {
	"search": function (elem) {
		return "search" === (elem.type || "");
	},
	
	"data": function (element, index, matches, set) {
		var data, parts = /^((?:[^=!^$*]|[!^$*](?!=))+)(?:([!^$*]?=)(.*))?$/.exec(matches[3]);

		if (parts) {
			data = jQueryWinRace(element).data(parts[1]);
			
			if (data !== undefined) {

				if (parts[2]) {
					data = "" + data;
				
					switch (parts[2]) {
						case "=":
							return (data == parts[3]);
						case "!=":
							return (data != parts[3]);
						case "^=":
							return (data.slice(0, parts[3].length) == parts[3]);
						case "$=":
							return (data.slice(-parts[3].length) == parts[3]);
						case "*=":
							return (data.indexOf(parts[3]) !== -1);
					}
				}

				return true;
			}
		}
		
		return false;
	}
});

jQueryWinRace.watermark = {

	// Current version number of the plugin
	version: "3.0.6",
		
	// Default options used when watermarks are instantiated.
	// Can be changed to affect the default behavior for all
	// new or updated watermarks.
	// BREAKING CHANGE:  The jQueryWinRace.watermark.className
	// property that was present prior to version 3.0.2 must
	// be changed to jQueryWinRace.watermark.options.className
	options: {
		
		// Default class name for all watermarks
		className: "watermark",
		
		// If true, plugin will detect and use native browser support for
		// watermarks, if available. (e.g., WebKit's placeholder attribute.)
		useNative: true
	},
	
	// Hide one or more watermarks by specifying any selector type
	// i.e., DOM element, string selector, jQuery matched set, etc.
	hide: function (selector) {
		jQueryWinRace(selector).filter(selWatermarkDefined).each(
			function () {
				jQueryWinRace.watermark._hide(jQueryWinRace(this));
			}
		);
	},
	
	// Internal use only.
	_hide: function ($input, focus) {
		var inputVal = $input.val() || "",
			inputWm = $input.data(dataText) || "",
			maxLen = $input.data(dataMaxLen) || 0,
			className = $input.data(dataClass);
	
		if ((inputWm.length) && (inputVal == inputWm)) {
			$input.val("");
			
			// Password type?
			if ($input.data(dataPassword)) {
				
				if (($input.attr("type") || "") === "text") {
					var $pwd = $input.data(dataPassword) || [], 
						$wrap = $input.parent() || [];
						
					if (($pwd.length) && ($wrap.length)) {
						$wrap[0].removeChild($input[0]); // Can't use jQuery methods, because they destroy data
						$wrap[0].appendChild($pwd[0]);
						$input = $pwd;
					}
				}
			}
			
			if (maxLen) {
				$input.attr("maxLength", maxLen);
				$input.removeData(dataMaxLen);
			}
		
			if (focus) {
				$input.attr("autocomplete", "off");  // Avoid NS_ERROR_XPC_JS_THREW_STRING error in Firefox
				
				window.setTimeout(
					function () {
						$input.select();  // Fix missing cursor in IE
					}
				, 1);
			}
		}
		
		className && $input.removeClass(className);
	},
	
	// Display one or more watermarks by specifying any selector type
	// i.e., DOM element, string selector, jQuery matched set, etc.
	// If conditions are not right for displaying a watermark, ensures that watermark is not shown.
	show: function (selector) {
		jQueryWinRace(selector).filter(selWatermarkDefined).each(
			function () {
				jQueryWinRace.watermark._show(jQueryWinRace(this));
			}
		);
	},
	
	// Internal use only.
	_show: function ($input) {
		var val = $input.val() || "",
			text = $input.data(dataText) || "",
			type = $input.attr("type") || "",
			className = $input.data(dataClass);

		if (((val.length == 0) || (val == text)) && (!$input.data(dataFocus))) {
			pageDirty = true;
		
			// Password type?
			if ($input.data(dataPassword)) {
				
				if (type === "password") {
					var $pwd = $input.data(dataPassword) || [],
						$wrap = $input.parent() || [];
						
					if (($pwd.length) && ($wrap.length)) {
						$wrap[0].removeChild($input[0]); // Can't use jQuery methods, because they destroy data
						$wrap[0].appendChild($pwd[0]);
						$input = $pwd;
						$input.attr("maxLength", text.length);
					}
				}
			}
		
			// Ensure maxLength big enough to hold watermark (input of type="text" or type="search" only)
			if ((type === "text") || (type === "search")) {
				var maxLen = $input.attr("maxLength") || 0;
				
				if ((maxLen > 0) && (text.length > maxLen)) {
					$input.data(dataMaxLen, maxLen);
					$input.attr("maxLength", text.length);
				}
			}
            
			className && $input.addClass(className);
			$input.val(text);
		}
		else {
			jQueryWinRace.watermark._hide($input);
		}
	},
	
	// Hides all watermarks on the current page.
	hideAll: function () {
		if (pageDirty) {
			jQueryWinRace.watermark.hide(selWatermarkAble);
			pageDirty = false;
		}
	},
	
	// Displays all watermarks on the current page.
	showAll: function () {
		jQueryWinRace.watermark.show(selWatermarkAble);
	}
};

jQueryWinRace.fn.watermark = function (text, options) {
	///	<summary>
	///		Set watermark text and class name on all input elements of type="text/password/search" and
	/// 	textareas within the matched set. If className is not specified in options, the default is
	/// 	"watermark". Within the matched set, only input elements with type="text/password/search"
	/// 	and textareas are affected; all other elements are ignored.
	///	</summary>
	///	<returns type="jQuery">
	///		Returns the original jQuery matched set (not just the input and texarea elements).
	/// </returns>
	///	<param name="text" type="String">
	///		Text to display as a watermark when the input or textarea element has an empty value and does not
	/// 	have focus. The first time watermark() is called on an element, if this argument is empty (or not
	/// 	a String type), then the watermark will have the net effect of only changing the class name when
	/// 	the input or textarea element's value is empty and it does not have focus.
	///	</param>
	///	<param name="options" type="Object" optional="true">
	///		Provides the ability to override the default watermark options (jQueryWinRace.watermark.options). For backward
	/// 	compatibility, if a string value is supplied, it is used as the class name that overrides the class
	/// 	name in jQueryWinRace.watermark.options.className. Properties include:
	/// 		className: When the watermark is visible, the element will be styled using this class name.
	/// 		useNative (Boolean or Function): Specifies if native browser support for watermarks will supersede
	/// 			plugin functionality. If useNative is a function, the return value from the function will
	/// 			determine if native support is used. The function is passed one argument -- a jQuery object
	/// 			containing the element being tested as the only element in its matched set -- and the DOM
	/// 			element being tested is the object on which the function is invoked (the value of "this").
	///	</param>
	/// <remarks>
	///		The effect of changing the text and class name on an input element is called a watermark because
	///		typically light gray text is used to provide a hint as to what type of input is required. However,
	///		the appearance of the watermark can be something completely different: simply change the CSS style
	///		pertaining to the supplied class name.
	///		
	///		The first time watermark() is called on an element, the watermark text and class name are initialized,
	///		and the focus and blur events are hooked in order to control the display of the watermark.  Also, as
	/// 	of version 3.0, drag and drop events are hooked to guard against dropped text being appended to the
	/// 	watermark.  If native watermark support is provided by the browser, it is detected and used, unless
	/// 	the useNative option is set to false.
	///		
	///		Subsequently, watermark() can be called again on an element in order to change the watermark text
	///		and/or class name, and it can also be called without any arguments in order to refresh the display.
	///		
	///		For example, after changing the value of the input or textarea element programmatically, watermark()
	/// 	should be called without any arguments to refresh the display, because the change event is only
	/// 	triggered by user actions, not by programmatic changes to an input or textarea element's value.
	/// 	
	/// 	The one exception to programmatic updates is for password input elements:  you are strongly cautioned
	/// 	against changing the value of a password input element programmatically (after the page loads).
	/// 	The reason is that some fairly hairy code is required behind the scenes to make the watermarks bypass
	/// 	IE security and switch back and forth between clear text (for watermarks) and obscured text (for
	/// 	passwords).  It is *possible* to make programmatic changes, but it must be done in a certain way, and
	/// 	overall it is not recommended.
	/// </remarks>
	
	if (!this.length) {
		return this;
	}
	
	var hasClass = false,
		hasText = (typeof(text) === "string");
	
	if (typeof(options) === "object") {
		hasClass = (typeof(options.className) === "string");
		options = jQueryWinRace.extend({}, jQueryWinRace.watermark.options, options);
	}
	else if (typeof(options) === "string") {
		hasClass = true;
		options = jQueryWinRace.extend({}, jQueryWinRace.watermark.options, {className: options});
	}
	else {
		options = jQueryWinRace.watermark.options;
	}
	
	if (typeof(options.useNative) !== "function") {
		options.useNative = options.useNative? function () { return true; } : function () { return false; };
	}
	
	return this.each(
		function () {
			var $input = jQueryWinRace(this);
			
			if (!$input.is(selWatermarkAble)) {
				return;
			}
			
			// Watermark already initialized?
			if ($input.data(dataFlag)) {
			
				// If re-defining text or class, first remove existing watermark, then make changes
				if (hasText || hasClass) {
					jQueryWinRace.watermark._hide($input);
			
					if (hasText) {
						$input.data(dataText, text);
					}
					
					if (hasClass) {
						$input.data(dataClass, options.className);
					}
				}
			}
			else {
			
				// Detect and use native browser support, if enabled in options
				if (options.useNative.call(this, $input)) {
					
					// Placeholder attribute (WebKit)
					// Big thanks to Opera for the wacky test required
					if ((("" + $input.css("-webkit-appearance")).replace("undefined", "") !== "") && (($input.attr("tagName") || "") !== "TEXTAREA")) {
						
						// className is not set because WebKit doesn't appear to have
						// a separate class name property for placeholders (watermarks).
						if (hasText) {
							$input.attr("placeholder", text);
						}
						
						// Only set data flag for non-native watermarks (purposely commented-out)
						// $input.data(dataFlag, 1);
						return;
					}
				}
				
				$input.data(dataText, hasText? text : "");
				$input.data(dataClass, options.className);
				$input.data(dataFlag, 1); // Flag indicates watermark was initialized
				
				// Special processing for password type
				
				if (($input.attr("type") || "") === "password") {
					var $wrap = $input.wrap("<span>").parent(),
						$wm = jQueryWinRace($wrap.html().replace(/type=["']?password["']?/i, 'type="text"'));
					
					$wm.data(dataText, $input.data(dataText));
					$wm.data(dataClass, $input.data(dataClass));
					$wm.data(dataFlag, 1);
					$wm.attr("maxLength", 1000);
					
					$wm.focus(
						function () {
							jQueryWinRace.watermark._hide($wm, true);
						}
					).bind("dragenter",
						function () {
							jQueryWinRace.watermark._hide($wm);
						}
					).bind("dragend",
						function () {
							window.setTimeout(function () { $wm.blur(); }, 1);
						}
					);
					$input.blur(
						function () {
							jQueryWinRace.watermark._show($input);
						}
					).bind("dragleave",
						function () {
							jQueryWinRace.watermark._show($input);
						}
					);
					
					$wm.data(dataPassword, $input);
					$input.data(dataPassword, $wm);
				}
				else {
					
					$input.focus(
						function () {
							$input.data(dataFocus, 1);
							jQueryWinRace.watermark._hide($input, true);
						}
					).blur(
						function () {
							$input.data(dataFocus, 0);
							jQueryWinRace.watermark._show($input);
						}
					).bind("dragenter",
						function () {
							jQueryWinRace.watermark._hide($input);
						}
					).bind("dragleave",
						function () {
							jQueryWinRace.watermark._show($input);
						}
					).bind("dragend",
						function () {
							window.setTimeout(function () { jQueryWinRace.watermark._show($input); }, 1);
						}
					).bind("drop",
						// Firefox makes this lovely function necessary because the dropped text
						// is merged with the watermark before the drop event is called.
						function (evt) {
							var dropText = evt.originalEvent.dataTransfer.getData("Text");
							
							if ($input.val().replace(dropText, "") === $input.data(dataText)) {
								$input.val(dropText);
							}
							
							$input.focus();
						}
					);
				}
				
				// In order to reliably clear all watermarks before form submission,
				// we need to replace the form's submit function with our own
				// function.  Otherwise watermarks won't be cleared when the form
				// is submitted programmatically.
				if (this.form) {
					var form = this.form,
						$form = jQueryWinRace(form);
					
					if (!$form.data(dataFormSubmit)) {
						$form.submit(jQueryWinRace.watermark.hideAll);
						
						// form.submit exists for all browsers except Google Chrome
						// (see "else" below for explanation)
						if (form.submit) {
							$form.data(dataFormSubmit, form.submit);
							
							form.submit = (function (f, $f) {
								return function () {
									var nativeSubmit = $f.data(dataFormSubmit);
									
									jQueryWinRace.watermark.hideAll();
									
									if (nativeSubmit.apply) {
										nativeSubmit.apply(f, Array.prototype.slice.call(arguments));
									}
									else {
										nativeSubmit();
									}
								};
							})(form, $form);
						}
						else {
							$form.data(dataFormSubmit, 1);
							
							// This strangeness is due to the fact that Google Chrome's
							// form.submit function is not visible to JavaScript (identifies
							// as "undefined").  I had to invent a solution here because hours
							// of Googling (ironically) for an answer did not turn up anything
							// useful.  Within my own form.submit function I delete the form's
							// submit function, and then call the non-existent function --
							// which, in the world of Google Chrome, still exists.
							form.submit = (function (f) {
								return function () {
									jQueryWinRace.watermark.hideAll();
									delete f.submit;
									f.submit();
								};
							})(form);
						}
					}
				}
			}
			
			jQueryWinRace.watermark._show($input);
		}
	);
};

// Hijack any functions found in the triggerFns list
if (triggerFns.length) {

	// Wait until DOM is ready before searching
	jQueryWinRace(function () {
		var i, name, fn;
	
		for (i=triggerFns.length-1; i>=0; i--) {
			name = triggerFns[i];
			fn = window[name];
			
			if (typeof(fn) === "function") {
				window[name] = (function (origFn) {
					return function () {
						jQueryWinRace.watermark.hideAll();
						return origFn.apply(null, Array.prototype.slice.call(arguments));
					};
				})(fn);
			}
		}
	});
}

})(jQueryWinRace);

jQueryWinRace(document).ready(function() {
	var partner = jQueryWinRace.cookie('winrPartner');
	
	// RP-online Channelizer
	if(channelized){
		if(partner == 'RPOnline') {
			
			var link = "http://www.rp-online.de/app/pferderennen/";
			
			jQueryWinRace("div.logo").remove();
			jQueryWinRace("div.#navi").css("margin-left","0");
			jQueryWinRace("body").css("padding-top","75px").css("background-position","0 75px");
			
			var header = "<a href=\""+link+"\" target=\"blank\">"; 
			header+="<div class=\"rpOnline\">";
			header+="	<div class=\"center\">";
			header+="		<div class=\"logo\"></div>";
			header+="		<div class=\"text\">";
			header+="			<div class=\"headline\">Pferdewetten</div>";
			header+="			<div class=\"subheadline\">präsentiert von Win Race</div>";
			header+="		</div>";
			header+="		<div class=\"wrLogo\"></div>";
			header+="	</div>";
			header+="</div>";
			header+="</a>";
			
	
			jQueryWinRace("body").prepend(header);
		}
		if(partner == 'WAZ') {
			
			var link = "http://pferdesport.derwesten.de/";
			
			jQueryWinRace("div.logo").remove();
			jQueryWinRace("div.#navi").css("margin-left","0");
			jQueryWinRace("body").css("padding-top","75px").css("background-position","0 75px");
			
			var header = "<a href=\""+link+"\" target=\"blank\">"; 
			header+="<div class=\"wazOnline\">";
			header+="	<div class=\"center\">";
			header+="		<div class=\"logo\"></div>";
			header+="		<div class=\"text\">";
			header+="			<div class=\"headline\">Pferdewetten</div>";
			header+="			<div class=\"subheadline\">präsentiert von</div>";
			header+="		</div>";
			header+="		<div class=\"wrLogo\"></div>";
			header+="	</div>";
			header+="</div>";
			header+="</a>";
			
	
			jQueryWinRace("body").prepend(header);
		}

		if(partner == 'WebDe') {
			
			var link   = "http://www.web.de/";
			var link_2 = "http://pferdewetten.web.de/";
			
			jQueryWinRace("div.logo").remove();
			jQueryWinRace("div.#navi").css("margin-left","0");
			jQueryWinRace("body").css("padding-top","75px").css("background-position","0 75px");
			
			var  header ="<div class=\"webOnline\">";
			header+="	<div class=\"center\">";
			header+="     <a href=\""+link+"\" target=\"blank\">";
			header+="		<div class=\"logo\"></div>";
			header+="	  </a><a href=\""+link_2+"\" target=\"blank\">";
			header+="		<div class=\"text\">";
			header+="			<div class=\"headline\">Pferdewetten</div>";
			header+="			<div class=\"subheadline\">präsentiert von</div>";
			header+="		</div>";
			header+="		<div class=\"wrLogo\"></div>";
			header+="	</a></div>";
			header+="</div>";
			
	
			jQueryWinRace("body").prepend(header);
		}
		
		if(partner == 'BerlinerVerlag') {
			
			var link   = "http://pferdesport.berliner-kurier.com";
			var link_2 = "http://pferdesport.berliner-kurier.com";
			
			jQueryWinRace("div.logo").remove();
			jQueryWinRace("div.#navi").css("margin-left","0");
			jQueryWinRace("body").css("padding-top","75px").css("background-position","0 75px");
			
			var  header ="<div class=\"berlinerVerlag\">";
			header+="	<div class=\"center\">";
			header+="     <a href=\""+link+"\" target=\"blank\">";
			header+="		<div class=\"logo\"></div>";
			header+="	  </a><a href=\""+link_2+"\" target=\"blank\">";
			header+="		<div class=\"text\">";
			header+="			<div class=\"headline\">Pferdewetten</div>";
			header+="			<div class=\"subheadline\">präsentiert von</div>";
			header+="		</div>";
			header+="		<div class=\"wrLogo\"></div>";
			header+="	</a></div>";
			header+="</div>";
			
	
			jQueryWinRace("body").prepend(header);
		}
		
		if(partner == 'Rtl') {
			
			var link   = "http://www.sport.de/cms/pferdesport.html";
			var link_2 = "http://www.sport.de/cms/pferdesport.html";
			
			jQueryWinRace("div.logo").remove();
			jQueryWinRace("div.#navi").css("margin-left","0");
			jQueryWinRace("body").css("padding-top","75px").css("background-position","0 75px");
			
			var header ="<div class=\"center\" style=\"position: relative; margin: 0pt auto; width: 1000px; top: -73px;\">"
			header+="		<a href=\""+link_2+"\" target=\"blank\">";
			header+="			<div class=\"rtl\">";
			header+="				<div class=\"center\">";
			header+="					<div class=\"text\">";
			header+="						<div class=\"headline\">Pferdewetten</div>";
			header+="						<div class=\"subheadline\">präsentiert von</div>";
			header+="					</div>";
			header+="					<div class=\"wrLogo\"></div>";
			header+="				</div>";
			header+="	  		</div>";
			header+="	 	</a>";
			header+="	 </div>";
			
	
			jQueryWinRace("body").prepend(header);
		}
		
		if(partner == 'Sport1') {
			
			var link   = "http://www.sport1.de/de/themen/pferderennen/";
			var link_2 = "http://www.sport1.de/de/themen/pferderennen/";
			
			jQueryWinRace("div.logo").remove();
			jQueryWinRace("div.#navi").css("margin-left","0");
			jQueryWinRace("body").css("padding-top","75px").css("background-position","0 75px");
			
			var  header ="<div class=\"sport1\">";
			header+="		<div class=\"center\">";
			header+="   		<a href=\""+link+"\" target=\"blank\">";
			header+="				<div class=\"logo\"></div>";
			header+="	  		</a><a href=\""+link_2+"\" target=\"blank\">";
			header+="				<div class=\"text\">";
			header+="					<div class=\"headline\">Pferdewetten</div>";
			header+="					<div class=\"subheadline\">präsentiert von</div>";
			header+="				</div>";
			header+="				<div class=\"wrLogo\"></div>";
			header+="			</a></div>";
			header+="	  </div>";
			
	
			jQueryWinRace("body").prepend(header);
		}
		
		if(partner == 'GallopStars') {
			
			var link   = "http://www.gallopstars.de";
			var link_2 = "http://www.gallopstars.de";
			
			jQueryWinRace("div.logo").remove();
			jQueryWinRace("div.#navi").css("margin-left","0");
			jQueryWinRace("body").css("padding-top","75px").css("background-position","0 75px");
			
			var  header ="<div class=\"gallopstars\">";
			header+="		<div class=\"center\">";
			header+="   		<a href=\""+link+"\" target=\"blank\">";
			header+="				<div class=\"logo\"></div>";
			header+="	  		</a><a href=\""+link_2+"\" target=\"blank\">";
			header+="				<div class=\"text\">";
			header+="					<div class=\"headline\">Pferdewetten</div>";
			header+="					<div class=\"subheadline\">präsentiert von</div>";
			header+="				</div>";
			header+="				<div class=\"wrLogo\"></div>";
			header+="			</a></div>";
			header+="	  </div>";
			
	
			jQueryWinRace("body").prepend(header);
		}
	}
});


if(!this.JSON)this.JSON={};
(function(){function k(a){return a<10?"0"+a:a}function n(a){o.lastIndex=0;return o.test(a)?'"'+a.replace(o,function(c){var d=q[c];return typeof d==="string"?d:"\\u"+("0000"+c.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function l(a,c){var d,f,i=g,e,b=c[a];if(b&&typeof b==="object"&&typeof b.toJSON==="function")b=b.toJSON(a);if(typeof j==="function")b=j.call(c,a,b);switch(typeof b){case "string":return n(b);case "number":return isFinite(b)?String(b):"null";case "boolean":case "null":return String(b);
case "object":if(!b)return"null";g+=m;e=[];if(Object.prototype.toString.apply(b)==="[object Array]"){f=b.length;for(a=0;a<f;a+=1)e[a]=l(a,b)||"null";c=e.length===0?"[]":g?"[\n"+g+e.join(",\n"+g)+"\n"+i+"]":"["+e.join(",")+"]";g=i;return c}if(j&&typeof j==="object"){f=j.length;for(a=0;a<f;a+=1){d=j[a];if(typeof d==="string")if(c=l(d,b))e.push(n(d)+(g?": ":":")+c)}}else for(d in b)if(Object.hasOwnProperty.call(b,d))if(c=l(d,b))e.push(n(d)+(g?": ":":")+c);c=e.length===0?"{}":g?"{\n"+g+e.join(",\n"+g)+
"\n"+i+"}":"{"+e.join(",")+"}";g=i;return c}}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+k(this.getUTCMonth()+1)+"-"+k(this.getUTCDate())+"T"+k(this.getUTCHours())+":"+k(this.getUTCMinutes())+":"+k(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()}}var p=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
o=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,g,m,q={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},j;if(typeof JSON.stringify!=="function")JSON.stringify=function(a,c,d){var f;m=g="";if(typeof d==="number")for(f=0;f<d;f+=1)m+=" ";else if(typeof d==="string")m=d;if((j=c)&&typeof c!=="function"&&(typeof c!=="object"||typeof c.length!=="number"))throw new Error("JSON.stringify");return l("",
{"":a})};if(typeof JSON.parse!=="function")JSON.parse=function(a,c){function d(f,i){var e,b,h=f[i];if(h&&typeof h==="object")for(e in h)if(Object.hasOwnProperty.call(h,e)){b=d(h,e);if(b!==undefined)h[e]=b;else delete h[e]}return c.call(f,i,h)}p.lastIndex=0;if(p.test(a))a=a.replace(p,function(f){return"\\u"+("0000"+f.charCodeAt(0).toString(16)).slice(-4)});if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){a=eval("("+a+")");return typeof c==="function"?d({"":a},""):a}throw new SyntaxError("JSON.parse");}})();

jQueryWinRace.fn.serializeObject = function() {
	var o = {};
	var a = this.serializeArray();
	$.each(a, function() {
		if (o[this.name]) {
			if (!o[this.name].push) {
				o[this.name] = [o[this.name]];
			}
			o[this.name].push(this.value || '');
		} else {
			o[this.name] = this.value || '';
		}
	});
	return o;
};

jQueryWinRace.postJSON = function(url, data, callback) {
    return jQueryWinRace.ajax({
        'type': 'POST',
        'url': url,
        'contentType': 'application/json',
        'data': JSON.stringify(data),
        'dataType': 'json',
        'success': callback
    });
};
/* Copyright (c) 2006 Mathias Bank (http://www.mathias-bank.de)
 * 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 Hinnerk Ruemenapf - http://hinnerk.ruemenapf.de/ for bug reporting and fixing.
 */
jQuery.extend({
/**
* Returns get parameters.
*
* If the desired param does not exist, null will be returned
*
* @example value = $.getURLParam("paramName");
*/ 
 getURLParam: function(strParamName){
	  var strReturn = "";
	  var strHref = window.location.href;
	  var bFound=false;
	  
	  var cmpstring = strParamName + "=";
	  var cmplen = cmpstring.length;

	  if ( strHref.indexOf("?") > -1 ){
	    var strQueryString = strHref.substr(strHref.indexOf("?")+1);
	    var aQueryString = strQueryString.split("&");
	    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
	      if (aQueryString[iParam].substr(0,cmplen)==cmpstring){
	        var aParam = aQueryString[iParam].split("=");
	        strReturn = aParam[1];
	        bFound=true;
	        break;
	      }
	      
	    }
	  }
	  if (bFound==false) return null;
	  return strReturn;
	}
});/*!
 * jQuery Form Plugin
 * version: 2.43 (12-MAR-2010)
 * @requires jQuery v1.3.2 or later
 *
 * Examples and documentation at: http://malsup.com/jquery/form/
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
;(function($) {

/*
	Usage Note:
	-----------
	Do not use both ajaxSubmit and ajaxForm on the same form.  These
	functions are intended to be exclusive.  Use ajaxSubmit if you want
	to bind your own submit handler to the form.  For example,

	$(document).ready(function() {
		$('#myForm').bind('submit', function() {
			$(this).ajaxSubmit({
				target: '#output'
			});
			return false; // <-- important!
		});
	});

	Use ajaxForm when you want the plugin to manage all the event binding
	for you.  For example,

	$(document).ready(function() {
		$('#myForm').ajaxForm({
			target: '#output'
		});
	});

	When using ajaxForm, the ajaxSubmit function will be invoked for you
	at the appropriate time.
*/

/**
 * ajaxSubmit() provides a mechanism for immediately submitting
 * an HTML form using AJAX.
 */
$.fn.ajaxSubmit = function(options) {
	// fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
	if (!this.length) {
		log('ajaxSubmit: skipping submit process - no element selected');
		return this;
	}

	if (typeof options == 'function')
		options = { success: options };

	var url = $.trim(this.attr('action'));
	if (url) {
		// clean url (don't include hash vaue)
		url = (url.match(/^([^#]+)/)||[])[1];
   	}
   	url = url || window.location.href || '';

	options = $.extend({
		url:  url,
		type: this.attr('method') || 'GET',
		iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
	}, options || {});

	// hook for manipulating the form data before it is extracted;
	// convenient for use with rich editors like tinyMCE or FCKEditor
	var veto = {};
	this.trigger('form-pre-serialize', [this, options, veto]);
	if (veto.veto) {
		log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
		return this;
	}

	// provide opportunity to alter form data before it is serialized
	if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
		log('ajaxSubmit: submit aborted via beforeSerialize callback');
		return this;
	}

	var a = this.formToArray(options.semantic);
	if (options.data) {
		options.extraData = options.data;
		for (var n in options.data) {
		  if(options.data[n] instanceof Array) {
			for (var k in options.data[n])
			  a.push( { name: n, value: options.data[n][k] } );
		  }
		  else
			 a.push( { name: n, value: options.data[n] } );
		}
	}

	// give pre-submit callback an opportunity to abort the submit
	if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
		log('ajaxSubmit: submit aborted via beforeSubmit callback');
		return this;
	}

	// fire vetoable 'validate' event
	this.trigger('form-submit-validate', [a, this, options, veto]);
	if (veto.veto) {
		log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
		return this;
	}

	var q = $.param(a);

	if (options.type.toUpperCase() == 'GET') {
		options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
		options.data = null;  // data is null for 'get'
	}
	else
		options.data = q; // data is the query string for 'post'

	var $form = this, callbacks = [];
	if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
	if (options.clearForm) callbacks.push(function() { $form.clearForm(); });

	// perform a load on the target only if dataType is not provided
	if (!options.dataType && options.target) {
		var oldSuccess = options.success || function(){};
		callbacks.push(function(data) {
			var fn = options.replaceTarget ? 'replaceWith' : 'html';
			$(options.target)[fn](data).each(oldSuccess, arguments);
		});
	}
	else if (options.success)
		callbacks.push(options.success);

	options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
		for (var i=0, max=callbacks.length; i < max; i++)
			callbacks[i].apply(options, [data, status, xhr || $form, $form]);
	};

	// are there files to upload?
	var files = $('input:file', this).fieldValue();
	var found = false;
	for (var j=0; j < files.length; j++)
		if (files[j])
			found = true;

	var multipart = false;
//	var mp = 'multipart/form-data';
//	multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);

	// options.iframe allows user to force iframe mode
	// 06-NOV-09: now defaulting to iframe mode if file input is detected
   if ((files.length && options.iframe !== false) || options.iframe || found || multipart) {
	   // hack to fix Safari hang (thanks to Tim Molendijk for this)
	   // see:  http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
	   if (options.closeKeepAlive)
		   $.get(options.closeKeepAlive, fileUpload);
	   else
		   fileUpload();
	   }
   else
	   $.ajax(options);

	// fire 'notify' event
	this.trigger('form-submit-notify', [this, options]);
	return this;


	// private function for handling file uploads (hat tip to YAHOO!)
	function fileUpload() {
		var form = $form[0];

		if ($(':input[name=submit]', form).length) {
			alert('Error: Form elements must not be named "submit".');
			return;
		}

		var opts = $.extend({}, $.ajaxSettings, options);
		var s = $.extend(true, {}, $.extend(true, {}, $.ajaxSettings), opts);

		var id = 'jqFormIO' + (new Date().getTime());
		var $io = $('<iframe id="' + id + '" name="' + id + '" src="'+ opts.iframeSrc +'" onload="(jQuery(this).data(\'form-plugin-onload\'))()" />');
		var io = $io[0];

		$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });

		var xhr = { // mock object
			aborted: 0,
			responseText: null,
			responseXML: null,
			status: 0,
			statusText: 'n/a',
			getAllResponseHeaders: function() {},
			getResponseHeader: function() {},
			setRequestHeader: function() {},
			abort: function() {
				this.aborted = 1;
				$io.attr('src', opts.iframeSrc); // abort op in progress
			}
		};

		var g = opts.global;
		// trigger ajax global events so that activity/block indicators work like normal
		if (g && ! $.active++) $.event.trigger("ajaxStart");
		if (g) $.event.trigger("ajaxSend", [xhr, opts]);

		if (s.beforeSend && s.beforeSend(xhr, s) === false) {
			s.global && $.active--;
			return;
		}
		if (xhr.aborted)
			return;

		var cbInvoked = false;
		var timedOut = 0;

		// add submitting element to data if we know it
		var sub = form.clk;
		if (sub) {
			var n = sub.name;
			if (n && !sub.disabled) {
				opts.extraData = opts.extraData || {};
				opts.extraData[n] = sub.value;
				if (sub.type == "image") {
					opts.extraData[n+'.x'] = form.clk_x;
					opts.extraData[n+'.y'] = form.clk_y;
				}
			}
		}

		// take a breath so that pending repaints get some cpu time before the upload starts
		function doSubmit() {
			// make sure form attrs are set
			var t = $form.attr('target'), a = $form.attr('action');

			// update form attrs in IE friendly way
			form.setAttribute('target',id);
			if (form.getAttribute('method') != 'POST')
				form.setAttribute('method', 'POST');
			if (form.getAttribute('action') != opts.url)
				form.setAttribute('action', opts.url);

			// ie borks in some cases when setting encoding
			if (! opts.skipEncodingOverride) {
				$form.attr({
					encoding: 'multipart/form-data',
					enctype:  'multipart/form-data'
				});
			}

			// support timout
			if (opts.timeout)
				setTimeout(function() { timedOut = true; cb(); }, opts.timeout);

			// add "extra" data to form if provided in options
			var extraInputs = [];
			try {
				if (opts.extraData)
					for (var n in opts.extraData)
						extraInputs.push(
							$('<input type="hidden" name="'+n+'" value="'+opts.extraData[n]+'" />')
								.appendTo(form)[0]);

				// add iframe to doc and submit the form
				$io.appendTo('body');
				$io.data('form-plugin-onload', cb);
				form.submit();
			}
			finally {
				// reset attrs and remove "extra" input elements
				form.setAttribute('action',a);
				t ? form.setAttribute('target', t) : $form.removeAttr('target');
				$(extraInputs).remove();
			}
		};

		if (opts.forceSync)
			doSubmit();
		else
			setTimeout(doSubmit, 10); // this lets dom updates render
	
		var domCheckCount = 100;

		function cb() {
			if (cbInvoked) 
				return;

			var ok = true;
			try {
				if (timedOut) throw 'timeout';
				// extract the server response from the iframe
				var data, doc;

				doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
				
				var isXml = opts.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
				log('isXml='+isXml);
				if (!isXml && (doc.body == null || doc.body.innerHTML == '')) {
				 	if (--domCheckCount) {
						// in some browsers (Opera) the iframe DOM is not always traversable when
						// the onload callback fires, so we loop a bit to accommodate
				 		log('requeing onLoad callback, DOM not available');
						setTimeout(cb, 250);
						return;
					}
					log('Could not access iframe DOM after 100 tries.');
					return;
				}

				log('response detected');
				cbInvoked = true;
				xhr.responseText = doc.body ? doc.body.innerHTML : null;
				xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
				xhr.getResponseHeader = function(header){
					var headers = {'content-type': opts.dataType};
					return headers[header];
				};

				if (opts.dataType == 'json' || opts.dataType == 'script') {
					// see if user embedded response in textarea
					var ta = doc.getElementsByTagName('textarea')[0];
					if (ta)
						xhr.responseText = ta.value;
					else {
						// account for browsers injecting pre around json response
						var pre = doc.getElementsByTagName('pre')[0];
						if (pre)
							xhr.responseText = pre.innerHTML;
					}			  
				}
				else if (opts.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
					xhr.responseXML = toXml(xhr.responseText);
				}
				data = $.httpData(xhr, opts.dataType);
			}
			catch(e){
				log('error caught:',e);
				ok = false;
				xhr.error = e;
				$.handleError(opts, xhr, 'error', e);
			}

			// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
			if (ok) {
				opts.success(data, 'success');
				if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);
			}
			if (g) $.event.trigger("ajaxComplete", [xhr, opts]);
			if (g && ! --$.active) $.event.trigger("ajaxStop");
			if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');

			// clean up
			setTimeout(function() {
				$io.removeData('form-plugin-onload');
				$io.remove();
				xhr.responseXML = null;
			}, 100);
		};

		function toXml(s, doc) {
			if (window.ActiveXObject) {
				doc = new ActiveXObject('Microsoft.XMLDOM');
				doc.async = 'false';
				doc.loadXML(s);
			}
			else
				doc = (new DOMParser()).parseFromString(s, 'text/xml');
			return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
		};
	};
};

/**
 * ajaxForm() provides a mechanism for fully automating form submission.
 *
 * The advantages of using this method instead of ajaxSubmit() are:
 *
 * 1: This method will include coordinates for <input type="image" /> elements (if the element
 *	is used to submit the form).
 * 2. This method will include the submit element's name/value data (for the element that was
 *	used to submit the form).
 * 3. This method binds the submit() method to the form for you.
 *
 * The options argument for ajaxForm works exactly as it does for ajaxSubmit.  ajaxForm merely
 * passes the options argument along after properly binding events for submit elements and
 * the form itself.
 */
$.fn.ajaxForm = function(options) {
	return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) {
		e.preventDefault();
		$(this).ajaxSubmit(options);
	}).bind('click.form-plugin', function(e) {
		var target = e.target;
		var $el = $(target);
		if (!($el.is(":submit,input:image"))) {
			// is this a child element of the submit el?  (ex: a span within a button)
			var t = $el.closest(':submit');
			if (t.length == 0)
				return;
			target = t[0];
		}
		var form = this;
		form.clk = target;
		if (target.type == 'image') {
			if (e.offsetX != undefined) {
				form.clk_x = e.offsetX;
				form.clk_y = e.offsetY;
			} else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
				var offset = $el.offset();
				form.clk_x = e.pageX - offset.left;
				form.clk_y = e.pageY - offset.top;
			} else {
				form.clk_x = e.pageX - target.offsetLeft;
				form.clk_y = e.pageY - target.offsetTop;
			}
		}
		// clear form vars
		setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
	});
};

// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
$.fn.ajaxFormUnbind = function() {
	return this.unbind('submit.form-plugin click.form-plugin');
};

/**
 * formToArray() gathers form element data into an array of objects that can
 * be passed to any of the following ajax functions: $.get, $.post, or load.
 * Each object in the array has both a 'name' and 'value' property.  An example of
 * an array for a simple login form might be:
 *
 * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
 *
 * It is this array that is passed to pre-submit callback functions provided to the
 * ajaxSubmit() and ajaxForm() methods.
 */
$.fn.formToArray = function(semantic) {
	var a = [];
	if (this.length == 0) return a;

	var form = this[0];
	var els = semantic ? form.getElementsByTagName('*') : form.elements;
	if (!els) return a;
	for(var i=0, max=els.length; i < max; i++) {
		var el = els[i];
		var n = el.name;
		if (!n) continue;

		if (semantic && form.clk && el.type == "image") {
			// handle image inputs on the fly when semantic == true
			if(!el.disabled && form.clk == el) {
				a.push({name: n, value: $(el).val()});
				a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
			}
			continue;
		}

		var v = $.fieldValue(el, true);
		if (v && v.constructor == Array) {
			for(var j=0, jmax=v.length; j < jmax; j++)
				a.push({name: n, value: v[j]});
		}
		else if (v !== null && typeof v != 'undefined')
			a.push({name: n, value: v});
	}

	if (!semantic && form.clk) {
		// input type=='image' are not found in elements array! handle it here
		var $input = $(form.clk), input = $input[0], n = input.name;
		if (n && !input.disabled && input.type == 'image') {
			a.push({name: n, value: $input.val()});
			a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
		}
	}
	return a;
};

/**
 * Serializes form data into a 'submittable' string. This method will return a string
 * in the format: name1=value1&amp;name2=value2
 */
$.fn.formSerialize = function(semantic) {
	//hand off to jQuery.param for proper encoding
	return $.param(this.formToArray(semantic));
};

/**
 * Serializes all field elements in the jQuery object into a query string.
 * This method will return a string in the format: name1=value1&amp;name2=value2
 */
$.fn.fieldSerialize = function(successful) {
	var a = [];
	this.each(function() {
		var n = this.name;
		if (!n) return;
		var v = $.fieldValue(this, successful);
		if (v && v.constructor == Array) {
			for (var i=0,max=v.length; i < max; i++)
				a.push({name: n, value: v[i]});
		}
		else if (v !== null && typeof v != 'undefined')
			a.push({name: this.name, value: v});
	});
	//hand off to jQuery.param for proper encoding
	return $.param(a);
};

/**
 * Returns the value(s) of the element in the matched set.  For example, consider the following form:
 *
 *  <form><fieldset>
 *	  <input name="A" type="text" />
 *	  <input name="A" type="text" />
 *	  <input name="B" type="checkbox" value="B1" />
 *	  <input name="B" type="checkbox" value="B2"/>
 *	  <input name="C" type="radio" value="C1" />
 *	  <input name="C" type="radio" value="C2" />
 *  </fieldset></form>
 *
 *  var v = $(':text').fieldValue();
 *  // if no values are entered into the text inputs
 *  v == ['','']
 *  // if values entered into the text inputs are 'foo' and 'bar'
 *  v == ['foo','bar']
 *
 *  var v = $(':checkbox').fieldValue();
 *  // if neither checkbox is checked
 *  v === undefined
 *  // if both checkboxes are checked
 *  v == ['B1', 'B2']
 *
 *  var v = $(':radio').fieldValue();
 *  // if neither radio is checked
 *  v === undefined
 *  // if first radio is checked
 *  v == ['C1']
 *
 * The successful argument controls whether or not the field element must be 'successful'
 * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
 * The default value of the successful argument is true.  If this value is false the value(s)
 * for each element is returned.
 *
 * Note: This method *always* returns an array.  If no valid value can be determined the
 *	   array will be empty, otherwise it will contain one or more values.
 */
$.fn.fieldValue = function(successful) {
	for (var val=[], i=0, max=this.length; i < max; i++) {
		var el = this[i];
		var v = $.fieldValue(el, successful);
		if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
			continue;
		v.constructor == Array ? $.merge(val, v) : val.push(v);
	}
	return val;
};

/**
 * Returns the value of the field element.
 */
$.fieldValue = function(el, successful) {
	var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
	if (typeof successful == 'undefined') successful = true;

	if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
		(t == 'checkbox' || t == 'radio') && !el.checked ||
		(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
		tag == 'select' && el.selectedIndex == -1))
			return null;

	if (tag == 'select') {
		var index = el.selectedIndex;
		if (index < 0) return null;
		var a = [], ops = el.options;
		var one = (t == 'select-one');
		var max = (one ? index+1 : ops.length);
		for(var i=(one ? index : 0); i < max; i++) {
			var op = ops[i];
			if (op.selected) {
				var v = op.value;
				if (!v) // extra pain for IE...
					v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
				if (one) return v;
				a.push(v);
			}
		}
		return a;
	}
	return el.value;
};

/**
 * Clears the form data.  Takes the following actions on the form's input fields:
 *  - input text fields will have their 'value' property set to the empty string
 *  - select elements will have their 'selectedIndex' property set to -1
 *  - checkbox and radio inputs will have their 'checked' property set to false
 *  - inputs of type submit, button, reset, and hidden will *not* be effected
 *  - button elements will *not* be effected
 */
$.fn.clearForm = function() {
	return this.each(function() {
		$('input,select,textarea', this).clearFields();
	});
};

/**
 * Clears the selected form elements.
 */
$.fn.clearFields = $.fn.clearInputs = function() {
	return this.each(function() {
		var t = this.type, tag = this.tagName.toLowerCase();
		if (t == 'text' || t == 'password' || tag == 'textarea')
			this.value = '';
		else if (t == 'checkbox' || t == 'radio')
			this.checked = false;
		else if (tag == 'select')
			this.selectedIndex = -1;
	});
};

/**
 * Resets the form data.  Causes all form elements to be reset to their original value.
 */
$.fn.resetForm = function() {
	return this.each(function() {
		// guard against an input with the name of 'reset'
		// note that IE reports the reset function as an 'object'
		if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
			this.reset();
	});
};

/**
 * Enables or disables any matching elements.
 */
$.fn.enable = function(b) {
	if (b == undefined) b = true;
	return this.each(function() {
		this.disabled = !b;
	});
};

/**
 * Checks/unchecks any matching checkboxes or radio buttons and
 * selects/deselects and matching option elements.
 */
$.fn.selected = function(select) {
	if (select == undefined) select = true;
	return this.each(function() {
		var t = this.type;
		if (t == 'checkbox' || t == 'radio')
			this.checked = select;
		else if (this.tagName.toLowerCase() == 'option') {
			var $sel = $(this).parent('select');
			if (select && $sel[0] && $sel[0].type == 'select-one') {
				// deselect all other options
				$sel.find('option').selected(false);
			}
			this.selected = select;
		}
	});
};

// helper fn for console logging
// set $.fn.ajaxSubmit.debug to true to enable debug logging
function log() {
	if ($.fn.ajaxSubmit.debug) {
		var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
		if (window.console && window.console.log)
			window.console.log(msg);
		else if (window.opera && window.opera.postError)
			window.opera.postError(msg);
	}
};

})(jQuery);
/*
 * Metadata - jQuery plugin for parsing metadata from elements
 *
 * Copyright (c) 2006 John Resig, Yehuda Katz, Jï¿½Ã¶rn Zaefferer, Paul McLanahan
 *
 * 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.metadata.js 3640 2007-10-11 18:34:38Z pmclanahan $
 *
 */

/**
 * Sets the type of metadata to use. Metadata is encoded in JSON, and each property
 * in the JSON will become a property of the element itself.
 *
 * There are four supported types of metadata storage:
 *
 *   attr:  Inside an attribute. The name parameter indicates *which* attribute.
 *          
 *   class: Inside the class attribute, wrapped in curly braces: { }
 *   
 *   elem:  Inside a child element (e.g. a script tag). The
 *          name parameter indicates *which* element.
 *   html5: Values are stored in data-* attributes.
 *          
 * The metadata for an element is loaded the first time the element is accessed via jQuery.
 *
 * As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
 * matched by expr, then redefine the metadata type and run another $(expr) for other elements.
 * 
 * @name $.metadata.setType
 *
 * @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
 * @before $.metadata.setType("class")
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 * @desc Reads metadata from the class attribute
 * 
 * @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
 * @before $.metadata.setType("attr", "data")
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 * @desc Reads metadata from a "data" attribute
 * 
 * @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
 * @before $.metadata.setType("elem", "script")
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 * @desc Reads metadata from a nested script element
 * 
 * @example <p id="one" class="some_class" data-item_id="1" data-item_label="Label">This is a p</p>
 * @before $.metadata.setType("html5")
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 * @desc Reads metadata from a series of data-* attributes
 *
 * @param String type The encoding type
 * @param String name The name of the attribute to be used to get metadata (optional)
 * @cat Plugins/Metadata
 * @descr Sets the type of encoding to be used when loading metadata for the first time
 * @type undefined
 * @see metadata()
 */

(function($) {

$.extend({
  metadata : {
    defaults : {
      type: 'class',
      name: 'metadata',
      cre: /({.*})/,
      single: 'metadata'
    },
    setType: function( type, name ){
      this.defaults.type = type;
      this.defaults.name = name;
    },
    get: function( elem, opts ){
      var settings = $.extend({},this.defaults,opts);
      // check for empty string in single property
      if ( !settings.single.length ) settings.single = 'metadata';
      
      var data = $.data(elem, settings.single);
      // returned cached data if it already exists
      if ( data ) return data;
      
      data = "{}";
      
      var getData = function(data) {
        if(typeof data != "string") return data;
        
        if( data.indexOf('{') < 0 ) {
          data = eval("(" + data + ")");
        }
      }
      
      var getObject = function(data) {
        if(typeof data != "string") return data;
        
        data = eval("(" + data + ")");
        return data;
      }
      
      if ( settings.type == "html5" ) {
        var object = {};
        $( elem.attributes ).each(function() {
          var name = this.nodeName;
          if(name.match(/^data-/)) name = name.replace(/^data-/, '');
          else return true;
          object[name] = getObject(this.nodeValue);
        });
      } else {
        if ( settings.type == "class" ) {
          var m = settings.cre.exec( elem.className );
          if ( m )
            data = m[1];
        } else if ( settings.type == "elem" ) {
          if( !elem.getElementsByTagName ) return;
          var e = elem.getElementsByTagName(settings.name);
          if ( e.length )
            data = $.trim(e[0].innerHTML);
        } else if ( elem.getAttribute != undefined ) {
          var attr = elem.getAttribute( settings.name );
          if ( attr )
            data = attr;
        }
        object = getObject(data.indexOf("{") < 0 ? "{" + data + "}" : data);
      }
      
      $.data( elem, settings.single, object );
      return object;
    }
  }
});

/**
 * Returns the metadata object for the first member of the jQuery object.
 *
 * @name metadata
 * @descr Returns element's metadata object
 * @param Object opts An object contianing settings to override the defaults
 * @type jQuery
 * @cat Plugins/Metadata
 */
$.fn.metadata = function( opts ){
  return $.metadata.get( this[0], opts );
};

})(jQuery);/* Extending String prototype begin */

String.prototype.hashCode = function () {
 var h = 0;
 var negative = false;
 for (var i = 0; i < this.length; i++) {
   h = 31 * h + this.charCodeAt(i);
   while (h > 2147483647) {
     h = h - 2147483648;
     negative = !negative;
   }
 }
 if (negative) {
   h = h - 2147483648;
 }
 return h + "";
}

String.prototype.trim = function(){
  return (this.replace(/^[\s\xA0]+/, "").replace(/[\s\xA0]+$/, ""));
}

String.prototype.startsWith = function(str){
  return (this.match("^"+str)==str);
}

String.prototype.endsWith = function(str){
  return (this.match(str+"$")==str);
}

String.prototype.replaceAll = function(pattern, replacement) {
  return this.split(pattern).join(replacement);
}

String.prototype.ensureLength = function(length) {
  var result = this;
  if (result.length > length){
    result = result.substring(0, length-1);
  }
  return result;
}

/* Extending String prototype end */

function showGreyToolTip(greyTooltipHtml, parentElement, tailLeft){
  hideGreyToolTip();
  var leftCorrection = 0;
  if (parseInt(tailLeft) >= 0) {
    leftCorrection = parseInt(tailLeft);
  }
  jQueryWinRace('div#greyTooltip table tr td#greyToolTipTailLeft').css('width', (1 + leftCorrection) + 'px');
  jQueryWinRace('div#greyTooltip').css('left', jQueryWinRace(parentElement).offset().left + (jQueryWinRace(parentElement).width() / 2) - leftCorrection - 25);
  jQueryWinRace('div#greyTooltip').css('top', jQueryWinRace(parentElement).offset().top + jQueryWinRace(parentElement).height() - 5);
  jQueryWinRace('div#greyTooltip div#greyTooltipContent').html(greyTooltipHtml);
  jQueryWinRace('div#greyTooltip').css('display', 'block');
  var tooltipBottomPosition = jQueryWinRace('div#greyTooltip').offset().top + jQueryWinRace('div#greyTooltip').height() - jQueryWinRace(window).scrollTop() + 10;
  if ((jQueryWinRace(window).height() < tooltipBottomPosition) && (parseFloat(jQueryWinRace(parentElement).offset().top - jQueryWinRace('div#greyTooltip').height() + 5) > 0)){
    hideGreyToolTip();
    showGreyToolTipUpsideDown(greyTooltipHtml, parentElement, tailLeft);
  }else{
    jQueryWinRace(document).bind('mousemove.greyTooltip', function(e){
      var tL = jQueryWinRace('div#greyTooltip').offset().left;
      var tR = tL + jQueryWinRace('div#greyTooltip').width();
      var tT = jQueryWinRace('div#greyTooltip').offset().top;
      var tB = tT + jQueryWinRace('div#greyTooltip').height();
      var pL = jQueryWinRace(parentElement).offset().left;
      var pR = pL + jQueryWinRace(parentElement).width();
      var pT = jQueryWinRace(parentElement).offset().top;
      var pB = pT + jQueryWinRace(parentElement).height();
      if (e.pageX < pL || e.pageX > pR || e.pageY < pT || e.pageY > pB){
        if (e.pageX < tL || e.pageX > tR || e.pageY < tT || e.pageY > tB){
          hideGreyToolTip();
        }
      }
    });
  }
}

function hideGreyToolTip(){
  jQueryWinRace(document).unbind('mousemove.greyTooltip');
  jQueryWinRace(document).unbind('mousemove.greyTooltipUpsideDown');
  jQueryWinRace('div#greyTooltip').css('display', 'none');
  jQueryWinRace('div#greyTooltipUpsideDown').css('display', 'none');
}

function showGreyToolTipUpsideDown(greyTooltipHtml, parentElement, tailLeft){
  var leftCorrection = 0;
  if (parseInt(tailLeft) >= 0) {
    leftCorrection = parseInt(tailLeft);
  }
  jQueryWinRace('div#greyTooltipUpsideDown table tr td#greyToolTipTailLeftUpsideDown').css('width', (1 + leftCorrection) + 'px');
  jQueryWinRace('div#greyTooltipUpsideDown').css('left', jQueryWinRace(parentElement).offset().left + (jQueryWinRace(parentElement).width() / 2) - leftCorrection - 25);
  jQueryWinRace('div#greyTooltipUpsideDown div#greyTooltipContentUpsideDown').html(greyTooltipHtml);
  jQueryWinRace('div#greyTooltipUpsideDown').css('display', 'block');
  jQueryWinRace('div#greyTooltipUpsideDown').css('top', jQueryWinRace(parentElement).offset().top - jQueryWinRace('div#greyTooltipUpsideDown').height() + 5);
  jQueryWinRace(document).bind('mousemove.greyTooltipUpsideDown', function(e){
    var tL = jQueryWinRace('div#greyTooltipUpsideDown').offset().left;
    var tR = tL + jQueryWinRace('div#greyTooltipUpsideDown').width();
    var tT = jQueryWinRace('div#greyTooltipUpsideDown').offset().top;
    var tB = tT + jQueryWinRace('div#greyTooltipUpsideDown').height();
    var pL = jQueryWinRace(parentElement).offset().left;
    var pR = pL + jQueryWinRace(parentElement).width();
    var pT = jQueryWinRace(parentElement).offset().top;
    var pB = pT + jQueryWinRace(parentElement).height();
    if (e.pageX < pL || e.pageX > pR || e.pageY < pT || e.pageY > pB){
      if (e.pageX < tL || e.pageX > tR || e.pageY < tT || e.pageY > tB){
        hideGreyToolTip();
      }
    }
  });
}

function showBlackToolTip(blackTooltipHtml, parentElement, tailLeft){
  hideBlackToolTip();
  var leftCorrection = 0;
  if (parseInt(tailLeft) >= 0) {
    leftCorrection = parseInt(tailLeft);
  }
  jQueryWinRace('div#blackTooltip table tr td#blackToolTipTailLeft').css('width', (1 + leftCorrection) + 'px');
  jQueryWinRace('div#blackTooltip').css('left', jQueryWinRace(parentElement).offset().left + (jQueryWinRace(parentElement).width() / 2) - leftCorrection - 25);
  jQueryWinRace('div#blackTooltip').css('top', jQueryWinRace(parentElement).offset().top + jQueryWinRace(parentElement).height() - 5);
  jQueryWinRace('div#blackTooltip div#blackTooltipContent').html(blackTooltipHtml);
  jQueryWinRace('div#blackTooltip').css('display', 'block');
  var tooltipBottomPosition = jQueryWinRace('div#blackTooltip').offset().top + jQueryWinRace('div#blackTooltip').height() - jQueryWinRace(window).scrollTop() + 10;
  if ((jQueryWinRace(window).height() < tooltipBottomPosition) && (parseFloat(jQueryWinRace(parentElement).offset().top - jQueryWinRace('div#blackTooltip').height() + 5) > 0)){
    hideBlackToolTip();
    showBlackToolTipUpsideDown(blackTooltipHtml, parentElement, tailLeft);
  }else{
    jQueryWinRace(document).bind('mousemove.blackTooltip', function(e){
      var tL = jQueryWinRace('div#blackTooltip').offset().left;
      var tR = tL + jQueryWinRace('div#blackTooltip').width();
      var tT = jQueryWinRace('div#blackTooltip').offset().top;
      var tB = tT + jQueryWinRace('div#blackTooltip').height();
      var pL = jQueryWinRace(parentElement).offset().left;
      var pR = pL + jQueryWinRace(parentElement).width();
      var pT = jQueryWinRace(parentElement).offset().top;
      var pB = pT + jQueryWinRace(parentElement).height();
      if (e.pageX < pL || e.pageX > pR || e.pageY < pT || e.pageY > pB){
        if (e.pageX < tL || e.pageX > tR || e.pageY < tT || e.pageY > tB){
          hideBlackToolTip();
        }
      }
    });
  }
}

function hideBlackToolTip(){
  jQueryWinRace(document).unbind('mousemove.blackTooltip');
  jQueryWinRace(document).unbind('mousemove.blackTooltipUpsideDown');
  jQueryWinRace('div#blackTooltip').css('display', 'none');
  jQueryWinRace('div#blackTooltipUpsideDown').css('display', 'none');
}

function showBlackToolTipUpsideDown(blackTooltipHtml, parentElement, tailLeft){
  var leftCorrection = 0;
  if (parseInt(tailLeft) >= 0) {
    leftCorrection = parseInt(tailLeft);
  }
  jQueryWinRace('div#blackTooltipUpsideDown table tr td#blackToolTipTailLeftUpsideDown').css('width', (1 + leftCorrection) + 'px');
  jQueryWinRace('div#blackTooltipUpsideDown').css('left', jQueryWinRace(parentElement).offset().left + (jQueryWinRace(parentElement).width() / 2) - leftCorrection - 25);
  jQueryWinRace('div#blackTooltipUpsideDown div#blackTooltipContentUpsideDown').html(blackTooltipHtml);
  jQueryWinRace('div#blackTooltipUpsideDown').css('display', 'block');
  jQueryWinRace('div#blackTooltipUpsideDown').css('top', jQueryWinRace(parentElement).offset().top - jQueryWinRace('div#blackTooltipUpsideDown').height() + 5);
  jQueryWinRace(document).bind('mousemove.blackTooltipUpsideDown', function(e){
    var tL = jQueryWinRace('div#blackTooltipUpsideDown').offset().left;
    var tR = tL + jQueryWinRace('div#blackTooltipUpsideDown').width();
    var tT = jQueryWinRace('div#blackTooltipUpsideDown').offset().top;
    var tB = tT + jQueryWinRace('div#blackTooltipUpsideDown').height();
    var pL = jQueryWinRace(parentElement).offset().left;
    var pR = pL + jQueryWinRace(parentElement).width();
    var pT = jQueryWinRace(parentElement).offset().top;
    var pB = pT + jQueryWinRace(parentElement).height();
    if (e.pageX < pL || e.pageX > pR || e.pageY < pT || e.pageY > pB){
      if (e.pageX < tL || e.pageX > tR || e.pageY < tT || e.pageY > tB){
        hideBlackToolTip();
      }
    }
  });
}

function addLayerContentBoxIfNotExists(){
	var layerHtml = "<div class=\"layer_msgbox\" id=\"layer_content_msgbox\"  style=\"display: none;\">";
	layerHtml += "<div class=\"layer_msg_top\">";
		layerHtml += "<div class=\"layer_msg_top_left\"></div>"
	layerHtml += "</div>";
	layerHtml += "<div class=\"layer_msg_left\">";
		layerHtml += "<div class=\"layer_msg\">";
			layerHtml += "<span class=\"button_small button_small_cross layer_closer\" style=\"display:none; min-width:0px;\"><input value=\"Schlie&szlig;en\" type=\"button\"></span>";
			layerHtml += "<div id=\"layercontent_content\">";
			layerHtml += "</div>";
		layerHtml += "</div>";
	layerHtml += "</div>";
	layerHtml += "<div class=\"layer_msg_bottom\">";
	layerHtml += "<div class=\"layer_msg_bottom_left\"></div>";
	layerHtml += "</div>";
	layerHtml += "</div>";
	
	var stuff = "<div id='content_stuff'>";
	stuff += layerHtml;
	stuff += '</div>';
	
	// add html for layer	
	if (jQueryWinRace("#content_stuff").length==0) {
		jQueryWinRace("body").append(stuff);
		//jQueryWinRace("body").append(layerHtmlCloser);
		//jQueryWinRace("body").append(layerHtml);
	}
	else{
		jQueryWinRace("#content_stuff").html(layerHtml);
		//jQueryWinRace("#layercontent").html(ajaxLoader);
	}
	
}

function addLayerBoxIfNotExists(){
	addLayerContentBoxIfNotExists();
	var ajaxLoader = '<img src="' + configAjaxLoaderImage +'"/>';
	var layerHtmlCloser = "<div class=\"layer_closer\" id=\"layer\" style=\"display: none;\"></div>";
	var layerHtml = "<div class=\"layer_msgbox\" id=\"layer_msgbox\"  style=\"display: none;\">";
	layerHtml += "<div class=\"layer_msg_top\">";
		layerHtml += "<div class=\"layer_msg_top_left\"></div>"
	layerHtml += "</div>";
	layerHtml += "<div class=\"layer_msg_left\">";
		layerHtml += "<div class=\"layer_msg\">";
			/*layerHtml += "<span class=\"button_small button_small_cross layer_closer\" style=\"display:none; min-width:0px;\"><input value=\"Schlie&szlig;en\" type=\"button\"></span>";*/
			layerHtml += "<div id=\"layercontent\">";
			layerHtml += ajaxLoader;
			layerHtml += "</div>";
		layerHtml += "</div>";
	layerHtml += "</div>";
	layerHtml += "<div class=\"layer_msg_bottom\">";
	layerHtml += "<div class=\"layer_msg_bottom_left\"></div>";
	layerHtml += "</div>";
	layerHtml += "</div>";
	
	var stuff = "<div id='stuff'>";
	stuff += layerHtmlCloser;
	stuff += layerHtml;
	stuff += '</div>';
	
	// add html for layer	
	if (jQueryWinRace("#stuff").length==0) {
		jQueryWinRace("body").append(stuff);
		//jQueryWinRace("body").append(layerHtmlCloser);
		//jQueryWinRace("body").append(layerHtml);
	}
	else{
		jQueryWinRace("#stuff").html(layerHtmlCloser + layerHtml);
		//jQueryWinRace("#layercontent").html(ajaxLoader);
	}
	
}

function showStaticContentLayer(){
	addLayerBoxIfNotExists();
	var layer = jQueryWinRace("div#layer");
	var layer_msg = jQueryWinRace("div#layer_msgbox");
	var layer_content_msg = jQueryWinRace("div#layer_content_msgbox");
	var layer_trigger = jQueryWinRace(".layer_opener");
	
	var layerWidth = 870;
	
	layer.show();
	layer_msg.addClass("layer_msgbox");
	layer_msg.show();
	
	var width = layer_msg.width();
	var halfWidth = (width/2)*(-1);
	var height = layer_msg.height();
	var halfHeight = ((height/2)*(-1));
	
	layer_msg.css({"margin-top":halfHeight});
	layer_msg.css({"margin-left":halfWidth});
	
	handleClickEventForLayerClosing(layer, layer_content_msg);
	fixIE8BugWhenHoveringFromLeftToRightOverButtons();
}

function handleClickEventForLayerClosing(layer, layer_content_msg){
	jQueryWinRace('.layer_closer').click( function() {
		var layer_msg = jQueryWinRace("div#layer_msgbox");
		var layer_content_msg = jQueryWinRace("div#layer_content_msgbox");
		var layer_class   = jQueryWinRace(".layer_opener").attr('rel');
		var layer = jQueryWinRace("div#layer")
		//layer_msg.removeClass(layer_class);
		//layer_msg.hide();
		layer_content_msg.removeClass(layer_class);
		layer_content_msg.hide();
		layer.hide();
	}); 
}

function closeLayer(layer_msgbox) {
	jQueryWinRace(layer_msgbox).removeClass(jQueryWinRace(".layer_opener").attr('rel'));
	jQueryWinRace(layer_msgbox).css('display', 'none');
	jQueryWinRace("div#layer").css('display', 'none'); 
}

function updateLayerPosition() {
	var layer_msg = jQueryWinRace("div#layer_msgbox");
	var layer_content_msg = jQueryWinRace("div#layer_content_msgbox");
	var width = layer_content_msg.width();
	var halfWidth = (width/2)*(-1);
	var height = layer_content_msg.height();
	var halfHeight = ((height/2)*(-1));
	layer_content_msg.css({"margin-top":halfHeight});
	layer_content_msg.css({"margin-left":halfWidth});
	layer_content_msg.find(".layer_closer").removeAttr('style');
	layer_msg.hide();
	layer_content_msg.show();
}





function showLayer(/*String*/ url, /*int*/layerWidth, /*boolean*/showCloseButton, closeButtonText /*String*/, redirectUrl /*String*/, params) {
	// set defaults
	if(!layerWidth) {
		layerWidth = 416;
	}
	if(!showCloseButton) {
		showCloseButton = false;
	}
	
	if(layerWidth != 416 && layerWidth != 320 && layerWidth != 870) {
		layerWidth = 416;
	}

	addLayerBoxIfNotExists();
	
	// load content via ajax, put them into the layer and show him	
	jQueryWinRace.ajax({
		url: "/pferdewetten/cms" + url,
		cache: false,
		dataType: "html",
		data: params,
		success: function(html){
			var layer = jQueryWinRace("div#layer");
			var layer_content_msg = jQueryWinRace("div#layer_content_msgbox");
			var layer_trigger = jQueryWinRace(".layer_opener");
			
			if(layerWidth == 870) {
				layer_content_msg.find("#layercontent_content").html("<span class=\"button_small button_small_cross layer_closer\" style=\"min-width:0px;\"><input value=\"Schlie&szlig;en\" type=\"button\"></span>");
				layer_content_msg.find("#layercontent_content").append("<div class='layer_msg_help_body'>").append("</div>");
				layer_content_msg.find(".layer_msg_help_body").append(html);
				
			} else {
				layer_content_msg.find("#layercontent_content").html(html);
			}
			if(showCloseButton) {
				/*layer_content_msg.find("#layercontent_content").find("#content_row").append("<span class=\"button_small button_small_cross layer_closer\" style=\"min-width:0px;\"><input value=\" " + closeButtonText + " \" type=\"button\"></span>");*/
				jQueryWinRace('#layer_content_msgbox .layer_msg_left .layer_msg .layer_closer').css('display', 'block');
			}
			
			layer.show();
			layer_content_msg.addClass("layer_msgbox");
			layer_content_msg.show();
			
			var width = layer_content_msg.width();
			var halfWidth = (width/2)*(-1);
			var height = layer_content_msg.height();
			var halfHeight = ((height/2)*(-1));
			
			layer_content_msg.css({"margin-top":halfHeight});
			layer_content_msg.css({"margin-left":halfWidth});
			
			jQueryWinRace('.layer_closer').click( function() {
				layer_content_msg.removeClass();
				layer_content_msg.hide();
				layer.hide();
				if(redirectUrl) {
					window.location.href = "/pferdewetten/cms" + redirectUrl;
				}
			});
		}
	});
	fixIE8BugWhenHoveringFromLeftToRightOverButtons();
}

function showRequest(formData, jqForm, options) {
	var queryString = jQueryWinRace.param(formData);
	return true;
} 

function addLoaderForTooltip(){
	var ajaxLoader = '<br><br><br><br><br><br><br><br><center><div style="font-weight: bold; font-size:22px;">' + configWaitingMessage + '</div></center>';
	var layerHtml = "<div id=\"dynatip\" class=\"dynatip\">";
	layerHtml += "<div class=\"tool_box\">";
	layerHtml += "<div class=\"pointer\"></div>";
	layerHtml += "<div class=\"top_left_tool\"><div class=\"top_right_tool\"></div></div>";
	layerHtml += "<div class=\"center_left_tool\">";
	layerHtml += "<div class=\"center_right_tool\">";
	layerHtml += "<div class=\"content_tool\" id=\"content\"></div>";
	layerHtml += ajaxLoader;
	layerHtml += "</div>";
	layerHtml += "</div>";
	layerHtml += "<div class=\"bottom_left_tool\"><div class=\"bottom_right_tool\"></div></div>";
	layerHtml += "</div>";
	layerHtml += "</div>";
	
	// add html for layer	
	if (jQueryWinRace("#dynatip").length==0) {
		jQueryWinRace("body").append(layerHtmlCloser);
		jQueryWinRace("body").append(layerHtml);
	}else{
		jQueryWinRace("#content").html(ajaxLoader);
	}
	
}

function putEntryToField(toField, valueDiv){
	jQueryWinRace(toField).each(function(){
		jQueryWinRace(this).attr('value', jQueryWinRace(valueDiv).html());
	});
}

function opencmsHackForTextImageSpace(){
	jQueryWinRace('img').each(function(){
		var hspace = jQueryWinRace(this).attr('hspace');
		if (hspace > 0){
			jQueryWinRace(this).css("margin-left", hspace + "px");
			jQueryWinRace(this).css("margin-right", hspace + "px");
			jQueryWinRace(this).attr('hspace', 0);
		}
		var vspace = jQueryWinRace(this).attr('vspace');
		if (vspace > 0){
			jQueryWinRace(this).css("margin-top", vspace + "px");
			jQueryWinRace(this).css("margin-bottom", vspace + "px");
			jQueryWinRace(this).attr('vspace', 0);
		}
	});
}

function insertImageSubText(){
	jQueryWinRace('div.imageSubText img').each(function(){
		jQueryWinRace(this).css('margin-bottom', 0);
		if (jQueryWinRace(this).parent().attr('href') != null && jQueryWinRace(this).parent().attr('href') != undefined && jQueryWinRace(this).parent().attr('href').length > 0){
			jQueryWinRace(this).parent().wrap("<div style='clear:both; display:inline-block;' />")
			.parent().wrap("<div style='float:" + jQueryWinRace(this).attr('align') + ";display:inline-block; margin-right: 15px;' />")
			.parent().append("<div style='text-align:center; font-size:10px; width:" + jQueryWinRace(this).attr('width') + "px; line-height:10px;'>" + jQueryWinRace(this).attr('alt') + "</div>");
		}else{
			jQueryWinRace(this).wrap("<div style='clear:both; display:inline-block;' />")
			.parent().wrap("<div style='float:" + jQueryWinRace(this).attr('align') + ";display:inline-block; margin-right: 15px;' />")
			.parent().append("<div style='text-align:center; font-size:10px; width:" + jQueryWinRace(this).attr('width') + "px; line-height:10px;'>" + jQueryWinRace(this).attr('alt') + "</div>");
		}
	});
}

function standardFloatSpinnerUpClicked(spinnerUpImage, inputClass){
	var currentComboboxOptions = jQueryWinRace(spinnerUpImage).parent().find('.fakeComboboxOptions');
	var allOptions = currentComboboxOptions.find('.fakeComboboxOption');
	var enteredValue = parseFloat(currentComboboxOptions.parent().find('input').attr('value'));
	for(var i = 0; i < allOptions.length; i++){
		var optionValue = parseFloat(jQueryWinRace(allOptions[i]).html());
		if (enteredValue < optionValue && jQueryWinRace(allOptions[i]).css('display') != 'none'){
			jQueryWinRace('input'+inputClass).each(function(){
				jQueryWinRace(this).attr('value', optionValue.toFixed(2));
			});
			break;
		}
	}		
}

function standardFloatSpinnerDownClicked(spinnerDownImage, inputClass){
	var currentComboboxOptions = jQueryWinRace(spinnerDownImage).parent().find('.fakeComboboxOptions');
	var allOptions = currentComboboxOptions.find('.fakeComboboxOption');
	var enteredValue = parseFloat(currentComboboxOptions.parent().find('input').attr('value'));
	for(var i = (allOptions.length-1); i >= 0; i--){
	  var optionValue = parseFloat(jQueryWinRace(allOptions[i]).html());
	  if (enteredValue > optionValue && jQueryWinRace(allOptions[i]).css('display') != 'none'){
		 jQueryWinRace('input'+inputClass).each(function(){
		   jQueryWinRace(this).attr('value', optionValue.toFixed(2));
		 });
		 break;
	  }
	}
}

function ensureTwoDigitsAfterDecimalPoint(inputClass, minValue, maxValue){
	var value = parseFloat(String(jQueryWinRace('input'+inputClass+':first').attr('value')).replace(/,/gi, '.'));
	minValue = parseFloat(minValue);
	maxValue = parseFloat(maxValue);
	if (value > minValue && value < maxValue){
	  value = value.toFixed(2);
	}else if (value > maxValue){
	  value = maxValue.toFixed(2);
	}else{
	  value = minValue.toFixed(2);
	}
	jQueryWinRace('input'+inputClass).each(function(){
	  jQueryWinRace(this).attr('value', value);
	});
}

function confirmMeetingBetSlipBet(){
  showStaticContentLayer();
  var options = { 
      target: '#layercontent_content',  
      data: { confirmBet: 'true' },
      success: updateLayerPosition
  }; 
  jQueryWinRace('form#vbetslip').ajaxSubmit(options); 
  return false;   
}
	
jQueryWinRace(document).ready(function() {
	var options = { 
		target: '#layercontent_content',   	// target element(s) to be updated with server response
		beforeSubmit: showRequest   // pre-submit callback
		
	};
	
	fixIE8BugWhenHoveringFromLeftToRightOverButtons();

	jQueryWinRace(document).click(function(o){
		var clickedElement = jQueryWinRace(o.target)[0];
		jQueryWinRace('.fakeComboboxOptions').each(function(){
			var currentComboboxOptions = jQueryWinRace(this);
			var currentComboboxImage = currentComboboxOptions.parent().find('img.fakeComboboxSelectionButton')[0];
			if(clickedElement == currentComboboxImage){
				if (currentComboboxOptions.css('display') == 'none'){
					currentComboboxOptions.css('display', 'block');
				}else{
					currentComboboxOptions.css('display', 'none');
				}
			}else{
				currentComboboxOptions.css('display', 'none');
			}
		});
	});
	
	opencmsHackForTextImageSpace();
	insertImageSubText();
	
	
	// bind form using 'ajaxForm' 
	jQueryWinRace('#passwort_vergessen').submit(function() { 
		jQueryWinRace(this).ajaxSubmit(options); 
		return false; 
	}); 

	jQueryWinRace('#acceptTermsForm').submit(function() { 
		jQueryWinRace(this).ajaxSubmit(options); 
		var layer_msg = jQueryWinRace("div#layer_msgbox");
		layer_msg.find(".layer_closer").removeAttr('style');
		var layer_content_msg = jQueryWinRace("div#layer_content_msgbox");
		layer_content_msg.find(".layer_closer").removeAttr('style');
		return false; 
	}); 
	
	jQueryWinRace('#betslip').submit(function() { 
		showStaticContentLayer();
		var options = { 
				target: '#layercontent_content',  
				data: { confirmBet: 'true' },
				success: updateLayerPosition
		}; 
		jQueryWinRace(this).ajaxSubmit(options); 
		return false;
	}); 
	
	jQueryWinRace('#vbetslip').bind('submit', confirmMeetingBetSlipBet); 
	
	jQueryWinRace('#easybet').submit(function() { 
		showStaticContentLayer();
		var options = { 
				target: '#layercontent_content',  
				data: { confirmBet: 'true' },
				success: updateLayerPosition
		}; 
		jQueryWinRace(this).ajaxSubmit(options); 
		return false; 
	}); 
	
	jQueryWinRace(".tooltip").tooltip({
		tip: '#dynatip',			// use single tooltip element for all tips
		position: 'top right',		// custom positioning 
		offset: [0, -54],			// tweak the position
		effect: 'slide',			// use "slide" effect
		lazy: false,
		events: {
			def: 	"click, mouseout",
			input:	"click, mouseout"
		},
		onBeforeShow: function() {
			addLoaderForTooltip();
			if (jQueryWinRace("#dynatip").length==0) {
				var tooltipHtml = "<div id=\"dynatip\" class=\"dynatip\">";
				tooltipHtml += "<div class=\"tool_box\">";
				tooltipHtml += "<div class=\"pointer\"></div>";
				tooltipHtml += "<div class=\"top_left_tool\"><div class=\"top_right_tool\"></div></div>";
				tooltipHtml += "<div class=\"center_left_tool\">";
				tooltipHtml += "<div class=\"center_right_tool\">";
				tooltipHtml += "<div class=\"content_tool\" id=\"content\"></div>";
				tooltipHtml += "</div>";
				tooltipHtml += "</div>";
				tooltipHtml += "<div class=\"bottom_left_tool\"><div class=\"bottom_right_tool\"></div></div>";
				tooltipHtml += "</div>";
				tooltipHtml += "</div>";
				jQueryWinRace("body").append(tooltipHtml);
			}
			var metadata = this.getTrigger().metadata();
			var url = this.getTrigger().metadata().url;
			if (url) {
				jQueryWinRace.ajax({
					url: "/pferdewetten/cms" + url,
					cache: false,
					data: metadata, 
					dataType: "html",
					success: function(html){
						jQueryWinRace("#content").html(html);
					}
				});
			}
		}
	}).dynamic({ 
		bottom: {
			direction: 'down', // slide downwards
			bounce: true // bounce back when closed
		}
	});
	
	
	jQueryWinRace('.layer_closer').click( function() {
		var layer_msg = jQueryWinRace("div#layer_msgbox");
		var layer_content_msg = jQueryWinRace("div#layer_content_msgbox");
		var layer_class   = jQueryWinRace(".layer_opener").attr('rel');
		var layer = jQueryWinRace("div#layer")
		//layer_msg.removeClass(layer_class);
		//layer_msg.hide();
		layer_content_msg.removeClass(layer_class);
		layer_content_msg.hide();
		layer.hide();
	}); 
	
	
	jQueryWinRace.ajaxSetup({
	    cache: false
	});

	
}); 
 
function fixIE8BugWhenHoveringFromLeftToRightOverButtons() {
	jQueryWinRace('.button_big_arrow').each(function(){
		if (jQueryWinRace(this).find('input').length > 0){
			var button = jQueryWinRace(this);
			jQueryWinRace(this).mouseenter(function(){
				jQueryWinRace(this).css('background-position', 'left -52px');
				jQueryWinRace(this).find('input').css('background-position', 'right -78px');
				jQueryWinRace(this).find('input').css('padding-bottom', '0');
				jQueryWinRace(this).find('input').css('line-height', '28px');
			});
			jQueryWinRace(this).mouseleave(function(){
				jQueryWinRace(this).css('background-position', 'left 0');
				jQueryWinRace(this).find('input').css('background-position', 'right -26px');
				jQueryWinRace(this).find('input').css('padding-bottom', '3px');
				jQueryWinRace(this).find('input').css('line-height', '26px');
			});
			jQueryWinRace(this).mousedown(function(){
				jQueryWinRace(this).css('background-position', 'left 0');
				jQueryWinRace(this).find('input').css('background-position', 'right -26px');
				jQueryWinRace(this).find('input').css('padding-bottom', '3px');
				jQueryWinRace(this).find('input').css('line-height', '26px');
			});
		}
	});

	jQueryWinRace('.button_small').each(function(){
		if (jQueryWinRace(this).find('input').length > 0){
			var button = jQueryWinRace(this);
			jQueryWinRace(this).mouseenter(function(){
				jQueryWinRace(this).css('background-position', 'left -42px');
				jQueryWinRace(this).find('input').css('background-position', 'right -63px');
				jQueryWinRace(this).find('input').css('padding-bottom', '0');
				jQueryWinRace(this).find('input').css('line-height', '23px');
			});
			jQueryWinRace(this).mouseleave(function(){
				jQueryWinRace(this).css('background-position', 'left 0');
				jQueryWinRace(this).find('input').css('background-position', 'right -21px');
				jQueryWinRace(this).find('input').css('padding-bottom', '2px');
				jQueryWinRace(this).find('input').css('line-height', '21px');
			});
			jQueryWinRace(this).mousedown(function(){
				jQueryWinRace(this).css('background-position', 'left 0');
				jQueryWinRace(this).find('input').css('background-position', 'right -21px');
				jQueryWinRace(this).find('input').css('padding-bottom', '2px');
				jQueryWinRace(this).find('input').css('line-height', '21px');
			});
		}
	});

	jQueryWinRace('.button_small_cross').each(function(){
		if (jQueryWinRace(this).find('input').length > 0){
			var button = jQueryWinRace(this);
			jQueryWinRace(this).mouseenter(function(){
				jQueryWinRace(this).css('background-position', 'left -147px');
			});
			jQueryWinRace(this).mouseleave(function(){
				jQueryWinRace(this).css('background-position', 'left -126px');
			});
			jQueryWinRace(this).mousedown(function(){
				jQueryWinRace(this).css('background-position', 'left -126px');
			});
		}
	});

}

function logUserIn() {
	jQueryWinRace("div#loginLayer span.errorMsg").html("");
	var options = {
		dataType: 'json', 
		success: processJsonLogin
	}; 
	jQueryWinRace('div#loginLayer form#login_form').ajaxSubmit(options);

};

function UpdateUserInformationRequest(updateDepositeValue){
	this.updateUserInformation = true;
	if(updateDepositeValue != undefined && updateDepositeValue != null && updateDepositeValue == true){
		this.updateDeposit = true;
	}else{
		this.updateDeposit = false;
	}
}

function formatNumberString(Str) {
    var L = Str.length, P = Str.indexOf("."), Q;
    if (P < 0) {
        return Str + ".00";
    }
    if (P == L - 2) {
        return Str + "0";
    }
    if (P == L - 3) {
        return Str;
    }
    if (Str.charAt(0) == "-") {
        return "-" + formatNumberString(Str.substring(1));
    }
    Q = Str.substring(P + 3);
    if (Q < "5") {
        return Str.substring(0, P + 3);
    }
    if (Q > "5") {
        return formatNumberString(String(0.0125 + + Str.substring(0, P + 3)));
    }
    Q = Str.charCodeAt(P + 2) % 2 ? 0.001 : -0.001;
    return formatNumberString(String(Q + + Str));
}

function updateUserInformations(updateDepositeValue){
	jQueryWinRace.getJSON("/pferdewetten/app/updateUserInformations", new UpdateUserInformationRequest(updateDepositeValue), function(userResponse){
		jQueryWinRace("#userDeposit").html(getGermanNumberFormat(userResponse.deposit));
		jQueryWinRace("#userBonusDeposit").html(getGermanNumberFormat(userResponse.bonusDeposit));
		jQueryWinRace("#userFullDeposit").html(getGermanNumberFormat(userResponse.fullDeposit));
	});
}

function processJsonLogin(data) {
	if(data.isValid == 'true'){
		location.href= configHomePageLink;
	}else{
		jQueryWinRace("div#loginLayer span.errorMsg").html(data.combination);
		jQueryWinRace("div#loginLayer input[name='password']").val("");
	}
}
	
	function popUpperConfig(Url,winName,width,height,resizable)
	{
		var resizableString = "no";
		if(resizable){
			resizableString = "yes";
		}
		myleft=20;
		mytop=20;
		settings="width=" + width +",height=" + height + ",top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,dependent=no,minimizable=yes,dialog=yes";
		win=window.open(Url,winName,settings);
		win.focus();
	}

	function popUpper(Url,winName)
	{
		myleft=20;
		mytop=20;
		settings="width=650,height=400,top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes,dependent=no";
		win=window.open(Url,winName,settings);
		win.focus();
	}
	
	function popUp(Url)
	{
		myleft=20;
		mytop=20;
		cHeight = 400;
		cWidth = 650;
		settings="width=" + cWidth + ",height=" + cHeight + ",top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes,dependent=no";
		win=window.open(Url,"mypopup",settings);
		win.focus();
	}

