/*
 * ARITHNEA GmbH
 * JavaScript Library Loader (loading js-files on demand)
 *
 * If using callbacks for notification a wrapper method named notifyScriptIsLoaded(scriptFilename)
 * must be supplied in the global scope if the window and at the end of the loaded script files
 * the method notifyScriptIsLoaded must be called.
 * 
 * usage at the end of a script file: if(window.notifyScriptIsLoaded)notifyScriptIsLoaded('myfilename');
*/
var JSLoader = {   
    requiredScripts: [],
    requiredScriptsCallback: [],
    
	getRequiredScripts: function(scripts,callback,immediately) {
		if(typeof scripts == 'string') {
			this.registerRequiredScripts(scripts,callback);		// callback is invoked if a certain script is loaded
			this.loadRequiredScripts(null,immediately);
		} else {
			this.registerRequiredScripts(scripts);
			this.loadRequiredScripts(callback,immediately);	// callback is invoked only if all scripts are loaded		
		}
	},	
    registerRequiredScripts: function(scripts,callback) {
    	var src = scripts;
        if (typeof scripts == 'string') src = scripts.split(',');
        for (var i in src) {
        	var registered = false;
        	for (var j in this.requiredScripts)
        		if (this.requiredScripts[j].uri == src[i]) {
        			registered = true;
        			break;	// prevent multiple registration
        		}
        	if (!registered)
        		this.requiredScripts.push({uri:src[i],required:false,loaded:false,cb:callback});
        }
    },	
    loadRequiredScripts: function(callback,immediately) {
    	// only supported if the loaded script invokes setRequiredScriptIsLoaded(<filename>);
    	if (callback)
    		this.requiredScriptsCallback.push(callback);

    	if (immediately) {
    		this.loadRequiredScriptsImmediately();		
    	}
    	else {
	    	// loading is done delayed (possibly necessary js loaded via document.write must be available at first)
	        var self = this;
	        setTimeout(function(){ self.loadRequiredScriptsImmediately(); }, 1);
    	}
   	},    
   	loadRequiredScriptsImmediately: function() {
        for (var i in this.requiredScripts) {
        	if( !(this.requiredScripts[i].required) ) {            		
        		this.requiredScripts[i].required = true;
        		this.loadScript(this.requiredScripts[i].uri);
        	}
        }   		
   	},   	
    setRequiredScriptIsLoaded: function(scriptId) {
        for (var i in this.requiredScripts) {
        	if (this.requiredScripts[i].uri.indexOf(scriptId) >= 0) {
        		this.requiredScripts[i].loaded = true;
        		if (this.requiredScripts[i].cb != null)
        			this.requiredScripts[i].cb();
        		break;
        	}
        }    	
        if (this.requiredScriptsCallback != null && this.requiredScriptsCallback.length > 0) {
        	for (var j in this.requiredScriptsCallback)
        		this.requiredScriptsCallback[j](this.checkRequiredScriptsAreLoaded(),scriptId); 
        }
    },    
    checkRequiredScriptsAreLoaded: function() {
        for (var n in this.requiredScripts) {
        	if( !(this.requiredScripts[n].loaded) )
        		return false;
        }
        return true;
    },
    loadScript: function(script) {
        var crs = this.createScript(script);
        document.getElementsByTagName('head')[0].appendChild(crs);
    },
    createScript: function(uri) {
        var script = document.createElement('script');
        script.type = 'text/javascript';	        
        script.src = uri;
        return script;
    }
};
/*!
 * jQuery JavaScript Library v1.6.1
 * http://jquery.com/
 *
 * Copyright 2011, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2011, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Thu May 12 15:04:36 2011 -0400
 */
(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!cj[a]){var b=f("<"+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),c.body.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write("<!doctype><html><body></body></html>");b=cl.createElement(a),cl.body.appendChild(b),d=f.css(b,"display"),c.body.removeChild(ck)}cj[a]=d}return cj[a]}function cu(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function ct(){cq=b}function cs(){setTimeout(ct,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function ca(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function b_(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bF.test(a)?d(a,e):b_(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)b_(a+"["+e+"]",b[e],c,d);else d(a,b)}function b$(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bU,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=b$(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=b$(a,c,d,e,"*",g));return l}function bZ(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bQ),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bD(a,b,c){var d=b==="width"?bx:by,e=b==="width"?a.offsetWidth:a.offsetHeight;if(c==="border")return e;f.each(d,function(){c||(e-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?e+=parseFloat(f.css(a,"margin"+this))||0:e-=parseFloat(f.css(a,"border"+this+"Width"))||0});return e}function bn(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bm(a){f.nodeName(a,"input")?bl(a):a.getElementsByTagName&&f.grep(a.getElementsByTagName("input"),bl)}function bl(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bk(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bj(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bi(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)f.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function bh(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function X(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(S.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function W(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function O(a,b){return(a&&a!=="*"?a+".":"")+b.replace(A,"`").replace(B,"&")}function N(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;i<s.length;i++)g=s[i],g.origType.replace(y,"")===a.type?q.push(g.selector):s.splice(i--,1);e=f(a.target).closest(q,a.currentTarget);for(j=0,k=e.length;j<k;j++){m=e[j];for(i=0;i<s.length;i++){g=s[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,d=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,d=f(a.relatedTarget).closest(g.selector)[0],d&&f.contains(h,d)&&(d=h);(!d||d!==h)&&p.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){e=p[j];if(c&&e.level>c)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function L(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function F(){return!0}function E(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"$1-$2").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function H(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(H,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=d.userAgent,x,y,z,A=Object.prototype.toString,B=Object.prototype.hasOwnProperty,C=Array.prototype.push,D=Array.prototype.slice,E=String.prototype.trim,F=Array.prototype.indexOf,G={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.1",length:0,size:function(){return this.length},toArray:function(){return D.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?C.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),y.done(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(D.apply(this,arguments),"slice",D.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:C,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;y.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!y){y=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",z,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",z),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&H()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):G[A.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!B.call(a,"constructor")&&!B.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||B.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:E?function(a){return a==null?"":E.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?C.call(c,a):e.merge(c,a)}return c},inArray:function(a,b){if(F)return F.call(b,a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=D.call(arguments,2),g=function(){return a.apply(c,f.concat(D.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=s.exec(a)||t.exec(a)||u.exec(a)||a.indexOf("compatible")<0&&v.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){G["[object "+b+"]"]=b.toLowerCase()}),x=e.uaMatch(w),x.browser&&(e.browser[x.browser]=!0,e.browser.version=x.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?z=function(){c.removeEventListener("DOMContentLoaded",z,!1),e.ready()}:c.attachEvent&&(z=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",z),e.ready())});return e}(),g="done fail isResolved isRejected promise then always pipe".split(" "),h=[].slice;f.extend({_Deferred:function(){var a=[],b,c,d,e={done:function(){if(!d){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=f.type(i),j==="array"?e.done.apply(e,i):j==="function"&&a.push(i);k&&e.resolveWith(k[0],k[1])}return this},resolveWith:function(e,f){if(!d&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(e,f)}finally{b=[e,f],c=0}}return this},resolve:function(){e.resolveWith(this,arguments);return this},isResolved:function(){return!!c||!!b},cancel:function(){d=1,a=[];return this}};return e},Deferred:function(a){var b=f._Deferred(),c=f._Deferred(),d;f.extend(b,{then:function(a,c){b.done(a).fail(c);return this},always:function(){return b.done.apply(b,arguments).fail.apply(this,arguments)},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,pipe:function(a,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[c,"reject"]},function(a,c){var e=c[0],g=c[1],h;f.isFunction(e)?b[a](function(){h=e.apply(this,arguments),h&&f.isFunction(h.promise)?h.promise().then(d.resolve,d.reject):d[g](h)}):b[a](d[g])})}).promise()},promise:function(a){if(a==null){if(d)return d;d=a={}}var c=g.length;while(c--)a[g[c]]=b[g[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c<d;c++)b[c]&&f.isFunction(b[c].promise)?b[c].promise().then(i(c),g.reject):--e;e||g.resolveWith(g,b)}else g!==a&&g.resolveWith(g,d?[a]:[]);return g.promise()}}),f.support=function(){var a=c.createElement("div"),b=c.documentElement,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;a.setAttribute("className","t"),a.innerHTML="   <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};f=c.createElement("select"),g=f.appendChild(c.createElement("option")),h=a.getElementsByTagName("input")[0],j={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},h.checked=!0,j.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,j.optDisabled=!g.disabled;try{delete a.test}catch(s){j.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function b(){j.noCloneEvent=!1,a.detachEvent("onclick",b)}),a.cloneNode(!0).fireEvent("onclick")),h=c.createElement("input"),h.value="t",h.setAttribute("type","radio"),j.radioValue=h.value==="t",h.setAttribute("checked","checked"),a.appendChild(h),k=c.createDocumentFragment(),k.appendChild(a.firstChild),j.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",l=c.createElement("body"),m={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};for(q in m)l.style[q]=m[q];l.appendChild(a),b.insertBefore(l,b.firstChild),j.appendChecked=h.checked,j.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,j.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",j.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",n=a.getElementsByTagName("td"),r=n[0].offsetHeight===0,n[0].style.display="",n[1].style.display="none",j.reliableHiddenOffsets=r&&n[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(i=c.createElement("div"),i.style.width="0",i.style.marginRight="0",a.appendChild(i),j.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(i,null)||{marginRight:0}).marginRight,10)||0)===0),l.innerHTML="",b.removeChild(l);if(a.attachEvent)for(q in{submit:1,change:1,focusin:1})p="on"+q,r=p in a,r||(a.setAttribute(p,"return;"),r=typeof a[p]=="function"),j[q+"Bubbles"]=r;return j}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([a-z])([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g=f.expando,h=typeof c=="string",i,j=a.nodeType,k=j?f.cache:a,l=j?a[f.expando]:a[f.expando]&&f.expando;if((!l||e&&l&&!k[l][g])&&h&&d===b)return;l||(j?a[f.expando]=l=++f.uuid:l=f.expando),k[l]||(k[l]={},j||(k[l].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?k[l][g]=f.extend(k[l][g],c):k[l]=f.extend(k[l],c);i=k[l],e&&(i[g]||(i[g]={}),i=i[g]),d!==b&&(i[f.camelCase(c)]=d);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[f.camelCase(c)]:i}},removeData:function(b,c,d){if(!!f.acceptData(b)){var e=f.expando,g=b.nodeType,h=g?f.cache:b,i=g?b[f.expando]:f.expando;if(!h[i])return;if(c){var j=d?h[i][e]:h[i];if(j){delete j[c];if(!l(j))return}}if(d){delete h[i][e];if(!l(h[i]))return}var k=h[i][e];f.support.deleteExpando||h!=a?delete h[i]:h[i]=null,k?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=k):g&&(f.support.deleteExpando?delete b[f.expando]:b.removeAttribute?b.removeAttribute(f.expando):b[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h<i;h++)g=e[h].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),k(this[0],g,d[g]))}}return d}if(typeof a=="object")return this.each(function(){f.data(this,a)});var j=a.split(".");j[1]=j[1]?"."+j[1]:"";if(c===b){d=this.triggerHandler("getData"+j[1]+"!",[j[0]]),d===b&&this.length&&(d=f.data(this[0],a),d=k(this[0],a,d));return d===b&&j[1]?this.data(j[0]):d}return this.each(function(){var b=f(this),d=[j[0],c];b.triggerHandler("setData"+j[1]+"!",d),f.data(this,a,c),b.triggerHandler("changeData"+j[1]+"!",d)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,c){a&&(c=(c||"fx")+"mark",f.data(a,c,(f.data(a,c,b,!0)||0)+1,!0))},_unmark:function(a,c,d){a!==!0&&(d=c,c=a,a=!1);if(c){d=d||"fx";var e=d+"mark",g=a?0:(f.data(c,e,b,!0)||1)-1;g?f.data(c,e,g,!0):(f.removeData(c,e,!0),m(c,d,"mark"))}},queue:function(a,c,d){if(a){c=(c||"fx")+"queue";var e=f.data(a,c,b,!0);d&&(!e||f.isArray(d)?e=f.data(a,c,f.makeArray(d),!0):e.push(d));return e||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e;d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),d.call(a,function(){f.dequeue(a,b)})),c.length||(f.removeData(a,b+"queue",!0),m(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){f.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f._Deferred(),!0))h++,l.done(m);m();return d.promise()}});var n=/[\n\t\r]/g,o=/\s+/,p=/\r/g,q=/^(?:button|input)$/i,r=/^(?:button|input|object|select|textarea)$/i,s=/^a(?:rea)?$/i,t=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,u=/\:/,v,w;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.addClass(a.call(this,b,c.attr("class")||""))});if(a&&typeof a=="string"){var b=(a||"").split(o);for(var c=0,d=this.length;c<d;c++){var e=this[c];if(e.nodeType===1)if(!e.className)e.className=a;else{var g=" "+e.className+" ",h=e.className;for(var i=0,j=b.length;i<j;i++)g.indexOf(" "+b[i]+" ")<0&&(h+=" "+b[i]);e.className=f.trim(h)}}}return this},removeClass:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.removeClass(a.call(this,b,c.attr("class")))});if(a&&typeof a=="string"||a===b){var c=(a||"").split(o);for(var d=0,e=this.length;d<e;d++){var g=this[d];if(g.nodeType===1&&g.className)if(a){var h=(" "+g.className+" ").replace(n," ");for(var i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){var d=f(this);d.toggleClass(a.call(this,c,d.attr("class"),b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(o);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if((" "+this[c].className+" ").replace(n," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;return(e.value||"").replace(p,"")}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h<i;h++){var j=e[h];if(j.selected&&(f.support.optDisabled?!j.disabled:j.getAttribute("disabled")===null)&&(!j.parentNode.disabled||!f.nodeName(j.parentNode,"optgroup"))){b=f(j).val();if(g)return b;d.push(b)}}if(g&&!d.length&&e.length)return f(e[c]).val();return d},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);c=j&&f.attrFix[c]||c,i=f.attrHooks[c],i||(!t.test(c)||typeof d!="boolean"&&d!==b&&d.toLowerCase()!==c.toLowerCase()?v&&(f.nodeName(a,"form")||u.test(c))&&(i=v):i=w);if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j)return i.get(a,c);h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.support.getSetAttribute?a.removeAttribute(b):(f.attr(a,b,""),a.removeAttributeNode(a.getAttributeNode(b))),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},tabIndex:{get:function(a){var c=a.getAttributeNode("tabIndex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);c=i&&f.propFix[c]||c,h=f.propHooks[c];return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==b?g:a[c]},propHooks:{}}),w={get:function(a,c){return a[f.propFix[c]||c]?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=b),a.setAttribute(c,c.toLowerCase()));return c}},f.attrHooks.value={get:function(a,b){if(v&&f.nodeName(a,"button"))return v.get(a,b);return a.value},set:function(a,b,c){if(v&&f.nodeName(a,"button"))return v.set(a,b,c);a.value=b}},f.support.getSetAttribute||(f.attrFix=f.propFix,v=f.attrHooks.name=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);if(d){d.nodeValue=b;return b}}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var x=Object.prototype.hasOwnProperty,y=/\.(.*)$/,z=/^(?:textarea|input|select)$/i,A=/\./g,B=/ /g,C=/[^\w\s.|`]/g,D=function(a){return a.replace(C,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=E;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=E);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),D).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))f.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=f.event.special[h]||{};for(j=e||0;j<p.length;j++){q=p[j];if(d.guid===q.guid){if(l||n.test(q.namespace))e==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(e!=null)break}}if(p.length===0||e!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&f.removeEvent(a,h,s.handle),g=null,delete t[h]}if(f.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,f.isEmptyObject(s)&&f.removeData(a,b,!0)}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){var h=c.type||c,i=[],j;h.indexOf("!")>=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem
)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h<i;h++){var j=d[h];if(e||c.namespace_re.test(j.namespace)){c.handler=j.handler,c.data=j.data,c.handleObj=j;var k=j.handler.apply(this,g);k!==b&&(c.result=k,k===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}return c.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 pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[f.expando])return a;var d=a;a=f.Event(d);for(var e=this.props.length,g;e;)g=this.props[--e],a[g]=d[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=a.target.ownerDocument||c,i=h.documentElement,j=h.body;a.pageX=a.clientX+(i&&i.scrollLeft||j&&j.scrollLeft||0)-(i&&i.clientLeft||j&&j.clientLeft||0),a.pageY=a.clientY+(i&&i.scrollTop||j&&j.scrollTop||0)-(i&&i.clientTop||j&&j.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:f.proxy,special:{ready:{setup:f.bindReady,teardown:f.noop},live:{add:function(a){f.event.add(this,O(a.origType,a.selector),f.extend({},a,{handler:N,guid:a.handler.guid}))},remove:function(a){f.event.remove(this,O(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!this.preventDefault)return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?F:E):this.type=a,b&&f.extend(this,b),this.timeStamp=f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=F;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=F;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=F,this.stopPropagation()},isDefaultPrevented:E,isPropagationStopped:E,isImmediatePropagationStopped:E};var G=function(a){var b=a.relatedTarget;a.type=a.data;try{if(b&&b!==c&&!b.parentNode)return;while(b&&b!==this)b=b.parentNode;b!==this&&f.event.handle.apply(this,arguments)}catch(d){}},H=function(a){a.type=a.data,f.event.handle.apply(this,arguments)};f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={setup:function(c){f.event.add(this,b,c&&c.selector?H:G,a)},teardown:function(a){f.event.remove(this,b,a&&a.selector?H:G)}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(a,b){if(!f.nodeName(this,"form"))f.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=b.type;(c==="submit"||c==="image")&&f(b).closest("form").length&&L("submit",this,arguments)}),f.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=b.type;(c==="text"||c==="password")&&f(b).closest("form").length&&a.keyCode===13&&L("submit",this,arguments)});else return!1},teardown:function(a){f.event.remove(this,".specialSubmit")}});if(!f.support.changeBubbles){var I,J=function(a){var b=a.type,c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},K=function(c){var d=c.target,e,g;if(!!z.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=J(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:K,beforedeactivate:K,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&K.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&K.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",J(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in I)f.event.add(this,c+".specialChange",I[c]);return z.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return z.test(this.nodeName)}},I=f.event.special.change.filters,I.focus=I.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i<j;i++)f.event.add(this[i],a,g,d);return this}}),f.fn.extend({unbind:function(a,b){if(typeof a=="object"&&!a.preventDefault)for(var c in a)this.unbind(c,a[c]);else for(var d=0,e=this.length;d<e;d++)f.event.remove(this[d],a,b);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f.data(this,"lastToggle"+a.guid)||0)%d;f.data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var M={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};f.each(["live","die"],function(a,c){f.fn[c]=function(a,d,e,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:f(this.context);if(typeof a=="object"&&!a.preventDefault){for(var o in a)n[c](o,d,a[o],m);return this}if(c==="die"&&!a&&g&&g.charAt(0)==="."){n.unbind(g);return this}if(d===!1||f.isFunction(d))e=d||E,d=b;a=(a||"").split(" ");while((h=a[i++])!=null){j=y.exec(h),k="",j&&(k=j[0],h=h.replace(y,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,M[h]?(a.push(M[h]+k),h=h+k):h=(M[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)f.event.add(n[p],"live."+O(h,m),{data:d,selector:m,handler:e,origType:h,origHandler:e,preType:l});else n.unbind("live."+O(h,m),e)}return this}}),f.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){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(!f)g=o=!0;else if(f===!0)continue}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.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|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("parentNode",b,f,a,e,c)},"~":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("previousSibling",b,f,a,e,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c<f;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){if(a===b){g=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};f.find=k,f.expr=k.selectors,f.expr[":"]=f.expr.filters,f.unique=k.uniqueSort,f.text=k.getText,f.isXMLDoc=k.isXML,f.contains=k.contains}();var P=/Until$/,Q=/^(?:parents|prevUntil|prevAll)/,R=/,/,S=/^.[^:#\[\.,]*$/,T=Array.prototype.slice,U=f.expr.match.POS,V={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(X(this,a,!1),"not",a)},filter:function(a){return this.pushStack(X(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d<e;d++)i=a[d],j[i]||(j[i]=U.test(i)?f(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=U.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(l?l.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a=="string")return f.inArray(this[0],a?f(a):this.parent().children());return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(W(c[0])||W(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=T.call(arguments);P.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!V[a]?f.unique(e):e,(this.length>1||R.test(d))&&Q.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var Y=/ jQuery\d+="(?:\d+|null)"/g,Z=/^\s+/,$=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,_=/<([\w:]+)/,ba=/<tbody/i,bb=/<|&#?\w+;/,bc=/<(?:script|object|embed|option|style)/i,bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={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,"",""]};bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(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,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Y,""):null;if(typeof a=="string"&&!bc.test(a)&&(f.support.leadingWhitespace||!Z.test(a))&&!bg[(_.exec(a)||["",""])[1].toLowerCase()]){a=a.replace($,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bh(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bn)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i=b&&b[0]?b[0].ownerDocument||b[0]:c;a.length===1&&typeof a[0]=="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!bc.test(a[0])&&(f.support.checkClone||!bd.test(a[0]))&&(g=!0,h=f.fragments[a[0]],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[a[0]]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bj(a,d),e=bk(a),g=bk(d);for(h=0;e[h];++h)bj(e[h],g[h])}if(b){bi(a,d);if(c){e=bk(a),g=bk(d);for(h=0;e[h];++h)bi(e[h],g[h])}}return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||
b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!bb.test(k))k=b.createTextNode(k);else{k=k.replace($,"<$1></$2>");var l=(_.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=ba.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&Z.test(k)&&o.insertBefore(b.createTextNode(Z.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bm(k[i]);else bm(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||be.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.expando,g=f.event.special,h=f.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&f.noData[j.nodeName.toLowerCase()])continue;c=j[f.expando];if(c){b=d[c]&&d[c][e];if(b&&b.events){for(var k in b.events)g[k]?f.event.remove(j,k):f.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[f.expando]:j.removeAttribute&&j.removeAttribute(f.expando),delete d[c]}}}});var bo=/alpha\([^)]*\)/i,bp=/opacity=([^)]*)/,bq=/-([a-z])/ig,br=/([A-Z]|^ms)/g,bs=/^-?\d+(?:px)?$/i,bt=/^-?\d/,bu=/^[+\-]=/,bv=/[^+\-\.\de]+/g,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Left","Right"],by=["Top","Bottom"],bz,bA,bB,bC=function(a,b){return b.toUpperCase()};f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bz(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{zIndex:!0,fontWeight:!0,opacity:!0,zoom:!0,lineHeight:!0,widows:!0,orphans:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d;if(h==="number"&&isNaN(d)||d==null)return;h==="string"&&bu.test(d)&&(d=+d.replace(bv,"")+parseFloat(f.css(a,c))),h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bz)return bz(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]},camelCase:function(a){return a.replace(bq,bC)}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){a.offsetWidth!==0?e=bD(a,b,d):f.swap(a,bw,function(){e=bD(a,b,d)});if(e<=0){e=bz(a,b,b),e==="0px"&&bB&&(e=bB(a,b,b));if(e!=null)return e===""||e==="auto"?"0px":e}if(e<0||e==null){e=a.style[b];return e===""||e==="auto"?"0px":e}return typeof e=="string"?e:e+"px"}},set:function(a,b){if(!bs.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bp.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.filter=bo.test(g)?g.replace(bo,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,c){var d,e,g;c=c.replace(br,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bs.test(d)&&bt.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bE=/%20/g,bF=/\[\]$/,bG=/\r?\n/g,bH=/#.*$/,bI=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bJ=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bK=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,bL=/^(?:GET|HEAD)$/,bM=/^\/\//,bN=/\?/,bO=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bP=/^(?:select|textarea)/i,bQ=/\s+/,bR=/([?&])_=[^&]*/,bS=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bT=f.fn.load,bU={},bV={},bW,bX;try{bW=e.href}catch(bY){bW=c.createElement("a"),bW.href="",bW=bW.href}bX=bS.exec(bW.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bT)return bT.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bO,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bP.test(this.nodeName)||bJ.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bG,"\r\n")}}):{name:b.name,value:c.replace(bG,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?f.extend(!0,a,f.ajaxSettings,b):(b=a,a=f.extend(!0,f.ajaxSettings,b));for(var c in{context:1,url:1})c in b?a[c]=b[c]:c in f.ajaxSettings&&(a[c]=f.ajaxSettings[c]);return a},ajaxSettings:{url:bW,isLocal:bK.test(bX[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML}},ajaxPrefilter:bZ(bU),ajaxTransport:bZ(bV),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a?4:0;var o,r,u,w=l?ca(d,v,l):b,x,y;if(a>=200&&a<300||a===304){if(d.ifModified){if(x=v.getResponseHeader("Last-Modified"))f.lastModified[k]=x;if(y=v.getResponseHeader("Etag"))f.etag[k]=y}if(a===304)c="notmodified",o=!0;else try{r=cb(d,w),c="success",o=!0}catch(z){c="parsererror",u=z}}else{u=c;if(!c||a)c="error",a<0&&(a=0)}v.status=a,v.statusText=c,o?h.resolveWith(e,[r,c,v]):h.rejectWith(e,[v,c,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,c]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bI.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bH,"").replace(bM,bX[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bQ),d.crossDomain==null&&(r=bS.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bX[1]&&r[2]==bX[2]&&(r[3]||(r[1]==="http:"?80:443))==(bX[3]||(bX[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bU,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bL.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bN.test(d.url)?"&":"?")+d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bR,"$1_="+x);d.url=y+(y===d.url?(bN.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", */*; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bV,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){status<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bE,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq,cr=a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cv(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cu("hide",3),a,b,c);for(var d=0,e=this.length;d<e;d++)if(this[d].style){var g=f.css(this[d],"display");g!=="none"&&!f._data(this[d],"olddisplay")&&f._data(this[d],"olddisplay",g)}for(d=0;d<e;d++)this[d].style&&(this[d].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cu("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return this[e.queue===!1?"each":"queue"](function(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(f.support.inlineBlockNeedsLayout?(j=cv(this.nodeName),j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)):this.style.display="inline-block"))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)k=new f.fx(this,b,i),h=a[i],cm.test(h)?k[h==="toggle"?d?"show":"hide":h]():(l=cn.exec(h),m=k.cur(),l?(n=parseFloat(l[2]),o=l[3]||(f.cssNumber[i]?"":"px"),o!=="px"&&(f.style(this,i,(n||1)+o),m=(n||1)/k.cur()*m,f.style(this,i,m+o)),l[1]&&(n=(l[1]==="-="?-1:1)*n+m),k.custom(m,n,o)):k.custom(m,h,""));return!0})},stop:function(a,b){a&&this.queue([]),this.each(function(){var a=f.timers,c=a.length;b||f._unmark(!0,this);while(c--)a[c].elem===this&&(b&&a[c](!0),a.splice(c,1))}),b||this.dequeue();return this}}),f.each({slideDown:cu("show",1),slideUp:cu("hide",1),slideToggle:cu("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default,d.old=d.complete,d.complete=function(a){d.queue!==!1?f.dequeue(this):a!==!1&&f._unmark(this),f.isFunction(d.old)&&d.old.call(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function h(a){return d.step(a)}var d=this,e=f.fx,g;this.startTime=cq||cs(),this.start=a,this.end=b,this.unit=c||this.unit||(f.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,h.elem=this.elem,h()&&f.timers.push(h)&&!co&&(cr?(co=1,g=function(){co&&(cr(g),e.tick())},cr(g)):co=setInterval(e.tick,e.interval))},show:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=cq||cs(),c=!0,d=this.elem,e=this.options,g,h;if(a||b>=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b<a.length;++b)a[b]()||a.splice(b--,1);a.length||f.fx.stop()},interval:13,stop:function(){clearInterval(co),co=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){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:a.elem[a.prop]=a.now}}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cy(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);f.offset.initialize();var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.offset.doesNotAddBorder&&(!f.offset.doesAddBorderForTableAndCells||!cw.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={initialize:function(){var a=c.body,b=c.createElement("div"),d,e,g,h,i=parseFloat(f.css(a,"marginTop"))||0,j="<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>";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){return this[0]?parseFloat(f.css(this[0],d,"padding")):null},f.fn["outer"+c]=function(a){return this[0]?parseFloat(f.css(this[0],d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c];return e.document.compatMode==="CSS1Compat"&&g||e.document.body["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=f.css(e,d),i=parseFloat(h);return f.isNaN(i)?h:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window);/*!
 * jQuery UI 1.8.6
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI
 */
(function(c,j){function k(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.6",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,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,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,
"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");
if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,l,m){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(l)g-=parseFloat(c.curCSS(f,
"border"+this+"Width",true))||0;if(m)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,
d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");if("area"===b){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&k(a)}return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b?a.href||!isNaN(d):!isNaN(d))&&k(a)},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}});
c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&
b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&c.ui.isOverAxis(b,e,i)}})}})(jQuery);
;/*!
 * jQuery UI Widget 1.8.6
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Widget
 */
(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)b(d).triggerHandler("remove");k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h,
a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.charAt(0)==="_")return h;
e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=b.extend(true,{},this.options,
this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},
widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},
enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
;/*!
 * jQuery UI Mouse 1.8.6
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Mouse
 *
 * Depends:
 *	jquery.ui.widget.js
 */
(function(c){c.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(b){return a._mouseDown(b)}).bind("click."+this.widgetName,function(b){if(a._preventClickEvent){a._preventClickEvent=false;b.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(a){a.originalEvent=a.originalEvent||{};if(!a.originalEvent.mouseHandled){this._mouseStarted&&
this._mouseUp(a);this._mouseDownEvent=a;var b=this,e=a.which==1,f=typeof this.options.cancel=="string"?c(a.target).parents().add(a.target).filter(this.options.cancel).length:false;if(!e||f||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){b.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();
return true}}this._mouseMoveDelegate=function(d){return b._mouseMove(d)};this._mouseUpDelegate=function(d){return b._mouseUp(d)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return a.originalEvent.mouseHandled=true}},_mouseMove:function(a){if(c.browser.msie&&!(document.documentMode>=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&
this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=a.target==this._mouseDownEvent.target;this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-
a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);
;/*
 * jQuery UI Slider 1.8.6
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Slider
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.mouse.js
 *	jquery.ui.widget.js
 */
(function(d){d.widget("ui.slider",d.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var a=this,b=this.options;this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all");b.disabled&&this.element.addClass("ui-slider-disabled ui-disabled");
this.range=d([]);if(b.range){if(b.range===true){this.range=d("<div></div>");if(!b.values)b.values=[this._valueMin(),this._valueMin()];if(b.values.length&&b.values.length!==2)b.values=[b.values[0],b.values[0]]}else this.range=d("<div></div>");this.range.appendTo(this.element).addClass("ui-slider-range");if(b.range==="min"||b.range==="max")this.range.addClass("ui-slider-range-"+b.range);this.range.addClass("ui-widget-header")}d(".ui-slider-handle",this.element).length===0&&d("<a href='#'></a>").appendTo(this.element).addClass("ui-slider-handle");
if(b.values&&b.values.length)for(;d(".ui-slider-handle",this.element).length<b.values.length;)d("<a href='#'></a>").appendTo(this.element).addClass("ui-slider-handle");this.handles=d(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(c){c.preventDefault()}).hover(function(){b.disabled||d(this).addClass("ui-state-hover")},function(){d(this).removeClass("ui-state-hover")}).focus(function(){if(b.disabled)d(this).blur();
else{d(".ui-slider .ui-state-focus").removeClass("ui-state-focus");d(this).addClass("ui-state-focus")}}).blur(function(){d(this).removeClass("ui-state-focus")});this.handles.each(function(c){d(this).data("index.ui-slider-handle",c)});this.handles.keydown(function(c){var e=true,f=d(this).data("index.ui-slider-handle"),h,g,i;if(!a.options.disabled){switch(c.keyCode){case d.ui.keyCode.HOME:case d.ui.keyCode.END:case d.ui.keyCode.PAGE_UP:case d.ui.keyCode.PAGE_DOWN:case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:e=
false;if(!a._keySliding){a._keySliding=true;d(this).addClass("ui-state-active");h=a._start(c,f);if(h===false)return}break}i=a.options.step;h=a.options.values&&a.options.values.length?(g=a.values(f)):(g=a.value());switch(c.keyCode){case d.ui.keyCode.HOME:g=a._valueMin();break;case d.ui.keyCode.END:g=a._valueMax();break;case d.ui.keyCode.PAGE_UP:g=a._trimAlignValue(h+(a._valueMax()-a._valueMin())/5);break;case d.ui.keyCode.PAGE_DOWN:g=a._trimAlignValue(h-(a._valueMax()-a._valueMin())/5);break;case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:if(h===
a._valueMax())return;g=a._trimAlignValue(h+i);break;case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:if(h===a._valueMin())return;g=a._trimAlignValue(h-i);break}a._slide(c,f,g);return e}}).keyup(function(c){var e=d(this).data("index.ui-slider-handle");if(a._keySliding){a._keySliding=false;a._stop(c,e);a._change(c,e);d(this).removeClass("ui-state-active")}});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");
this._mouseDestroy();return this},_mouseCapture:function(a){var b=this.options,c,e,f,h,g;if(b.disabled)return false;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();c=this._normValueFromMouse({x:a.pageX,y:a.pageY});e=this._valueMax()-this._valueMin()+1;h=this;this.handles.each(function(i){var j=Math.abs(c-h.values(i));if(e>j){e=j;f=d(this);g=i}});if(b.range===true&&this.values(1)===b.min){g+=1;f=d(this.handles[g])}if(this._start(a,
g)===false)return false;this._mouseSliding=true;h._handleIndex=g;f.addClass("ui-state-active").focus();b=f.offset();this._clickOffset=!d(a.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:a.pageX-b.left-f.width()/2,top:a.pageY-b.top-f.height()/2-(parseInt(f.css("borderTopWidth"),10)||0)-(parseInt(f.css("borderBottomWidth"),10)||0)+(parseInt(f.css("marginTop"),10)||0)};this._slide(a,g,c);return this._animateOff=true},_mouseStart:function(){return true},_mouseDrag:function(a){var b=
this._normValueFromMouse({x:a.pageX,y:a.pageY});this._slide(a,this._handleIndex,b);return false},_mouseStop:function(a){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(a,this._handleIndex);this._change(a,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b;if(this.orientation==="horizontal"){b=
this.elementSize.width;a=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{b=this.elementSize.height;a=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}b=a/b;if(b>1)b=1;if(b<0)b=0;if(this.orientation==="vertical")b=1-b;a=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+b*a)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);
c.values=this.values()}return this._trigger("start",a,c)},_slide:function(a,b,c){var e;if(this.options.values&&this.options.values.length){e=this.values(b?0:1);if(this.options.values.length===2&&this.options.range===true&&(b===0&&c>e||b===1&&c<e))c=e;if(c!==this.values(b)){e=this.values();e[b]=c;a=this._trigger("slide",a,{handle:this.handles[b],value:c,values:e});this.values(b?0:1);a!==false&&this.values(b,c,true)}}else if(c!==this.value()){a=this._trigger("slide",a,{handle:this.handles[b],value:c});
a!==false&&this.value(c)}},_stop:function(a,b){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);c.values=this.values()}this._trigger("stop",a,c)},_change:function(a,b){if(!this._keySliding&&!this._mouseSliding){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);c.values=this.values()}this._trigger("change",a,c)}},value:function(a){if(arguments.length){this.options.value=
this._trimAlignValue(a);this._refreshValue();this._change(null,0)}return this._value()},values:function(a,b){var c,e,f;if(arguments.length>1){this.options.values[a]=this._trimAlignValue(b);this._refreshValue();this._change(null,a)}if(arguments.length)if(d.isArray(arguments[0])){c=this.options.values;e=arguments[0];for(f=0;f<c.length;f+=1){c[f]=this._trimAlignValue(e[f]);this._change(null,f)}this._refreshValue()}else return this.options.values&&this.options.values.length?this._values(a):this.value();
else return this._values()},_setOption:function(a,b){var c,e=0;if(d.isArray(this.options.values))e=this.options.values.length;d.Widget.prototype._setOption.apply(this,arguments);switch(a){case "disabled":if(b){this.handles.filter(".ui-state-focus").blur();this.handles.removeClass("ui-state-hover");this.handles.attr("disabled","disabled");this.element.addClass("ui-disabled")}else{this.handles.removeAttr("disabled");this.element.removeClass("ui-disabled")}break;case "orientation":this._detectOrientation();
this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue();break;case "value":this._animateOff=true;this._refreshValue();this._change(null,0);this._animateOff=false;break;case "values":this._animateOff=true;this._refreshValue();for(c=0;c<e;c+=1)this._change(null,c);this._animateOff=false;break}},_value:function(){var a=this.options.value;return a=this._trimAlignValue(a)},_values:function(a){var b,c;if(arguments.length){b=this.options.values[a];
return b=this._trimAlignValue(b)}else{b=this.options.values.slice();for(c=0;c<b.length;c+=1)b[c]=this._trimAlignValue(b[c]);return b}},_trimAlignValue:function(a){if(a<this._valueMin())return this._valueMin();if(a>this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=a%b;a=a-c;if(Math.abs(c)*2>=b)a+=c>0?b:-b;return parseFloat(a.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var a=
this.options.range,b=this.options,c=this,e=!this._animateOff?b.animate:false,f,h={},g,i,j,l;if(this.options.values&&this.options.values.length)this.handles.each(function(k){f=(c.values(k)-c._valueMin())/(c._valueMax()-c._valueMin())*100;h[c.orientation==="horizontal"?"left":"bottom"]=f+"%";d(this).stop(1,1)[e?"animate":"css"](h,b.animate);if(c.options.range===true)if(c.orientation==="horizontal"){if(k===0)c.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},b.animate);if(k===1)c.range[e?"animate":"css"]({width:f-
g+"%"},{queue:false,duration:b.animate})}else{if(k===0)c.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},b.animate);if(k===1)c.range[e?"animate":"css"]({height:f-g+"%"},{queue:false,duration:b.animate})}g=f});else{i=this.value();j=this._valueMin();l=this._valueMax();f=l!==j?(i-j)/(l-j)*100:0;h[c.orientation==="horizontal"?"left":"bottom"]=f+"%";this.handle.stop(1,1)[e?"animate":"css"](h,b.animate);if(a==="min"&&this.orientation==="horizontal")this.range.stop(1,1)[e?"animate":"css"]({width:f+"%"},
b.animate);if(a==="max"&&this.orientation==="horizontal")this.range[e?"animate":"css"]({width:100-f+"%"},{queue:false,duration:b.animate});if(a==="min"&&this.orientation==="vertical")this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},b.animate);if(a==="max"&&this.orientation==="vertical")this.range[e?"animate":"css"]({height:100-f+"%"},{queue:false,duration:b.animate})}}});d.extend(d.ui.slider,{version:"1.8.6"})})(jQuery);
;/*!
 * jCarousel - Riding carousels with jQuery
 *   http://sorgalla.com/jcarousel/
 *
 * Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Built on top of the jQuery library
 *   http://jquery.com
 *
 * Inspired by the "Carousel Component" by Bill Scott
 *   http://billwscott.com/carousel/
 */

(function(g){var q={vertical:!1,rtl:!1,start:1,offset:1,size:null,scroll:3,visible:null,animation:"normal",easing:"swing",auto:0,wrap:null,initCallback:null,setupCallback:null,reloadCallback:null,itemLoadCallback:null,itemFirstInCallback:null,itemFirstOutCallback:null,itemLastInCallback:null,itemLastOutCallback:null,itemVisibleInCallback:null,itemVisibleOutCallback:null,animationStepCallback:null,buttonNextHTML:"<div></div>",buttonPrevHTML:"<div></div>",buttonNextEvent:"click",buttonPrevEvent:"click", buttonNextCallback:null,buttonPrevCallback:null,itemFallbackDimension:null},m=!1;g(window).bind("load.jcarousel",function(){m=!0});g.jcarousel=function(a,c){this.options=g.extend({},q,c||{});this.autoStopped=this.locked=!1;this.buttonPrevState=this.buttonNextState=this.buttonPrev=this.buttonNext=this.list=this.clip=this.container=null;if(!c||c.rtl===void 0)this.options.rtl=(g(a).attr("dir")||g("html").attr("dir")||"").toLowerCase()=="rtl";this.wh=!this.options.vertical?"width":"height";this.lt=!this.options.vertical? this.options.rtl?"right":"left":"top";for(var b="",d=a.className.split(" "),f=0;f<d.length;f++)if(d[f].indexOf("jcarousel-skin")!=-1){g(a).removeClass(d[f]);b=d[f];break}a.nodeName.toUpperCase()=="UL"||a.nodeName.toUpperCase()=="OL"?(this.list=g(a),this.clip=this.list.parents(".jcarousel-clip"),this.container=this.list.parents(".jcarousel-container")):(this.container=g(a),this.list=this.container.find("ul,ol").eq(0),this.clip=this.container.find(".jcarousel-clip"));if(this.clip.size()===0)this.clip= this.list.wrap("<div></div>").parent();if(this.container.size()===0)this.container=this.clip.wrap("<div></div>").parent();b!==""&&this.container.parent()[0].className.indexOf("jcarousel-skin")==-1&&this.container.wrap('<div class=" '+b+'"></div>');this.buttonPrev=g(".jcarousel-prev",this.container);if(this.buttonPrev.size()===0&&this.options.buttonPrevHTML!==null)this.buttonPrev=g(this.options.buttonPrevHTML).appendTo(this.container);this.buttonPrev.addClass(this.className("jcarousel-prev"));this.buttonNext= g(".jcarousel-next",this.container);if(this.buttonNext.size()===0&&this.options.buttonNextHTML!==null)this.buttonNext=g(this.options.buttonNextHTML).appendTo(this.container);this.buttonNext.addClass(this.className("jcarousel-next"));this.clip.addClass(this.className("jcarousel-clip")).css({position:"relative"});this.list.addClass(this.className("jcarousel-list")).css({overflow:"hidden",position:"relative",top:0,margin:0,padding:0}).css(this.options.rtl?"right":"left",0);this.container.addClass(this.className("jcarousel-container")).css({position:"relative"}); !this.options.vertical&&this.options.rtl&&this.container.addClass("jcarousel-direction-rtl").attr("dir","rtl");var j=this.options.visible!==null?Math.ceil(this.clipping()/this.options.visible):null,b=this.list.children("li"),e=this;if(b.size()>0){var h=0,i=this.options.offset;b.each(function(){e.format(this,i++);h+=e.dimension(this,j)});this.list.css(this.wh,h+100+"px");if(!c||c.size===void 0)this.options.size=b.size()}this.container.css("display","block");this.buttonNext.css("display","block");this.buttonPrev.css("display", "block");this.funcNext=function(){e.next()};this.funcPrev=function(){e.prev()};this.funcResize=function(){e.resizeTimer&&clearTimeout(e.resizeTimer);e.resizeTimer=setTimeout(function(){e.reload()},100)};this.options.initCallback!==null&&this.options.initCallback(this,"init");!m&&g.browser.safari?(this.buttons(!1,!1),g(window).bind("load.jcarousel",function(){e.setup()})):this.setup()};var f=g.jcarousel;f.fn=f.prototype={jcarousel:"0.2.8"};f.fn.extend=f.extend=g.extend;f.fn.extend({setup:function(){this.prevLast= this.prevFirst=this.last=this.first=null;this.animating=!1;this.tail=this.resizeTimer=this.timer=null;this.inTail=!1;if(!this.locked){this.list.css(this.lt,this.pos(this.options.offset)+"px");var a=this.pos(this.options.start,!0);this.prevFirst=this.prevLast=null;this.animate(a,!1);g(window).unbind("resize.jcarousel",this.funcResize).bind("resize.jcarousel",this.funcResize);this.options.setupCallback!==null&&this.options.setupCallback(this)}},reset:function(){this.list.empty();this.list.css(this.lt, "0px");this.list.css(this.wh,"10px");this.options.initCallback!==null&&this.options.initCallback(this,"reset");this.setup()},reload:function(){this.tail!==null&&this.inTail&&this.list.css(this.lt,f.intval(this.list.css(this.lt))+this.tail);this.tail=null;this.inTail=!1;this.options.reloadCallback!==null&&this.options.reloadCallback(this);if(this.options.visible!==null){var a=this,c=Math.ceil(this.clipping()/this.options.visible),b=0,d=0;this.list.children("li").each(function(f){b+=a.dimension(this, c);f+1<a.first&&(d=b)});this.list.css(this.wh,b+"px");this.list.css(this.lt,-d+"px")}this.scroll(this.first,!1)},lock:function(){this.locked=!0;this.buttons()},unlock:function(){this.locked=!1;this.buttons()},size:function(a){if(a!==void 0)this.options.size=a,this.locked||this.buttons();return this.options.size},has:function(a,c){if(c===void 0||!c)c=a;if(this.options.size!==null&&c>this.options.size)c=this.options.size;for(var b=a;b<=c;b++){var d=this.get(b);if(!d.length||d.hasClass("jcarousel-item-placeholder"))return!1}return!0}, get:function(a){return g(">.jcarousel-item-"+a,this.list)},add:function(a,c){var b=this.get(a),d=0,p=g(c);if(b.length===0)for(var j,e=f.intval(a),b=this.create(a);;){if(j=this.get(--e),e<=0||j.length){e<=0?this.list.prepend(b):j.after(b);break}}else d=this.dimension(b);p.get(0).nodeName.toUpperCase()=="LI"?(b.replaceWith(p),b=p):b.empty().append(c);this.format(b.removeClass(this.className("jcarousel-item-placeholder")),a);p=this.options.visible!==null?Math.ceil(this.clipping()/this.options.visible): null;d=this.dimension(b,p)-d;a>0&&a<this.first&&this.list.css(this.lt,f.intval(this.list.css(this.lt))-d+"px");this.list.css(this.wh,f.intval(this.list.css(this.wh))+d+"px");return b},remove:function(a){var c=this.get(a);if(c.length&&!(a>=this.first&&a<=this.last)){var b=this.dimension(c);a<this.first&&this.list.css(this.lt,f.intval(this.list.css(this.lt))+b+"px");c.remove();this.list.css(this.wh,f.intval(this.list.css(this.wh))-b+"px")}},next:function(){this.tail!==null&&!this.inTail?this.scrollTail(!1): this.scroll((this.options.wrap=="both"||this.options.wrap=="last")&&this.options.size!==null&&this.last==this.options.size?1:this.first+this.options.scroll)},prev:function(){this.tail!==null&&this.inTail?this.scrollTail(!0):this.scroll((this.options.wrap=="both"||this.options.wrap=="first")&&this.options.size!==null&&this.first==1?this.options.size:this.first-this.options.scroll)},scrollTail:function(a){if(!this.locked&&!this.animating&&this.tail){this.pauseAuto();var c=f.intval(this.list.css(this.lt)), c=!a?c-this.tail:c+this.tail;this.inTail=!a;this.prevFirst=this.first;this.prevLast=this.last;this.animate(c)}},scroll:function(a,c){!this.locked&&!this.animating&&(this.pauseAuto(),this.animate(this.pos(a),c))},pos:function(a,c){var b=f.intval(this.list.css(this.lt));if(this.locked||this.animating)return b;this.options.wrap!="circular"&&(a=a<1?1:this.options.size&&a>this.options.size?this.options.size:a);for(var d=this.first>a,g=this.options.wrap!="circular"&&this.first<=1?1:this.first,j=d?this.get(g): this.get(this.last),e=d?g:g-1,h=null,i=0,k=!1,l=0;d?--e>=a:++e<a;){h=this.get(e);k=!h.length;if(h.length===0&&(h=this.create(e).addClass(this.className("jcarousel-item-placeholder")),j[d?"before":"after"](h),this.first!==null&&this.options.wrap=="circular"&&this.options.size!==null&&(e<=0||e>this.options.size)))j=this.get(this.index(e)),j.length&&(h=this.add(e,j.clone(!0)));j=h;l=this.dimension(h);k&&(i+=l);if(this.first!==null&&(this.options.wrap=="circular"||e>=1&&(this.options.size===null||e<= this.options.size)))b=d?b+l:b-l}for(var g=this.clipping(),m=[],o=0,n=0,j=this.get(a-1),e=a;++o;){h=this.get(e);k=!h.length;if(h.length===0){h=this.create(e).addClass(this.className("jcarousel-item-placeholder"));if(j.length===0)this.list.prepend(h);else j[d?"before":"after"](h);if(this.first!==null&&this.options.wrap=="circular"&&this.options.size!==null&&(e<=0||e>this.options.size))j=this.get(this.index(e)),j.length&&(h=this.add(e,j.clone(!0)))}j=h;l=this.dimension(h);if(l===0)throw Error("jCarousel: No width/height set for items. This will cause an infinite loop. Aborting..."); this.options.wrap!="circular"&&this.options.size!==null&&e>this.options.size?m.push(h):k&&(i+=l);n+=l;if(n>=g)break;e++}for(h=0;h<m.length;h++)m[h].remove();i>0&&(this.list.css(this.wh,this.dimension(this.list)+i+"px"),d&&(b-=i,this.list.css(this.lt,f.intval(this.list.css(this.lt))-i+"px")));i=a+o-1;if(this.options.wrap!="circular"&&this.options.size&&i>this.options.size)i=this.options.size;if(e>i){o=0;e=i;for(n=0;++o;){h=this.get(e--);if(!h.length)break;n+=this.dimension(h);if(n>=g)break}}e=i-o+ 1;this.options.wrap!="circular"&&e<1&&(e=1);if(this.inTail&&d)b+=this.tail,this.inTail=!1;this.tail=null;if(this.options.wrap!="circular"&&i==this.options.size&&i-o+1>=1&&(d=f.intval(this.get(i).css(!this.options.vertical?"marginRight":"marginBottom")),n-d>g))this.tail=n-g-d;if(c&&a===this.options.size&&this.tail)b-=this.tail,this.inTail=!0;for(;a-- >e;)b+=this.dimension(this.get(a));this.prevFirst=this.first;this.prevLast=this.last;this.first=e;this.last=i;return b},animate:function(a,c){if(!this.locked&& !this.animating){this.animating=!0;var b=this,d=function(){b.animating=!1;a===0&&b.list.css(b.lt,0);!b.autoStopped&&(b.options.wrap=="circular"||b.options.wrap=="both"||b.options.wrap=="last"||b.options.size===null||b.last<b.options.size||b.last==b.options.size&&b.tail!==null&&!b.inTail)&&b.startAuto();b.buttons();b.notify("onAfterAnimation");if(b.options.wrap=="circular"&&b.options.size!==null)for(var c=b.prevFirst;c<=b.prevLast;c++)c!==null&&!(c>=b.first&&c<=b.last)&&(c<1||c>b.options.size)&&b.remove(c)}; this.notify("onBeforeAnimation");if(!this.options.animation||c===!1)this.list.css(this.lt,a+"px"),d();else{var f=!this.options.vertical?this.options.rtl?{right:a}:{left:a}:{top:a},d={duration:this.options.animation,easing:this.options.easing,complete:d};if(g.isFunction(this.options.animationStepCallback))d.step=this.options.animationStepCallback;this.list.animate(f,d)}}},startAuto:function(a){if(a!==void 0)this.options.auto=a;if(this.options.auto===0)return this.stopAuto();if(this.timer===null){this.autoStopped= !1;var c=this;this.timer=window.setTimeout(function(){c.next()},this.options.auto*1E3)}},stopAuto:function(){this.pauseAuto();this.autoStopped=!0},pauseAuto:function(){if(this.timer!==null)window.clearTimeout(this.timer),this.timer=null},buttons:function(a,c){if(a==null&&(a=!this.locked&&this.options.size!==0&&(this.options.wrap&&this.options.wrap!="first"||this.options.size===null||this.last<this.options.size),!this.locked&&(!this.options.wrap||this.options.wrap=="first")&&this.options.size!==null&& this.last>=this.options.size))a=this.tail!==null&&!this.inTail;if(c==null&&(c=!this.locked&&this.options.size!==0&&(this.options.wrap&&this.options.wrap!="last"||this.first>1),!this.locked&&(!this.options.wrap||this.options.wrap=="last")&&this.options.size!==null&&this.first==1))c=this.tail!==null&&this.inTail;var b=this;this.buttonNext.size()>0?(this.buttonNext.unbind(this.options.buttonNextEvent+".jcarousel",this.funcNext),a&&this.buttonNext.bind(this.options.buttonNextEvent+".jcarousel",this.funcNext), this.buttonNext[a?"removeClass":"addClass"](this.className("jcarousel-next-disabled")).attr("disabled",a?!1:!0),this.options.buttonNextCallback!==null&&this.buttonNext.data("jcarouselstate")!=a&&this.buttonNext.each(function(){b.options.buttonNextCallback(b,this,a)}).data("jcarouselstate",a)):this.options.buttonNextCallback!==null&&this.buttonNextState!=a&&this.options.buttonNextCallback(b,null,a);this.buttonPrev.size()>0?(this.buttonPrev.unbind(this.options.buttonPrevEvent+".jcarousel",this.funcPrev), c&&this.buttonPrev.bind(this.options.buttonPrevEvent+".jcarousel",this.funcPrev),this.buttonPrev[c?"removeClass":"addClass"](this.className("jcarousel-prev-disabled")).attr("disabled",c?!1:!0),this.options.buttonPrevCallback!==null&&this.buttonPrev.data("jcarouselstate")!=c&&this.buttonPrev.each(function(){b.options.buttonPrevCallback(b,this,c)}).data("jcarouselstate",c)):this.options.buttonPrevCallback!==null&&this.buttonPrevState!=c&&this.options.buttonPrevCallback(b,null,c);this.buttonNextState= a;this.buttonPrevState=c},notify:function(a){var c=this.prevFirst===null?"init":this.prevFirst<this.first?"next":"prev";this.callback("itemLoadCallback",a,c);this.prevFirst!==this.first&&(this.callback("itemFirstInCallback",a,c,this.first),this.callback("itemFirstOutCallback",a,c,this.prevFirst));this.prevLast!==this.last&&(this.callback("itemLastInCallback",a,c,this.last),this.callback("itemLastOutCallback",a,c,this.prevLast));this.callback("itemVisibleInCallback",a,c,this.first,this.last,this.prevFirst, this.prevLast);this.callback("itemVisibleOutCallback",a,c,this.prevFirst,this.prevLast,this.first,this.last)},callback:function(a,c,b,d,f,j,e){if(!(this.options[a]==null||typeof this.options[a]!="object"&&c!="onAfterAnimation")){var h=typeof this.options[a]=="object"?this.options[a][c]:this.options[a];if(g.isFunction(h)){var i=this;if(d===void 0)h(i,b,c);else if(f===void 0)this.get(d).each(function(){h(i,this,d,b,c)});else for(var a=function(a){i.get(a).each(function(){h(i,this,a,b,c)})},k=d;k<=f;k++)k!== null&&!(k>=j&&k<=e)&&a(k)}}},create:function(a){return this.format("<li></li>",a)},format:function(a,c){for(var a=g(a),b=a.get(0).className.split(" "),d=0;d<b.length;d++)b[d].indexOf("jcarousel-")!=-1&&a.removeClass(b[d]);a.addClass(this.className("jcarousel-item")).addClass(this.className("jcarousel-item-"+c)).css({"float":this.options.rtl?"right":"left","list-style":"none"}).attr("jcarouselindex",c);return a},className:function(a){return a+" "+a+(!this.options.vertical?"-horizontal":"-vertical")}, dimension:function(a,c){var b=g(a);if(c==null)return!this.options.vertical?b.outerWidth(!0)||f.intval(this.options.itemFallbackDimension):b.outerHeight(!0)||f.intval(this.options.itemFallbackDimension);else{var d=!this.options.vertical?c-f.intval(b.css("marginLeft"))-f.intval(b.css("marginRight")):c-f.intval(b.css("marginTop"))-f.intval(b.css("marginBottom"));g(b).css(this.wh,d+"px");return this.dimension(b)}},clipping:function(){return!this.options.vertical?this.clip[0].offsetWidth-f.intval(this.clip.css("borderLeftWidth"))- f.intval(this.clip.css("borderRightWidth")):this.clip[0].offsetHeight-f.intval(this.clip.css("borderTopWidth"))-f.intval(this.clip.css("borderBottomWidth"))},index:function(a,c){if(c==null)c=this.options.size;return Math.round(((a-1)/c-Math.floor((a-1)/c))*c)+1}});f.extend({defaults:function(a){return g.extend(q,a||{})},intval:function(a){a=parseInt(a,10);return isNaN(a)?0:a},windowLoaded:function(){m=!0}});g.fn.jcarousel=function(a){if(typeof a=="string"){var c=g(this).data("jcarousel"),b=Array.prototype.slice.call(arguments, 1);return c[a].apply(c,b)}else return this.each(function(){var b=g(this).data("jcarousel");b?(a&&g.extend(b.options,a),b.reload()):g(this).data("jcarousel",new f(this,a))})}})(jQuery);
if(window.notifyScriptIsLoaded)notifyScriptIsLoaded('jquery.jcarousel.min.js');/*
 * Thickbox 3.1 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
      
var tb_pathToImage = "/store/resources/bosch/images/icons/ico_loading_thickbox.gif";
/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/
//on page load call tb_init
$(document).ready(function(){   
  tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
  imgLoader = new Image();// preload image
  imgLoader.src = tb_pathToImage;
});
//add thickbox to href & area elements that have a class of .thickbox
function tb_init(domChunk){
  $(domChunk).click(function(){
  var t = this.title || this.name || null;
  var a = this.href || this.alt;
  var g = this.rel || false;
  tb_show(t,a,g);
  this.blur();
  return false;
  });
}
function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link
  try {
    if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
      $("body","html").css({height: "100%", width: "100%"});
      $("html").css("overflow","hidden");
      if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
        $("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
        $("#TB_overlay").click(tb_remove);
      }
    }else{//all others
      if(document.getElementById("TB_overlay") === null){
        $("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
        $("#TB_overlay").click(tb_remove);
      }
    }
    
    if(tb_detectMacXFF()){
      $("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
    }else{
      $("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
    }
    
    if(caption===null){caption="";}
    $("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page
    $('#TB_load').show();//show loader
    
    var baseURL;
     if(url.indexOf("?")!==-1){ //ff there is a query string involved
      baseURL = url.substr(0, url.indexOf("?"));
     }else{ 
         baseURL = url;
     }
     
     var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
     var urlType = baseURL.toLowerCase().match(urlString);
    if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
        
      TB_PrevCaption = "";
      TB_PrevURL = "";
      TB_PrevHTML = "";
      TB_NextCaption = "";
      TB_NextURL = "";
      TB_NextHTML = "";
      TB_imageCount = "";
      TB_FoundURL = false;
      if(imageGroup){
        TB_TempArray = $("a[@rel="+imageGroup+"]").get();
        for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
          var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
            if (!(TB_TempArray[TB_Counter].href == url)) {            
              if (TB_FoundURL) {
                TB_NextCaption = TB_TempArray[TB_Counter].title;
                TB_NextURL = TB_TempArray[TB_Counter].href;
                TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>";
              } else {
                TB_PrevCaption = TB_TempArray[TB_Counter].title;
                TB_PrevURL = TB_TempArray[TB_Counter].href;
                TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; Prev</a></span>";
              }
            } else {
              TB_FoundURL = true;
              TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length);                      
            }
        }
      }
      imgPreloader = new Image();
      imgPreloader.onload = function(){    
      imgPreloader.onload = null;
        
      // Resizing large images - orginal by Christian Montoya edited by me.
      var pagesize = tb_getPageSize();
      var x = pagesize[0] - 150;
      var y = pagesize[1] - 150;
      var imageWidth = imgPreloader.width;
      var imageHeight = imgPreloader.height;
      if (imageWidth > x) {
        imageHeight = imageHeight * (x / imageWidth); 
        imageWidth = x; 
        if (imageHeight > y) { 
          imageWidth = imageWidth * (y / imageHeight); 
          imageHeight = y; 
        }
      } else if (imageHeight > y) { 
        imageWidth = imageWidth * (y / imageHeight); 
        imageHeight = y; 
        if (imageWidth > x) { 
          imageHeight = imageHeight * (x / imageWidth); 
          imageWidth = x;
        }
      }
      // End Resizing
      if(screen.width <= 1024){ // ARITHNEA: Hack for the resolution lower than 1024
        //alert("Original size: " + Math.round(imageWidth) + "x" + Math.round(imageHeight));
        var imageWidthResized = Math.round(screen.width/2);
        var ratio = imageWidthResized/imageWidth;
        imageWidth = imageWidthResized;
        imageHeight = Math.round(imageHeight*ratio);
        //alert("Resized to: " + Math.round(imageWidth) + "x" + Math.round(imageHeight));
      }
      
      TB_WIDTH = imageWidth; 
      TB_HEIGHT = imageHeight + 60;

     			$("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'><img src=\'../images/icons/OverlayCloseButton.png\' alt=\'close\' title=\'close\'/></a></div>"); 		
			$('<div id="fancy_bg"><div class="fancy_bg fancy_bg_n"></div><div class="fancy_bg fancy_bg_ne"></div><div class="fancy_bg fancy_bg_e"></div><div class="fancy_bg fancy_bg_se"></div><div class="fancy_bg fancy_bg_s"></div><div class="fancy_bg fancy_bg_sw"></div><div class="fancy_bg fancy_bg_w"></div><div class="fancy_bg fancy_bg_nw"></div></div>').prependTo("#TB_window");
			$(".TB_closeWindowButton").click(tb_remove);
      
      if (!(TB_PrevHTML === "")) {
        function goPrev(){
          if($(document).unbind("click",goPrev)){$(document).unbind("click",goPrev);}
          $("#TB_window").remove();
          $("body").append("<div id='TB_window'></div>");
          tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
          return false;  
        }
        $("#TB_prev").click(goPrev);
      }
      
      if (!(TB_NextHTML === "")) {    
        function goNext(){
          $("#TB_window").remove();
          $("body").append("<div id='TB_window'></div>");
          tb_show(TB_NextCaption, TB_NextURL, imageGroup);        
          return false;  
        }
        $("#TB_next").click(goNext);
        
      }
      document.onkeydown = function(e){   
        if (e == null) { // ie
          keycode = event.keyCode;
        } else { // mozilla
          keycode = e.which;
        }
        if(keycode == 27){ // close
          tb_remove();
        } else if(keycode == 190){ // display previous image
          if(!(TB_NextHTML == "")){
            document.onkeydown = "";
            goNext();
          }
        } else if(keycode == 188){ // display next image
          if(!(TB_PrevHTML == "")){
            document.onkeydown = "";
            goPrev();
          }
        }  
      };
      
      tb_position();
      $("#TB_load").remove();
      $("#TB_ImageOff").click(tb_remove);
      $("#TB_window").css({display:"block"}); //for safari using css instead of show
      };
      
      imgPreloader.src = url;
    }else{//code to show html
    
      
      var queryString = url.replace(/^[^\?]+\??/,'');
      var params = tb_parseQuery( queryString );
      TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL
      TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
                 
      if(screen.width <= 1024){ // ARITHNEA: Hack for the resolution lower than 1024
        //TB_WIDTH = screen.width - 200;
        //TB_WIDTH = 400;
        TB_HEIGHT = 340;
      }
      ajaxContentW = TB_WIDTH - 30;
      ajaxContentH = TB_HEIGHT - 45;
      
      if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window		
					urlNoQuery = url.split('TB_');
					$("#TB_iframeContent").remove();
					if(params['modal'] != "true"){//iframe no modal
						$("#TB_window").append("<div id='TB_Box'><div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'><img src=\'../images/icons/OverlayCloseButton.png\' alt=\'close\' title=\'close\'/></a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe></div>");
						$('<div id="fancy_bg"><div class="fancy_bg fancy_bg_n"></div><div class="fancy_bg fancy_bg_ne"></div><div class="fancy_bg fancy_bg_e"></div><div class="fancy_bg fancy_bg_se"></div><div class="fancy_bg fancy_bg_s"></div><div class="fancy_bg fancy_bg_sw"></div><div class="fancy_bg fancy_bg_w"></div><div class="fancy_bg fancy_bg_nw"></div></div>').prependTo("#TB_Box");
					}else{//iframe modal
					$("#TB_overlay").unbind();
						$("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>");
					}
      }else{// not an iframe, ajax
					if($("#TB_window").css("display") != "block"){
						if(params['modal'] != "true"){//ajax no modal
						$("#TB_window").append("<div id='TB_Box'><div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'><img src=\'../images/icons/OverlayCloseButton.png\' alt=\'close\' title=\'close\'/></a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div></div>");
						$('<div id="fancy_bg"><div class="fancy_bg fancy_bg_n"></div><div class="fancy_bg fancy_bg_ne"></div><div class="fancy_bg fancy_bg_e"></div><div class="fancy_bg fancy_bg_se"></div><div class="fancy_bg fancy_bg_s"></div><div class="fancy_bg fancy_bg_sw"></div><div class="fancy_bg fancy_bg_w"></div><div class="fancy_bg fancy_bg_nw"></div></div>').prependTo("#TB_Box");
						}else{//ajax modal
						$("#TB_overlay").unbind();
						$("#TB_window").append("<div id='TB_Box'><div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div></div>");	
						$('<div id="fancy_bg"><div class="fancy_bg fancy_bg_n"></div><div class="fancy_bg fancy_bg_ne"></div><div class="fancy_bg fancy_bg_e"></div><div class="fancy_bg fancy_bg_se"></div><div class="fancy_bg fancy_bg_s"></div><div class="fancy_bg fancy_bg_sw"></div><div class="fancy_bg fancy_bg_w"></div><div class="fancy_bg fancy_bg_nw"></div></div>').prependTo("#TB_Box");
						}
					}else{//this means the window is already up, we are just loading new content via ajax
						$("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
						$("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
						$("#TB_ajaxContent")[0].scrollTop = 0;
						$("#TB_ajaxWindowTitle").html(caption);
					}
			}
					
			$("#TB_closeWindowButton").click(tb_remove);
      
        if(url.indexOf('TB_inline') != -1){  
          $("#TB_ajaxContent").append($('#' + params['inlineId']).children());
          $("#TB_window").unload(function () {
            $('#' + params['inlineId']).append( $("#TB_ajaxContent").children() ); // move elements back when you're finished
          });
          tb_position();
          $("#TB_load").remove();
          $("#TB_window").css({display:"block"}); 
        }else if(url.indexOf('TB_iframe') != -1){
          tb_position();
          if($.browser.safari){//safari needs help because it will not fire iframe onload
            $("#TB_load").remove();
            $("#TB_window").css({display:"block"});
          }
        }else{
          $("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method
            tb_position();
            $("#TB_load").remove();
            tb_init("#TB_ajaxContent a.thickbox");
            $("#TB_window").css({display:"block"});
          });
        }
      
    }
    if(!params['modal']){
      document.onkeyup = function(e){   
        if (e == null) { // ie
          keycode = event.keyCode;
        } else { // mozilla
          keycode = e.which;
        }
        if(keycode == 27){ // close
          tb_remove();
        }  
      };
    }
    
  } catch(e) {
    //nothing here
  }
}
//helper functions below
function tb_showIframe(){
	$("#TB_load").remove();
	$("#TB_window").css({display:"block"});
	if (isIE) {
			$(".fancy_bg").fixPNG();
	}
}
function tb_remove() {
   $("#TB_imageOff").unbind("click");
  $(".TB_closeWindowButton").unbind("click");
  $("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});
  $("#TB_load").remove();
  if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
    $("body","html").css({height: "auto", width: "auto"});
    $("html").css("overflow","");
  }
  document.onkeydown = "";
  document.onkeyup = "";
  return false;
}
function tb_position() {
$("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
  if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
    if(screen.width <= 1024){ // ARITHNEA: Hack for resolution lower than 1024
      var fixBugMargin = parseInt((window.innerHeight/2 - 100),10); 
      $("#TB_window").css({marginTop: '-' + fixBugMargin + 'px'});
     }else{
      $("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
    }
  }
}
function tb_parseQuery ( query ) {
   var Params = {};
   if ( ! query ) {return Params;}// return empty object
   var Pairs = query.split(/[;&]/);
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('=');
      if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      Params[key] = val;
   }
   return Params;
}
function tb_getPageSize(){
  var de = document.documentElement;
  var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
  var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
  arrayPageSize = [w,h];
  return arrayPageSize;
}
function tb_detectMacXFF() {
  var userAgent = navigator.userAgent.toLowerCase();
  if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
    return true;
  }
}


// JavaScript Document
/*!
 * jQuery corner plugin: simple corner rounding
 * Examples and documentation at: http://jquery.malsup.com/corner/
 * version 2.11 (15-JUN-2010)
 * Requires jQuery v1.3.2 or later
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Authors: Dave Methvin and Mike Alsup
 */

/**
 *  corner() takes a single string argument:  $('#myDiv').corner("effect corners width")
 *
 *  effect:  name of the effect to apply, such as round, bevel, notch, bite, etc (default is round). 
 *  corners: one or more of: top, bottom, tr, tl, br, or bl.  (default is all corners)
 *  width:   width of the effect; in the case of rounded corners this is the radius. 
 *           specify this value using the px suffix such as 10px (yes, it must be pixels).
 */
;(function($) { 

var style = document.createElement('div').style,
    moz = style['MozBorderRadius'] !== undefined,
    webkit = style['WebkitBorderRadius'] !== undefined,
    radius = style['borderRadius'] !== undefined || style['BorderRadius'] !== undefined,
    mode = document.documentMode || 0,
    noBottomFold = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8),

    expr = $.browser.msie && (function() {
        var div = document.createElement('div');
        try { div.style.setExpression('width','0+0'); div.style.removeExpression('width'); }
        catch(e) { return false; }
        return true;
    })();

$.support = $.support || {};
$.support.borderRadius = moz || webkit || radius; // so you can do:  if (!$.support.borderRadius) $('#myDiv').corner();

function sz(el, p) { 
    return parseInt($.css(el,p))||0; 
};
function hex2(s) {
    var s = parseInt(s).toString(16);
    return ( s.length < 2 ) ? '0'+s : s;
};
function gpc(node) {
    while(node) {
        var v = $.css(node,'backgroundColor'), rgb;
        if (v && v != 'transparent' && v != 'rgba(0, 0, 0, 0)') {
            if (v.indexOf('rgb') >= 0) { 
                rgb = v.match(/\d+/g); 
                return '#'+ hex2(rgb[0]) + hex2(rgb[1]) + hex2(rgb[2]);
            }
            return v;
        }
        if (node.nodeName.toLowerCase() == 'html')
            break;
        node = node.parentNode; // keep walking if transparent
    }
    return '#ffffff';
};

function getWidth(fx, i, width) {
    switch(fx) {
    case 'round':  return Math.round(width*(1-Math.cos(Math.asin(i/width))));
    case 'cool':   return Math.round(width*(1+Math.cos(Math.asin(i/width))));
    case 'sharp':  return Math.round(width*(1-Math.cos(Math.acos(i/width))));
    case 'bite':   return Math.round(width*(Math.cos(Math.asin((width-i-1)/width))));
    case 'slide':  return Math.round(width*(Math.atan2(i,width/i)));
    case 'jut':    return Math.round(width*(Math.atan2(width,(width-i-1))));
    case 'curl':   return Math.round(width*(Math.atan(i)));
    case 'tear':   return Math.round(width*(Math.cos(i)));
    case 'wicked': return Math.round(width*(Math.tan(i)));
    case 'long':   return Math.round(width*(Math.sqrt(i)));
    case 'sculpt': return Math.round(width*(Math.log((width-i-1),width)));
    case 'dogfold':
    case 'dog':    return (i&1) ? (i+1) : width;
    case 'dog2':   return (i&2) ? (i+1) : width;
    case 'dog3':   return (i&3) ? (i+1) : width;
    case 'fray':   return (i%2)*width;
    case 'notch':  return width; 
    case 'bevelfold':
    case 'bevel':  return i+1;
    }
};

$.fn.corner = function(options) {
    // in 1.3+ we can fix mistakes with the ready state
    if (this.length == 0) {
        if (!$.isReady && this.selector) {
            var s = this.selector, c = this.context;
            $(function() {
                $(s,c).corner(options);
            });
        }
        return this;
    }

    return this.each(function(index){
        var $this = $(this),
            // meta values override options
            o = [$this.attr($.fn.corner.defaults.metaAttr) || '', options || ''].join(' ').toLowerCase(),
            keep = /keep/.test(o),                       // keep borders?
            cc = ((o.match(/cc:(#[0-9a-f]+)/)||[])[1]),  // corner color
            sc = ((o.match(/sc:(#[0-9a-f]+)/)||[])[1]),  // strip color
            width = parseInt((o.match(/(\d+)px/)||[])[1]) || 10, // corner width
            re = /round|bevelfold|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dogfold|dog/,
            fx = ((o.match(re)||['round'])[0]),
            fold = /dogfold|bevelfold/.test(o),
            edges = { T:0, B:1 },
            opts = {
                TL:  /top|tl|left/.test(o),       TR:  /top|tr|right/.test(o),
                BL:  /bottom|bl|left/.test(o),    BR:  /bottom|br|right/.test(o)
            },
            // vars used in func later
            strip, pad, cssHeight, j, bot, d, ds, bw, i, w, e, c, common, $horz;
        
        if ( !opts.TL && !opts.TR && !opts.BL && !opts.BR )
            opts = { TL:1, TR:1, BL:1, BR:1 };
            
        // support native rounding
        if ($.fn.corner.defaults.useNative && fx == 'round' && (radius || moz || webkit) && !cc && !sc) {
            if (opts.TL)
                $this.css(radius ? 'border-top-left-radius' : moz ? '-moz-border-radius-topleft' : '-webkit-border-top-left-radius', width + 'px');
            if (opts.TR)
                $this.css(radius ? 'border-top-right-radius' : moz ? '-moz-border-radius-topright' : '-webkit-border-top-right-radius', width + 'px');
            if (opts.BL)
                $this.css(radius ? 'border-bottom-left-radius' : moz ? '-moz-border-radius-bottomleft' : '-webkit-border-bottom-left-radius', width + 'px');
            if (opts.BR)
                $this.css(radius ? 'border-bottom-right-radius' : moz ? '-moz-border-radius-bottomright' : '-webkit-border-bottom-right-radius', width + 'px');
            return;
        }
            
        strip = document.createElement('div');
        $(strip).css({
            overflow: 'hidden',
            height: '1px',
            minHeight: '1px',
            fontSize: '1px',
            backgroundColor: sc || 'transparent',
            borderStyle: 'solid'
        });
    
        pad = {
            T: parseInt($.css(this,'paddingTop'))||0,     R: parseInt($.css(this,'paddingRight'))||0,
            B: parseInt($.css(this,'paddingBottom'))||0,  L: parseInt($.css(this,'paddingLeft'))||0
        };

        if (typeof this.style.zoom != undefined) this.style.zoom = 1; // force 'hasLayout' in IE
        if (!keep) this.style.border = 'none';
        strip.style.borderColor = cc || gpc(this.parentNode);
        cssHeight = $(this).outerHeight();

        for (j in edges) {
            bot = edges[j];
            // only add stips if needed
            if ((bot && (opts.BL || opts.BR)) || (!bot && (opts.TL || opts.TR))) {
                strip.style.borderStyle = 'none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none');
                d = document.createElement('div');
                $(d).addClass('jquery-corner');
                ds = d.style;

                bot ? this.appendChild(d) : this.insertBefore(d, this.firstChild);

                if (bot && cssHeight != 'auto') {
                    if ($.css(this,'position') == 'static')
                        this.style.position = 'relative';
                    ds.position = 'absolute';
                    ds.bottom = ds.left = ds.padding = ds.margin = '0';
                    if (expr)
                        ds.setExpression('width', 'this.parentNode.offsetWidth');
                    else
                        ds.width = '100%';
                }
                else if (!bot && $.browser.msie) {
                    if ($.css(this,'position') == 'static')
                        this.style.position = 'relative';
                    ds.position = 'absolute';
                    ds.top = ds.left = ds.right = ds.padding = ds.margin = '0';
                    
                    // fix ie6 problem when blocked element has a border width
                    if (expr) {
                        bw = sz(this,'borderLeftWidth') + sz(this,'borderRightWidth');
                        ds.setExpression('width', 'this.parentNode.offsetWidth - '+bw+'+ "px"');
                    }
                    else
                        ds.width = '100%';
                }
                else {
                    ds.position = 'relative';
                    ds.margin = !bot ? '-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px' : 
                                        (pad.B-width)+'px -'+pad.R+'px -'+pad.B+'px -'+pad.L+'px';                
                }

                for (i=0; i < width; i++) {
                    w = Math.max(0,getWidth(fx,i, width));
                    e = strip.cloneNode(false);
                    e.style.borderWidth = '0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px';
                    bot ? d.appendChild(e) : d.insertBefore(e, d.firstChild);
                }
                
                if (fold && $.support.boxModel) {
                    if (bot && noBottomFold) continue;
                    for (c in opts) {
                        if (!opts[c]) continue;
                        if (bot && (c == 'TL' || c == 'TR')) continue;
                        if (!bot && (c == 'BL' || c == 'BR')) continue;
                        
                        common = { position: 'absolute', border: 'none', margin: 0, padding: 0, overflow: 'hidden', backgroundColor: strip.style.borderColor };
                        $horz = $('<div/>').css(common).css({ width: width + 'px', height: '1px' });
                        switch(c) {
                        case 'TL': $horz.css({ bottom: 0, left: 0 }); break;
                        case 'TR': $horz.css({ bottom: 0, right: 0 }); break;
                        case 'BL': $horz.css({ top: 0, left: 0 }); break;
                        case 'BR': $horz.css({ top: 0, right: 0 }); break;
                        }
                        d.appendChild($horz[0]);
                        
                        var $vert = $('<div/>').css(common).css({ top: 0, bottom: 0, width: '1px', height: width + 'px' });
                        switch(c) {
                        case 'TL': $vert.css({ left: width }); break;
                        case 'TR': $vert.css({ right: width }); break;
                        case 'BL': $vert.css({ left: width }); break;
                        case 'BR': $vert.css({ right: width }); break;
                        }
                        d.appendChild($vert[0]);
                    }
                }
            }
        }
    });
};

$.fn.uncorner = function() { 
    if (radius || moz || webkit)
        this.css(radius ? 'border-radius' : moz ? '-moz-border-radius' : '-webkit-border-radius', 0);
    $('div.jquery-corner', this).remove();
    return this;
};

// expose options
$.fn.corner.defaults = {
    useNative: true, // true if plugin should attempt to use native browser support for border radius rounding
    metaAttr:  'data-corner' // name of meta attribute to use for options
};
    
})(jQuery);
/*
 * ARITHNEA GmbH
 * Image Library Loader (loading image-files on demand)
 *
 * If an image tag has set the attribute altsrc instead src the noted
 * image of altsrc is loaded only after loadImagesInScope is called
 * (a load-is-in-progress image is used to signalize loading large images) 
*/
var ImgLoader = {   
    imgArray : [],
    imgIndex : 0,
    imgLoadedIndex : 0,
    /* replace image is only necessary if an img tag must have a dimension
       f.e. preventing js-errors using the jquery fancybox plugin */
    imgReplaceSrc : "/store/resources/bosch/images/backgrounds/transparent.gif",
    /* the loading image is shown as long as the image is not completely showable */
    imgLoadingSrc : "/store/resources/bosch/images/icons/facebox/loading.gif",
    imgLoadingPos : "50% 50%",
    /* if the image could not be loaded try it again */
    retryOnError  : 1,

    setReplaceImgSrc: function(src) {
        this.imgReplaceSrc = src;
    },
    
    setLoadingImgSrc: function(src, pos) {
        this.imgLoadingSrc = src;
        if (pos != null) {
            this.imgLoadingPos = pos;
        }
    },

    prepareAlternateImages: function() {
        var self = this;
        $("img[altsrc^='/']").each(function(){
            this.src = self.imgReplaceSrc;
        });
    },
        
    preloadImagesInScope: function(selector, delayed) {
        var self = this;
        $(selector).each(function(){
            if (delayed != null && delayed) {
                var scopeObj = this;
                setTimeout(function(){self.loadImagesInScope(scopeObj);}, 1);
            }
            else {
        		self.loadImagesInScope(this);
            }
        });
    },
        
    loadImagesInScope: function(scopeObj, delayed) {  
        if (delayed == null || delayed) {
            var self = this;
            setTimeout(function(){self.loadImagesInScopeImpl(scopeObj);}, 1);
        }
        else {
            this.loadImagesInScopeImpl(scopeObj);
        }         
    },
    
    loadImagesInScopeImpl: function(scopeObj) {       
        var found = false;   
        if (scopeObj != null && typeof(scopeObj) == "string") {
            scopeObj = $(scopeObj);
            if (scopeObj == null) {
                return;
            }
        }
        var self = this;
        $("img",scopeObj).each(function(){
            var altsrc = $(this).attr("altsrc");
            if (altsrc != null) {
                var src = $(this).attr("src");                 
                if (src == null || src == "" || src.indexOf(self.imgReplaceSrc) >= 0) {
                    this.onload = function() {
                        self.imgLoadedIndex++;
                        self.loadNextImage();    // load only one image at one time                        
                    };
                    this.onerror = function(e) { 
                        // try to reload once again on error
                        var imgObj = this;
                        if (imgObj.loadCounter == null) {
                            imgObj.loadCounter = self.retryOnError; // retry it once again
                        }
                        if (imgObj.loadCounter > 0) {
                            imgObj.loadCounter--;
                            setTimeout(function(){
                                var s = imgObj.src;
                                imgObj.src = s + ((s.indexOf('?')<0)?"?":"&") + "retryCounter=" + imgObj.loadCounter;
                            },1);
                        }
                        else if (imgObj.src.indexOf(self.imgReplaceSrc) < 0) {
                            // loading on error
                            imgObj.src = self.imgReplaceSrc; 
                        }
                    };
                    found = true;
                    self.imgArray.push({img:this,src:altsrc});
                }
            }
        });
        if (found) {
            setTimeout(function(){ self.loadNextImage(); }, 1);
        }
    },

    loadNextImage: function() {
        var idx = this.imgIndex; 
        if (this.imgIndex < this.imgArray.length) {
            this.imgIndex++;
            this.imgLoadedIndex = idx;
 
            var img = this.imgArray[idx].img;
            if (this.imgLoadingSrc != null) {
                $(img).css("background", "url('"+this.imgLoadingSrc+"') no-repeat " + this.imgLoadingPos);
            }
            var src = this.imgArray[idx].src;
            img.src = src;
        }                    
    },
    
    areAllImagesLoaded: function() {
        return (this.imgIndex >= this.imgArray.length && this.imgLoadedIndex >= this.imgIndex);
    }    
};
/* * ARITHNEA GmbH * JavaScript Utilities*/// activate stylesheet with certain media typefunction setActiveStyleSheet(mediaType) {  var i, a, main;   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {     if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("media") == mediaType) {       a.disabled = false;       a.media='all';     }   }}// set all links target="_top" to target="_self" ; hint: include call at the end of the page function setLinkTargets() {    var oldTarget = '_top';    var newTarget = '_self';    var links = document.getElementsByTagName('a');    for (var i=0; i<links.length; i++) {        var link = links[i];        if (link.target == oldTarget) {          link.target = newTarget;          if (link.href.indexOf('?') == -1) {               link.href = link.href + '?KeepThis=true';          } else {               link.href = link.href + '&KeepThis=true';          }        }    }    return true;}// highlight a location in map with a red dot and location titlefunction highlightLocation () {     var loc = getParam('loc');     if(loc != 'undefined') {     	var spot = document.getElementById(loc);     	spot.className = 'spotSelected';     	spot.innerHTML = spot.title;     	spot.onmouseout  = function(){this.className = 'spot redspot';this.innerHTML='&nbsp;';};     	spot.onmouseover = function(){this.className = 'spotSelected';this.innerHTML=spot.title;};     }}// set boxes (e.g. teasers) to the same heightfunction setBoxHeight(id,matchClass) {	var tsr = $(id).find(matchClass);  // formerly: $(id).children('.tsrBoxL,.tsrBoxR')	var h = 0;	for(var i=0; i<tsr.size(); i++) {          var tsrH = tsr[i].offsetHeight;          if (tsrH > h) h = tsrH;     }	for(var i=0; i<tsr.size(); i++) {          tsr[i].style.height = h+'px';	}}// read heights of picture and text in stage and adjust stage heigth via css-class function setStageHeight(id) {	var pic = $(id).find('.imgSection');	var txt = $(id).find('.txtSection');	if(pic && txt) {		picH = pic.get(0).offsetHeight;		txtH = txt.get(0).offsetHeight;		if(txtH < picH) {               $(id).removeClass('templateStage');               txt.css('padding-bottom','500px');		}	}}var stageImgInit;var mmpc = 0;var showPic;function changeStagePic(pic,delay) {	// timeout function for little delay     clearTimeout(showPic);	showPic = setTimeout( function(){	    // find image to be changed         var stageImg = $('#mainMenu').find('img:first');	    var stageImgSrc = stageImg.attr('src');	    if(mmpc++ == 0) stageImgInit = stageImgSrc;	    if(pic != stageImgSrc) {	         // fade image out, change src, fade it in again              stageImg.fadeOut('slow',function(){                    stageImg.attr('src',pic);                    stageImg.fadeIn('slow');              });	    }	},delay);}// Overlay settings, this function should be called onloadvar overlayParam  = getParam('KeepThis');var overlayScroll = getParam('noScroll');var allowSetLinkTargets = true;function loadOverlay(){     /* activate overlay css by url parameter */ 	if(overlayParam=='true'){		//$(".toggleof").removeClass('closed');		setActiveStyleSheet('overlay');	}	if(overlayScroll=='true') document.getElementsByTagName('html')[0].style.overflow = 'auto';}// EVENTS Functions Start	// read GET-Parameter	function getParam(term){				HTTP_GET_VARS = new Array();		strGET = document.location.search.substr(1,document.location.search.length);		if(strGET!=''){		    var gArr=strGET.split('&');		    for(i=0;i<gArr.length;++i){		        var v='';		        var vArr=gArr[i].split('=');		        		        if(vArr.length>1){v=vArr[1];}		        HTTP_GET_VARS[unescape(vArr[0])]=unescape(v);		    }	    }		if(!HTTP_GET_VARS[term]){return 'undefined';}		return HTTP_GET_VARS[term];	}		function getElementsByClass(className){       var class_arr = new Array();       var all_tags = document.getElementsByTagName("*");       for(var i=0; i<all_tags.length; i++){         if(all_tags[i].className.indexOf(className) != -1) class_arr.push(all_tags[i]);       }       return class_arr;     }     function show(obj){          obj.style.display = "";          return true;     }     function hide(obj){          obj.style.display = "none";          return true;     }	      function showHideEvent(blockName,box,layer,page) {          		  var className = layer;		  var defaultpage = page;          var blocks = getElementsByClass(blockName); // all rows with outer class "events"          var shows = getElementsByClass(className); // all rows where checkbox is checked          var allBoxes = document.event_selector.eventselect;		  var resultCounter = 0;		            // reset Filter          if(className == '') {		   for(var i=0; i<blocks.length; i++){               show(blocks[i]);           }		   for(var i=0; i<allBoxes.length; i++){				allBoxes[i].checked = false;			}	    	window.location = defaultpage;	      	      //set Filter	          } else {          	                  for(var i=0; i<blocks.length; i++){										hide(blocks[i]);               }			   			   for(var i=0; i<allBoxes.length; i++){					if(allBoxes[i].checked){						//alert(allBoxes[i].id);						shows = getElementsByClass(allBoxes[i].id);						for(var j=0; j<shows.length; j++){							show(shows[j]);					    }					}				}				// if none is checked, show all rows			   var isChecked = false;          	   for(var i=0; i<allBoxes.length; i++){          	   		if(allBoxes[i].checked){isChecked = true};          	   }          	   if(!isChecked){	 			   for(var i=0; i<allBoxes.length; i++){						shows = getElementsByClass(allBoxes[i].id);						for(var j=0; j<shows.length; j++){							show(shows[j]);					    }					}         	   	          	   }          }		  for(var i=0; i<blocks.length; i++){				if(blocks[i].style.display == ""){resultCounter++;}				//alert(blocks[i].style.display);		  }		  var allCounters = getElementsByClass("eventResultCounter");		  for(var i=0; i<allCounters.length; i++){									allCounters[i].innerHTML = resultCounter;          }		  if(resultCounter==0){show(document.getElementById("noresult"));}		  else{hide(document.getElementById("noresult"));}	     //document.getElementById("eventResultCounter").innerHTML = resultCounter;          return false;          }        // all checked Checkboxes are deliverd as GET-Parameter String	function getAllChecked(){		var paramString = "";		var allBoxes = document.event_selector.eventselect;	   for(var i=0; i<allBoxes.length; i++){			if(allBoxes[i].checked){				var divider = "&";				if(paramString.length > 0){divider = "&";};				paramString = paramString + divider + allBoxes[i].id + "=true";			}		}		return paramString;			}		// initial Filter setting via GET-Parameter	function setChecked(){		// set Federal State	   document.event_selector.eventStateFilter.selectedIndex = getParam("fstate");		   	   var allBoxes = document.event_selector.eventselect;	   var isChecked = false;	   for(var i=0; i<allBoxes.length; i++){	   		if(getParam(allBoxes[i].id) == "true"){				isChecked = true;			}	   }	   // only if any Checkbox is checked, do hide/show	   if(isChecked){	   	   // set all DIVS hidden		   for(var i=0; i<allBoxes.length; i++){				blocks = getElementsByClass(allBoxes[i].id);				for(var j=0; j<blocks.length; j++){					hide(blocks[j]);			    }		   }		   for(var i=0; i<allBoxes.length; i++){		  			  		 	if(getParam(allBoxes[i].id) == "true"){					// set DIVs with Checkboxes checked visible					allBoxes[i].checked = true;					shows = getElementsByClass(allBoxes[i].id);					for(var j=0; j<shows.length; j++){						show(shows[j]);				    }				}			}		}	}			// Change Federal Country via Dropdown + GET-Parameter with Filterinformation	function changeLocation(obj) {		window.location = obj.value + "?fstate=" + obj.selectedIndex + getAllChecked();	}	// EVENTS Functions Endfunction ie8SafePreventEvent(e){    if(e.preventDefault){       e.preventDefault();      window.history.go(-1);      }    else{      window.history.go(-1);    };    e.returnValue = false;    e.stopPropagation();  }(function($){
	/* hoverIntent by Brian Cherne */
	$.fn.hoverIntent = function(f,g) {
		// default configuration options
		var cfg = {
			sensitivity: 7,
			interval: 100,
			timeout: 0
		};
		// override configuration options with user supplied object
		cfg = $.extend(cfg, g ? { over: f, out: g } : f );

		// instantiate variables
		// cX, cY = current X and Y position of mouse, updated by mousemove event
		// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
		var cX, cY, pX, pY;

		// A private function for getting mouse position
		var track = function(ev) {
			cX = ev.pageX;
			cY = ev.pageY;
		};

		// A private function for comparing current and previous mouse position
		var compare = function(ev,ob) {
			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
			// compare mouse positions to see if they've crossed the threshold
			if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
				$(ob).unbind("mousemove",track);
				// set hoverIntent state to true (so mouseOut can be called)
				ob.hoverIntent_s = 1;
				return cfg.over.apply(ob,[ev]);
			} else {
				// set previous coordinates for next time
				pX = cX; pY = cY;
				// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
				ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
			}
		};

		// A private function for delaying the mouseOut function
		var delay = function(ev,ob) {
			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
			ob.hoverIntent_s = 0;
			return cfg.out.apply(ob,[ev]);
		};

		// A private function for handling mouse 'hovering'
		var handleHover = function(e) {
			// next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
			var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
			while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
			if ( p == this ) { return false; }

			// copy objects to be passed into t (required for event object to be passed in IE)
			var ev = jQuery.extend({},e);
			var ob = this;

			// cancel hoverIntent timer if it exists
			if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }

			// else e.type == "onmouseover"
			if (e.type == "mouseover") {
				// set "previous" X and Y position based on initial entry point
				pX = ev.pageX; pY = ev.pageY;
				// update "current" X and Y position based on mousemove
				$(ob).bind("mousemove",track);
				// start polling interval (self-calling timeout) to compare mouse coordinates over time
				if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}

			// else e.type == "onmouseout"
			} else {
				// unbind expensive mousemove event
				$(ob).unbind("mousemove",track);
				// if hoverIntent state is true, then call the mouseOut function after the specified delay
				if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
			}
		};

		// bind the function to the two event listeners
		return this.mouseover(handleHover).mouseout(handleHover);
	};
	
})(jQuery);
/*
 * Superfish v1.4.8 - jQuery menu widget
 * Copyright (c) 2008 Joel Birch
 *
 * Dual licensed under the MIT and GPL licenses:
 * 	http://www.opensource.org/licenses/mit-license.php
 * 	http://www.gnu.org/licenses/gpl.html
 *
 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
 */

;(function($){
	$.fn.superfish = function(op){
    var delayTimer = 2000;
		var sf = $.fn.superfish,
			c = sf.c,
			$arrow = $(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),
			over = function(){        
        var $$ = $(this), menu = getMenu($$);
				clearTimeout(menu.sfTimer);
				$$.showSuperfishUl().siblings().hideSuperfishUl();
			},
			out = function(){
	
				var $$ = $(this), menu = getMenu($$), o = sf.op;
				clearTimeout(menu.sfTimer);
				menu.sfTimer=setTimeout(function(){
					o.retainPath=($.inArray($$[0],o.$path)>-1);
					$$.hideSuperfishUl();
					if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);} 		
				
        },o.delay);	
			},
			getMenu = function($menu){
				var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
				sf.op = sf.o[menu.serial];
				return menu;
			},
			addArrow = function($a){ $a.addClass(c.anchorClass)};//.append($arrow.clone()); };
			
		return this.each(function() {
			var s = this.serial = sf.o.length;
			var o = $.extend({},sf.defaults,op);
			o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
				$(this).addClass([o.hoverClass,c.bcClass].join(' '))
					.filter('li:has(ul)').removeClass(o.pathClass);
			});
			sf.o[s] = sf.op = o;
			
			$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
				if (o.autoArrows) addArrow( $('>a:first-child',this) );
			})
			.not('.'+c.bcClass)
				.hideSuperfishUl();
			
			var $a = $('a',this);
			$a.each(function(i){
				var $li = $a.eq(i).parents('li');
				$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
			});
			o.onInit.call(this);
			
		}).each(function() {
			var menuClasses = [c.menuClass];
			if (sf.op.dropShadows  && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
			$(this).addClass(menuClasses.join(' '));
		});
	};

	var sf = $.fn.superfish;
	sf.o = [];
	sf.op = {};
	sf.IE7fix = function(){
		var o = sf.op;
		if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
			this.toggleClass(sf.c.shadowClass+'-off');
		};
	sf.c = {
		bcClass     : 'sf-breadcrumb',
		menuClass   : 'sf-js-enabled',
		anchorClass : 'sf-with-ul',
		arrowClass  : 'sf-sub-indicator',
		shadowClass : 'sf-shadow'
	};
	sf.defaults = {
		hoverClass	: 'onTop',
		pathClass	: 'overideThisToUse',
		pathLevels	: 1,
		delay		: 800,
		animation	: {opacity:'show'},
		speed		: 'normal',
		autoArrows	: true,
		dropShadows : true,
		disableHI	: false,		// true disables hoverIntent detection
		onInit		: function(){}, // callback functions
		onBeforeShow: function(){	 jQuery('li').removeClass('iehover');},
		onShow		: function(){$('li.onTop').addClass('iehover');},
		onHide		: function(){}
	};
	$.fn.extend({
		hideSuperfishUl : function(){
			var o = sf.op,
				not = (o.retainPath===true) ? o.$path : '';
			o.retainPath = false;
			var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
					.find('>ul').hide().css('visibility','hidden');
			o.onHide.call($ul);
			return this;
		},
		showSuperfishUl : function(){
			var o = sf.op,
				sh = sf.c.shadowClass+'-off',
				$ul = this.addClass(o.hoverClass)
					.find('>ul:hidden').css('visibility','visible');
			sf.IE7fix.call($ul);
			o.onBeforeShow.call($ul);
			$ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
			return this;
		}
	});

})(jQuery);
/*Call Expandable Plugin*/
/*  
* $('.toggle').bind('mouseup',function(){
* $(this).toggleClass('toggledwn')
* $(this).expandableBosch({
*	collapsing: "false",
*	classToggle: "div.expandable",  //class of wrapper
*	contToggle:	 "div.toggleof",		// content to toogle
*	contItem: "toggledwn",
*  time: 800
*	});
*}); 
*
*/

(function($){
jQuery.fn.expandableBosch = function(options) {
  // Vorgabewerte definieren und �berschreiben mit optionen

	var defaultPara = jQuery.extend({
		eventClass:  ".toggle",
		collapsing: "false",     
		classToggle: "", 		 //class of wrapper
		contToggle:	 "",		// content to toogle
		contItem: "toggledwn",
		time: 800
		
	}, options);
	
	var bodyT = $(this).closest(defaultPara.classToggle).find(defaultPara.contToggle);

	if (bodyT.is(':hidden')) 
	{
		if(defaultPara.collapsing == "true")
		{	
			$(this).parents().find(defaultPara.contToggle).stop(true).slideUp(defaultPara.time).parent(defaultPara.classToggle).find(defaultPara.eventClass).addClass(defaultPara.contItem);
			
		}
		bodyT.slideDown(defaultPara.time).parent(defaultPara.classToggle).find(defaultPara.eventClass).removeClass(defaultPara.contItem);
  //  	bodyT.animate({height:'toggle'}, 1000).parent(defaultPara.classToggle).find(defaultPara.eventClass).removeClass(defaultPara.contItem);	
  	 
	}
	else {
	bodyT.slideUp(defaultPara.time);
	}
};

})(jQuery);


(function($){
// Gloabal Variables for Timeoutfunctions
//*****************************************	
	var tooltip_hide;	//Tooltip
	var tooltip_show;
	
	var pToolTimeOut;	//Tooltip Stage
	var pToolTimeIn;
//*****************************************
	jQuery.fn.tooltipWCMS = function(options) {
    // Vorgabewerte definieren und �berschreiben mit optionen

	var defaultPara = jQuery.extend({
		current: "",     
		tooltip_icon: "false", 		 //sign which kind of tooltip
		tooltipWidth:	 "392px",		// set the width for the tooltip
		evClientX: "0",					// this one must be set for dimension of window
		fooOffset: "",
		wrapperClass: "",				// Class of wrapper is needed if you want to calculate a shadow
		ttClass: ".ie",
		evType: "",
		timeout_ttin: "500",					// var for timeout
		timeout_ttout: "500",
		posLeft: 0,						
		posTop: 0,
		time: 800
		}, options);
	

	
	function overMouse()	
	{
	   if(parseInt( defaultPara.evClientX - (document.documentElement.clientWidth - 1000)/2) > 720)
	   {
	    $(defaultPara.wrapperClass).css("width","257px");
	   tooltipWidth = "257px"; 
	    }
	    else  if(parseInt( defaultPara.evClientX - (document.documentElement.clientWidth - 1000)/2) > 600) 
	    {
	      $(defaultPara.wrapperClass).css("width","378px");
	    }
	    
	    else
	    {
	      $(defaultPara.wrapperClass).css("width","392px");
	    }
	    
	    $.each($(defaultPara.ttClass),function(index){  
			           
	     $(defaultPara.ttClass).eq(index).removeClass('tooltip_active').removeClass('tooltipVisible').addClass('tooltipHidden');
		  
	      if(index == defaultPara.current)
		  {
		  clearTimeout(tooltip_hide);
	  
		tooltip_show = setTimeout( function() {
			
			if(defaultPara.tooltip_icon == "true")
	        { 
				
	        jQuery(defaultPara.ttClass).eq(defaultPara.current).css({'top': defaultPara.fooOffset.top + 22 + defaultPara.posTop, 'left' : defaultPara.fooOffset.left - 12 + defaultPara.posLeft});
	        }
		   else
		   {
			   
	       jQuery(defaultPara.ttClass).eq(defaultPara.current).css({'top': defaultPara.fooOffset.top + 28});
	       jQuery(defaultPara.ttClass).eq(defaultPara.current).css({'top': defaultPara.fooOffset.top + 28 + defaultPara.posTop, 'left' : defaultPara.fooOffset.left - 7 + defaultPara.posLeft});
	        }
	     jQuery(defaultPara.ttClass).eq(defaultPara.current).removeClass("tooltipHidden");
	     jQuery(defaultPara.ttClass).eq(defaultPara.current).addClass('tooltipVisible');
	     jQuery(defaultPara.ttClass).eq(defaultPara.current).addClass("tooltip_active");
	     shadow_height = jQuery(defaultPara.ttClass).eq(defaultPara.current).find('span.top').next().height() + 35;
	     shadow_width = jQuery(defaultPara.ttClass).eq(defaultPara.current).find('span.top').next().width() + 20;
	     jQuery(defaultPara.ttClass).eq(defaultPara.current).find('div.tooltip_shadow').css({'width': shadow_width, 'height': shadow_height});
	        },defaultPara.timeout_ttin ); // end Timeout Tooltip_show
	     }
	  });
	}   

	 function overMouseTT()
	 {
	        clearTimeout(tooltip_hide);
	     
	        if(defaultPara.tooltip_icon == "true")
	        {
	        jQuery(defaultPara.ttClass).eq(defaultPara.current).addClass("tooltipVisible");
	        }
	      
	        jQuery(defaultPara.ttClass).eq(defaultPara.current).removeClass("tooltipHidden");
	        jQuery(defaultPara.ttClass).eq(defaultPara.current).addClass("tooltip_active");
	   
	 } 
			  	
	 function outMouse()
	 {
	      clearTimeout(tooltip_show);
	      tooltip_hide = setTimeout( function() {
	      if(defaultPara.tooltip_icon == "true")
	      {
	    	  $(defaultPara.ttClass).removeClass('tooltip_active');
	      }
	    	  jQuery(defaultPara.ttClass).eq(defaultPara.current).removeClass("tooltipVisible");
	          jQuery(defaultPara.ttClass).eq(defaultPara.current).addClass("tooltipHidden");
	      }, defaultPara.timeout_ttout );
}
			
		function outMouseTT()
		{
		clearTimeout(tooltip_show);
		tooltip_hide = setTimeout( function() {
	      if(defaultPara.tooltip_icon == "true")
	      {
	      $(defaultPara.ttClass).removeClass('tooltip_active');         
	      }
	      	jQuery(defaultPara.ttClass).eq(defaultPara.current).removeClass("tooltipVisible");
	          jQuery(defaultPara.ttClass).eq(defaultPara.current).addClass("tooltipHidden");

	      },defaultPara.timeout_ttout);
		}
		
		if(defaultPara.evType == "overM")
		{
			overMouse();
		}
		else if(defaultPara.evType == "overTT")
		{
			overMouseTT();
		}
		else if(defaultPara.evType == "outM")
		{
			outMouse();
		}
		else if(defaultPara.evType =="outTT")
		{
			outMouseTT();
		}
		

		
};

})(jQuery);/* show/hide elements by id */
function toggleBlock(id) {
	var target = $('#' + id);

	if (target.is(':hidden')) {
		target.fadeIn();
	} else {
		target.fadeOut();
	}
}

/* show elements by id */
function showBlock(id) {                                                        
	var target = $('#' + id);
     target.fadeIn();
}

/* hide elements by id */
function hideBlock(id) {
	var target = $('#' + id);
     target.fadeOut();
}

/* show only element by id and hide all other elements with class .cntWrapper (content grids) */
function showOnlyBlock (id) {
	var delay = 333;
	var undisplay = $('.cntWrapper');
	for(var i=0; i<undisplay.length; i++) {
    if(undisplay[i].id != '') hideBlock(undisplay[i].id);
	}
	setTimeout(function(){ showBlock(id); }, delay);
}

/* show,hide elements by comma-separated id list */
function displayUndisplay (undisp,disp) {
	var delay = 333;
	var display   = disp.split(',');
	var undisplay = undisp.split(',');
	for(var i=0; i<undisplay.length; i++) hideBlock(undisplay[i]);
	setTimeout(function(){ for(var i=0; i<display.length; i++) showBlock(display[i]); }, delay);
}

//=======================================================================
//Playbutton Videoplayer
function centerPlayButton()
{
	$.each($('div.boschplayer_wrap'),function(){
		var new_top = $(this).find("img.back_img").height()/2 - $('img.playbutton').height()/2 ;
		var new_left = $(this).find('img.back_img').width()/2- $('img.playbutton').width()/2;
		
		$(this).find('img.playbutton').css('top', new_top);   
		$(this).find('img.playbutton').css('left', new_left);
		$(this).find('img.back_img').css("cursor","pointer");
		$(this).find("img.playbutton").css({'position':'absolute', 'cursor':'pointer'});	
	});
}

//=======================================================================
// Expandable
function initializeExpandables() {
	$('.tobeclosed').addClass("closed");
	$('.tobetoggledwn').addClass("toggledwn");

    $('.toggle').each(function(){
        if($(this).attr("expandInitialized") == "true") {
          return true;  // continue
        }
        $(this).attr("expandInitialized", "true");
        
        //Fix of collapsing Margin (expandable box)
        if($(this).attr("nomargincollapsing") != "true") {
            $(this).click(function(){
              centerPlayButton();
              if (navigator.appName.indexOf("Internet Explorer") != -1)
              {
                    if(navigator.userAgent.indexOf('MSIE 8')>0) 
                    { 
                     $(this).css("border-bottom","12px solid transparent");
                    }
                    else
                    {
                      $(this).css("border-bottom","2px solid transparent");
                    }
              }
            }); 
        }  
        /*Call Expandable Plugin*/
        if(navigator.userAgent.indexOf('MSIE 6')>0) 
        {     
          $(this).bind('mouseup',function(){
               $(this).toggleClass('toggledwn');
              
              if($(this).parent('div.expandable').find('div.toggleof').is(':visible'))
        					{	
                 $(this).parent('div.expandable').find('div.toggleof').css("display","none");
                } 
        					else
        					{ 
                  $(this).parent('div.expandable').find('div.toggleof').css("display","block");
                
                 }
          }); 
        } 
        else
        {
          $(this).bind('mouseup',function(){
        	  $(this).toggleClass('toggledwn')
        	  $(this).expandableBosch({
        		  collapsing: "false",
        		  classToggle: "div.expandable",  //class of wrapper
        		  contToggle:	 "div.toggleof",		// content to toogle
        		  contItem: "toggledwn",
        		  time: 1000
        	  });
          });     
        }
    });
}

// test auto-ready logic - call corner before DOM is ready
$('#readyTest').corner();
//=======================================================================  
  jQuery(document).ready(function($) {
//====================Fallback=========================================== 

  $('div.markerInfo').addClass('closed');                                                      
  $('div#map_canvas').removeClass('closed');
     
  $('#fallbackOpen').addClass('closed');
  $('#fallbackClose').removeClass('hidden');
	$('#fallbackOpen').addClass('closed');
  
  $('.boschplayer_wrap').find('img.playbutton').removeClass('closed');
  $('span.bRed').addClass('closed');
//====================Flyout add Class===========================================   
  var openMenue = 0;
     if($('ul').hasClass('flyout'))
      {$('ul.flyout').addClass('sf-menu');}
      if($('ul').hasClass('mmc'))
      {$('ul.mmc').addClass('sf-menu');}  
     
      jQuery(function(){
			jQuery('ul.sf-menu').superfish({
      speed:       timeout_menuein, 
      delay:       timeout_menueout
      });
		});                                                 
                                                    
 
//====================Fallback=========================================== 
// Clean Input Searchbox by first focus
var inputVal =  $('input.searchTopic').attr('value');
$('input.searchTopic').focus(function(){
if($('input.searchTopic').val()=== inputVal)
{
$(this).val("");
}
});
$('input.searchTopic').blur(function(){
if($('input.searchTopic').val()== "")
{
$(this).val(inputVal);
}
});
$('input#btnSearchSubmit').mousedown(function(){
if($('input.searchTopic').val()=== inputVal)
{
$('input.searchTopic').val("");
}
});


	/* JCarousel*/
//====================FUNCTION TO START THE CAROUSEL IN THE MIDDLE===========================================
if (navigator.appName.indexOf("Internet Explorer") != -1)
{
// Array definition for Tooltip Carousel Grid16 + Grid12 without SubNav IE
var array_pos16 =          new Array(43,158,273,388,503,610,733,848);
var array_pos16_uneven =   new Array(81,196,311,426,541,656,771);
var array_pos16_even =     new Array(159,264,379,494,619,724);   
var array_range16 =        new Array(184,301,416,533,648,765,880,953);
var array_range16_uneven = new Array(203,327,444,560,676,791,910);
var array_range16_even =   new Array(272,389,503,621,736,853);
}
else 
{
// Array definition for Tooltip Carousel Grid16 + Grid12 without SubNav
var array_pos16 =          new Array(83,198,313,428,543,650,773,888);
var array_pos16_uneven =   new Array(121,236,351,466,581,696,811);
var array_pos16_even =     new Array(189,304,419,534,659,764);   
var array_range16 =        new Array(184,301,416,533,648,765,880,953);
var array_range16_uneven = new Array(203,327,444,560,676,791,900);
var array_range16_even =   new Array(272,389,503,621,736,853);
}
var grid_width = 0; 
var center_pos = 0;
var center_cols = true;
var carousel_current = 0;
// Different position grid12
var diff_grid12 = 0;
var get_max = 0;
$.each($('div.jcarousel-skin-ie7'),function(i)
{	
var empty_li = 0;		
var even = 0;	
$(this).attr('index',i)  
// Maximum size of the carousel
// note: set class noCenterCols to prevent filling up the carousel with invisible items (causes js-error if no margins are set)
if(center_cols && !($(this).parent().hasClass('noCenterCols'))) {
	if($(this).parent().hasClass('cntBox col16')){ 
		get_max = 7; grid_width = 16; 
	} else if($(this).parent().hasClass('cntBox col12')){ 
		get_max = 5; grid_width = 12;
		if($('ul').hasClass('navSub')) {
			diff_grid12 = 249;   // Mausevent
		}
	}
	else if($(this).parent().hasClass('cntBox col8')){ 
		get_max = 3; grid_width = 8; diff_grid12 = 249;
	}
	array_pos16[3] = 395;

	var get_picture = $(this).find('li > div > img').length;
	if(get_picture%2 == 0) {
		even = 1;
	}
	center_pos =  get_max - get_picture;
} else {
	center_cols = false;
}

switch(grid_width)
{
case 16:    
     
switch(center_pos)
            {

            case 2:   $(this).find('ul').prepend("<li class='fillUp' style='width: 131px; border: none'></li>"); $(this).find('ul').append("<li class='fillUp' style='width: 2px; border: none'></li>"); break;
            case 4:   $(this).find('ul').prepend("<li class='fillUp' style='width: 249px; border: none'></li>"); $(this).find('ul').append("<li class='fillUp' style='width: 2px; border: none'></li>"); break;
            case 6:   $(this).find('ul').prepend("<li class='fillUp' style='width: 364px; border: none'></li>"); $(this).find('ul').append("<li class='fillUp' style='width: 2px; border: none'></li>"); break;
            case 1:   $(this).find('ul').prepend("<li class='fillUp' style='width: 79px; border: none'></li>");  $(this).find('ul').append("<li class='fillUp' style='width: 2px; border: none'></li>");break;
            case 3:   $(this).find('ul').prepend("<li class='fillUp' style='width: 194px; border: none'></li>"); $(this).find('ul').append("<li class='fillUp' style='width: 2px; border: none'></li>"); break;
            case 5:   $(this).find('ul').prepend("<li class='fillUp' style='width: 312px; border: none'></li>"); $(this).find('ul').append("<li class='fillUp' style='width: 2px; border: none'></li>"); break;
            case 0:   $(this).find('ul').prepend("<li class='fillUp' style='width: 11px; border: none'></li>"); $(this).find('ul').append("<li class='fillUp' style='width: 2px; border: none'></li>"); break;
            default: $(this).find('ul').append("<li class='fillUp' style='width: 60px; border: none'></li>"); $(this).find('ul').append("<li class='fillUp' style='width: 2px; border: none'></li>"); break;
            } break;
case 12:   
          
switch(center_pos)
            {    
            case 0:   $(this).find('ul').prepend("<li class='fillUp' style='width: 13px; border: none'></li>"); $(this).find('ul').append("<li class='fillUp' style='width: 2px; border: none'></li>");break;
            case 2:   $(this).find('ul').prepend("<li class='fillUp' style='width: 131px; border: none'></li>"); $(this).find('ul').append("<li class='fillUp' style='width: 2px; border: none'></li>"); break;
            case 4:   $(this).find('ul').prepend("<li class='fillUp' style='width: 250px; border: none;'></li>"); $(this).find('ul').append("<li class='fillUp' style='width: 2px; border: none'></li>"); break;
            case 1:   $(this).find('ul').prepend("<li class='fillUp' style='width: 77px; border: none'></li>"); $(this).find('ul').append("<li class='fillUp' style='width: 2px; border: none'></li>"); break;
            case 3:   $(this).find('ul').prepend("<li class='fillUp' style='width: 193px; border: none'></li>"); $(this).find('ul').append("<li class='fillUp' style='width: 2px; border: none'></li>"); break;
            default: $(this).find('ul').append("<li class='fillUp' style='width: 60px; border: none'></li>"); $(this).find('ul').append("<li class='fillUp' style='width: 2px; border: none'></li>"); break;
            
            } break;
case 8:               
switch(center_pos)
            {
             case 1:  $(this).find('ul').prepend("<li class='fillUp' style='width: 67px; border: none'></li>"); $(this).find('ul').append("<li class='fillUp' style='width: 2px; border: none'></li>"); break;
            case 2:   $(this).find('ul').prepend("<li class='fillUp' style='width: 121px; border: none'></li>"); $(this).find('ul').append("<li class='fillUp' style='width: 2px; border: none'></li>"); break;
            default:  $(this).find('ul').append("<li class='fillUp' style='width: 60px; border: none'></li>"); $(this).find('ul').append("<li class='fillUp' style='width: 3px; border: none'></li>"); break;
             
            }break;           
            
 }//end switch
     }); 
//=============================================================================================================

 //jQuery('.mycarousel').jcarousel();
 $.each($('.mycarousel'),function(index){
 	 if($(this).attr("autoCarouselControl") != "false") {
		 var options = {};
		 if($(this).attr("wrap") != null)
			 options.wrap = $(this).attr("wrap");
		 if($(this).attr("scroll") != null)
			 options.scroll = parseInt($(this).attr("scroll"));
		 if($(this).attr("size") != null)
			 options.size = parseInt($(this).attr("size"));
		 $(this).jcarousel(options);
 	 }
 });
 $.each($('li.fillUp'),function(index){
 widthFix = parseInt($(this).css("width"))-1;
 $(this).css("width",widthFix);
 }); 
//=================================================================

// Stage Pagination
//=================================================================
if($('div.cntStage').find('div').hasClass('anythingSlider'))
{

$('ul#stagePagination').removeClass('closed');
//====================================================================
	var pTool = new Array(-10,20,48,80,110);
	var pTipCont = new Array;
	var stagePagHeight =  $('.cntStage').css('height');
	var stagePagHeightDef = stagePagHeight;
	$.each($('div.cntStage').find('li.panel'),function(index){

	var panelHeight =  $(this).css('height');
	if (panelHeight > stagePagHeight) {
        stagePagHeight = panelHeight;
    }
    $(this).css("display","none");
    pNum = index + 1;
	  $('ul.thumbNav').append("<li><a class='panel' href='#'>" + pNum + "</a></li>");
 });
 if ($('ul#stagePagination').attr("autoHeight") == "true" && stagePagHeight > stagePagHeightDef) {
    $('ul#stagePagination').css("height", stagePagHeight);
 }
 $.each($('li.panel'),function(){
 $(this).find('.imgSection > img').css("height",stagePagHeight);
 $(this).find('.overlayL').addClass('addOverlay');
 $(this).find('.overlayR').addClass('addOverlay');
 });
	$('div.stagePaginationControl').append("<div class='pTool' style='top:20px; display: none; width: 392px; position: absolute;'><div class='tooltip_wrap'><div class='tooltip'><span class='top bgBlue75'></span><div class='bgBlue75 stageTip'></div></div></div><div class='tooltip_shadow'></div></div>");
	$('div.cntStage').css("overflow","visible");
	$('div.cntStage').find('li.panel').eq(0).css("display","block");
	 $('ul.thumbNav').find('li').eq(0).find('a').addClass('cur');
	 
	var stIsAnimated = 0;
	var stLastStage  = 0;
    var stFadingState = false;
    var stFadingTimer = null;
    
	$('a.panel').click(function(){
	    var self = this;
        setTimeout(function(){animateStagePagination(self);},1);
		return false;
	});

    function animateStagePagination(stagePanel) {

		if(stIsAnimated == $(stagePanel).text()) {
            return;	
        }
        
        // synchronize fading
        if (stFadingState) {
            if (stFadingTimer != null) {
                clearTimeout(stFadingTimer);
            }
            stFadingTimer = setTimeout(function(){animateStagePagination(stagePanel);},50);
            return;
        }
        stFadingState = true;

        vis_stage = parseInt($(stagePanel).text()) - 1;

		if (navigator.appName.indexOf("Internet Explorer") != -1)
		{   		  
			$('.addOverlay').fadeOut(200);

            var elmLastStage = $('div.cntStage').find('li.panel').eq(stLastStage);
            var elmCurStage = $('div.cntStage').find('li.panel').eq(vis_stage);
            
	    	$(elmLastStage).fadeOut(timeout_stageout, function() {
    		    $(elmCurStage).fadeIn(timeout_stagein/2, function(){ stFadingState=false; });
	    	});

	    	$('div.cntStage').find('.addOverlay').css("display","block");
		}
		else
		{                     
			$('div.cntStage').find('li.panel').fadeOut(timeout_stageout).eq(vis_stage).fadeIn(timeout_stagein,function(){ stFadingState=false; });
		}
		$('a.panel').removeClass('cur');
		$(stagePanel).addClass('cur');

		stIsAnimated = $(stagePanel).text(); 
		stLastStage = parseInt($(stagePanel).text()) - 1;
    }
	
	var pToolTimeOut;
	var pToolTimeIn;
	$('a.panel').hover(function(){
	clearTimeout(pToolTimeOut);
	vis_stage = parseInt($(this).text()) - 1;
 	if($('div.stageCntMain').eq(vis_stage).find('p').hasClass('stageTip'))
	{
  pToolTimeIn = setTimeout(function(){		
	$('div.pTool').css("display","block");	
	$('div.pTool').css("left",pTool[vis_stage]);

	$('div.stageTip').html($('div.stageCntMain').eq(vis_stage).find('p.stageTip').html())
	
  },600);
	}//end if
  },
	function(){
		clearTimeout(pToolTimeIn);
		pToolTimeOut = setTimeout(function(){
		$('div.pTool').css("display","none");	
	},500);	
	});
}// end if stagepag	
	//End Stagepagination
	//====================================================================

	// Stage Accordion  ; Open first entry 
	//====================================================================

	$.each($('li.items_acc'),function(index){
		 $('a.relatedLnk').addClass('hover');
      if(index == 0)
		  {
      $(this).attr('id',index);
      $(this).addClass('opened');
      $(this).find('a.accTag').addClass('hover opened');
      $(this).find('ul.accTag').css("display","block");
       $(this).find('a.accTag').addClass('enable');
      $('div.picWrapper').eq(index).css("display","block");
      }
      else{
        $(this).find('a.accTag').attr('class','').addClass('accTag enable');
        $(this).find('ul.accTag').css("display","none");
         $(this).find('a.accTag').addClass('closed');
         $('div.picWrapper').eq(index).css("display","none");	
    		$(this).attr('id',index);
           }
	});

	  var aniRun = 0;
    var time;
	$('li.items_acc').find('a.enable').click(function(){
     
     if($(this).hasClass('enable'))
     {     
        aniRun = 1;
     }
    if($(this).attr('class') == "hover opened current")
		{
		return false;
		}
		else
		{ 
    if(aniRun == 1)
    {
     aniRun = 0;
    $('li.items_acc').find('a.accTag').removeClass('enable');   
		$('div.picWrapper').fadeOut(500);
		$('li.items_acc').find('ul').css("display","none");//.slideUp();
		$('li.items_acc').removeClass('opened');
		$('li.items_acc').find('a.accTag').attr('class','closed');
		$(this).attr('class','hover opened current');
		$(this).parent('li').attr('class','items_acc opened');
    $(this).parent('li').find('ul').slideDown();	
    $('li.items_acc').find('ul').css("display","none");
		$('div.picWrapper').eq($(this).parent('li').attr('id')).fadeIn(timeout_acc);
    time = setTimeout(function(){
    $('li.items_acc').find('a').addClass('enable');
    },timeout_acc); 
    return false;
		 }
    }
     
	});

	
	$('li.items_acc').find('a.accTag').hover(function(){
	if($(this).parent('li').attr('class') == 'hover opened current')
	{
	return false;
	}
	else
	{
	$(this).addClass('hover');	
	}	
		
		
	}, function(){
		if($(this).parent('li').attr('class') == 'hover opened current')
		{
		return false;
		}
		else
		{
		$(this).removeClass('hover');	
		$(this).addClass('closed');
		}		
	});
//====================================================================
	if($('div').hasClass('gallery'));
	{     

	// Delete Fallback
  $('div.imgSection').removeClass('closed');
  $('div.txtSection').removeClass('closed');	
	$('a.sliderprev').removeClass('closed');
  $('a.slidernext').removeClass('closed');	
	
  $('div.Fallback').remove();
 
// Center Buttons in the middle of the Image 
  function centerButtons()
  {
  centerPos = ($('.slidercontainer').height()/2)-14;
   $('a.slidernext').css("top",centerPos);
   $('a.sliderprev').css("top",centerPos);

  }
    	function dotheSlidePrev(counter)
	{ 
		if(gallery_index!=0)
	{
	for(loop = 0;loop >  counter; loop--)
	  { 
	   $('div.slidercontainer').find('.gallery_txt').eq(gallery_index).css("display","none");
	  if(gallery_index != 0){
		  gallery_index -= 1;
		  $('a.slidernext').removeClass('disabled');
		  $('a.slidernextPag').removeClass('disabled');
		  $('a.slidernextPag').removeClass('inactive');
	  }
	  if(gallery_index == 0)
	  {
	  $('div.gallery').find('a.sliderprev').addClass('disabled');
	  $('div.gallery').find('a.sliderprevPag').addClass('disabled');
	  $('div.gallery').find('a.sliderprevPag').addClass('inactive');
	  }
	  
	  
	  $('div.slidercontainer').find('.gallery_txt').eq(gallery_index).css("display","block");
	  
	  $('div.slidercontainer').find('.gallery').eq(gallery_index).animate({
						opacity: 'toggle',
						width: 'toggle'
						}, 'slow');

	 }//end for
	$('div.gallery').find('div.paginatorDefault').find('a').removeClass('selected');
	  $('div.gallery').find('div.paginatorDefault').find('a').eq(gallery_index +1 ).addClass('selected'); 
	 if(pagination_items > 7)
	 {	 
	  updatePagination();
	 } 
	 } 
	}
    
	function dotheSlideNext(counter)
	{ 
	  for(loop = 1; loop <= counter ;loop++)
	  {

	  $('div.slidercontainer').find('.gallery_txt').eq(gallery_index).css("display","none");
	  $('div.slidercontainer').find('.gallery').eq(gallery_index).animate({
						opacity: 'toggle',
						width: 'toggle'   
						}, 'slow');
						
	  if(gallery_index != (gallery_item - 1)){
		  gallery_index += 1;
	  $('div.gallery').find('a.sliderprev').removeClass('disabled');
	  $('div.gallery').find('a.sliderprevPag').removeClass('disabled');
	  $('div.gallery').find('a.sliderprevPag').removeClass('inactive');
	  
	  }
	  if(gallery_index == (gallery_item - 1))
	  {
	  $('div.gallery').find('a.slidernext').addClass('disabled');
	  $('div.gallery').find('a.slidernextPag').addClass('disabled');
	  $('div.gallery').find('a.slidernextPag').addClass('inactive');
	  }
	  $('div.slidercontainer').find('.gallery_txt').eq(gallery_index).css("display","block");		

	  }
	  $('div.gallery').find('div.paginatorDefault').find('a').removeClass('selected');

	  $('div.gallery').find('div.paginatorDefault').find('a').eq(gallery_index + 1).addClass('selected');  
	  if(pagination_items > 7)
		 {	 
		  updatePagination();
		  
		 } 
	}
	function createImgMargin()
	{
		$.each($('.gallery').find('img'),function(){
			  if($('.imgSection.gallery').width() < $(this).width() )
			  {
			  $(this).css("height","auto");
        $(this).css("width",$('.imgSection.gallery').width());
        }
        
	//		imgMargin = (parseInt($('div.slidercontainer').css('height')) - parseInt($(this).css('height')))/2; 
		  	imgMargin = ($('div.slidercontainer').height() - $(this).height())/2;

			  $(this).css("margin-top",imgMargin);
        // Is needed to fix IE6 bug with controls
        $(this).css("margin-bottom",imgMargin); 	
			 
     
			  });
			 
		
	}
function refreshGlobal()
{

$.each($('a.relatedLnk.thickbox'),function(){
 var dtstr = $(this).attr('href');  
  
var start = dtstr.indexOf("height");
var end = dtstr.indexOf("&", start); 

var list = parseInt(dtstr.substring(start+7, end));

return list;
});

  }
  
    
  
  

	function createPagination(counter)
	{ 
	 $('a.slidernext').removeClass('disabled');
	  $('div.gallery').find('div.paginatorDefault').append("<a class='sliderprevPag inactive' href='#'>&lt;</a>");
	
    if(counter <= 7)
	  {
	    for(loop=1; loop <=counter;loop++)
	    {
	      $('div.gallery').find('div.paginatorDefault').append("<a href='#' class='contentPag'>" + loop + "</a>");
	    }// end for
	  }//end if
	  else
	  {
	  for(loop=1; loop <=counter;loop++)
	    {
	    if(loop>=1 && loop <= 2)
	      {
	       $('div.gallery').find('div.paginatorDefault').append("<a href='#' class='contentPag'>" + loop + "</a>");
	      }
	     else if(loop == 3 ) 
	      { 
	        $('div.gallery').find('div.paginatorDefault').append("<a href='#' class='contentPag'>...</a>");
	      }
	      else if((loop >= 4 ) && (loop <=6)) 
	      { 
	        $('div.gallery').find('div.paginatorDefault').append("<a href='#' class='contentPag' style='display:none;'>" + loop + "</a>");
	      }
	     else if(loop == counter) 
	      {
	      $('div.gallery').find('div.paginatorDefault').append("<a href='#' class='contentPag'>" + counter + "</a>");
	      }
	     
	    }
	  updatePagination();
	  }  
	    if(counter == 1)
	  {
      $('div.gallery').find('div.paginatorDefault').append("<a href='#' class='slidernextPag inactive disabled'>&gt;</a>");
      $('a.slidernext').addClass('disabled');
    }
    else
    {
	 $('div.gallery').find('div.paginatorDefault').append("<a href='#' class='slidernextPag'>&gt;</a>");  
	 }
  }
	
	function updatePagination()
	{ 
	 
	step = parseInt($('div.gallery').find('div.paginatorDefault').find('a.selected').text());
	step = gallery_index + 1;
	switch(step)
	{
case 1: $('div.gallery').find('div.paginatorDefault').find ('a').eq(0).removeClass('selected');
				$('div.gallery').find('div.paginatorDefault').find ('a').eq(1).css("display","inline").html("1").addClass('selected');
				$('div.gallery').find('div.paginatorDefault').find ('a').eq(2).css("display","inline").html("2").removeClass('selected');
    		  	$('div.gallery').find('div.paginatorDefault').find ('a').eq(3).css("display","inline").html("3").removeClass('selected');
    		 	$('div.gallery').find('div.paginatorDefault').find ('a').eq(4).css("display","inline").html("4").removeClass('selected');
			  	$('div.gallery').find('div.paginatorDefault').find ('a').eq(5).css("display","inline").html("5").removeClass('selected');
    		  	$('div.gallery').find('div.paginatorDefault').find ('a').eq(6).css("display","inline").html("...").removeClass('selected');
    		  	$('div.gallery').find('div.paginatorDefault').find ('a').eq(7).html(pagination_items).removeClass('selected');
    		  	$('div.gallery').find('div.paginatorDefault').find ('a').eq(8).removeClass('selected');
    		  	break;
	
	case 2:   	$('div.gallery').find('div.paginatorDefault').find ('a').eq(0).removeClass('selected');
				$('div.gallery').find('div.paginatorDefault').find ('a').eq(1).css("display","inline").html("1").removeClass('selected');
				$('div.gallery').find('div.paginatorDefault').find ('a').eq(2).css("display","inline").html("2").addClass('selected');
			  	$('div.gallery').find('div.paginatorDefault').find ('a').eq(3).css("display","inline").html("3").removeClass('selected');
			 	$('div.gallery').find('div.paginatorDefault').find ('a').eq(4).css("display","inline").html("4").removeClass('selected');
			  	$('div.gallery').find('div.paginatorDefault').find ('a').eq(5).css("display","inline").html("5").removeClass('selected');
			  	$('div.gallery').find('div.paginatorDefault').find ('a').eq(6).html("...").css("display","inline").removeClass('selected');
			  	$('div.gallery').find('div.paginatorDefault').find ('a').eq(7).html(pagination_items).removeClass('selected');
			  	$('div.gallery').find('div.paginatorDefault').find ('a').eq(8).removeClass('selected');
			  	break;
			  
	case 3:   	$('div.gallery').find('div.paginatorDefault').find ('a').eq(0).removeClass('selected');
				$('div.gallery').find('div.paginatorDefault').find ('a').eq(1).css("display","inline").html("1").removeClass('selected');
				$('div.gallery').find('div.paginatorDefault').find ('a').eq(2).css("display","inline").html("2").removeClass('selected');
			  	$('div.gallery').find('div.paginatorDefault').find ('a').eq(3).css("display","inline").html("3").addClass('selected');
			  	$('div.gallery').find('div.paginatorDefault').find ('a').eq(4).css("display","inline").html("4").removeClass('selected');
			  	$('div.gallery').find('div.paginatorDefault').find ('a').eq(5).css("display","inline").html("5").removeClass('selected');
			  	$('div.gallery').find('div.paginatorDefault').find ('a').eq(6).html("...").css("display","inline").removeClass('selected');
			  	$('div.gallery').find('div.paginatorDefault').find ('a').eq(7).html(pagination_items).removeClass('selected');
			  	$('div.gallery').find('div.paginatorDefault').find ('a').eq(8).removeClass('selected');

			    
			  	break;
			  	
	case 4:   	
				$('div.gallery').find('div.paginatorDefault').find ('a').eq(0).removeClass('selected');
				$('div.gallery').find('div.paginatorDefault').find ('a').eq(1).css("display","inline").html("1").removeClass('selected');
				$('div.gallery').find('div.paginatorDefault').find ('a').eq(2).css("display","inline").html("2").removeClass('selected');
			  	$('div.gallery').find('div.paginatorDefault').find ('a').eq(3).css("display","inline").html("3").removeClass('selected');
			  	$('div.gallery').find('div.paginatorDefault').find ('a').eq(4).css("display","inline").html("4").addClass('selected');
			  	$('div.gallery').find('div.paginatorDefault').find ('a').eq(5).css("display","inline").html("5").removeClass('selected');
			  	$('div.gallery').find('div.paginatorDefault').find ('a').eq(6).html("...").css("display","inline").removeClass('selected');
			  	$('div.gallery').find('div.paginatorDefault').find ('a').eq(7).html(pagination_items).removeClass('selected');
			  	$('div.gallery').find('div.paginatorDefault').find ('a').eq(8).removeClass('selected');
			    
			  	break;


	
	case (pagination_items-3):  $('div.gallery').find('div.paginatorDefault').find ('a').eq(0).removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(1).css("display","inline").html("1").removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(2).css("display","inline").html("...").removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(3).html(pagination_items -4).css("display","inline").removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(4).html(pagination_items -3).css("display","inline").addClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(5).html(pagination_items -2).css("display","inline").removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(6).html(pagination_items -1).css("display","inline").removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(7).html(pagination_items).removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(8).removeClass('selected');
							
								break;
	
	case (pagination_items-2):  $('div.gallery').find('div.paginatorDefault').find ('a').eq(0).removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(1).css("display","inline").html("1").removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(2).css("display","inline").html("...").removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(3).html(pagination_items -4).css("display","inline").removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(4).html(pagination_items -3).css("display","inline").removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(5).html(pagination_items -2).css("display","inline").addClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(6).html(pagination_items -1).css("display","inline").removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(7).html(pagination_items).removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(8).removeClass('selected');
						
								break;
			  	
			  	
	case (pagination_items-1):  $('div.gallery').find('div.paginatorDefault').find ('a').eq(0).removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(1).css("display","inline").html("1").removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(2).css("display","inline").html("...").removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(3).css("display","inline").html(pagination_items -4).removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(4).css("display","inline").html(pagination_items -3).removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(5).html(pagination_items -2).css("display","inline").removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(6).html(pagination_items -1).css("display","inline").addClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(7).html(pagination_items).removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(8).removeClass('selected');
							
								break;
			  	
			  	
	case pagination_items:   	$('div.gallery').find('div.paginatorDefault').find ('a').eq(0).removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(1).css("display","inline").html("1").removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(2).css("display","inline").html("...").removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(3).html(pagination_items -4).css("display","inline").removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(4).html(pagination_items -3).css("display","inline").removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(5).html(pagination_items -2).css("display","inline").removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(6).html(pagination_items -1).css("display","inline").removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(7).html(pagination_items).addClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(8).removeClass('selected');
				
								break;
	default: 					$('div.gallery').find('div.paginatorDefault').find ('a').eq(0).removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(1).css("display","inline").html("1").removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(2).css("display","inline").html("...").removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(3).css("display","inline").html(step - 1).removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(4).css("display","inline").html(step).addClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(5).html(step + 1).css("display","inline").removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(6).html("...").css("display","inline").removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(7).html(pagination_items).removeClass('selected');
								$('div.gallery').find('div.paginatorDefault').find ('a').eq(8).removeClass('selected');
							
								break;		
	
	}
	  
	}        

	var paginatorMargin = new Array("78px","72px","60px","47px","41px","35px","24px");
	
  var gallery_item =  $('div.slidercontainer').find('.gallery_txt').length;
	var gallery_index = 0;
  var global_height =  refreshGlobal(); 
 
	  $.each($('.gallery'),function(){   
	  $(this).next('div.txtSection').css("display","none");
    
    if($(this).find('img').height() > global_height)
	   {
    
	    global_height = $(this).find('img').css('height');
	    global_height = $(this).find('img').height();

	   } 
	  });
	 
	  _wait = setTimeout(function(){
   

	 $('div.slidercontainer').find('.gallery').eq(gallery_index).next('div').css("display","block"); 
   $('div.gallery').css("height",global_height);
   $('div.slidercontainer').find('.imgSection').css("height",$('div.gallery').css("height"));
    $('div.slidercontainer').find('.gallery_txt').css("height",$('div.gallery').height());
 
 $('.slidercontainer').css("height",global_height);
 if(!$('div').hasClass('sliderNews'))
  { 
  createImgMargin();  
  }
	  //Generate Pagination
	pagination_items = $('.gallery').length - 1;
	
	 createPagination(pagination_items);
	 centerButtons();
  
  

	//End Pagination 
	// Slide Buttons
	$('div.gallery').find('a.sliderprev').click(function(){
		if($(this).hasClass('disabled'))
		{
		return false;
		}
		else
		{
			dotheSlidePrev(-1);
			return false;
		}
	});

	$('div.gallery').find('a.slidernext').click(function(){
		if($(this).hasClass('disabled'))
		{
		return false;
    }
		else
		{
			dotheSlideNext(1);
			return false;
		}
	});
	$('div.gallery').find('div.paginatorDefault').find('a.slidernextPag').click(function(){
		if($(this).hasClass('disabled'))
		{
		return false;
		}
		else
		{
			dotheSlideNext(1);
			return false;
		}
	});
	$('div.gallery').find('div.paginatorDefault').find('a.sliderprevPag').click(function(){
		if($(this).hasClass('disabled'))
		{
		return false;
		}
		else
		{
			dotheSlidePrev(-1);
			return false;
		} 
	}); 
	//Pagination Slide
	$('div.gallery').find('div.paginatorDefault').find('a').click(function(){
		
	if(isNaN($(this).text()))
		  {
			return false;
	    }	
	else
	{
		counter = ($(this).text() - gallery_index) -1;
	
		if(counter > 0) 
		{
		       dotheSlideNext(counter);
		       return false;
		} 
		else
		{        
		       dotheSlidePrev(counter);
		       return false;
		}
	}	
  
	
	});    
	},200); 
	//End Pagination Slide
	// Mark the Current Item in the Pagination
	$('div.gallery').find('div.paginatorDefault').find('a').eq(gallery_index+1).addClass('selected');  
	$('div.slidercontainer').css("text-align","center");  
	}
    centerPlayButton();
  // Corner adjustment
    $('.right a.more').attr( 'data-corner','left 5px');//corner Flyout
    $('.left a.more').attr( 'data-corner','right 5px');//corner Flyout  
  //	$('a.more').attr( 'data-corner','left 5px');//corner Flyout
		$('a.lightBlue').corner('5px cc:#215f8b');//corner Flyout
		$('a.darkBlue').corner('5px cc:#003b6a');//corner Flyout
		$('.multiLang ul a').corner('5px cc:#fff');	//corner Language Selector
		$('a.white').corner('5px cc:#fff');	//corner Main Men�
		$('a.lightGrey').corner('5px cc:#f1f1f1');	//corner Main Men�
		$('a.darkGrey').corner('5px cc:#e1e1e2');	//corner Main Men�  



//Tooltip
  //======================================================
		$.each($('.tooltip_active'),function(index){	
			$(this).data('ttCount',index);
		});
		$.each($('.ie'),function(index){
			$(this).data('ttCount',index);
		
		});
		function checkIcon(item)
		{
			if(item == 'tooltip_active icon')
			{
			return "true"; }
			else
			{return "false";}
		}
		
		jQuery('.tooltip_active').mouseover(function(event){
			
				$(this).tooltipWCMS({
				tooltip_icon: checkIcon($(this).attr('class')),
				fooOffset: jQuery(this).offset(),	
				evClientX: event.clientX,
				wrapperClass: ".tooltip_wrap",
				ttClass: ".ie",
				current:  $(this).data('ttCount'),
				time: 2000,
				timeout_ttin: timeout_ttin,
				evType: "overM"
					});
			
		});
		 jQuery('div.ie').mouseover(function(event){
		 	
			$(this).tooltipWCMS({
				tooltip_icon: checkIcon($(this).attr('class')),	
				current:  $(this).data('ttCount'),
				ttClass: ".ie",
				evType: "overTT"
				});
			
		 });
		jQuery('.tooltip_active').mouseout(function(){
			
			$(this).tooltipWCMS({	
			tooltip_icon: checkIcon($(this).attr('class')),
				current:  $(this).data('ttCount'),
				ttClass: ".ie",
				evType: "outM",
				timeout_ttout: timeout_ttout,
				time: 1000
				});
			
		});
		jQuery('div.ie').mouseout(function(){
		
			$(this).tooltipWCMS({	
			tooltip_icon: checkIcon($(this).attr('class')),
				current:  $(this).data('ttCount'),
				ttClass: ".ie",
				evType: "outTT",
				timeout_ttout: timeout_ttout,
				time: 800
				});
				});
       
//====================================================================
	   
// Tooltip Carousel
	
  $.each($('.tooltip_wrap_carousel'),function(index){
		$(this).attr('id',index);	
	});	
	var dif_window = 0;
	if(document.documentElement.clientWidth >= 1024)
	{
     dif_window =  parseInt((document.documentElement.clientWidth-1024)/2);
  }
  jQuery('.jcarousel-skin-ie7').mouseover(function(){
  carousel_current = $(this).attr('index');
      jQuery('.tooltipOverflow').removeClass('tooltipIe');
      jQuery(this).parent('div').addClass('tooltipIe');
  });
  jQuery('.jcarousel-skin-ie7').mouseout(function(){
     jQuery(this).parent('div').removeClass('tooltipIe');

  });

   jQuery('.jcarousel-item').find('img').mouseover(function(event) {
    
    pos_left =  event.clientX - dif_window;      // pos left for Tooltip 
       
       set = 0; // indicator if pos set
       for(loop = 0; loop <= array_range16.length-1; loop++)
       {
       //==================================UNEVEN==============================================================================
         if((jQuery('.jcarousel-container').eq(carousel_current).find('img').length%2 == 1) && (jQuery('.jcarousel-container').eq(carousel_current).find('img').length <= get_max))
         {    // alert("1"); 
           if(((event.clientX - dif_window) <= array_range16_uneven[loop] + diff_grid12) && (set != 1))
           {   
            if((jQuery('.jcarousel-container').eq(carousel_current).find('img').length%2 == 1) && ($('.jcarousel-next').eq(carousel_current).attr('disabled')== "true") && (jQuery('.jcarousel-container').eq(carousel_current).find('img').length <= get_max))
             {    
             set = 1;
              $('.tooltip_wrap_carousel').eq(carousel_current).css("left",array_pos16_uneven[loop]); 
            }
            else if (navigator.appName.indexOf("Internet Explorer") != -1)
            {        
            set = 1;                        
              $('.tooltip_wrap_carousel').eq(carousel_current).css("left",array_pos16_uneven[loop]); 
            }
          }           
         }
         //==================================EVEN============================================================================== 
        if((jQuery('.jcarousel-container').eq(carousel_current).find('img').length%2 == 0)&& (jQuery('.jcarousel-container').eq(carousel_current).find('img').length <= get_max))
         {    
           if(((event.clientX - dif_window) <= array_range16_even[loop] + diff_grid12) && (set != 1))
           {
             // Button disabled --> Even entities
            if((jQuery('.jcarousel-container').eq(carousel_current).find('img').length%2 == 0) && ($('.jcarousel-next').eq(carousel_current).attr('disabled')== "true") && (jQuery('.jcarousel-container').eq(carousel_current).find('img').length <= get_max))
             {                 
             set = 1; $('.tooltip_wrap_carousel').eq(carousel_current).css("left",array_pos16_even[loop]);}
             else if (navigator.appName.indexOf("Internet Explorer") != -1)
            {   
             set = 1;                        
             $('.tooltip_wrap_carousel').eq(carousel_current).css("left",array_pos16_even[loop]);
            }}}
         //===================================Button enabled --> Carousel full==========================================================
        if(jQuery('.jcarousel-container').eq(carousel_current).find('img').length > get_max) 
        {      
          if((event.clientX - dif_window) <= (array_range16[loop] + diff_grid12) && (set != 1))
           {  
                      
              if($('.jcarousel-next').eq(carousel_current).attr('disabled')== "false")
              {    
                 
              set = 1; $('.tooltip_wrap_carousel').eq(carousel_current).css("left",array_pos16[loop]); 
              }                
              else         
              {                  
                  set = 1; $('.tooltip_wrap_carousel').eq(carousel_current).css("left",array_pos16[loop]);//- 40 ); 

                  if(grid_width == 12)
                  {    
             
                //  array_range16 =  new Array(170,285,400,515,633,727,873,960);
                  set = 1; $('.tooltip_wrap_carousel').eq(carousel_current).css("left",array_pos16[loop]); }
                  
              if(grid_width == 8)
              {     
               
                  set = 1; $('.tooltip_wrap_carousel').eq(carousel_current).css("left",array_pos16[loop]); }  
                  
              } }}
       }  // END FOR
       $('.tooltip_wrap_carousel').removeClass("tooltipVisible"); 
       $('.tooltip_wrap_carousel').removeClass("tooltip_active"); 
       $('.tooltip_wrap_carousel').css("display","none");  
      var tooltip_carousel_hide = 0;
      $content = $(this).parent('div').html();
      $('.tooltip_wrap_carousel').eq(carousel_current).find('.content_carousel').html($content).find('img').remove();//css({'width':'114px','height':'114px'});
   //   $('.tooltip_wrap_carousel').eq(carousel_current).find('.content_carousel').find('div.moreInfo').append("<a href='www.google.de'>hallo</a>");
      
      clearTimeout(tooltip_carousel_hide);      
      // Timeout
      tooltip_carousel = setTimeout( function() { 
      $('.tooltip_wrap_carousel').eq(carousel_current).css("display","block");
      $('.tooltip_wrap_carousel').eq(carousel_current).css("top","80px");
      jQuery('.tooltip_wrap_carousel').eq(carousel_current).addClass("tooltipVisible");
      jQuery('.tooltip_wrap_carousel').eq(carousel_current).addClass("tooltip_active");    
         }, timeout_carousel_ttin); // end Timeout Tooltip
        
    });  
 
    
      jQuery('.tooltip_wrap_carousel').mouseover(function(event) {
     
      clearTimeout(tooltip_carousel_hide);
       $(this).addClass("tooltipVisible"); 
       $(this).addClass("tooltip_active");
       $('.tooltip_wrap_carousel').eq(carousel_current).css("display","block"); 
       
    });
     jQuery('.tooltip_wrap_carousel').mouseout(function(event) {
        clearTimeout(tooltip_carousel);
       tooltip_carousel_hide = setTimeout( function(){
       $(this).removeClass("tooltipVisible"); 
       $(this).removeClass("tooltip_active"); 
       $('.tooltip_wrap_carousel').css("display","none"); 
       
      }, timeout_carousel_ttout);
    });
       jQuery('.jcarousel-item').find('img').mouseout(function(event) {       
       clearTimeout(tooltip_carousel);
       tooltip_carousel_hide = setTimeout( function(){
       $(this).removeClass("tooltipVisible"); 
       $(this).removeClass("tooltip_active"); 
       $('.tooltip_wrap_carousel').css("display","none");
        
       }, timeout_carousel_ttout);
       
       
    });
      
		//End Tooltip Carousel
//===================================================================		

/* Hover Box */
$(".tsrLnk").mouseover(function(){
	$(this).next("div").addClass('active');
	return false;
	});
	$(".tsrLnk").mouseout(function(){
	$(this).next("div").removeClass('active');
	return false;
});

	// Expandables
	initializeExpandables();

	// Tab

	//When page loads... (no autoTabControl means there is another tab handler used for the page)
 	if($("ul.tabs").attr("autoTabControl") != "false") {
		$(".tab_content").hide(); //Hide all content
		$("ul.tabs li:first").addClass("active").show(); //Activate first tab
		$(".tab_content:first").show(); //Show first tab content
	
		//On Click Event
		$("ul.tabs li").click(function() {
	     scroll_to_x = $(window).scrollLeft();
	     scroll_to_y = $(window).scrollTop();
		 var lastTab = $(this).parent().children("ul.tabs li.active").find("a").attr("href");
	     $("ul.tabs li").removeClass("active"); //Remove any "active" class
	     $(this).addClass("active"); //Add "active" class to selected tab
		 var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		 
		 if ($(this).parent().attr("pagetype") == "product"){
			 if(activeTab == "#tab4"){
				 wa.tab("overview");
			 }
			 if(activeTab == "#tab5"){
				 wa.tab("technical documents");
			 }
			 if(activeTab == "#tab6"){
				 wa.tab("suitable accessories");
			 }
			 if(activeTab == "#tab7"){
				 wa.tab("reviews");
			 }
		 }
		 var hOld = $(lastTab).height();
		 var hNew = $(activeTab).height();
		 if(hOld != null && hNew != null) {
			 // set height of new tab content before hiding to prevent layout flickering
			 var hCur = $(".tab_container").height();
			 $(".tab_container").height(hCur-(hOld-hNew));	
		 }
	     $(".tab_content").hide(); //Hide all tab content
	     $(activeTab).fadeIn(); //Fade in the active ID content
		 window.scroll(scroll_to_x,scroll_to_y);
		 if(hOld != null && hNew != null)
			 $(".tab_container").height("auto");	// set auto to change height if necessary
	     return false;
		});
 	}

// ie Hover Flyout

	jQuery('ul.flyout ul li').hover(function() {
	  jQuery(this).addClass('iebg');
	}, function() {
	  jQuery(this).removeClass('iebg');
	});

	jQuery('ul.flyout li.top').hover(function() {
	  jQuery(this).addClass('ieHover');
	}, function() {
	  jQuery(this).removeClass('ieHover');
	});

// ie Hover Image Language Selector
	jQuery('#header #langSelection.multiLang').hover(function() {
	  jQuery(this).addClass('iehover');
	}, function() {
	  jQuery(this).removeClass('iehover');
	});

// ie7 z-index Bugfix IE7 mainMenue
	jQuery('#mainMenu .mainMenuContent div').hover(function() {
	//  jQuery(this).addClass('onTop');
	}, function() {
  // jQuery(this).removeClass('onTop');
	});

// ie6 mainMenue Hover
var hideRo;
	jQuery('#mainMenu .mainMenuContent div ul li').hover(function() {
	clearTimeout(hideRo);
  //  jQuery(this).addClass('iehover');//.css("z-index","3000");
	}, function() { 

 hideRo = setTimeout(function(){  jQuery('li').removeClass('iehover');},timeout_menueout)

  });
   // Fancybox Videoplayer
  	$(".boschOverlay").fancybox({
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});   
     
});// document ready

/* main.js */

/* Author: Sascha Meier \*/
/* LastChangedDate: 2010-06-24 \*/
/* LastChangedBy: SM \*/

function onLoadFunctions() {
     // add function calls here
     navHover();
	 carouselHover();
     roundedCorners('A','leftSide');
     roundedCorners('A','subMenu');
     roundedCorners('A','sitemap');
     iframeFix('UL','mainNav');
     initFontStepper();
     initHovers('TR');
     BrowserDetect.init();
     fixOldFirefox ();
}
if (window.addEventListener) {
     window.addEventListener("load", onLoadFunctions, true);
} else if (window.attachEvent) {
     window.attachEvent("onload", onLoadFunctions);
}

/* show navi items (ie 6) */
navHover = function() {
     var nav = document.getElementById("mainNav");
     if (nav) {
          var lis = document.getElementById("mainNav").getElementsByTagName("LI");
          for (var i=0; i<lis.length; i++) {
               
               lis[i].onmouseover=function() {
                    this.curentClass = this.className;
                    this.className+=" iehover";
               }
               lis[i].onmouseout=function() {
                    this.className=this.curentClass;
               }
          }
     }
}
/* show navi items (ie 6) */
carouselHover = function() {
     var nav = document.getElementById("carousel");
     if (nav) {
          var lis = document.getElementById("carousel").getElementsByTagName("LI");
          for (var i=0; i<lis.length; i++) {
               
               lis[i].onmouseover=function() {
                    this.curentClass = this.className;
                    this.className+=" iehover";
               }
               lis[i].onmouseout=function() {
                    this.className=this.curentClass;
               }
          }
     }
}


// initialize hovers
function initHovers(tag,IdName) {
     // set hover
     var lis = document.getElementsByTagName(tag);
     for (var i=0; i<lis.length; i++) {
          if (!lis[i].className) {lis[i].className=' ';}

          if (lis[i].id == IdName) {
               lis[i].onmouseover=function() {
                    this.className = this.id+"Hover";
               }
               lis[i].onmouseout=function() {
                    this.className = "";
               }
          } else if (!IdName) {
               if (lis[i].className) {
                    lis[i].classNames = lis[i].className.split(" ");
                    if (lis[i].classNames.length > 0) {
                         lis[i].classes = "";
                         for (var z=0; z<lis[i].classNames.length; z++) {
                              lis[i].classes +=  " "+lis[i].classNames[z];
                         }
                    }
									}
                    lis[i].onmouseover=function() {
                         this.className = this.classes+" "+this.classNames[0]+"iehover";
                    }
                    lis[i].onmouseout=function() {
                         this.className = this.classes;
                    }
                    lis[i].onfocus=function() {
                         this.className = this.classes+" "+this.classNames[0]+"iehover";
                    }
                    lis[i].onblur=function() {
                         this.className = this.classes;
                    }
          }
     }
}


// initialize roundedCorners
function roundedCorners(tag,IdName) {
     // set corners
     if (navigator.appName == "Microsoft Internet Explorer") {
          var node = document.getElementById(IdName);
          if (node) {
               var lis = document.getElementById(IdName).getElementsByTagName(tag);
               for (var i=0; i<lis.length; i++) {
                    lis[i].className+=" roundedCorners"
                    lis[i].innerHTML='<span class="lt"></span>'+lis[i].innerHTML;
                    lis[i].innerHTML='<span class="rt"></span>'+lis[i].innerHTML;
                    lis[i].innerHTML='<span class="lb"></span>'+lis[i].innerHTML;
                    lis[i].innerHTML='<span class="rb"></span>'+lis[i].innerHTML;
               }
          }
     }
}


// initialize iFrame (ie6 fix for navi)
function iframeFix(tag,IdName) {
     // set iframeFix
     if (navigator.appName == "Microsoft Internet Explorer") {
          var node = document.getElementById(IdName);
          if (node) {
               var lis = document.getElementById(IdName).getElementsByTagName(tag);
               for (var i=0; i<lis.length; i++) {
                    lis[i].innerHTML='<iframe class="iframeFix" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="javascript:\'\';"></iframe>'+lis[i].innerHTML;
               }
          }
     }
}


// cookie functionality
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

// initialize font stepper
function initFontStepper() {
     // show font stepper
     if (document.getElementById("footerFontResize")) {
          document.getElementById("footerFontResize").style.visibility = "visible";
     }
     if (document.getElementById("fontdec")) {
          document.getElementById("fontdec").onclick= function () {fontStepper(-1, false); 
          return false;
          }
     }
     if (document.getElementById("fontdef")) {
          document.getElementById("fontdef").onclick= function () {fontStepper(0, false);
          return false;
          }
          document.getElementById("fontdef").className= "footerFontsize2Active";
     }
     if (document.getElementById("fontinc")) {
          document.getElementById("fontinc").onclick= function () {fontStepper(1, false);
          return false;
          }
     }

  /* set cookie if needed*/
  if (readCookie("fontStepperValue")) {
    var fontstepperInt = Number(readCookie("fontStepperValue"));
    fontStepper(fontstepperInt);
  }
}

function fontStepper(spInc, spReset) {
     /* font stepper */
     var spEmStepWidth 	= 0.125;	// increase/decrease font every step by spEmStepWidth
     var spEmBasis 		= 1;		// font size of spArticleBody at startup
     var spEmStep 		= 0;		// counter for current step (leave as 0)
     var spEmMaxSteps 	= 2;		// maximum steps alowed
     
     // reset font size
     if (spReset)
     spEmStep = -1;
     // inside allowed steps?
     if (Math.abs(spEmStep + spInc) <= spEmMaxSteps) {
          // increase/decrease spEmStep
          spEmStep += spInc;
          // set new font size for every tag inside "spEmStep"
          spEmFontSize = spEmStep * spEmStepWidth + spEmBasis;
          //get spArticleBody
          spEmBody = document.getElementById('wrapperAll');
          // set new fot size
          spEmBody.style.fontSize = spEmFontSize + "em";
          //spEmBody.style.lineHeight = spEmFontSize+0.54 + "em";
          // save value in cookie
          step = spEmStep+1;
        if (spInc == -1) {
         if (document.getElementById("fontinc")) {
          document.getElementById("fontdec").className= "footerFontsize1Active";
          document.getElementById("fontdef").className= "footerFontsize2";
          document.getElementById("fontinc").className= "footerFontsize3";
          createCookie("fontStepperValue",spInc,"1")
        }
      }
      if (spInc == 0) {
         if (document.getElementById("fontinc")) {
          document.getElementById("fontdec").className= "footerFontsize1";
          document.getElementById("fontdef").className= "footerFontsize2Active";
          document.getElementById("fontinc").className= "footerFontsize3";
          createCookie("fontStepperValue",spInc,"1")
        }
      }
      if (spInc == 1) {
         if (document.getElementById("fontinc")) {
          document.getElementById("fontdec").className= "footerFontsize1";
          document.getElementById("fontdef").className= "footerFontsize2";
          document.getElementById("fontinc").className= "footerFontsize3Active";
          createCookie("fontStepperValue",spInc,"1")
        }
      }

     }
}

function urlEncode(rawText){
      // this converts the rawText into x-www-form-urlencoded format (and space to "%20")
      var encoded = "";
      for(var n=0; n<rawText.length; n++) {
        var c=rawText.charCodeAt(n);
        // all chars in range 0-127 => 1byte   without (A-Z, a-z, 0-9, *, -, ., _)
        if (c<128) {
            if ((c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || (c==42) || (c==45) || (c==46) || (c==95))
                encoded += String.fromCharCode(c);
            else 
                encoded += '%' + c.toString(16);
        }
        // all chars in range 127 to 2047 => 2byte
        else if((c>127) && (c<2048)) {
          encoded += '%' + ((c>>6)|192).toString(16);
          encoded += '%' + ((c&63)|128).toString(16);
        }
        // all chars in range 2048 to 66536 => 3byte
        else {
          encoded += '%' + ((c>>12)|224).toString(16);
          encoded += '%' + (((c>>6)&63)|128).toString(16);
          encoded += '%' + ((c&63)|128).toString(16);
        }
      }
      return encoded;
}
	

function webQuery() {
     var url = '';
     var lang = '?lang=';
     var country = '&country=';
     var query = '&query=';
          if (document.forms.search.url.value != '') url = document.forms.search.url.value;
          if (document.forms.search.lang.value != '') lang += document.forms.search.lang.value;
          if (document.forms.search.country.value != '') country += document.forms.search.country.value;
          if (document.forms.search.query.value != '') query += urlEncode(document.forms.search.query.value);
     var searchAddress = url + lang + country + query;
     window.open(searchAddress,'q','width=564,height=528,toolbar=no,location=no,directories=no,scrollbars=yes,status=no,menubar=no,resizable=no');
     return false;
} 



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"
		}
	]

};

function fixOldFirefox () {
  if (BrowserDetect) {
    if (BrowserDetect.browser == "Firefox")
      if (BrowserDetect.version <= "3.5") {
        var getHead = document.getElementsByTagName("HEAD");
        if (getHead[0]) {
          getHead[0].innerHTML += ('<link rel="stylesheet" href="../css/cssfirefoxold.css" type="text/css" media="all" charset="UTF-8" />');
        }
    }
  }
}
/*
 * ARITHNEA GmbH
 * JavaScript Library jsTemplateParser
 *
 * Parser used for javascript templates
 * by E.G. 
 *  
 * Syntax: each occurrence of %{<key>} or %{<fctName()>} is replaced by the 
 *         value of <key> (supplied via key-value map) or by the returned string 
 *         of the invoked function: fctName()
 *         fctName can also contain the prefix "parent." or "window." 
 *         for calling parent.fctName() or window.fctName()
*/
var JSTemplateParser =
{
    /* ------------------------- */
    /* --- private variables --- */
    /* ------------------------- */

    /* string */        _tokenDelimBeg  : "%{",
    /* string */        _tokenDelimEnd  : "}",
    /* boolean */       _showParserMissingTokens : true,
    /* boolean */       _showParserErrors : true,
 
    /* ------------------------- */
    /* --- public functions  --- */
    /* ------------------------- */

    setTokenDelimeters: function(charsBeg, charsEnd) {
        this._tokenDelimBeg = charsBeg;  
        this._tokenDelimEnd = charsEnd;  
    },

    enableShowMissingTokens: function(enabled) {
        this._showParserMissingToken = enabled;
    },

    enableShowErrors: function(enabled) {
        this._showParserErrors = enabled;
    },

    parse: function(template, varMap, fctObj) {
        
        if (template == null) {
            if (this._showParserErrors)
                alert( "parseTemplate error: no template found" );
            return "";
        }
        
        var tokens = template.split(new RegExp(this._tokenDelimBeg, "g")); 
        var result = "";

        if (tokens.length > 1) {
            for (var i=0; i < tokens.length; i++) {
                var token  = tokens[i];
                var endIdx = token.indexOf(this._tokenDelimEnd);

                if (endIdx >= 0) {                    
                    var expStr  = token.substring(0, endIdx);
                    var expObj  = this;
                    var pPrefix = "parent.";
                    var wPrefix = "window.";

                    // get out the target object
                    if (expStr.indexOf( pPrefix ) == 0) {
                        expStr = expStr.substring( pPrefix.length );
                        expObj = parent;
                    }
                    else if (expStr.indexOf( wPrefix ) == 0) {
                        expStr = expStr.substring(wPrefix.length);
                        expObj = window;
                    }

                    var argIdx  = expStr.indexOf("(");
                    if (argIdx > 0 && argIdx < expStr.length) {
                        // function handling
                        if (expStr.charAt( expStr.length-1 ) != ")") {
                            if (this._showParserErrors)
                                alert( "parseTemplate error: missing ending function parameter character ')' in token " + token );
                            break;
                        }
                        
                        var args    = expStr.substring(argIdx+1, expStr.length-1).split(",");
                        var fctName = expStr.substring(0, argIdx);
                        
                        try {
                            if (fctObj != null && fctObj[fctName] != null) {
                                expObj = fctObj;
                            }

                            if (varMap != null) {
                                var newArgs = new Array();
                                for (var j=0; j < args.length; j++)
                                {
                                    var argKey = args[j];                                  
                                    if (argKey.length > 0) {
                                        if (argKey.indexOf('"') == 0 && argKey.lastIndexOf('"') == (argKey.length-1))
                                            newArgs.push(argKey.substring(1, (argKey.length-1)));
                                        else if (argKey == "true" )
                                            newArgs.push(true);
                                        else if (argKey == "false")
                                            newArgs.push(false);
                                        else
                                            newArgs.push(varMap[argKey]);
                                    }
                                }
                                args = newArgs;
                            }
                                
                            var value = expObj[fctName].apply(expObj,args);                          
                            if (value != null) {
                                if (typeof(value) == "string") 
                                    result += value;
                                else
                                    result += value.toString();
                            }
                        }
                        catch(e) {
                            if (this._showParserErrors)
                                alert("parseTemplate error: " + e + " in token " + token);
                            break;
                        }
                    }
                    else {
                        // variable handling
                        var value = null;
                        var memberIndex = expStr.indexOf(".");
                        
                        if (memberIndex > 0) {
                            var expStr1 = expStr.substring(0, memberIndex);
                            var expStr2 = expStr.substring(memberIndex+1);
                            var mapObj  = null;
                            
                            if (varMap != null)
                                mapObj = varMap[expStr1];

                            if (mapObj == null)
                                mapObj = expObj[expStr1];
                            
                            if (mapObj != null)
                                value = mapObj[expStr2];
                        }
                        else {
                            if (varMap != null)
                                value = varMap[expStr];

                            if (value == null)
                                value = expObj[expStr];
                        }                       
                        
                        if (value == null) {
                            if (this._showParserMissingTokens)
                                alert("parseTemplate error: variable " + expStr + " not found in token " + token);
                            break;
                        }
                        else {
                            if (typeof(value) == "string") 
                                result += value;
                            else
                                result += value.toString();
                        }
                    }                 
                    result += token.substring(endIdx + this._tokenDelimEnd.length);
                }
                else {
                    result += token;
                }
            }
        }
        else {
            result = template;
        }        
        return result;
    }
};
/* +++++++++++++++ js-modul for navigation (dyn. loaded nectar flyouts) +++++++++++++++ */

var compNavigation = {
	/* variables beginning with '_' are private */
	/* integer */_checkedMenuItemIdx : [-1, 1, -1, 3, -1, -1, 6], // expected menu items containing nectar flyouts (-1 means no flyout)

	invokeNectarRequest : function(menuItem, menuPositionIndex, menuRequestIndex) {
		$.support.cors = true;

		try {
			$.ajax({
				url : "/Integration.ashx",
				type : "POST",
				data : {
					"action" : "getFlyout",
					"menuIndex" : menuRequestIndex
				},
				cache : false,
				async : true,
				success : function(result, status) {
					if (result != "" && result.indexOf("404 Error") < 0 && (result.indexOf("DOCTYPE") < 0)
							&& (result.indexOf("<html") < 0)) {
						var rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;

						$("#flyoutContainer_" + menuPositionIndex).html(result.replace(rscript, ""));
						$("#flyoutContainer_" + menuPositionIndex).removeAttr("flyout-requested");
						$(menuItem).children("a").addClass("more"); // show pulldown arrow of menu item
					}
				},
				error : function(jqXHR, textStatus, errorThrown) {
					// remove requested flag to try loading flyout again after a connectione error has occurred
					// $("#flyoutContainer_"+menuIndex).removeAttr("flyout-requested");
				}
			});
		}
		catch (e) { /* the connection to nectar is possibly not reachable */
		}
	},

	getNectarFlyout : function(menuItem, menuPositionIndex) {
	    var menuRequestIndex = this._checkedMenuItemIdx[menuPositionIndex];
		if (menuRequestIndex < 0) {
			return; // menu item is not check (assuming there is no nectar flyout)
		}
		if (($("#flyoutContainer_" + menuPositionIndex).children().size() <= 0)) {  
			if ($("#flyoutContainer_" + menuPositionIndex).attr("flyout-requested") != "true") {
				$("#flyoutContainer_" + menuPositionIndex).attr("flyout-requested", "true");
				this.invokeNectarRequest(menuItem, menuPositionIndex, menuRequestIndex);
			}
		}
	},

    getNectarMenuFlyouts : function() {
		$.support.cors = true;

		if ($("#mainNav").attr("flyout-requested") != "true") {
    	   $("#mainNav").attr("flyout-requested", "true");
        }
        else {
            return; // already done
        }
        
		try {
		    var self = this;
		    
			$.ajax({
				url : "/Integration.ashx",
				type : "POST",
				data : {
					"action" : "getMenu"
				},
				cache : false,
				async : true,
				success : function(result, status) {
					if (result != "" && result.indexOf("404 Error") < 0 && (result.indexOf("DOCTYPE") < 0)
							&& (result.indexOf("<html") < 0)) {
						var rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;
                        var result = result.replace(rscript, "");
                        
                        var availableMenuItems = 0;
                        $("#mainNav li.dropdown").each(function(idx,item) {
                            self._checkedMenuItemIdx[idx] = -1;   // re-init: no flyout 
                            availableMenuItems++;
                        });

                        // Note: currently the uk and nl menu information is different
                        //
                        //       uk delivers only the nectar supported item positions 
                        //          (store is not included) but item.Index is correct -> menuItemIdx
                        //       nl delivers all menu positions but item.Index is not correct -> menuPosIdx
                        //
                        //       strategy: we take the array-index if all menu positions are set
                        //                 otherwise we take the menu index reference
                        //

                        var menuObj = jQuery.parseJSON(result);
                        if (menuObj != null && menuObj.Success == true && menuObj.Items != null) {
                            var items = menuObj.Items;
                            $.each(menuObj.Items, function(idx,item){
                                if (item.HasChild) {
                                    if (items.length == availableMenuItems) {
                                        // take array index as workaround (store should not be included in array!)
                                        self._checkedMenuItemIdx[idx] = item.Index;   
                                    }
                                    else {
                                        // take item.Index as it should be (store is not include in menu information)
                                        self._checkedMenuItemIdx[item.Index] = item.Index;   
                                    }
                                }
                            });
                        }

                        // show all pulldown icons at first
                		$(".flyout").each(function() {
                			var menuIndex = $(this).attr("index");
                    		if (self._checkedMenuItemIdx[menuIndex] >= 0) {
                                $(this).children("a").addClass("more"); // show pulldown arrow of menu item
                            }
                		});

                        // get all nectar flyouts
                 		$(".flyout").each(function() {
                			var menuIndex = $(this).attr("index");
                    		if (self._checkedMenuItemIdx[menuIndex] >= 0) {
                    			self.getNectarFlyout(this, menuIndex);
                    			// load by mouse over again if request was not successfull 
                    			/*
                                $(this).mouseover(function() {
                        			var menuIndex = $(this).attr("index");
                        			self.getNectarFlyout(this, menuIndex);
                        		});
                        		*/
                            }
                		});
					}
				},
				error : function(jqXHR, textStatus, errorThrown) {
					// remove requested flag to try loading flyout again after a connectione error has occurred
					// $("#mainNav").removeAttr("flyout-requested");
				}
			});
		}
		catch (e) { /* the connection to nectar is possibly not reachable */
		}
	},

	isRequired : function() {
		return ($("#mainNav").length > 0);
	},

	initialize : function() {
	
    	this.getNectarMenuFlyouts();
        /*
		var self = this;
		$(".flyout").mouseover(function() {
			var menuIndex = $(this).attr("index");
			self.getNectarFlyout(this, menuIndex);
		});

		$(".flyout").each(function() {
			var menuIndex = $(this).attr("index");
			self.getNectarFlyout(this, menuIndex);
		});
		*/
	}
};

/* +++++++++++++++ js-modul for viewed items carousel +++++++++++++++ */

var compViewedItems = {
	/* variables beginning with '_' are private */
	/* integer */_viewedItemPreFilledCount : 0,

	removeViewedItemFromList : function(productCode) {
		// remove stored item from viewed item list (without consideration of the result)
		jQuery.ajax({
			type : "POST",
			url : '/store/removeViewedItem',
			data : ({
				'productCode' : productCode
			}),
			cache : false,
			async : true,
			dataType : "text",
			complete : function() {
			}
		});
	},

	checkVisibility : function() {
		this._viewedItemPreFilledCount = 0;

		// get out count of shown items (maybe there are invisible pre-filled li-items)
		$("li.jcarousel-item", $(".viewed .mycarousel")).each(function(i) {
			if ($(this).css("display") == 'none') {
				this._viewedItemPreFilledCount++;
			}
		});

		var jc = $(".viewed .mycarousel").data("jcarousel");
		if (jc != null && jc.size() <= this._viewedItemPreFilledCount) {
			$(".grid16.viewed").hide();
			return false;
		}
		return true;
	},

    showLastItem : function() {
		var jc = $(".viewed .mycarousel").data("jcarousel");
		if (jc != null && jc.size() > jc.last) {
            jc.scroll(jc.size()-jc.last+1,false);
        }
    },
    
	isRequired : function() {
		return ($(".viewed .mycarousel").length > 0);
	},

	initialize : function() {
		var self = this;

		$(".closeView").click(function() {
			// remove visible item from carousel
			var jc = $(".viewed .mycarousel").data("jcarousel");
			var oldSize = jc.size();

			$(this).closest("LI").remove();

			setTimeout(function() {
				jc.lock();
				jc.reload();
				jc.size(oldSize - 1); // must update size (not done automatically)
				jc.unlock();

				// hide if carousel is empty (there are 2 invisible items always)
				if (jc.size() <= self._viewedItemPreFilledCount) {
					$(".grid16.viewed").hide();
				}
			}, 10);
		});

		this.checkVisibility();
	}
};


  

var compRegisteredItems = {
		/* variables beginning with '_' are private */
		/* integer */_viewedItemPreFilledCount : 0,
        /* id of selected item */_selectedImage : "",
		
		initRegisteredItemsCarousel : function() {

            var jc = jQuery("#registeredItemsCarousel");    
            
            if (jc.attr("compInitialized") == "true") {
                return false;     // already initialized
            }  
            jc.attr("compInitialized", "true");
            
    		var options = {};
    		if($(jc).attr("wrap") != null)
    		    options.wrap = $(jc).attr("wrap");
    		if($(jc).attr("scroll") != null)
    			options.scroll = parseInt($(jc).attr("scroll"));
    		if($(jc).attr("size") != null)
    	        options.size = parseInt($(jc).attr("size"));
    		$(jc).jcarousel(options);

            var carousel = $(jc).data("jcarousel");
			if (carousel == null || carousel.size() == null || $(jc).data("jcarousel").size() == 0) {
                $("#registeredItemsCarouselComponent").hide();
				$("#registeredProductComponent").hide(); 
				$("#registerlinkComponent").show();  
				
		    }  
			return true;
		},
		
		removeRegisteredItemFromList : function(productCode, messageText) {
		    var self = this;
	    
		    var answer = confirm (messageText);
            if (!answer) {
            	return;
            }
               

			// remove stored item from viewed item list (without consideration of the result)
			jQuery.ajax({
				type : "POST",
				url : '/store/removeRegisteredItem',
				data : ({
					'productCode' : productCode
				}),
				cache : false,
				async : true,
				dataType : "text",
				complete : function() {
					$("#registeredProductComponent").hide();
					setTimeout(function(){self.refreshRegisteredItems();},1);					
				}
			});
		},
		
		
		
		showRegisteredItemDetails : function(productCode, image) {
		    var self = this;
		    
			// remove stored item from viewed item list (*registered*comwithout consideration of the result)
			jQuery.ajax({
				type : "POST",
				url : '/store/showRegisteredItemDetails',
				data : ({
					'productCode' : productCode
				}),
				cache : false,
				async : true,
				dataType : "text",
				success: function(html) {
					$("#registeredProductDetails").html(html);
					initializeExpandables();
					$("#productDetail").mouseup();
					self.markRegisteredItem(image); 
				}
			});
		},

		markRegisteredItem : function(image) {
			if (this._selectedImage != ""){
				$("#"+this._selectedImage).css("border" ,"none");	
			}			
			$("#"+image).css("border" ,"1px solid #265D86");
			this._selectedImage = image; 
        },
        		
		refreshRegisteredItems : function(hide) {
		    var self = this;
			// remove stored item from viewed item list (*registered*comwithout consideration of the result)
			jQuery.ajax({
				type : "POST",
				url : '/store/refreshRegisteredItems',
				data : ({}),
				cache : false,
				async : true,
				dataType : "text",
				success: function(html) {			
					$("#registeredItemsCarouselPlaceHolder").html(html);		
					window.setTimeout(function(){
						self.initRegisteredItemsCarousel();

            			var carousel = $("#registeredItemsCarousel").data("jcarousel");
            			if (carousel != null) {
                            // alert(carousel.size()+ "--" +carousel.last);
                			if (carousel.size() > carousel.last ){
                				carousel.scroll(carousel.size() -  carousel.last + 1, false);						
                			}					
            			
                			if (carousel.size() != null && carousel.size() > 0){
                			    var lastItemIdx = carousel.size() - 1; 
                    			compRegisteredItems.markRegisteredItem(lastItemIdx); 
                    			compRegisteredItems.showRegisteredItemDetails($("#productCode"+lastItemIdx).text(),lastItemIdx);
        
                			}
            				$("#registerFormPage").hide();
            				$("#rateplatefinder").hide();
                        }
					},10);

				}
			});
		},

		
		
		showRegisterPage : function(eNumber, fdDate, serialNumber, purchaseDate) {
		    var self = this;
			// remove stored item from viewed item list (*registered*comwithout consideration of the result)
			jQuery.ajax({
				type : "POST",
				url : '/store/BSHRegisterProductForm1Controller',
				data : ({
					'eNumber' : eNumber,
					'fdDate'  : fdDate,
					'serialNumber'  : serialNumber,
					'purchaseDate'  : purchaseDate
				}),
				cache : false,
				async : true,
				dataType : "text",
				success: function(html) {
					$("#registerFormPage").html(html);
					initializeExpandables();
				}
			});
		},

		
		registerItem : function(eNumber, fdDate, serialNumber, purchaseDate) {
		    var self = this;
			// remove stored item from viewed item list (*registered*comwithout consideration of the result)
			jQuery.ajax({
				type : "POST",
				url : '/store/productregistration/registerproduct',
				data : ({
					'eNumber' : eNumber,
					'fdDate'  : fdDate,
					'serialNumber'  : serialNumber,
					'purchaseDate'  : purchaseDate
				}),
				context: document.body,
				cache : false,
				async : true,
				dataType : "text",
				success: function(html,data,xmlResponse) {
					if(xmlResponse.getResponseHeader("loggedin") == "true"){
						initializeExpandables();
						
						$("#registerFormPage").hide();
						$("#registerFormPage").html(html);
						$("#registeredItemsCarouselComponent").show();
						$("#rateplatefinder").hide();
						
						window.toggleProcess="hide";

						self.refreshRegisteredItems();
                        					
/* refreshRegisteredItems will refresh registeredItemsCarouselComponent					
						window.setTimeout(function(){						
							$("#registeredItemsCarouselComponent").show();
							self.initRegisteredItemsCarousel();
							var carousel = $("#registeredItemsCarousel").data("jcarousel");
							if (carousel.size() > carousel.last ){
								carousel.scroll(carousel.size() -  carousel.last + 1, false);						
							}
              			    if (carousel.size() > 0) {
                                var lastItemIdx = carousel.size() - 1; 	
						        self.markRegisteredItem(lastItemIdx); 
							    self.showRegisteredItemDetails($("#productCode"+lastItemIdx).text(),lastItemIdx);
							}
						},1);
*/
						
					} else {
						window.location="/store/myaccount/overview";
					}				
				},
				complete: function(jqXHR, textStatus) {
					if (textStatus != "success"){
						window.location="/store/myaccount/overview";
					}
				   }
			});
		},
		
		
		
		validateItem : function(eNumber, fdDate, serialNumber, purchaseDate) {
		    var self = this;
			// remove stored item from viewed item list (*registered*comwithout consideration of the result)
			jQuery.ajax({
				type : "POST",
				url : '/store/productregistration/validateproduct',
				data : ({
					'eNumber' : eNumber,
					'fdDate'  : fdDate,
					'serialNumber'  : serialNumber,
					'purchaseDate'  : purchaseDate
				}),
				context: document.body,
				cache : false,
				async : true,
				dataType : "text",
				success: function(html,data,xmlResponse) {
					if(xmlResponse.getResponseHeader("loggedin") == "true"){
						$("#registerFormPage").html(html);
						initializeExpandables();						
						
					} else {
						window.location="/store/myaccount/overview";
					}				
				},
				complete: function(jqXHR, textStatus) {
					if (textStatus != "success"){
						window.location="/store/myaccount/overview";
					}
				   }
			});
		},
		

    	checkVisibility : function() {
    		this._viewedItemPreFilledCount = 0;
    
    		// get out count of shown items (maybe there are invisible pre-filled li-items)
    		$("li.jcarousel-item", $(".viewed.myproducts .mycarousel")).each(function(i) {
    			if ($(this).css("display") == 'none') {
    				this._viewedItemPreFilledCount++;
    			}
    		});
    
    		var jc = $(".viewed.myproducts .mycarousel").data("jcarousel");
    		if (jc != null && jc.size() <= this._viewedItemPreFilledCount) {
    			$(".grid12.viewed.myproducts").hide();
    			return false;
    		}
    		return true;
    	}

	};

/* +++++++++++++++ js-modul for startpage +++++++++++++++ */

var compStore = {
	/* variables beginning with '_' are private */
	/* timerId */_invokeDelayTimer : null,
	/* msec */_invokeTimeout : 500,
	/* boolean */_invokeBlocked : false,
	/* string */_requestAddItemToBasket : "/store/product/addItemToBasket",
	/* string */_paramProductCode : "productCode",
	/* string */_paramQuantity : "quantity",
	/*
	 * note: only the mini basket component on this page is updated by the ajax request /* string
	 */_compMiniBasketContentId : "#miniBasketContent",
	/* string */_compMiniBasektInnerContentId : "#miniBasketInnerContent",

	resultHandling : function(resultText, status, res) {
		this._invokeBlocked = false;

		if (status === "success" || status === "notmodified") {
			$(document).trigger("initialize"); // notify all related components to re-initialize
		}
	},

	addItemToBasket : function(productCode) {
		if (productCode == "" || this._invokeBlocked) {
			return;
		}
		this._invokeBlocked = true;

		// note: load(request,params,callback) with params as object sends a post request
		var params = {};
		params[this._paramProductCode] = productCode;
		params[this._paramQuantity] = 1;
		var urlParams = $.param(params);
		
		wa.add2basket(productCode, 1);

		var self = this;
		$(this._compMiniBasketContentId).load(
				this._requestAddItemToBasket + "?" + urlParams + " " + this._compMiniBasektInnerContentId,
				function(text, status, res) {
					self.resultHandling(text, status, res);
					if (status === "success" || status === "notmodified") {
						compMiniBasket.signalize();
					}
				});
	}

// note: no initialize method is necessary because only the mini-basket is actualized
};

/* +++++++++++++++ js-modul for basketcomponent +++++++++++++++ */

var compBasket = {
	/* variables beginning with '_' are private */
	/* timerId */_invokeDelayTimer : null,
	/* msec */_invokeTimeout : 500,
	/* boolean */_invokeBlocked : false,
	/* string */_requestIncrementItem : "/store/incrementItem",
	/* string */_requestAddItemToBasket : "/store/addItemToBasket",
	/* string */_requestDeleteItemFromBasket : "/store/deleteItem",
	/* string */_paramPartNumber : "partNumber", /* same as productCode? */
	/* string */_paramProductCode : "productCode",
	/* string */_paramQuantity : "quantity",
	/* string */_compContentId : "#basketContent",
	/* string */_compInnerContentId : "#basketInnerContent",
	/* string */_compMiniBasketContentId : "#miniBasketContent",
	/* string */_compMiniBasektInnerContentId : "#miniBasketInnerContent",

	resultHandling : function(resultText, status, res) {
		this._invokeBlocked = false;

		if (status === "success" || status === "notmodified") {
			var rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;

			// actualize mini basket (if available)
			$(this._compMiniBasketContentId).html(jQuery("<div>")
			// removing all scripts to avoid errors (IE)
			.append(resultText.replace(rscript, ""))
			// locate the specified elements to actualize
			.find(this._compMiniBasektInnerContentId));

			$(document).trigger("initialize"); // notify all related components to re-initialize
		}
		else if (status == "error") {
			compBasket.restoreLoadedQuantity();
		}
	},

	setNewQuantity : function(operation, productCode, quantity) {
		// note: load(request,params,callback) with params as object sends a post request
		var params = {};
		params[this._paramProductCode] = productCode;
		params[this._paramQuantity] = quantity;
		var urlParams = $.param(params);

		var self = this;
		$(this._compContentId).load(this._requestIncrementItem + "?" + urlParams + " " + this._compInnerContentId,
				function(text, status, res) {
					self.resultHandling(text, status, res);
				});
	},

	addItemToBasket : function() {

		var partNumber = document.testform.partNumber.value;
		var quantity = document.testform.quantity.value;
		
		wa.add2basket(partNumber, quantity);

		if (partNumber == "" || quantity == null || quantity == "" || quantity <= 0 || this._invokeBlocked) {
			return;
		}
		this._invokeBlocked = true;

		// note: load(request,params,callback) with params as object sends a post request
		var params = {};
		params[this._paramPartNumber] = partNumber;
		params[this._paramQuantity] = quantity;
		var urlParams = $.param(params);

		var self = this;
		$(this._compContentId).load(this._requestAddItemToBasket + "?" + urlParams + " " + this._compInnerContentId,
				function(text, status, res) {
					self.resultHandling(text, status, res);
					if (status === "success" || status === "notmodified") {
						compMiniBasket.signalize();
					}
				});
	},

	deleteItemFromBasket : function(productCode) {
		if (this._invokeBlocked) {
			return;
		}
		this._invokeBlocked = true;

		// note: load(request,params,callback) with params as object sends a post request
		var params = {};
		params[this._paramProductCode] = productCode;
		var urlParams = $.param(params);
		
		wa.removefrombasket(productCode, 1);

		var self = this;
		$(this._compContentId).load(this._requestDeleteItemFromBasket + "?" + urlParams + " " + this._compInnerContentId,
				function(text, status, res) {
					self.resultHandling(text, status, res);
				});
	},

	decrementPartNumberQuantity : function() {
		var quantity = parseInt($("#quantityForPartnumber").text());
		if (quantity <= 1) {
			return;
		}
		quantity--;
		$("#quantityForPartnumber").text(quantity);
		document.testform.quantity.value = quantity.toString();
	},

	incrementPartNumberQuantity : function() {
		var quantity = parseInt($("#quantityForPartnumber").text());
		quantity++;
		$("#quantityForPartnumber").text(quantity);
		document.testform.quantity.value = quantity.toString();
	},

	restoreLoadedQuantity : function() {
		// quantity was changed by javascript before the ajax request was sent,
		// thus we have to restore the value if the request fails
		$('.quantity > .minus').each(function() {
			var elm = $(this).next('.value');
			var initValue = $(elm).attr("initValue");
			if (initValue != null && initValue != "") {
				$(elm).text(initValue);
			}
		});
	},

	changeQuantityValue : function(elm, operation) {
		var value = parseInt($(elm).text());
		if ((operation == "minus") && (value > 1)) {
			value--;
			$(elm).text(value);
			return true;
		}
		else if (operation == "plus") {
			value++;
			$(elm).text(value);
			return true;
		}
		return false;
	},

	submitAddItemToBasket : function() {
		document.testform.submit();
	},

	isRequired : function() {
		return ($(this._compInnerContentId).length > 0 && $(this._compInnerContentId).attr("compInitialized") != "true");
	},

	initialize : function() {
		// prevent multiple initializing
		$(this._compInnerContentId).attr("compInitialized", "true");

		if (document.testform != null) {
			document.testform.quantity.value = $("#quantityForPartnumber").text();
			document.testform.partNumber.value = "";
		}

		var self = this;

		$('.quantity > .plus, .quantity > .minus').click(function() {
			if (self._invokeBlocked) {
				return;
			}

			var opId = $(this).attr('class');
			var elm = (opId == "minus") ? $(this).next('.value') : $(this).prev('.value');

			if (self.changeQuantityValue(elm, opId)) {

				if (self._invokeDelayTimer != null) {
					clearTimeout(self._invokeDelayTimer);
				}

				var quantity = parseInt($(elm).text());
				var productCode = $(elm).attr("productCode");
                if (productCode == null) {
                    productCode = "";
                }
				self._invokeDelayTimer = setTimeout(function() {
					self._invokeDelayTimer = null;
					self._invokeBlocked = true;
					self.setNewQuantity(opId, productCode, quantity);
				}, self._invokeTimeout);
			}
			return false;
		});
	}
};

/* +++++++++++++++ js-modul for mini-basket component +++++++++++++++ */
var compMiniBasket = {
	/* variables beginning with '_' are private */
	/* string */_compContentId : "#miniBasketContent",
	/* string */_compInnerContentId : "#miniBasketInnerContent",
	/* timerId */_hideDelayTimer : null,
	/* boolean */_signalizeEnabled : true,
	/* boolean */_flyoutEnabled : true,
	/* boolean */_showReadyToOrder : false,
	/* boolean */_isAdding : false,
	/* boolean */_isShown : false,
	/* integer */_initPosY : 0,
	/* integer */_initTop : 0,

	setEnabled : function(enable,showReadyToOrder) {
		this._flyoutEnabled = enable;
		this._showReadyToOrder = showReadyToOrder;
		
		if (this._showReadyToOrder)
			$("#readyToOrderSection").show();

		if (!(this._flyoutEnabled)) {
			$(".store_myBasket *").css("cursor", "default");
			$(".store_myBasket").children("a").click(function() {
				return false;
			});
		}
		else {
			$(".store_myBasket *").css("cursor", "pointer");
			$(".store_myBasket").children("a").click(function() {
				return true;
			});
		}
	},

	isRequired : function() {
		return ($(this._compInnerContentId).length > 0 && $(this._compInnerContentId).attr("compInitialized") != "true");
	},

	// show content of mini basket for a short time as feedback that an item was added
	signalize : function() {
		if (this._signalizeEnabled && this._flyoutEnabled) {
			this._isAdding = true;
			var basketFlyout = $(".store_myBasket > .store_basketItems");

			// try to show flyout always even window is scrolled down
			if (this._initTop > 0) {
				var scrollPosY = $(window).scrollTop();
				if (scrollPosY >= this._initPosY) {
					$(basketFlyout).css("top", ((scrollPosY - 145 + 2) + this._initTop));
				}
				else {
					$(basketFlyout).css("top", this._initTop);
				}
			}
			$(basketFlyout).fadeIn("fast", function() {
				var self = this;
				setTimeout(function() {
					compMiniBasket._isShown = true;
				}, 100);
				compMiniBasket._hideDelayTimer = setTimeout(function() {
					if (compMiniBasket._hideDelayTimer != null) {
						$(self).fadeOut("fast", function() {
							compMiniBasket._hideDelayTimer = null;
							compMiniBasket._isShown = false;
							if (compMiniBasket._initTop > 0) {
								$(basketFlyout).css("top", compMiniBasket._initTop);
							}
							setTimeout(function() {
								compMiniBasket._isAdding = false;
							}, 100);
						});
					}
				}, 800);
			});
		}
	},

	initialize : function() {
		// prevent multiple initializing
		$(this._compInnerContentId).attr("compInitialized", "true");

		if (this._showReadyToOrder)
			$("#readyToOrderSection").show();
		
		// get position to show flyout accordingly to scroll-top position
		this._initTop = parseInt($(".store_myBasket > .store_basketItems").css("top"));
		this._initPosY = $(".store_myBasket").offset().top + $(".store_myBasket").height();

		if (!(this._flyoutEnabled)) {
			$(".store_myBasket *").css("cursor", "default");
			$(".store_myBasket").children("a").click(function() {
				return false;
			});
		}

		var self = this;
		$('.store_myBasket > .store_basketItems').mousedown(function() {
			if (self._isAdding) {
				// stop fading out if someone has clicked into flyout
				if (compMiniBasket._hideDelayTimer != null) {
					clearTimeout(compMiniBasket._hideDelayTimer);
					compMiniBasket._hideDelayTimer = null;
				}
				self._isAdding = false;
				$(this).stop(true, true);
				if (self._flyoutEnabled) {
					$(this).addClass('store_active');
				}
			}
		});

		$('.store_myBasket').hover(function() {
			if (!(self._isAdding)) {
				if (compMiniBasket._hideDelayTimer != null) {
					clearTimeout(compMiniBasket._hideDelayTimer);
					compMiniBasket._hideDelayTimer = null;
				}
				$(".store_myBasket > .store_basketItems").stop(true, true);
				if (self._flyoutEnabled) {
					$(this).addClass('store_active');
				}
			}
			else if (self._isShown) {
				if (self._flyoutEnabled) {
					$(this).addClass('store_active');
				}
			}
		}, function() {
			if (self._flyoutEnabled && !(self._isAdding)) {
				var store_myBasket = this;
				compMiniBasket._hideDelayTimer = setTimeout(function() {
					$(".store_myBasket > .store_basketItems").fadeOut("fast", function() {
						$(store_myBasket).removeClass('store_active');
					});
					compMiniBasket._hideDelayTimer = null;
					if (compMiniBasket._initTop > 0) {
						$(".store_myBasket > .store_basketItems").css("top", compMiniBasket._initTop);
					}
				}, 250);
			}
		});
	}
};

/* +++++++++++++++ js-modul for product-details page +++++++++++++++ */

var compProdDetails = {
	/* variables beginning with '_' are private */
	/* boolean */_invokeBlocked : false,
	/* string */_requestAddItemToBasket : "/store/product/addItemToBasket",
	/* string */_paramProductCode : "productCode",
	/* string */_paramQuantity : "quantity",
	/* string */_compContentId : "#productDetailsContent",
	/* string */_compInnerContentId : "#productDetailsInnerContent",
	/* string */_compMiniBasketContentId : "#miniBasketContent",
	/* string */_compMiniBasektInnerContentId : "#miniBasketInnerContent",
	/* string */_compQuantityContentId : "#productDetailsQuantity",
	/* string */_compWasAddedContentId : "#msgItemWasAdded",

	resultHandling : function(resultText, status, res) {
		this._invokeBlocked = false;

		if (status === "success" || status === "notmodified") {

			var rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;

			// actualize mini basket (if available)
			$(this._compMiniBasketContentId).html(jQuery("<div>")
			// removing all scripts to avoid errors (IE)
			.append(resultText.replace(rscript, ""))
			// locate the specified elements to actualize
			.find(this._compMiniBasektInnerContentId));

			$(document).trigger("initialize"); // notify all related components to re-initialize
		}
	},

	showBundleItem : function(elm) {

		var detailImageUrl = $(elm).attr("productImageUrl");
        if (detailImageUrl == null) {
            detailImageUrl = "";
        }
		if ($("#bigProductPicture").attr("src") != detailImageUrl) {

			$(".detail .thumbs a").removeClass("active");
			$(elm).addClass("active");

			$("#bigProductPicture").stop(true, true).fadeOut("fast", function() {
				$("#bigProductPicture").unbind("load").load(function() {
					$("#bigProductPicture").fadeIn("fast");
				});
				$("#bigProductPicture").attr("src", detailImageUrl);
			});

			var detailZoomImageUrl = $(elm).attr("productZoomImageUrl");
			if (detailZoomImageUrl != null && detailZoomImageUrl != "") {
				$("#productDetailZoom").attr("href", detailZoomImageUrl).show();
				$("#bigProductPicture").attr("title", compProductDetailZoom.getZoomTitle()).css("cursor", "pointer").click(function() {
					$("#productDetailZoom").click();
				});
			}
			else {
				$("#productDetailZoom").hide();
				$("#bigProductPicture").attr("title", "").css("cursor", "default").unbind("click");
			}
		}
	},

	addItemToBasket : function(productCode) {
		var quantity = parseInt($(this._compQuantityContentId).text());

		if (productCode == "" || quantity == null || quantity == "" || quantity <= 0 || this._invokeBlocked) {
			return;
		}
		this._invokeBlocked = true;

		// note: load(request,params,callback) with params as object sends a post request
		var params = {};
		params[this._paramProductCode] = productCode;
		params[this._paramQuantity] = quantity;
		var urlParams = $.param(params);
		
		wa.add2basket(productCode, quantity);

		$(this._compWasAddedContentId).hide();

		var self = this;
		$(this._compContentId).load(this._requestAddItemToBasket + "?" + urlParams + " " + this._compInnerContentId,
				function(text, status, res) {
					self.resultHandling(text, status, res);
					if (status === "success" || status === "notmodified") {
						compMiniBasket.signalize();
					}
				});
	},

	changeQuantityValue : function(elm, operation) {
		var value = parseInt($(elm).text());
		if ((operation == "minus") && (value > 1)) {
			value--;
			$(elm).text(value);
			return true;
		}
		else if (operation == "plus") {
			value++;
			$(elm).text(value);
			return true;
		}
		return false;
	},

	isRequired : function() {
		return ($(this._compInnerContentId).length > 0 && $(this._compInnerContentId).attr("compInitialized") != "true");
	},

	initialize : function() {
		// prevent multiple initializing
		$(this._compInnerContentId).attr("compInitialized", "true");

		var self = this;
        
		$(this._compInnerContentId + ' .plus,' + this._compInnerContentId + ' .minus').click(function() {
			if (self._invokeBlocked) {
				return false;
			}

			var opId = $(this).attr('class');
			var elm = (opId == "minus") ? $(this).next('.value') : $(this).prev('.value');

			self.changeQuantityValue(elm, opId);
			return false;
		});

		$(this._compInnerContentId + ' .detail .thumbs a').click(function() {
			var detailZoomImageUrl = $(this).attr("productZoomImageUrl");
			if (detailZoomImageUrl != null && detailZoomImageUrl != "") {
                $("#productDetailZoom").click();
            }
			return false;
		}).hover(function() {
			// hover in: show selected bundle image
			self.showBundleItem(this);
		}, function() {
			// hover out: show last hovered image
		});
	}
};

/* +++++++++++++++ js-modul for suitable-accessories in product-details page +++++++++++++++ */

// local component modul (variables beginning with '_' are private)
var compProdSuitableAccessories = {
	/* variables beginning with '_' are private */
	/* boolean */_invokeBlocked : false,
	/* string */_requestAddItemToBasket : "/store/product/addItemToBasket",
	/* string */_paramProductCode : "productCode",
	/* string */_paramQuantity : "quantity",
	/* string */_compContentId : "#productSuitableAccessoriesContent",
	/* string */_compMiniBasketContentId : "#miniBasketContent",
	/* string */_compMiniBasektInnerContentId : "#miniBasketInnerContent",
	/* string */_compQuantityContentId : "#productAccessoryQuantity_", /*
	 * _compCurrentIndexId will be
	 * added
	 */
	/* string */_compWasAddedContentId : "#msgProductAccessoryWasAdded_", /*
	 * _compCurrentIndexId will be
	 * added
	 */
	/* string */_compProductWasAddedContentId : "#msgItemWasAdded",
	/* integer */_compCurrentIndexId : 0,

	resultHandling : function(resultText, status, res) {
		this._invokeBlocked = false;

		if (status === "success" || status === "notmodified") {

			var rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;

			// actualize mini basket (if available)
			$(this._compMiniBasketContentId).html(jQuery("<div>")
			// removing all scripts to avoid errors (IE)
			.append(resultText.replace(rscript, ""))
			// locate the specified elements to actualize
			.find(this._compMiniBasektInnerContentId));

			if (resultText.indexOf(this._compProductWasAddedContentId)) {
				var self = this;
				// show "was added" delayed to be sure text is shown with repainted effect (IE)
				setTimeout(function() {
					$(self._compWasAddedContentId + self._compCurrentIndexId).css({
						"display" : "block",
						"visibility" : "visible"
					});
				}, 10);
			}

			$(document).trigger("initialize"); // notify all related components to re-initialize
		}
	},

	addItemToBasket : function(productCode, indexId) {
		var quantity = parseInt($(this._compQuantityContentId + indexId).text());

		if (productCode == "" || quantity == null || quantity == "" || quantity <= 0 || this._invokeBlocked) {
			return;
		}
		this._invokeBlocked = true;

		// note: indexId is loop counter of listed accessories
		this._compCurrentIndexId = parseInt(indexId);

		var params = {};
		params[this._paramProductCode] = productCode;
		params[this._paramQuantity] = quantity;
		
		wa.add2basket(productCode, quantity);

		if ($(this._compWasAddedContentId + this._compCurrentIndexId).css("display") == "block") {
			$(this._compWasAddedContentId + this._compCurrentIndexId).css("visibility", "hidden");
		}
		else {
			$(this._compWasAddedContentId + this._compCurrentIndexId).hide();
		}

		var self = this;
		$.ajax({
			url : this._requestAddItemToBasket,
			data : params,
			type : "GET",
			cache : false,
			async : false,
			complete : function(res, status) {
				self.resultHandling(res.responseText, status, res);
				if (status === "success" || status === "notmodified") {
					compMiniBasket.signalize();
				}
			}
		});
	},

	changeQuantityValue : function(elm, operation) {
		var value = parseInt($(elm).text());
		if ((operation == "minus") && (value > 1)) {
			value--;
			$(elm).text(value);
			return true;
		}
		else if (operation == "plus") {
			value++;
			$(elm).text(value);
			return true;
		}
		return false;
	},

	isRequired : function() {
		return ($(this._compContentId).length > 0 && $(this._compContentId).attr("compInitialized") != "true");
	},

	initialize : function() {
		// prevent multiple initializing
		$(this._compContentId).attr("compInitialized", "true");

		var self = this;

		$(this._compContentId + ' .plus,' + this._compContentId + ' .minus').click(function() {
			if (self._invokeBlocked) {
				return false;
			}

			var opId = $(this).attr('class');
			var elm = (opId == "minus") ? $(this).next('.value') : $(this).prev('.value');

			self.changeQuantityValue(elm, opId);
			return false;
		});
	}
};

/* +++++++++++++++ js-modul for SparePartDetail page +++++++++++++++ */
var compSparePartDetailPage = {

	/* string */_requestAddItemToBasket : "/store/spareparts/addItemToBasket",

	addItemToBasket : function(productCode) {
		if (productCode == "" || this._invokeBlocked) {
			return;
		}
		this._invokeBlocked = true;
		var params = {};
		params["productCode"] = productCode;
		params["quantity"] = 1;
		var urlParams = $.param(params);
		var self = this;
		
		wa.add2basket(productCode, 1);

		$("#miniBasket").load(this._requestAddItemToBasket + "?" + urlParams, function(text, status, res) {
			if (status === "success" || status === "notmodified") {
				compMiniBasket.initialize();
				compMiniBasket.signalize();
			}
		});

		this._invokeBlocked = false;
	},

	isRequired : function() {
		return ($("#sparePartDetailPage").length > 0);
	},
	initialize : function() {
		var self = this;
		$("[id^=addItemToBasket]").click(function() {
			self.addItemToBasket($(this).attr('value'));
			return false;
		});

	}
};
/* +++++++++++++++ js-modul for Partlist page +++++++++++++++ */
var compPartListSummary = {
	/* string */_showSparePart : "/store/spareparts/showsparepart/",
	/* string */_showSparePartList : "/store/spareparts/showsparepartlist/",
	/* string */_compInnerParePartId : "#sparePartFooterComponent",
	/* string */_requestAddItemToBasket : "/store/spareparts/addItemToBasket",
	reloadSparPartListAnyWay : "false",
	htmlDump : "",
	tableContent : "",
	showSparePart : function(sparePartNumber, target, url) {
		var self = this;
		htmlDump = $("#sparePartFooterComponent").html();
		if (target != null && target == 'top') {
			location.href = url;
			return;
		}
        if (sparePartNumber == null) {
            sparePartNumber = "";
        }
		$("#sparePartFooterComponent").load(this._showSparePart + sparePartNumber, function(text, status, res) {
			self.initializeSparPart();
			self.initTableSorter();
			self.initSparePartAddBasketItem();
		});
	},
	showSparePartList : function(image, vibki) {
		var self = this;
		var filename = image.replace(/^.*(\\|\/|\:)/, '');
		var params = {};
		params["vibki"] = vibki;
		params["reloadSparPartListAnyWay"] = this.reloadSparPartListAnyWay;
		var urlParams = $.param(params);
		var requestLink = this._showSparePartList + filename;
		if (filename.indexOf('width') != -1) {
			requestLink = this._showSparePartList + filename + "&" + urlParams;
		}
		else {
			requestLink = this._showSparePartList + filename + "?" + urlParams
		}
		$("#sparePartFooterComponent").load(requestLink, function(text, status, res) {
			// alert("Call to initializeSparPartListTable()4");
			// self.initializeSparPartListTable();
			self.initSparePartPaginator();
			self.initExplodedViewPaginator();
			});
	},

	addItemToBasket : function(productCode) {
		if (productCode == null || productCode == "" || this._invokeBlocked) {
			return;
		}
		this._invokeBlocked = true;
		var params = {};
		params["productCode"] = productCode;
		params["quantity"] = 1;
		var urlParams = $.param(params);
		var self = this;
		
		wa.add2basket(productCode, 1);

		$("#miniBasket").load(this._requestAddItemToBasket + "?" + urlParams, function(text, status, res) {
			if (status === "success" || status === "notmodified") {
				compMiniBasket.initialize();
				compMiniBasket.signalize();
			}
		});

		this._invokeBlocked = false;
	},

	isRequired : function() {
		return ($("#sparePartFooterComponent").length > 0);
	},

	initializeSparPartListTable : function() {
		var self = this;
		$("#sparePartTableData td > a").click(function() {
		    var itemId = $(this).attr('id');
            if (itemId != null && itemId.indexOf("addItemToBasket") != -1) {
				self.addItemToBasket($(this).attr('value'));
			}
			else {
				self.showSparePart($(this).attr('value'), $(this).attr('target'), $(this).attr('href'));
			}
			return false;

		});

	},

	initializeSparPartAccessories : function() {
		var self = this;
		$("#accessorieSparePartContainer li > a.btnSubmit").click(function() {
		    var itemId = $(this).attr('id'); 
			if (itemId != null && itemId.indexOf("addItemToBasket") != -1) {
				self.addItemToBasket($(this).attr('value'));
				return false;
			}
			return true;
		});

	},

	initializeSparPartCommon : function() {
		var self = this;
		$("#commonSparePartContainer li > a.btnSubmit").click(function() {
		    var itemId = $(this).attr('id'); 
			if (itemId != null && itemId.indexOf("addItemToBasket") != -1) {
				self.addItemToBasket($(this).attr('value'));
				return false;
			}
			return true;
		});

	},

	initializeSparPart : function() {
		var self = this;
		// $("#entireList").animate({paddingLeft: '15'},"fast").animate({paddingLeft: '10'},"slow");
		$("#entireList").click(function() {
			tmpHtml = $("#sparePartFooterComponent").html();
			$("#sparePartFooterComponent").html(htmlDump);
			if (tmpHtml != "") {
				htmlDump = tmpHtml;
			}

			self.initializeSparPartListTable();
			self.initSparePartPaginator();
			self.initTableSorter();
			self.initExplodedViewPaginator();
			return false;
		});
	},

	initSparePartPaginator : function() {
		$('[id^=paginatiorSparePartList]').pagination(numberOfItems, {
			callback : pageselectCallback,
			items_per_page : 20,
			prev_text : "&lt;",
			next_text : "&gt;",
			current_page : page
		});
	},
	
	initExplodedViewPaginator : function() {
				 $("#explodedViewPaginatorDown").pagination(numberOfExplodedViews,
						  {callback: explodedViewPaginationCallback, items_per_page: 1,  prev_text: "&lt;", next_text: "&gt;", current_page:pageExploded });
				 window.calledFromLoadCallBack = 1;
				 $("#explodedViewPaginatorUp").trigger("setPage",pageExploded);
				 window.calledFromLoadCallBack = 0;
						 
	},

	initTableSorter : function() {
		$('[id^=colHeader]').click(function() {
			columnId = $(this).attr('value');
			if ($(this).attr('sortDirUp') == "true") {
				$(this).attr('sortDirUp', 'false');
			}
			else {
				$(this).attr('sortDirUp', 'true');
			}
			sortDirUp = $(this).attr('sortDirUp');
			sortTable();
		});
	},

	initSparePartAddBasketItem : function() {
		var self = this;
		$("#addItemToBasket").click(function() {
			self.addItemToBasket($(this).attr('value'));
			return false;
		});
	},

	initialize : function() {
		var self = this;

		self.initSparePartPaginator();
		self.initializeSparPartListTable();
		htmlDump = $("#sparePartFooterComponent").html();

		/*
		 * already done in initializeSparPartListTable with selector: "#sparePartTableData td > a" (same identifiers
		 * addItemToBasket<n> used in "common spare parts" and "parts list" tab)
		 */
		$("[id^=addItemToBasket]:not('#sparePartTableData td > a')").click(function() {
			self.addItemToBasket($(this).attr('value'));
			return false;
		});

	}
};

/* +++++++++++++++ js-modul for checkout-summary page +++++++++++++++ */

var compCheckoutSummary = {
	/* variables beginning with '_' are private */
	/* timerId */_invokeDelayTimer : null,
	/* msec */_invokeTimeout : 500,
	/* boolean */_invokeBlocked : false,
	/* string */_requestIncrementItem : "/store/checkout/incrementItem",
	/* string */_paramProductCode : "productCode",
	/* string */_paramQuantity : "quantity",
	/* string */_compContentId : "#checkoutSummaryContent",
	/* string */_compInnerContentId : "#checkoutSummaryInnerContent",

	resultHandling : function(resultText, status, res) {
		this._invokeBlocked = false;

		if (status === "success" || status === "notmodified") {
			$(document).trigger("initialize"); // notify all related components to re-initialize
		}
		else if (status == "error") {
			compCheckoutSummary.restoreLoadedQuantity();
		}
	},

	setNewQuantity : function(operation, productCode, quantity) {
		// note: load(request,params,callback) with params as object sends a post request
		var params = {};
		params[this._paramProductCode] = productCode;
		params[this._paramQuantity] = quantity;
		var urlParams = $.param(params);

		var self = this;
		$(this._compContentId).load(this._requestIncrementItem + "?" + urlParams + " " + this._compInnerContentId,
				function(text, status, res) {
					self.resultHandling(text, status, res);
				});
	},

	restoreLoadedQuantity : function() {
		// quantity was changed by javascript before the ajax request was sent,
		// thus we have to restore the value if the request fails
		$('.quantity > .minus').each(function() {
			var elm = $(this).next('.value');
			var initValue = $(elm).attr("initValue");
			if (initValue != null && initValue != "") {
				$(elm).text(initValue);
			}
		});
	},

	changeQuantityValue : function(elm, operation) {
		var value = parseInt($(elm).text());
		if ((operation == "minus") && (value > 1)) {
			value--;
			$(elm).text(value);
			return true;
		}
		else if (operation == "plus") {
			value++;
			$(elm).text(value);
			return true;
		}
		return false;
	},

	isRequired : function() {
		return ($(this._compInnerContentId).length > 0 && $(this._compInnerContentId).attr("compInitialized") != "true");
	},

	initialize : function() {
		// prevent multiple initializing
		$(this._compInnerContentId).attr("compInitialized", "true");

		if (document.testform != null) {
			document.testform.quantity.value = $("#quantityForPartnumber").text();
			document.testform.partNumber.value = "";
		}

		var self = this;

		$('.quantity > .plus, .quantity > .minus').click(function() {
			if (self._invokeBlocked) {
				return;
			}

			var opId = $(this).attr('class');
			var elm = (opId == "minus") ? $(this).next('.value') : $(this).prev('.value');

			if (self.changeQuantityValue(elm, opId)) {

				if (self._invokeDelayTimer != null) {
					clearTimeout(self._invokeDelayTimer);
				}

				var quantity = parseInt($(elm).text());
				var productCode = $(elm).attr("productCode");
                if (productCode == null) {
                    productCode = "";
                }
				self._invokeDelayTimer = setTimeout(function() {
					self._invokeDelayTimer = null;
					self._invokeBlocked = true;
					self.setNewQuantity(opId, productCode, quantity);
				}, self._invokeTimeout);
			}
			return false;
		});

		// form posts / URL request
		$("#continueButton").click(function() {
			if ($("#voucherform :input").length != 0 && $("#voucherform #code").val() != "") {
				$("#voucherform").submit();
			} else {
				$("#handlingform").submit();
			}
		});
		
		// form posts / URL request
		$("#applyVoucherButton").click(function() {
			$("#voucherform").submit();
		});
		
		// form posts / URL request
		$("#deleteVoucherButton").click(function() {
			$("#voucherform").submit();
		});
	}
};

/* +++++++++++++++ js-modul for spareparts search page +++++++++++++++ */

var compRatePlateFinder = {
	/* variables beginning with '_' are private */
	/* string */_requestTypePlateFinder : "/store/ajax/typeplatefinder",
	/* string */_compCategoryContentId : "#categoryContent",
	/* string */_compCategoryInnerContentId : "#categoryInnerContent",
	/* string */_compSubCategoryContentId : "#subCategoryContent",
	/* string */_compSubCategoryInnerContentId : "#subCategoryInnerContent",
	/* string */_compPlatesContentId : "#foundPlatesContent",
	/* string */_compPlatesInnerContentId : "#foundPlatesInnerContent",

	findTypePlate : function() {
		var category = $("#selectCategory option:selected").val();
		if (category == "") {
			return;
		}
		var subcategory = $("#selectSubCategory option:selected").val();
		var params = {};
		params["category"] = category;
		if (subcategory != null && subcategory != "") {
			params["subcategory"] = subcategory;
		}
		var urlParams = $.param(params);

		$(this._compPlatesContentId).html(""); // clear content

		var self = this;
		$(this._compSubCategoryContentId).load(
				this._requestTypePlateFinder + "?" + urlParams + " " + this._compSubCategoryInnerContentId,
				function(resultText, status, res) {
					if (status === "success" || status === "notmodified") {
						compRatePlateFinder.initializeSubCategory();
					}

					if (self.subcategory == null || self.subcategory == "") {
						if ($("#selectSubCategory option").length == 2 && $("#selectSubCategory option").val() == "") {
							$("#selectSubCategory").attr("selectedIndex", 1);
							self.findTypePlate();
							return;
						}
					}
					// removing all scripts to avoid errors (IE)
					var rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;
					var resultDom = jQuery("<div>").append(resultText.replace(rscript, ""));

					// actualize main selection
					$(self._compCategoryContentId).html(resultDom.find(self._compCategoryInnerContentId));
					compRatePlateFinder.initializeMainCategory();

					// actualize plate finder images (if available)
					$(self._compPlatesContentId).html(resultDom.find(self._compPlatesInnerContentId));
				});
	},

	isRequired : function() {
		return ($("#rateplatefinder").length > 0);
	},

	initializeSubCategory : function() {
		var self = this;
		$("#selectSubCategory").change(function() {
			self.findTypePlate();
			return false;
		});
	},

	initializeMainCategory : function() {
		var self = this;
		$("#selectCategory").change(function() {
			self.findTypePlate();
			return false;
		});
	},

	initialize : function() {
		this.initializeMainCategory();
		this.initializeSubCategory();
	}
};

/* +++++++++++++++ js-modul for primary navigation search (autosuggest) +++++++++++++++ */
/* attention: this component needs JSTemplateParser modul */

function jsonAutoSuggestCallback(data) {
    // only necessary for mock, can be removed later 
    // (ajax uses a temp. generated callback, but jsonp mock file autosuggest-test.js needs fix defined callback)
}

var compPrimarySearch = { 
	/* string */_compSearchInputField : "#searchTerm",
	/* string */_compSearchDefaultText : "",
	/* string */_compSearchRequest : "",           // search url after suggestion was done
	/* string */_compSearchSuggestRequest : "",    // auto suggest request (by default disabled)
	/* string */_compSearchRequestScope : "",      // sope of the auto suggest request (added to request))
	/* array */_compSearchTemplates  : {},         // js-templates used to insert autosuggest values
    /* array */_compSearchKeyWrapper  : {},        // mapping of autosuggest attributes to keys used in js-templates
    /* array */_compSearchResultKeys : [],         // mapping of an autosuggest attribute used to set as selection into input field for searching
    /* array */_compSearchResultHandler : {},      // mapping for handling with selected result (default is returing result string)
    /* integer */_compSearchSuggestMaxItems : 100,  // max. shown suggestions, then 'more ...' is shown
    /* integer */_compSearchMinChars : 3,          // min. entered characters for suggestion
    /* array */_compSearchSuggestRanges : [],      // used for navigate through suggestions if more as max visible items are available
    /* string */_compSearchLastResult : null,
    /* string */_compSearchLastShopResult : null,
    /* string */_compSearchLastAdditionResult : null,
    /* boolean */_compSearchShowKeywords : false,
    /* boolean */_compSearchShowShadow : false,
    /* string */_compSearchPathPrefixCategory : "/store/category/",
    /* string */_compSearchPathPrefixProduct : "/store/product/",
    /* string */_compSearchPathPrefixMaterialNumber : "/store/sparepartdetails/",
    /* string */_compSearchAllProductsUrl : "",
    /* string */_compSearchAllContentsUrl : "",
    /* array */_compSearchExtendedOptions : {},
    /* array */_compSearchDefaultOptions : {
    		width: 320,
            leftAligned: true,
            topOffset: 5,
            leftOffset: 35,                                                                                                          
    		max: 500,
    		resultsClass: "suggest_results",
        	matchContains: true,
        	useCache: false,
        	selectByReturn: true,
        	selectFirst: false,
        	showLoadingIndicator: false,
    		scroll: true,
    		scrollHeight: 700
    },

    setSearchInputfieldId : function(fieldId) {
        this._compSearchInputField = ((fieldId.charAt(0) == '#') ? fieldId : "#" + fieldId);
    },
    
    setSearchDefaultText : function(defText) {
        this._compSearchDefaultText = defText;
		$(this._compSearchInputField).attr("value", this._compSearchDefaultText);

        var self = this;
		$(this._compSearchInputField).focusin(function() {
			if ($(this).attr("value") == self._compSearchDefaultText)
				$(this).attr("value", "");
		}).focusout(function() {
			if ($(this).attr("value") == "")
				$(this).attr("value", self._compSearchDefaultText);
		});
    },
   
    setSearchRequest : function(request) {
        this._compSearchRequest = request;    // set search url after suggestion was done
    },

    setAutoSuggestRequest : function(request) {
        // check for valid url (must start with http)
        if (request.toLowerCase().indexOf("http") == 0) {
            this._compSearchSuggestRequest = request;    // set auto suggest request to activate this feature
            this.initAutoSuggestCompleter();
        }
    },

    setAutoSuggestScope : function(scope) {
        this._compSearchRequestScope = scope; // set auto suggest scope of the request
    },

    setAutoSuggestExtendedOptions : function(opt) {
        this._compSearchExtendedOptions = opt;     
    },
     
    setMinCharactersForSuggestion : function(minChars) {
        if (minChars != null && minChars > 0) {
            this._compSearchMinChars = minChars;
        }
        else {
            this._compSearchMinChars = 1;
        }
    },
    
    showAutoSuggestMenuShadow : function(enabled) {
        this._compSearchShowShadow = enabled;
    },
    
    addAutoSuggestTemplates : function(templateGroupId, tmplMap) {
        this.setTemplates(templateGroupId, tmplMap);     
    },

    addAutoSuggestTemplateKeyWrapper : function(suggestField, tmplField) {
        this._compSearchKeyWrapper[suggestField] = tmplField;
    },

    setAutoSuggestResultKeys : function(keys) {
        this._compSearchResultKeys = keys;
    },

    addAutoSuggestResultResultHandler : function(suggestField, hdlr) {
        // hdlr = { prepareResult: function(templateGroupId, value, suggestion) {return value;},
        //          submitResult: function(templateGroupId, value) {}};
        this._compSearchResultHandler[suggestField] = hdlr;
    },
            
    setShowKeywordsEnabled : function(enabled) {
        this._compSearchShowKeywords = enabled;
    },
    
    setAllProductsUrl : function(url) {
        this._compSearchAllProductsUrl = url;
    },

    setAllContentsUrl : function(url) {
        this._compSearchAllContentsUrl = url;
    },

    setCategroyPrefixPath : function(prefixPath) {
        this._compSearchPathPrefixCategory = prefixPath;
    },
        
    setProductPrefixPath : function(prefixPath) {
        this._compSearchPathPrefixProduct = prefixPath;
    },

    setMaterialNumberPrefixPath : function(prefixPath) {
        this._compSearchPathPrefixMaterialNumber = prefixPath;
    },
    
    setAutoSuggestMaxItems : function(maxSuggestItems) {
        this._compSearchSuggestMaxItems = maxSuggestItems; // set auto suggest max. count of suggest items
    },

	searchForSelectedSuggestion : function() {
        // invoked by selecting normal search (default handling like done by enter return)
        if ($(this._compSearchInputField).attr("value") != "") {
            var inputForm = $(this._compSearchInputField).parent();
            if (inputForm != null) {
                setTimeout(function() { $(inputForm).submit(); }, 1);
            }
        }
    },

    getValideSearchValue : function() {
		var value = $(this._compSearchInputField).attr("value");
		if (value != "") {
            if (value == this._compSearchDefaultText) {
                value = "";
            }
            else {
                // encrypt or remove invalid characters
    			value = value.replace(/\//g, "_").replace(/</g, "").replace(/>/g, "");
            }
        }
        return value;
    },
    
    verifySearchValue : function() {
		var value = this.getValideSearchValue();
		if (value != "") {
			var inputForm = $(this._compSearchInputField).parent();
			$(inputForm).attr( "action",
					this._compSearchRequest	+ encodeURIComponent(value));
		    $(this._compSearchInputField).attr("value",value);

		    var self = this;
            setTimeout(function(){ $(self._compSearchInputField).addClass("ac_loading"); }, 10);
			return true;
		}
		return false; // no search
	},

    getAutoSuggestSearchValue : function() {
        this.initTemplateNavigation();  // reset navigation before next search is done
		var searchValue = this.getValideSearchValue();

        this._compSearchLastResult = null;
        this._compSearchLastShopResult = null;
        this._compSearchLastAdditionResult = null;
        
        // currently no additional direct json result from another suggestion server is involved
        // this.invokeAdditionalSuggestRequest(searchValue);  // another autosuggest integration
        return searchValue;
    },
    
    initTemplateNavigation : function() {
        // initialize navigation through suggestions
        this._compSearchSuggestRanges["keywords"] = { start:0, end:-1, max:-1 };
        this._compSearchSuggestRanges["categories"] = { start:0, end:-1, max:-1 };
        this._compSearchSuggestRanges["products"] = { start:0, end:-1, max:-1 };
        this._compSearchSuggestRanges["default"] = { start:0, end:-1, max:-1 };    
    },
    
    initTemplates : function() {
         // used suggest values shown in input field if selected (the first one has the lowest priority)
        this._compSearchResultKeys.push("mlValue");
        this._compSearchResultKeys.push("catid");
        this._compSearchResultKeys.push("productcode");
        this._compSearchResultKeys.push("searchterm");
        this._compSearchResultKeys.push("fhLocation");

        var self = this;
        this._compSearchResultHandler["fhLocation"] = {
                prepareResult: function(templateGroupId, value, suggestion) { 
                    // prepare value of fhLocation if necessary
                    if (templateGroupId == "categories") {
                        var path = self.buildURLPathForCategory(value);
                        return self._compSearchPathPrefixCategory + path;
                    }
                    else {
                        return value; 
                    }
                },
                submitResult: function(templateGroupId, value) {
                    // go immediately to suggested category 
                    setTimeout(function(){
                        window.location.href = value;
                    }, 1); 
                    return true; 
                }
        };
        
        this._compSearchResultHandler["productcode"] = {
                prepareResult: function(templateGroupId, value, suggestion) { 
                    // prepare value of productcode if necessary
                    if (templateGroupId == "products") {
                        if (self.isProductCodeMaterialNumber(value)) {
                            var path = self.buildURLPathForProduct(value,suggestion.name);
                            return self._compSearchPathPrefixMaterialNumber + path;
                        }
                        else {
                            var path = self.buildURLPathForProduct(value,suggestion.name);
                            return self._compSearchPathPrefixProduct + path;
                        }
                    }
                    else {
                        return value; 
                    }
                },
                submitResult: function(templateGroupId, value) {
                    // go immediately to suggested product 
                    setTimeout(function(){
                        window.location.href = value;
                    }, 1); 
                    return true; 
                }
        };
                    
        this._compSearchResultHandler["nectarLink"] = {
                prepareResult: function(templateGroupId, nectarLink, nectarGroupId) { 
                    return self.buildURLPathForNectarLink(nectarLink, nectarGroupId);
                },
                submitResult: function(templateGroupId, value) {
                    // go immediately to nectar link 
                    setTimeout(function(){
                        window.location.href = value;
                    }, 1); 
                    return true; 
                }
        };

        // wrapped keys used in templates (suggest-info key -> layout template key) 
        this._compSearchKeyWrapper["indexName"]  = "groupName";
        this._compSearchKeyWrapper["indexTitle"] = "groupTitle";
        this._compSearchKeyWrapper["fhLocation"] = "suggestLocation";
        this._compSearchKeyWrapper["mlValue"]    = "suggestName";
        this._compSearchKeyWrapper["name"]       = "suggestName";
        this._compSearchKeyWrapper["nrResults"]  = "suggestCount";
        this._compSearchKeyWrapper["catid"]      = "suggestProductId";
        this._compSearchKeyWrapper["productcode"] = "suggestProductCode";
        this._compSearchKeyWrapper["secondid"]   = "suggestProductId";
        this._compSearchKeyWrapper["price"]      = "suggestPrice";
        this._compSearchKeyWrapper["_thumburl"]  = "suggestImage";
        this._compSearchKeyWrapper["_iconurl"]   = "suggestImage";
        this._compSearchKeyWrapper["searchterm"] = "suggestSearchterm";
                       
        this._compSearchTemplates["keywords"] = { 
            suggestionGroup :           '<div class="suggest-group-title">%{getMessage("keywords",groupTitle)}</div>',
            suggestionGroupSeparator :  '<hr class="suggest-group-separator" />',
            suggestionMore :            '<div class="suggest-item-navigation"><span class="suggest-item-more" onclick="compPrimarySearch.selectMoreItem(\'keywords\');">%{getMessage("more","more")}</span></div>',
            suggestionPrevious :        '<div class="suggest-item-navigation-disabled"><span class="suggest-item-moreAndPrevious-disabled">%{getMessage("more","more")}</span><span class="suggest-item-separator">&nbsp;</span><span class="suggest-item-previous" onclick="compPrimarySearch.selectPreviousItem(\'keywords\');">%{getMessage("previous","previous")}</span></div>',
            suggestionMoreAndPrevious : '<div class="suggest-item-navigation"><span class="suggest-item-moreAndPrevious" onclick="compPrimarySearch.selectMoreItem(\'keywords\');">%{getMessage("more","more")}</span><span class="suggest-item-separator">&nbsp;</span><span class="suggest-item-previous" onclick="compPrimarySearch.selectPreviousItem(\'keywords\');">%{getMessage("previous","previous")}</span></div>',
            suggestion :                '<div class="suggest-item-title">%{suggestSearchterm} <span class="suggest-item-count">(%{suggestCount})</span></div>'
        };
        this._compSearchTemplates["categories"] = { 
            suggestionGroup :           '<div class="suggest-group-title">%{getMessage("categories",groupTitle)}</div>',
            suggestionGroupSeparator :  '<hr class="suggest-group-separator" />',
            suggestionMore :            '<div class="suggest-item-navigation"><span class="suggest-item-more" onclick="compPrimarySearch.selectMoreItem(\'categories\');">%{getMessage("more","more")}</span></div>',
            suggestionPrevious :        '<div class="suggest-item-navigation-disabled"><span class="suggest-item-moreAndPrevious-disabled">%{getMessage("more","more")}</span><span class="suggest-item-separator">&nbsp;</span><span class="suggest-item-previous" onclick="compPrimarySearch.selectPreviousItem(\'categories\');">%{getMessage("previous","previous")}</span></div>',
            suggestionMoreAndPrevious : '<div class="suggest-item-navigation"><span class="suggest-item-moreAndPrevious" onclick="compPrimarySearch.selectMoreItem(\'categories\');">%{getMessage("more","more")}</span><span class="suggest-item-separator">&nbsp;</span><span class="suggest-item-previous" onclick="compPrimarySearch.selectPreviousItem(\'categories\');">%{getMessage("previous","previous")}</span></div>',
            suggestion :                '<div class="suggest-item-title">%{suggestName} <span class="suggest-item-count">(%{suggestCount})</span></div>'
        };
        this._compSearchTemplates["products"] = { 
            suggestionGroup :           '<div class="suggest-group-title">%{getMessage("products",groupTitle)}</div>',
            suggestionGroupSeparator :  '<hr class="suggest-group-separator" />',
            suggestionMore :            '<div class="suggest-item-navigation"><span class="suggest-item-more" onclick="compPrimarySearch.selectMoreItem(\'products\');">%{getMessage("more","more")}</span></div>' ,
            suggestionPrevious :        '<div class="suggest-item-navigation-disabled"><span class="suggest-item-moreAndPrevious-disabled">%{getMessage("more","more")}</span><span class="suggest-item-separator">&nbsp;</span><span class="suggest-item-previous" onclick="compPrimarySearch.selectPreviousItem(\'products\');">%{getMessage("previous","previous")}</span></div>',
            suggestionMoreAndPrevious : '<div class="suggest-item-navigation"><span class="suggest-item-moreAndPrevious" onclick="compPrimarySearch.selectMoreItem(\'products\');">%{getMessage("more","more")}</span><span class="suggest-item-separator">&nbsp;</span><span class="suggest-item-previous" onclick="compPrimarySearch.selectPreviousItem(\'products\');">%{getMessage("previous","previous")}</span></div>',
            suggestion :                '<div class="suggest-item-title">%{suggestName}<br/>%{suggestProductCode}</div>',
            suggestionWithImage :       '<div class="suggest-item-image"><div class="imgSection"><div class="imgContainer"><img src="%{suggestImage}"></div></div> <div class="suggest-item-image-title">%{suggestName}<br/>%{suggestProductCode}</div></div>'
        };
        this._compSearchTemplates["default"] = { 
            suggestionGroup :           '<div class="suggest-group-title">%{groupTitle}</div>',
            suggestionGroupSeparator :  '<hr class="suggest-group-separator" />',
            suggestionGroupSpacer :     '<div class="suggest-group-spacer">&nbsp;</div>',
            suggestionMore :            '<div class="suggest-item-navigation"><span class="suggest-item-more" onclick="compPrimarySearch.selectMoreItem(\'default\');">%{getMessage("more","more")}</span></div>',
            suggestionPrevious :        '<div class="suggest-item-navigation-disabled"><span class="suggest-item-moreAndPrevious-disabled">%{getMessage("more","more")}</span><span class="suggest-item-separator">&nbsp;</span><span class="suggest-item-previous" onclick="compPrimarySearch.selectPreviousItem(\'default\');">%{getMessage("previous","previous")}</span></div>',
            suggestionMoreAndPrevious : '<div class="suggest-item-navigation"><span class="suggest-item-moreAndPrevious" onclick="compPrimarySearch.selectMoreItem(\'default\');">%{getMessage("more","more")}</span><span class="suggest-item-separator">&nbsp;</span><span class="suggest-item-previous" onclick="compPrimarySearch.selectPreviousItem(\'default\');">%{getMessage("previous","previous")}</span></div>',
            suggestionShowAll :         '<div class="suggest-item-all">%{getMessage("showAll","Show all")}</div>',
            suggestion :                '<div class="suggest-item-title">%{suggestName} <span class="suggest-item-count">(%{suggestCount})</span></div>',
            suggestionStoreLink :       '<div class="suggest-item-link">%{getMessage("store","Show all in Store")}</div>'
        };
        this._compSearchTemplates["nectar"] = { 
            suggestionProductLink :     '<div class="suggest-item-link">%{getMessage("allProducts","All Products")}</div>',
            suggestionContentLink :     '<div class="suggest-item-link">%{getMessage("allContents","Show all Contents")}</div>',
            suggestionGroupSeparator :  '<hr class="suggest-group-separator" />'
        };
    },

    getTemplates : function(templateGroupId) {
        templateGroupId = templateGroupId.toLowerCase();
        var tmpl = this._compSearchTemplates[templateGroupId];
        if (tmpl != null) {
            return tmpl;
        }
        return this._compSearchTemplates["default"];  
    },

    parseTemplate : function(templateGroupId, templateId, uimap) {
        templateGroupId = templateGroupId.toLowerCase();
        var tmpl = this.getTemplates(templateGroupId)[templateId];
        if (tmpl == null && templateId != "suggestion") {
            this.getTemplates(templateGroupId)["suggestion"];   // default
        }
        
        // attention: needs JSTemplateParser implementation
        return JSTemplateParser.parse(tmpl, uimap, compCommon);
    },
 
    setTemplates : function(templateGroupId, tmplMap) {
        templateGroupId = templateGroupId.toLowerCase();
        this._compSearchTemplates[templateGroupId] = tmplMap;
    },
    
    selectMoreItem : function(templateGroupId) {
        templateGroupId = templateGroupId.toLowerCase();
        var range = this._compSearchSuggestRanges[templateGroupId];
        if (range != null) {
            range.start += this._compSearchSuggestMaxItems;
            if (range.start > range.max) {
                range.start = 0;
            }
        }
		var value = this.getValideSearchValue();
        $(this._compSearchInputField).trigger("update", [this._compSearchLastResult, value]);
    },
    
    selectPreviousItem : function(templateGroupId) {
        templateGroupId = templateGroupId.toLowerCase();
        var range = this._compSearchSuggestRanges[templateGroupId];
        if (range != null) {
            range.start -= this._compSearchSuggestMaxItems;
            if (range.start < 0) {
                range.start = 0;
            }
        }
		var value = this.getValideSearchValue();
        $(this._compSearchInputField).trigger("update", [this._compSearchLastResult, value]);
    },

    invokeAdditionalSuggestRequest : function(searchValue) {
        var self = this;
        var autoSuggestURL = this._compSearchSuggestRequest;  // test
       
        // add params to request
 		var params = {};
        if (this._compSearchRequestScope != null && this._compSearchRequestScope != "") {
    		params["scope"] = this._compSearchRequestScope;
        }

    	params["search"] = searchValue;
        
		var urlParams = $.param(params);
        if (urlParams != "") {
            autoSuggestURL += (((autoSuggestURL.indexOf("?") < 0) ? "?" : "&")+ urlParams);
        }
		
        try {
			$.ajax({
				url : autoSuggestURL,
				type : "GET",
				cache : false,
				async : true,
				crossDomain : true,
        		dataType: "jsonp",
				success : function(jsonResult, status) {
                    var result = null;
                    if (typeof(jsonResult) == "string") {
                        if (jsonResult != null && jsonResult != "" && jsonResult.indexOf("404 Error") < 0 && (jsonResult.indexOf("DOCTYPE") < 0)
    							&& (jsonResult.indexOf("<html") < 0)) {    
                            result = $.parseJSON(jsonResult);
					    }
                    }
                    else {
                        result = jsonResult;
                    }
                    self._compSearchLastAdditionResult = result;

                    if (self._compSearchLastShopResult != null && self._compSearchLastAdditionResult != null) {
        	            // merge result with shop suggestion and update menu
                        var mergedResult = self.mergeSearchResults(self._compSearchLastShopResult, self._compSearchLastAdditionResult);
                        self._compSearchLastResult = self.sortSearchResults(mergedResult);
                        
                		var value = self.getValideSearchValue();
                        $(self._compSearchInputField).trigger("update", [self._compSearchLastResult, value]);
                    }
				},
				error : function(jqXHR, textStatus, errorThrown) {
				}
			});
		}
		catch (e) { /* the connection to nectar is possibly not reachable */
		}    
    },
    
    initAutoSuggestCompleter : function() {
        var self = this;

        if (this._compSearchSuggestRequest == null || this._compSearchSuggestRequest == "") {
            // autosuggest is not configured
            return;
        }

        if ($(this._compSearchInputField).attr("compInitialized") == "true") {
            return; // already initialized
        }        
		$(this._compSearchInputField).attr("compInitialized", "true");
	    $(this._compSearchInputField).removeClass("ac_loading");

        this.initTemplates();

        if (this._compSearchSuggestRequest.indexOf("autosuggest-test.js") > 0) {       
        	$.ajaxSetup({
        		jsonpCallback: "jsonAutoSuggestCallback"  // only necessary for mock, can be removed later
        	});
        }
        
        // build auto suggest request
        var autoSuggestURL = this._compSearchSuggestRequest;
       
        // add params to request
 		var params = {};
        if (this._compSearchRequestScope != null && this._compSearchRequestScope != "") {
    		params["scope"] = this._compSearchRequestScope;
        }
        
		var urlParams = $.param(params);
        if (urlParams != "") {
            autoSuggestURL += (((autoSuggestURL.indexOf("?") < 0) ? "?" : "&")+ urlParams);
        }

        var options = {};
        $.extend(options, this._compSearchDefaultOptions, (this._compSearchExtendedOptions || {}), {
        	minChars: this._compSearchMinChars,
            dataType: "jsonp",
            extraParams: { search: function() { 
                return self.getAutoSuggestSearchValue(); } 
            },
        	highlight: function(value, term) {
                if (value.indexOf("...") > 0 || (value.length > 0 && value.charAt(0) == " ")) {
                    return value;   // do not highlight letters in more, previous text
                }
        		return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
            },
    		parse: function(jsonResult) {
                        var result = null;
                        if (typeof(jsonResult) == "string") {
                            result = $.parseJSON(jsonResult);
                        }
                        else {
                            result = jsonResult;
                        }
                        self._compSearchLastShopResult = result;
        	            
        	            if (self._compSearchLastShopResult != null && self._compSearchLastAdditionResult != null) {
            	            // merge result with nectar suggestion
            	            result = self.mergeSearchResults(self._compSearchLastShopResult, self._compSearchLastAdditionResult);
                        }
                        self._compSearchLastResult = self.sortSearchResults(result);
        	            
                        var parsed = []; 
                        // note: parsed object format:       	       
                        // data[]->user data, value->formatted result data shown in menu, result->set into input field as selected value
                        // example: parsed[parsed.length] = {data:["dddd1"],value:"vvvv1",result:"rrrrr1"};    
                        if (self._compSearchLastResult != null) {
                            self.handleResult(self._compSearchLastResult, parsed);
                        }
                        return parsed;  
                    },
       		formatItem: function(data, i, n, value) {
    			return self.formatResult(i, n, value, data);
    		},
    		formatResult: function(data, value) {
    			return value.split(".")[0];
    		}
        });

        if (this._compSearchShowShadow) {
            if (options.width != null) {
                options.width += 20;
            }
            if (options.leftOffset != null) {
                options.leftOffset += 10;
            }
            if (options.resultsClass != null) {
                options.resultsClass += " shadow";
            }
        }
       
        $(this._compSearchInputField).autocomplete(autoSuggestURL, options).bind("result", function(){
            self.searchForSelectedSuggestion();   // user has selected a suggestion
        });
    },

    mergeSearchResults : function(shopResult, nectarResult) {
        var result = shopResult;

        if (shopResult != null && nectarResult != null) {
            var groupCountShop = this.getSuggestionGroupCount(shopResult.suggestionGroups);
            var groupCountNectar = this.getSuggestionGroupCount(nectarResult.suggestionGroups);

            if (groupCountShop == 0) {
                result = nectarResult;
            }
            else if (groupCountNectar > 0) {
                var mergedSuggestionGroups = [];
                // merge suggestion groups
                $(shopResult.suggestionGroups).each(function(groupIdx, suggestionGroup){
                    mergedSuggestionGroups.push(suggestionGroup);    
                });
                $(nectarResult.suggestionGroups).each(function(groupIdx, suggestionGroup){
                    mergedSuggestionGroups.push(suggestionGroup);    
                });
                result = {"suggestionGroups" : mergedSuggestionGroups};
            }
        }
        return result;
    },
        
    sortSearchResults : function(allResult) {
        var result = allResult;

        // sort products, categories and keywords
        if (allResult != null) {
            var suggestionGroupKeywords = null;
            var sortedSuggestionGroups = [];
            
            $(allResult.suggestionGroups).each(function(groupIdx, suggestionGroup){

                var indexName = suggestionGroup.indexName.toLowerCase(); // "keywords", "categories" or "products", ...
                if (indexName.indexOf("categories") >= 0) {
                    sortedSuggestionGroups.unshift(suggestionGroup);    // always at first    
                }
                else if (indexName.indexOf("products") >= 0) {
                    sortedSuggestionGroups.push(suggestionGroup);    
                }
                else if (indexName.indexOf("keywords") >= 0) {
                    suggestionGroupKeywords = suggestionGroup;  // always at last 
                }
            });
            if (suggestionGroupKeywords != null && this._compSearchShowKeywords) {
                sortedSuggestionGroups.push(suggestionGroupKeywords); 
            }
            result = {"suggestionGroups" : sortedSuggestionGroups};
        }
        return result;
    },
    
    getSuggestionGroupCount : function(suggestionGroups) {
        var count = 0;
        $(suggestionGroups).each(function(groupIdx, suggestionGroup){
             $(suggestionGroup.suggestions).each(function(suggestIdx, suggestion){
	             if (suggestion.nrResults != null && suggestion.nrResults > 0) {
		             count += 1;
		             return false;    // break
		         }
		         else if (suggestion.productcode != null){
		             count += 1;
		             return false;    // break
                 }
		     });
        });
        return count;
    },
    
    getSuggestionCount : function(templateGroupId, suggestionGroups, allItems) {
        var count = 0;
        $(suggestionGroups).each(function(groupIdx, suggestionGroup){
		    if (templateGroupId == "*" || (suggestionGroup.indexName != null && 
                suggestionGroup.indexName.toLowerCase().indexOf(templateGroupId) >= 0)) { 
                     if (allItems) {
                         $(suggestionGroup.suggestions).each(function(suggestIdx, suggestion){
    			             if (suggestion.nrResults != null) {
        			             count += suggestion.nrResults;
        			         }
        			         else if (suggestion.productcode != null){
        			             count += 1;
                             }
        			     });
                     }
                     else {
        			     count += suggestionGroup.suggestions.length;
                     }
    		}
        });
        return count;
    },
    
    extractSuggestionIndexName : function(indexName) {
        var ret = "";

        if (indexName.match(".idx$") == '.idx') {
        	indexName = indexName.substr(0, indexName.length - 4); // cut the optional trailing extension
        }
    
        for (var i=0; i < indexName.length; i++) {
            var c = indexName.charAt(i);
            if (c < '0' || c > '9')
                ret += c;
        }
        return ret;
    },
    
    buildURLPathForCategory : function(fhLocation) {
        var fullPath = "";
        var lastPath = "";
        var path = "";
        var readingPath = false;
        var rootPathIgnored = false;    // root is starting with "catalog01"

        for (var i=0; i < fhLocation.length; i++) {
            var c = fhLocation.charAt(i);
            if (c == '}') {
                readingPath = false;
                if (lastPath.length > 0) {
                    lastPath += '_';
                }
                if (!rootPathIgnored) {
                    rootPathIgnored = true;
                }
                else {
                    lastPath += path;
                    fullPath += lastPath;
                }
                path = "";
            }
            else if (c == '{') {
                readingPath = true;
                if (rootPathIgnored && fullPath.length > 0) {
                    fullPath += '/';
                }
            }
            else if (readingPath) {
                path += c;
            }
        }
        return fullPath;
    },
    
    buildURLPathForProduct : function(productCode, productName) {
        var fullPath = "p";  // default for product name
    
        if (productName != null && productName.length > 0) {
            fullPath = productName.replace(/[^(a-zA-Z)]/g, "");  
        }
        fullPath += ("/" + productCode);  
        return fullPath;
    },
    
    buildURLPathForNectarLink : function(nectarLink, nectarGroupId) {
        var fullPath = nectarLink;
 		var params = {};
   		params["q"] = $(this._compSearchInputField).attr("value");;
   		params["fgroup"] = nectarGroupId;
      
		var urlParams = $.param(params);
        fullPath += (((fullPath.indexOf("?") < 0) ? "?" : "&")+ urlParams);
        return fullPath; 
    },
    
    isProductCodeMaterialNumber : function( productCode ) {
        if( productCode != null && productCode.length == 6 && productCode.search(/[^(0-9)]/) == -1) {
            return true;
        }
        return false;
    },
    
    handleResult : function(result, parsed) {
        var self = this;
        var groupCount = self.getSuggestionGroupCount(result.suggestionGroups);
        var groupIndex = 0;
        var uiHeadMap = {};

        if (groupCount > 0) {
            uiHeadMap["suggestGroupCount"] = groupCount;
            uiHeadMap["suggestAllCount"] = self.getSuggestionCount("*", result.suggestionGroups, true);
            uiHeadMap["suggestProductsCount"] = self.getSuggestionCount("products", result.suggestionGroups);
        }
        else {
            uiHeadMap["suggestGroupCount"] = 0;
            uiHeadMap["suggestAllCount"] = 0;
            uiHeadMap["suggestProductsCount"] = 0;
        } 

        if (uiHeadMap["suggestAllCount"] == 0) {
    		var resultValue = self.getValideSearchValue();
            var suggestHtml = self.parseTemplate("default", "suggestionStoreLink", uiHeadMap);
            parsed[parsed.length] = {data:["storeLink"],value:suggestHtml,result:resultValue};
    
            var suggestGroupSeparatorHtml = self.parseTemplate("default", "suggestionGroupSeparator", uiHeadMap);
            parsed[parsed.length] = {data:["separator"],value:suggestGroupSeparatorHtml,result:null};
        }

        $(result.suggestionGroups).each(function(groupIdx, suggestionGroup){
           
            var suggestionsCount = suggestionGroup.suggestions.length;
            if (suggestionsCount <= 0) {
            	return true;
            }
                                    
            var indexName = suggestionGroup.indexName; // "searchterm", "Categories" or "Suggested Products", ...
            var indexTitle = suggestionGroup.indexTitle; // "searchterm", "Categories" or "Suggested Products"
            if (indexTitle.match(".idx$") == '.idx') {
            	indexTitle = indexTitle.substr(0, indexTitle.length - 4); // cut the optional trailing extension
            }
			// suggest index with name ' .idx' is an alias for 'searchterm.idx' (legacy) 
			if (indexName === ' ') {
				indexName = 'searchterm';
			}
			else {
				indexName = indexName.replace(' ', '_');
			}
	        
	        indexName = self.extractSuggestionIndexName(indexName);

	        var uimap = {};
	        for (var field in suggestionGroup) {
                field = field.replace(' ', '_');
                var mapped = self._compSearchKeyWrapper[field];
                if (mapped != null) {
                    uimap[mapped] = suggestionGroup[field];
                }
            }

            var suggestGroupHtml = self.parseTemplate(indexName, "suggestionGroup", uimap);
            parsed[parsed.length] = {data:["group"],value:suggestGroupHtml,result:null};

            var suggestRange = self._compSearchSuggestRanges[indexName.toLowerCase()];
            if (suggestRange != null) {
                suggestRange.max = suggestionGroup.suggestions.length;
            }
                        
		    var suggestCount = 0;
			$(suggestionGroup.suggestions).each(function(suggestIdx, suggestion) {
    			if (suggestion.nrResults != null || suggestion.productcode != null) {
    			    
                    if (suggestRange != null && suggestIdx < suggestRange.start) {
                        return true;    // next
                    }

    			    if (suggestCount >= self._compSearchSuggestMaxItems) {
                        if (suggestRange.start == 0) {
                            var suggestHtml = self.parseTemplate(indexName, "suggestionMore", uimap);
                            parsed[parsed.length] = {data:["more"],value:suggestHtml,result:null};
                        }
                        else {
                            var suggestHtml = self.parseTemplate(indexName, "suggestionMoreAndPrevious", uimap);
                            parsed[parsed.length] = {data:["moreandprevious"],value:suggestHtml,result:null};
                        }
                        return false;    // break iteration
                    }
    			
    			    var useImgTemplate = false;
    			    var resultIndex = -1;
    			    var resultValue = null;
    			    var resultHandler = null;
    			    
    			    if (suggestion._thumburl != null && suggestion._iconurl != null) {
                        suggestion._thumburl = null;    // use thumbnail (_iconurl)
                    }
        	        
                    for (var field in suggestion) {
                        if (field == null || field == "") {
                            continue;
                        }
                        
                        field = field.replace(' ', '_');
                        var mapped = self._compSearchKeyWrapper[field];
                        if (mapped != null) {
                            uimap[mapped] = suggestion[field];
                            
                            if (mapped == "suggestImage") {
                                useImgTemplate = true;
                            }
                        }
                        
                        var idx = $.inArray(field, self._compSearchResultKeys);
                        if (idx > resultIndex) {
                            resultIndex = idx;
                            resultValue = suggestion[field];
                            resultHandler = self._compSearchResultHandler[field];
                        }
                    }
                   
                    if (resultHandler != null) {
                        if (resultHandler.prepareResult != null) {
                            resultValue = resultHandler.prepareResult(indexName, resultValue, suggestion);
                        }
                        if (resultHandler.submitResult != null) {
                            var resVal = resultValue;
                            resultValue = function(){ return resultHandler.submitResult(indexName, resVal); };
                        }
                    }
                    suggestCount++;
                    
                    var suggestHtml = self.parseTemplate(indexName, (useImgTemplate ? "suggestionWithImage" : "suggestion"), uimap);
                    parsed[parsed.length] = {data:["suggest"],value:suggestHtml,result:resultValue};
    	        }

                if (suggestRange != null && (suggestRange.start > 0 && suggestIdx == (suggestionGroup.suggestions.length-1))) {
                    /* full up with emtpy items to hold more-button on same place */
       			    for (var i=suggestCount; i < self._compSearchSuggestMaxItems; i++) {
                        var suggestGroupSpacerHtml = self.parseTemplate("default", "suggestionGroupSpacer", uimap);
                        parsed[parsed.length] = {data:["spacer"],value:suggestGroupSpacerHtml,result:null};
                    }
                    /* */
                    var suggestHtml = self.parseTemplate(indexName, "suggestionPrevious", uimap);
                    parsed[parsed.length] = {data:["previous"],value:suggestHtml,result:null};
                    return false;    // break iteration
                }
			});

            if (suggestCount > 0) {
                groupIndex++;
            }

            if (indexName != "keywords") {
    		    var resultValue = self.getValideSearchValue();
                var suggestHtml = self.parseTemplate("default", "suggestionShowAll", uiHeadMap);
                parsed[parsed.length] = {data:["showAll"],value:suggestHtml,result:resultValue};
            }

            if (groupIndex < groupCount) {
                var suggestGroupSeparatorHtml = self.parseTemplate(indexName, "suggestionGroupSeparator", uimap);
                parsed[parsed.length] = {data:["separator"],value:suggestGroupSeparatorHtml,result:null};
            }
       });
      
       // add nectar links to menu flyout 
       if (self._compSearchAllProductsUrl != "" || self._compSearchAllContentsUrl != "") {
            if (groupCount > 0 && uiHeadMap["suggestAllCount"] > 0) {
                var suggestGroupSeparatorHtml = self.parseTemplate("nectar", "suggestionGroupSeparator", uiHeadMap);
                parsed[parsed.length] = {data:["separator"],value:suggestGroupSeparatorHtml,result:null};
            }
            if (self._compSearchAllProductsUrl != "") {
                var resultHandler = self._compSearchResultHandler["nectarLink"];
                var resProduct = resultHandler.prepareResult("nectar", self._compSearchAllProductsUrl, "product");
                var resValue = function(){ return resultHandler.submitResult("nectar", resProduct); };

                var suggestHtml = self.parseTemplate("nectar", "suggestionProductLink", uiHeadMap);
                parsed[parsed.length] = {data:["nectarLinkProduct"],value:suggestHtml,result:resValue};
            }
            if (self._compSearchAllContentsUrl != "") {
                if (self._compSearchAllProductsUrl != "") {
                    var suggestGroupSeparatorHtml = self.parseTemplate("nectar", "suggestionGroupSeparator", uiHeadMap);
                    parsed[parsed.length] = {data:["separator"],value:suggestGroupSeparatorHtml,result:null};
                }
                var resultHandler = self._compSearchResultHandler["nectarLink"];
                var resContent = resultHandler.prepareResult("nectar", self._compSearchAllContentsUrl, "content");
                var resValue = function(){ return resultHandler.submitResult("nectar", resContent); };

                var suggestHtml = self.parseTemplate("nectar", "suggestionContentLink", uiHeadMap);
                parsed[parsed.length] = {data:["nectarLinkContent"],value:suggestHtml,result:resValue};
            }
        } 
    },
    
    formatResult : function(idx, maxCount, value, data) {
        return value;
    },
        
	cleanup : function() {
	    if ($(this._compSearchInputField).length > 0) {
            $(this._compSearchInputField).removeClass("ac_loading");
        }
    },

	isRequired : function() {
		return ($(this._compSearchInputField).length > 0 && $(this._compSearchInputField).attr("compInitialized") != "true");
	},

	initialize : function() {        
        this.initAutoSuggestCompleter();
	}
};

/* +++++++++++++++ common js-modul for zooming product detail images +++++++++++++++ */

var compProductDetailZoom = {
	/* string */_zoomTitle : "",

    getZoomTitle : function() {
        return this._zoomTitle;
    },
    
	isRequired : function() {
		return ($("#productDetailZoom").length > 0 && $("#productDetailZoom").attr("compInitialized") != "true");
	},

    initialize: function() {
		$("#productDetailZoom").attr("compInitialized", "true");

		$("#productDetailZoom").fancybox({
			'titlePosition' : 'inside',
			'transitionIn' : 'none',
			'transitionOut' : 'none',
			'titleShow' : false
		});

		var detailZoomImageUrl = $("#productDetailZoom").attr("href");
		if (detailZoomImageUrl != null && detailZoomImageUrl != "") {
			this._zoomTitle = $("#bigProductPicture").attr("title");
			$("#productDetailZoom").show();
			$("#bigProductPicture").css("cursor", "pointer").click(function() {
				$("#productDetailZoom").click();
			});
		}
		else {
			$("#productDetailZoom").hide();
			$("#bigProductPicture").attr("title", "").css("cursor", "default").unbind("click");
		}
    }
};

/* +++++++++++++++ common js-modul for all components +++++++++++++++ */

var compCommon = {
	/* timerId */_waitCursorTimer : null,
	/* boolean */_waitCursorIsShown : false,
	/* millisec */_waitCursorDelay : 100,
	/* array */_messageMap : {},
	
	addMessages : function(map) {
	   $.extend(this._messageMap, map);
    },
    
    addMessage : function(key, text) {
       this._messageMap[key] = text;
    },

    getMessage : function(key,defText) {
        var text = this._messageMap[key];
        if (text == null) {
            text = ((defText != null) ? defText : "");
        }
        else if (text.length > 0 && text.charAt(0) == '[' &&
                 text.charAt(text.length-1) == ']') {
            if (defText != null) {
                text = defText;
            }
            else {
                text = key.charAt(0).toUpperCase() + key.slice(1); // capitalize
            }
        }
        return text;
    },

	setWaitCursor : function() {
		// using timer to let the brower change the cursor
		var self = this;

		/* as long as we have no special gui feedback we do not delay showing the wait cursor */
		// this._waitCursorTimer = setTimeout(function(){
		self._waitCursorTimer = null;
		self._waitCursorIsShown = true;
		$("body").css("cursor", "progress");
		$(".btnSubmit,.plus,.minus,.basketItem > a").css("cursor", "progress");
		// }, this._waitCursorDelay);
	},

	resetWaitCursor : function() {
		if (this._waitCursorTimer != null) {
			clearTimeout(this._waitCursorTimer);
			this._waitCursorTimer = null;
		}

		if (this._waitCursorIsShown) {
			var self = this;

			/* as long as we have no special gui feedback we show the wait cursor at least for 100 msec. */
			setTimeout(function() {
				self._waitCursorIsShown = false;
				$("body").css("cursor", "auto");
				$(".btnSubmit,.plus,.minus,.basketItem > a").css("cursor", "pointer");
			}, 100);
		}
	}
};

/* +++++++++++++++ js-modul initialization +++++++++++++++ */

$(document).ready(function() {
    function addAttrValueHook() {
        // for jQuery 1.6.1 to be compatible to 1.4.2
        if ($.attrHooks != null) {
            var oldAttrValueHook = $.attrHooks.value;
            $.attrHooks.value = {
            	get: function( elem, name ) {
                    var ret = ((oldAttrValueHook != null) ? oldAttrValueHook.get(elem, name) : null);
                    if (ret === undefined && typeof elem.getAttribute !== "undefined") {
                        ret = elem.getAttribute(name);
                        if (ret === undefined) {
                            ret = "";   // default as used in jQuery 1.4.2
                        }
                    }
            		return ret;
            	},
            	set: function( elem, value, name ) {
            	    var ret = ((oldAttrValueHook != null) ? oldAttrValueHook.set(elem, value, name) : null);
                    if (ret === undefined) {
                        ret = value;
                    }
            		elem.setAttribute(name, "" + value);
            		return ret;
             	}
            };
        }
    };
    
	// initialize all components if required
	function initializeAllComponents() {
		if (compNavigation.isRequired()) {
			compNavigation.initialize();
		}
		if (compBasket.isRequired()) {
			compBasket.initialize();
		}
		if (compMiniBasket.isRequired()) {
			compMiniBasket.initialize();
		}
		if (compProdDetails.isRequired()) {
			compProdDetails.initialize();
		}
		if (compProdSuitableAccessories.isRequired()) {
			compProdSuitableAccessories.initialize();
		}
		if (compCheckoutSummary.isRequired()) {
			compCheckoutSummary.initialize();
		}
		if (compViewedItems.isRequired()) {
			compViewedItems.initialize();
		}
		if (compPartListSummary.isRequired()) {
			compPartListSummary.initialize();
		}
		if (compSparePartDetailPage.isRequired()) {
			compSparePartDetailPage.initialize();
		}
		if (compRatePlateFinder.isRequired()) {
			compRatePlateFinder.initialize();
		}
		if (compPrimarySearch.isRequired()) {
			compPrimarySearch.initialize();
		}
		if (compProductDetailZoom.isRequired()) {
			compProductDetailZoom.initialize();
		}
	}

    addAttrValueHook();
	initializeAllComponents();

	// note: customer event "initialize" is triggered after ajax request to re-initialize component
	$(document).bind("initialize", function() {
		initializeAllComponents();
	});

	$("html").bind("ajaxStart", function() {
		compCommon.setWaitCursor();
	}).bind("ajaxComplete", function() {
		compCommon.resetWaitCursor();
	});

	$.ajaxSetup({
		cache : false,
		async : true
	});

    $(window).unload(function() {
	    compPrimarySearch.cleanup();
    });
});
/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
* Licensed under the MIT License (LICENSE.txt).
*
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
* Thanks to: Seamus Leahy for adding deltaX and deltaY
*
* Version: 3.0.4
*
* Requires: 1.2.2+
*/

(function(d){function g(a){var b=a||window.event,i=[].slice.call(arguments,1),c=0,h=0,e=0;a=d.event.fix(b);a.type="mousewheel";if(a.wheelDelta)c=a.wheelDelta/120;if(a.detail)c=-a.detail/3;e=c;if(b.axis!==undefined&&b.axis===b.HORIZONTAL_AXIS){e=0;h=-1*c}if(b.wheelDeltaY!==undefined)e=b.wheelDeltaY/120;if(b.wheelDeltaX!==undefined)h=-1*b.wheelDeltaX/120;i.unshift(a,c,h,e);return d.event.handle.apply(this,i)}var f=["DOMMouseScroll","mousewheel"];d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=
f.length;a;)this.addEventListener(f[--a],g,false);else this.onmousewheel=g},teardown:function(){if(this.removeEventListener)for(var a=f.length;a;)this.removeEventListener(f[--a],g,false);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery);/*
 * FancyBox - jQuery Plugin
 * Simple and fancy lightbox alternative
 *
 * Examples and documentation at: http://fancybox.net
 * 
 * Copyright (c) 2008 - 2010 Janis Skarnelis
 * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
 * 
 * Version: 1.3.4 (11/11/2010)
 * Requires: jQuery v1.3+
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */

;(function(b){var m,t,u,f,D,j,E,n,z,A,q=0,e={},o=[],p=0,d={},l=[],G=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,i,h=false,B=b.extend(b("<div/>")[0],{prop:0}),M=b.browser.msie&&b.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;G&&G.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();h=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');
F()}},I=function(){var a=o[q],c,g,k,C,P,w;N();e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));w=e.onStart(o,q,e);if(w===false)h=false;else{if(typeof w=="object")e=b.extend(e,w);k=e.title||(a.nodeName?b(a).attr("title"):a.title)||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");c=e.href||(a.nodeName?b(a).attr("href"):a.href)||null;if(/^(?:javascript)/i.test(c)||
c=="#")c=null;if(e.type){g=e.type;if(!c)c=e.content}else if(e.content)g="html";else if(c)g=c.match(J)?"image":c.match(W)?"swf":b(a).hasClass("iframe")?"iframe":c.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){a=c.substr(c.indexOf("#"));g=b(a).length>0?"inline":"ajax"}e.type=g;e.href=c;e.title=k;if(e.autoDimensions)if(e.type=="html"||e.type=="inline"||e.type=="ajax"){e.width="auto";e.height="auto"}else e.autoDimensions=false;if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=
false;e.enableEscapeButton=false;e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(j.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(b(a).parent().is("#fancybox-content")===true){h=false;break}b('<div class="fancybox-inline-tmp" />').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(j.children())}).bind("fancybox-cancel",
function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){h=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;b("<img />").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=c;break;case "swf":e.scrolling="no";C='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+c+
'"></param>';P="";b.each(e.swf,function(x,H){C+='<param name="'+x+'" value="'+H+'"></param>';P+=" "+x+'="'+H+'"'});C+='<embed src="'+c+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+P+"></embed></object>";m.html(C);F();break;case "ajax":h=false;b.fancybox.showActivity();e.ajax.win=e.ajax.success;G=b.ajax(b.extend({},e.ajax,{url:c,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,H,R){if((typeof R=="object"?R:G).status==200){if(typeof e.ajax.win==
"function"){w=e.ajax.win(c,x,H,R);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case "iframe":Q()}}else O()}},F=function(){var a=e.width,c=e.height;a=a.toString().indexOf("%")>-1?parseInt((b(window).width()-e.margin*2)*parseFloat(a)/100,10)+"px":a=="auto"?"auto":a+"px";c=c.toString().indexOf("%")>-1?parseInt((b(window).height()-e.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";m.wrapInner('<div style="width:'+a+";height:"+c+
";overflow: "+(e.scrolling=="auto"?"auto":e.scrolling=="yes"?"scroll":"hidden")+';position:relative;"></div>');e.width=m.width();e.height=m.height();Q()},Q=function(){var a,c;t.hide();if(f.is(":visible")&&false===d.onCleanup(l,p,d)){b.event.trigger("fancybox-cancel");h=false}else{h=true;b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");f.is(":visible")&&d.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;d=e;if(d.overlayShow){u.css({"background-color":d.overlayColor,
opacity:d.overlayOpacity,cursor:d.hideOnOverlayClick?"pointer":"auto",height:b(document).height()});if(!u.is(":visible")){M&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();i=X();s=d.title||"";y=0;n.empty().removeAttr("style").removeClass();if(d.titleShow!==false){if(b.isFunction(d.titleFormat))a=d.titleFormat(s,l,p,d);else a=s&&s.length?
d.titlePosition=="float"?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+s+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+d.titlePosition+'">'+s+"</div>":false;s=a;if(!(!s||s==="")){n.addClass("fancybox-title-"+d.titlePosition).html(s).appendTo("body").show();switch(d.titlePosition){case "inside":n.css({width:i.width-d.padding*2,marginLeft:d.padding,marginRight:d.padding});
y=n.outerHeight(true);n.appendTo(D);i.height+=y;break;case "over":n.css({marginLeft:d.padding,width:i.width-d.padding*2,bottom:d.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-i.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:i.width-d.padding*2,paddingLeft:d.padding,paddingRight:d.padding}).appendTo(f)}}}n.hide();if(f.is(":visible")){b(E.add(z).add(A)).hide();a=f.position();r={top:a.top,left:a.left,width:f.width(),height:f.height()};c=r.width==i.width&&r.height==
i.height;j.fadeTo(d.changeFade,0.3,function(){var g=function(){j.html(m.contents()).fadeTo(d.changeFade,1,S)};b.event.trigger("fancybox-change");j.empty().removeAttr("filter").css({"border-width":d.padding,width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2});if(c)g();else{B.prop=0;b(B).animate({prop:1},{duration:d.changeSpeed,easing:d.easingChange,step:T,complete:g})}})}else{f.removeAttr("style");j.css("border-width",d.padding);if(d.transitionIn=="elastic"){r=V();j.html(m.contents());
f.show();if(d.opacity)i.opacity=0;B.prop=0;b(B).animate({prop:1},{duration:d.speedIn,easing:d.easingIn,step:T,complete:S})}else{d.titlePosition=="inside"&&y>0&&n.show();j.css({width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2}).html(m.contents());f.css(i).fadeIn(d.transitionIn=="none"?0:d.speedIn,S)}}}},Y=function(){if(d.enableEscapeButton||d.enableKeyboardNav)b(document).bind("keydown.fb",function(a){if(a.keyCode==27&&d.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if((a.keyCode==
37||a.keyCode==39)&&d.enableKeyboardNav&&a.target.tagName!=="INPUT"&&a.target.tagName!=="TEXTAREA"&&a.target.tagName!=="SELECT"){a.preventDefault();b.fancybox[a.keyCode==37?"prev":"next"]()}});if(d.showNavArrows){if(d.cyclic&&l.length>1||p!==0)z.show();if(d.cyclic&&l.length>1||p!=l.length-1)A.show()}else{z.hide();A.hide()}},S=function(){if(!b.support.opacity){j.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}e.autoDimensions&&j.css("height","auto");f.css("height","auto");
s&&s.length&&n.show();d.showCloseButton&&E.show();Y();d.hideOnContentClick&&j.bind("click",b.fancybox.close);d.hideOnOverlayClick&&u.bind("click",b.fancybox.close);b(window).bind("resize.fb",b.fancybox.resize);d.centerOnScroll&&b(window).bind("scroll.fb",b.fancybox.center);if(d.type=="iframe")b('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(b.browser.msie?'allowtransparency="true""':"")+' scrolling="'+e.scrolling+'" src="'+d.href+'"></iframe>').appendTo(j);
f.show();h=false;b.fancybox.center();d.onComplete(l,p,d);var a,c;if(l.length-1>p){a=l[p+1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}if(p>0){a=l[p-1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}},T=function(a){var c={width:parseInt(r.width+(i.width-r.width)*a,10),height:parseInt(r.height+(i.height-r.height)*a,10),top:parseInt(r.top+(i.top-r.top)*a,10),left:parseInt(r.left+(i.left-r.left)*a,10)};if(typeof i.opacity!=="undefined")c.opacity=a<0.5?0.5:a;f.css(c);
j.css({width:c.width-d.padding*2,height:c.height-y*a-d.padding*2})},U=function(){return[b(window).width()-d.margin*2,b(window).height()-d.margin*2,b(document).scrollLeft()+d.margin,b(document).scrollTop()+d.margin]},X=function(){var a=U(),c={},g=d.autoScale,k=d.padding*2;c.width=d.width.toString().indexOf("%")>-1?parseInt(a[0]*parseFloat(d.width)/100,10):d.width+k;c.height=d.height.toString().indexOf("%")>-1?parseInt(a[1]*parseFloat(d.height)/100,10):d.height+k;if(g&&(c.width>a[0]||c.height>a[1]))if(e.type==
"image"||e.type=="swf"){g=d.width/d.height;if(c.width>a[0]){c.width=a[0];c.height=parseInt((c.width-k)/g+k,10)}if(c.height>a[1]){c.height=a[1];c.width=parseInt((c.height-k)*g+k,10)}}else{c.width=Math.min(c.width,a[0]);c.height=Math.min(c.height,a[1])}c.top=parseInt(Math.max(a[3]-20,a[3]+(a[1]-c.height-40)*0.5),10);c.left=parseInt(Math.max(a[2]-20,a[2]+(a[0]-c.width-40)*0.5),10);return c},V=function(){var a=e.orig?b(e.orig):false,c={};if(a&&a.length){c=a.offset();c.top+=parseInt(a.css("paddingTop"),
10)||0;c.left+=parseInt(a.css("paddingLeft"),10)||0;c.top+=parseInt(a.css("border-top-width"),10)||0;c.left+=parseInt(a.css("border-left-width"),10)||0;c.width=a.width();c.height=a.height();c={width:c.width+d.padding*2,height:c.height+d.padding*2,top:c.top-d.padding-20,left:c.left-d.padding-20}}else{a=U();c={width:d.padding*2,height:d.padding*2,top:parseInt(a[3]+a[1]*0.5,10),left:parseInt(a[2]+a[0]*0.5,10)}}return c},Z=function(){if(t.is(":visible")){b("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)};
b.fn.fancybox=function(a){if(!b(this).length)return this;b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!h){h=true;b(this).blur();o=[];q=0;c=b(this).attr("rel")||"";if(!c||c==""||c==="nofollow")o.push(this);else{o=b("a[rel="+c+"], area[rel="+c+"]");q=o.index(this)}I()}});return this};b.fancybox=function(a,c){var g;if(!h){h=true;g=typeof c!=="undefined"?c:{};o=[];q=parseInt(g.index,10)||0;if(b.isArray(a)){for(var k=
0,C=a.length;k<C;k++)if(typeof a[k]=="object")b(a[k]).data("fancybox",b.extend({},g,a[k]));else a[k]=b({}).data("fancybox",b.extend({content:a[k]},g));o=jQuery.merge(o,a)}else{if(typeof a=="object")b(a).data("fancybox",b.extend({},g,a));else a=b({}).data("fancybox",b.extend({content:a},g));o.push(a)}if(q>o.length||q<0)q=0;I()}};b.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};b.fancybox.hideActivity=function(){t.hide()};b.fancybox.next=function(){return b.fancybox.pos(p+
1)};b.fancybox.prev=function(){return b.fancybox.pos(p-1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a);o=l;if(a>-1&&a<l.length){q=a;I()}else if(d.cyclic&&l.length>1){q=a>=l.length?0:l.length-1;I()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);h=false}};b.fancybox.close=function(){function a(){u.fadeOut("fast");n.empty().hide();f.hide();b.event.trigger("fancybox-cleanup");j.empty();d.onClosed(l,p,d);l=e=[];p=q=0;d=e={};h=false}if(!(h||f.is(":hidden"))){h=
true;if(d&&false===d.onCleanup(l,p,d))h=false;else{N();b(E.add(z).add(A)).hide();b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");j.find("iframe").attr("src",M&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");d.titlePosition!=="inside"&&n.empty();f.stop();if(d.transitionOut=="elastic"){r=V();var c=f.position();i={top:c.top,left:c.left,width:f.width(),height:f.height()};if(d.opacity)i.opacity=1;n.empty().hide();B.prop=1;
b(B).animate({prop:0},{duration:d.speedOut,easing:d.easingOut,step:T,complete:a})}else f.fadeOut(d.transitionOut=="none"?0:d.speedOut,a)}}};b.fancybox.resize=function(){u.is(":visible")&&u.css("height",b(document).height());b.fancybox.center(true)};b.fancybox.center=function(a){var c,g;if(!h){g=a===true?1:0;c=U();!g&&(f.width()>c[0]||f.height()>c[1])||f.stop().animate({top:parseInt(Math.max(c[3]-20,c[3]+(c[1]-j.height()-40)*0.5-d.padding)),left:parseInt(Math.max(c[2]-20,c[2]+(c[0]-j.width()-40)*0.5-
d.padding))},typeof a=="number"?a:200)}};b.fancybox.init=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('<div id="fancybox-tmp"></div>'),t=b('<div id="fancybox-loading"><div></div></div>'),u=b('<div id="fancybox-overlay"></div>'),f=b('<div id="fancybox-wrap"></div>'));D=b('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(f);
D.append(j=b('<div id="fancybox-content"></div>'),E=b('<a id="fancybox-close"></a>'),n=b('<div id="fancybox-title"></div>'),z=b('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),A=b('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));E.click(b.fancybox.close);t.click(b.fancybox.cancel);z.click(function(a){a.preventDefault();b.fancybox.prev()});A.click(function(a){a.preventDefault();b.fancybox.next()});
b.fn.mousewheel&&f.bind("mousewheel.fb",function(a,c){if(h)a.preventDefault();else if(b(a.target).get(0).clientHeight==0||b(a.target).get(0).scrollHeight===b(a.target).get(0).clientHeight){a.preventDefault();b.fancybox[c>0?"prev":"next"]()}});b.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");b('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(D)}}};
b.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",
easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};b(document).ready(function(){b.fancybox.init()})})(jQuery);/*
 * jQuery Autocomplete plugin 1.1
 *
 * Copyright (c) 2009 Jörn Zaefferer
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $
 */

;(function($) {
	
$.fn.extend({
	autocomplete: function(urlOrData, options) {
		var isUrl = typeof urlOrData == "string";
		options = $.extend({}, $.Autocompleter.defaults, {
			url: isUrl ? urlOrData : null,
			data: isUrl ? null : urlOrData,
			delay: isUrl ? $.Autocompleter.defaults.delay : 10,
			max: options && !options.scroll ? 10 : 150
		}, options);
		
		// if highlight is set to false, replace it with a do-nothing function
		options.highlight = options.highlight || function(value) { return value; };
		
		// if the formatMatch option is not specified, then use formatItem for backwards compatibility
		options.formatMatch = options.formatMatch || options.formatItem;
		
		return this.each(function() {
			new $.Autocompleter(this, options);
		});
	},
	result: function(handler) {
		return this.bind("result", handler);
	},
	search: function(handler) {
		return this.trigger("search", [handler]);
	},
	flushCache: function() {
		return this.trigger("flushCache");
	},
	setOptions: function(options){
		return this.trigger("setOptions", [options]);
	},
	unautocomplete: function() {
		return this.trigger("unautocomplete");
	}
});

$.Autocompleter = function(input, options) {

	var KEY = {
		UP: 38,
		DOWN: 40,
		DEL: 46,
		TAB: 9,
		RETURN: 13,
		ESC: 27,
		COMMA: 188,
		PAGEUP: 33,
		PAGEDOWN: 34,
		BACKSPACE: 8
	};

	// Create $ object for input element
	var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass);

	var timeout;
	var previousValue = "";
	var cache = $.Autocompleter.Cache(options);
	var hasFocus = 0;
	var lastKeyPressCode;
	var config = {
		mouseDownOnSelect: false
	};
	var select = $.Autocompleter.Select(options, input, selectCurrent, config);
	
	var blockSubmit;
	
	// prevent form submit in opera when selecting with return key
	$.browser.opera && $(input.form).bind("submit.autocomplete", function() {
		if (blockSubmit) {
			blockSubmit = false;
			return false;
		}
	});
	
	// only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all
	$input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) {
		// a keypress means the input has focus
		// avoids issue where input had focus before the autocomplete was applied
		hasFocus = 1;
		// track last key pressed
		lastKeyPressCode = event.keyCode;
		switch(event.keyCode) {
		
			case KEY.UP:
				event.preventDefault();
				if ( select.visible() ) {
					select.prev();
				} else {
					onChange(0, true);
				}
				break;
				
			case KEY.DOWN:
				event.preventDefault();
				if ( select.visible() ) {
					select.next();
				} else {
					onChange(0, true);
				}
				break;
				
			case KEY.PAGEUP:
				event.preventDefault();
				if ( select.visible() ) {
					select.pageUp();
				} else {
					onChange(0, true);
				}
				break;
				
			case KEY.PAGEDOWN:
				event.preventDefault();
				if ( select.visible() ) {
					select.pageDown();
				} else {
					onChange(0, true);
				}
				break;
			
			// matches also semicolon
			case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA:
			case KEY.TAB:
			case KEY.RETURN:
				//BSHSHOP-928
				if( selectCurrent() && options.selectByReturn ) {
					// stop default to prevent a form submit, Opera needs special handling
					event.preventDefault();
					blockSubmit = true;
					return false;
				}
				select.hide();
				break;
				
			case KEY.ESC:
				select.hide();
				break;
				
			default:
				clearTimeout(timeout);
				timeout = setTimeout(onChange, options.delay);
				break;
		}
	}).focus(function(){
		// track whether the field has focus, we shouldn't process any
		// results if the field no longer has focus
		hasFocus++;
	}).blur(function() {
		hasFocus = 0;
		if (!config.mouseDownOnSelect) {
			hideResults();
		}
	}).click(function() {
		// show select when clicking in a focused field
		if ( hasFocus++ > 1 && !select.visible() ) {
			onChange(0, true);
		}
	}).bind("search", function() {
		// TODO why not just specifying both arguments?
		var fn = (arguments.length > 1) ? arguments[1] : null;
		function findValueCallback(q, data) {  
			var result;
			if( data && data.length ) {
				for (var i=0; i < data.length; i++) {
					if( data[i].result != null && data[i].result.toLowerCase() == q.toLowerCase() ) {
						result = data[i];
						break;
					}
				}
			}
			if( typeof fn == "function" ) {
                fn(result);
			}
            else {
                $input.trigger("result", result && [result.data, result.value]);
            }
        }
		$.each(trimWords($input.val()), function(i, value) {
			request(value, findValueCallback, findValueCallback);
		});
	}).bind("update", function() {
		var data = (arguments.length > 1) ? arguments[1] : null;
		var term = (arguments.length > 2) ? arguments[2] : null;
		if (data != null) {
    	    var parsed = options.parse && options.parse(data) || parse(data);
			select.display(parsed, term);
			select.show();
        }
	}).bind("flushCache", function() {
		cache.flush();
	}).bind("setOptions", function() {
		$.extend(options, arguments[1]);
		// if we've updated the data, repopulate
		if ( "data" in arguments[1] )
			cache.populate();
	}).bind("unautocomplete", function() {
		select.unbind();
		$input.unbind();
		$(input.form).unbind(".autocomplete");
	});
	
	
	function selectCurrent(selectedElement) {
		var selected = select.selected();
		if( !selected )
			return false;
		
		var v = selected.result;
		previousValue = v;
		
		if ( options.multiple ) {
			var words = trimWords($input.val());
			if ( words.length > 1 ) {
				var seperator = options.multipleSeparator.length;
				var cursorAt = $(input).selection().start;
				var wordAt, progress = 0;
				$.each(words, function(i, word) {
					progress += word.length;
					if (cursorAt <= progress) {
						wordAt = i;
						return false;
					}
					progress += seperator;
				});
				words[wordAt] = v;
				// TODO this should set the cursor to the right position, but it gets overriden somewhere
				//$.Autocompleter.Selection(input, progress + seperator, progress + seperator);
				v = words.join( options.multipleSeparator );
			}
			v += options.multipleSeparator;
		}
		
		if (v != null) {
    		if (typeof(v) == "string") {
        		$input.val(v);
        		hideResultsNow();
        		$input.trigger("result", [selected.data, selected.value]);
            }
            else if (typeof(v) == "function") {
                if (v(selectedElement) == true) {
            		hideResultsNow();                
                }
            }
        }
		return true;
	}
	
	function onChange(crap, skipPrevCheck) {
		if( lastKeyPressCode == KEY.DEL ) {
			select.hide();
			return;
		}
		
		var currentValue = $input.val();
		
		if ( !skipPrevCheck && currentValue == previousValue )
			return;
		
		previousValue = currentValue;
		
		currentValue = lastWord(currentValue);
		if ( currentValue.length >= options.minChars) {
            if (options.showLoadingIndicator) {  
			     $input.addClass(options.loadingClass);
			}
			if (!options.matchCase)
				currentValue = currentValue.toLowerCase();
			request(currentValue, receiveData, hideResultsNow);
		} else {
			stopLoading();
			select.hide();
		}
	};
	
	function trimWords(value) {
		if (!value)
			return [""];
		if (!options.multiple)
			return [$.trim(value)];
		return $.map(value.split(options.multipleSeparator), function(word) {
			return $.trim(value).length ? $.trim(word) : null;
		});
	}
	
	function lastWord(value) {
		if ( !options.multiple )
			return value;
		var words = trimWords(value);
		if (words.length == 1) 
			return words[0];
		var cursorAt = $(input).selection().start;
		if (cursorAt == value.length) {
			words = trimWords(value)
		} else {
			words = trimWords(value.replace(value.substring(cursorAt), ""));
		}
		return words[words.length - 1];
	}
	
	// fills in the input box w/the first match (assumed to be the best match)
	// q: the term entered
	// sValue: the first matching result
	function autoFill(q, sValue){
		// autofill in the complete box w/the first match as long as the user hasn't entered in more data
		// if the last user key pressed was backspace, don't autofill
		if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) {
			// fill in the value (keep the case the user has typed)
			$input.val($input.val() + sValue.substring(lastWord(previousValue).length));
			// select the portion of the value not typed by the user (so the next character will erase)
			$(input).selection(previousValue.length, previousValue.length + sValue.length);
		}
	};

	function hideResults() {
		clearTimeout(timeout);
		timeout = setTimeout(hideResultsNow, 200);
	};

	function hideResultsNow() {
		var wasVisible = select.visible();
		select.hide();
		clearTimeout(timeout);
		stopLoading();
		if (options.mustMatch) {
			// call search and run callback
			$input.search(
				function (result){
					// if no value found, clear the input box
					if( !result ) {
						if (options.multiple) {
							var words = trimWords($input.val()).slice(0, -1);
							$input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") );
						}
						else {
							$input.val( "" );
							$input.trigger("result", null);
						}
					}
				}
			);
		}
	};

	function receiveData(q, data) {
		if ( data && data.length && hasFocus ) {
			stopLoading();
			select.display(data, q);
			autoFill(q, data[0].value);
			select.show();
		} else {
			hideResultsNow();
		}
	};

	function request(term, success, failure) {
		if (!options.matchCase)
			term = term.toLowerCase();
		var data = cache.load(term);
		if(data && !options.useCache)
            data.length=0;
		if (data && data.length) {
		// recieve the cached data
			success(term, data);
		// if an AJAX url has been supplied, try loading the data now
		} else if( (typeof options.url == "string") && (options.url.length > 0) ){
			
			var extraParams = {
				timestamp: +new Date()
			};
			$.each(options.extraParams, function(key, param) {
				extraParams[key] = typeof param == "function" ? param() : param;
			});
			
			$.ajax({
				// try to leverage ajaxQueue plugin to abort previous requests
				mode: "abort",
				// limit abortion to this input
				port: "autocomplete" + input.name,
				dataType: options.dataType,
				url: options.url,
				data: $.extend({
					q: lastWord(term),
					limit: options.max
				}, extraParams),
				success: function(data) {
					var parsed = options.parse && options.parse(data) || parse(data);
					cache.add(term, parsed);
					success(term, parsed);
				}
			});
		} else {
			// if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match
			select.emptyList();
			failure(term);
		}
	};
	
	function parse(data) {
		var parsed = [];
		var rows = data.split("\n");
		for (var i=0; i < rows.length; i++) {
			var row = $.trim(rows[i]);
			if (row) {
				row = row.split("|");
				parsed[parsed.length] = {
					data: row,
					value: row[0],
					result: options.formatResult && options.formatResult(row, row[0]) || row[0]
				};
			}
		}
		return parsed;
	};

	function stopLoading() {
        if (options.showLoadingIndicator) {  
		  $input.removeClass(options.loadingClass);
		}
	};

};

$.Autocompleter.defaults = {
	inputClass: "ac_input",
	resultsClass: "ac_results",
	loadingClass: "ac_loading",
	showLoadingIndicator: true,
	minChars: 1,
	delay: 400,
	matchCase: false,
	matchSubset: true,
	matchContains: false,
	cacheLength: 10,
	max: 100,
	mustMatch: false,
	extraParams: {},
	selectFirst: true,
	formatItem: function(row) { return row[0]; },
	formatMatch: null,
	autoFill: false,
	width: 0,
	multiple: false,
	multipleSeparator: ", ",
	highlight: function(value, term) {
		return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
	},
    scroll: true,
    scrollHeight: 180,
    useCache: false,
    selectByReturn: false,
    leftAligned: false,
    topOffset: 0,
    leftOffset: 0                                                                                                          
};

$.Autocompleter.Cache = function(options) {

	var data = {};
	var length = 0;
	
	function matchSubset(s, sub) {
		if (!options.matchCase) 
			s = s.toLowerCase();
		var i = s.indexOf(sub);
		if (options.matchContains == "word"){
			i = s.toLowerCase().search("\\b" + sub.toLowerCase());
		}
		if (i == -1) return false;
		return i == 0 || options.matchContains;
	};
	
	function add(q, value) {
		if (length > options.cacheLength){
			flush();
		}
		if (!data[q]){ 
			length++;
		}
		data[q] = value;
	}
	
	function populate(){
		if( !options.data ) return false;
		// track the matches
		var stMatchSets = {},
			nullData = 0;

		// no url was specified, we need to adjust the cache length to make sure it fits the local data store
		if( !options.url ) options.cacheLength = 1;
		
		// track all options for minChars = 0
		stMatchSets[""] = [];
		
		// loop through the array and create a lookup structure
		for ( var i = 0, ol = options.data.length; i < ol; i++ ) {
			var rawValue = options.data[i];
			// if rawValue is a string, make an array otherwise just reference the array
			rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue;
			
			var value = options.formatMatch(rawValue, i+1, options.data.length);
			if ( value === false )
				continue;
				
			var firstChar = value.charAt(0).toLowerCase();
			// if no lookup array for this character exists, look it up now
			if( !stMatchSets[firstChar] ) 
				stMatchSets[firstChar] = [];

			// if the match is a string
			var row = {
				value: value,
				data: rawValue,
				result: options.formatResult && options.formatResult(rawValue) || value
			};
			
			// push the current match into the set list
			stMatchSets[firstChar].push(row);

			// keep track of minChars zero items
			if ( nullData++ < options.max ) {
				stMatchSets[""].push(row);
			}
		};

		// add the data items to the cache
		$.each(stMatchSets, function(i, value) {
			// increase the cache size
			options.cacheLength++;
			// add to the cache
			add(i, value);
		});
	}
	
	// populate any existing data
	setTimeout(populate, 25);
	
	function flush(){
		data = {};
		length = 0;
	}
	
	return {
		flush: flush,
		add: add,
		populate: populate,
		load: function(q) {
			if (!options.cacheLength || !length)
				return null;
			/* 
			 * if dealing w/local data and matchContains than we must make sure
			 * to loop through all the data collections looking for matches
			 */
			if( !options.url && options.matchContains ){
				// track all matches
				var csub = [];
				// loop through all the data grids for matches
				for( var k in data ){
					// don't search through the stMatchSets[""] (minChars: 0) cache
					// this prevents duplicates
					if( k.length > 0 ){
						var c = data[k];
						$.each(c, function(i, x) {
							// if we've got a match, add it to the array
							if (matchSubset(x.value, q)) {
								csub.push(x);
							}
						});
					}
				}				
				return csub;
			} else 
			// if the exact item exists, use it
			if (data[q]){
				return data[q];
			} else
			if (options.matchSubset) {
				for (var i = q.length - 1; i >= options.minChars; i--) {
					var c = data[q.substr(0, i)];
					if (c) {
						var csub = [];
						$.each(c, function(i, x) {
							if (matchSubset(x.value, q)) {
								csub[csub.length] = x;
							}
						});
						return csub;
					}
				}
			}
			return null;
		}
	};
};

$.Autocompleter.Select = function (options, input, select, config) {
	var CLASSES = {
		ACTIVE: "ac_over"
	};
	
	var listItems,
		active = -1,
		data,
		term = "",
		needsInit = true,
		element,
		list;
	
	// Create results
	function init() {
		if (!needsInit)
			return;
		element = $("<div/>")
		.hide()
		.addClass(options.resultsClass)
		.css("position", "absolute")
		.appendTo(document.body);
	
		list = $("<ul/>").appendTo(element).mouseover( function(event) {
			if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') {
	            active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
			    $(target(event)).addClass(CLASSES.ACTIVE);            
	        }
		}).click(function(event) {
			$(target(event)).addClass(CLASSES.ACTIVE);
			select($(target(event)).first());
			// TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus
			input.focus();
			return false;
		}).mousedown(function() {
			config.mouseDownOnSelect = true;
		}).mouseup(function() {
			config.mouseDownOnSelect = false;
		});
		
		if( options.width > 0 )
			element.css("width", options.width);
			
		needsInit = false;
	} 
	
	function target(event) {
		var element = event.target;
		while(element && element.tagName != "LI")
			element = element.parentNode;
		// more fun with IE, sometimes event.target is empty, just ignore it then
		if(!element)
			return [];
		return element;
	}

	function moveSelect(step) {
		listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE);
		movePosition(step);
        var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE);
        if(options.scroll) {
            var offset = 0;
            listItems.slice(0, active).each(function() {
				offset += this.offsetHeight;
			});
            if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) {
                list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight());
            } else if(offset < list.scrollTop()) {
                list.scrollTop(offset);
            }
        }
	};
	
	function movePosition(step) {
		active += step;
		if (active < 0) {
			active = listItems.size() - 1;
		} else if (active >= listItems.size()) {
			active = 0;
		}
	}
	
	function limitNumberOfItems(available) {
		return options.max && options.max < available
			? options.max
			: available;
	}
	
	function fillList() {
		list.empty();
		var max = limitNumberOfItems(data.length);
		for (var i=0; i < max; i++) {
			if (!data[i])
				continue;
			var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term);
			if ( formatted === false )
				continue;
			var li = $("<li/>").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0];
			$.data(li, "ac_data", data[i]);
		}
		listItems = list.find("li");
		if ( options.selectFirst ) {
			listItems.slice(0, 1).addClass(CLASSES.ACTIVE);
			active = 0;
		}
		// apply bgiframe if available
		if ( $.fn.bgiframe )
			list.bgiframe();
	}
	
	return {
		display: function(d, q) {
			init();
			data = d;
			term = q;
			fillList();
		},
		next: function() {
			moveSelect(1);
		},
		prev: function() {
			moveSelect(-1);
		},
		pageUp: function() {
			if (active != 0 && active - 8 < 0) {
				moveSelect( -active );
			} else {
				moveSelect(-8);
			}
		},
		pageDown: function() {
			if (active != listItems.size() - 1 && active + 8 > listItems.size()) {
				moveSelect( listItems.size() - 1 - active );
			} else {
				moveSelect(8);
			}
		},
		hide: function() {
			element && element.hide();
			listItems && listItems.removeClass(CLASSES.ACTIVE);
			active = -1;
		},
		visible : function() {
			return element && element.is(":visible");
		},
		current: function() {
			return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]);
		},
		show: function() {
			var offset = $(input).offset();
			element.css({
				width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(),
				top: offset.top + input.offsetHeight + options.topOffset,
				left: offset.left - ((options.leftAligned == true && (typeof options.width == "string" || options.width > 0)) ? (parseInt(options.width) - $(input).width() - options.leftOffset) : 0)
			}).show();
            if(options.scroll) {
                list.scrollTop(0);
                list.css({
					maxHeight: options.scrollHeight,
					overflow: 'auto'
				});
				
                if($.browser.msie && typeof document.body.style.maxHeight === "undefined") {
					var listHeight = 0;
					listItems.each(function() {
						listHeight += this.offsetHeight;
					});
					var scrollbarsVisible = listHeight > options.scrollHeight;
                    list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight );
					if (!scrollbarsVisible) {
						// IE doesn't recalculate width when scrollbar disappears
						listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) );
					}
                }
                
            }
		},
		selected: function() {
			var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);
			return selected && selected.length && $.data(selected[0], "ac_data");
		},
		emptyList: function (){
			list && list.empty();
		},
		unbind: function() {
			element && element.remove();
		}
	};
};

$.fn.selection = function(start, end) {
	if (start !== undefined) {
		return this.each(function() {
			if( this.createTextRange ){
				var selRange = this.createTextRange();
				if (end === undefined || start == end) {
					selRange.move("character", start);
					selRange.select();
				} else {
					selRange.collapse(true);
					selRange.moveStart("character", start);
					selRange.moveEnd("character", end);
					selRange.select();
				}
			} else if( this.setSelectionRange ){
				this.setSelectionRange(start, end);
			} else if( this.selectionStart ){
				this.selectionStart = start;
				this.selectionEnd = end;
			}
		});
	}
	var field = this[0];
	if ( field.createTextRange ) {
		var range = document.selection.createRange(),
			orig = field.value,
			teststring = "<->",
			textLength = range.text.length;
		range.text = teststring;
		var caretAt = field.value.indexOf(teststring);
		field.value = orig;
		this.selection(caretAt, caretAt + textLength);
		return {
			start: caretAt,
			end: caretAt + textLength
		}
	} else if( field.selectionStart !== undefined ){
		return {
			start: field.selectionStart,
			end: field.selectionEnd
		}
	}
};

})(jQuery);/**
 * This jQuery plugin displays pagination links inside the selected elements.
 * 
 * This plugin needs at least jQuery 1.4.2
 *
 * @author Gabriel Birke (birke *at* d-scribe *dot* de)
 * @version 2.2
 * @param {int} maxentries Number of entries to paginate
 * @param {Object} opts Several options (see README for documentation)
 * @return {Object} jQuery Object
 */
 (function($){
	/**
	 * @class Class for calculating pagination values
	 */
	$.PaginationCalculator = function(maxentries, opts) {
		this.maxentries = maxentries;
		this.opts = opts;
	}
	
	$.extend($.PaginationCalculator.prototype, {
		/**
		 * Calculate the maximum number of pages
		 * @method
		 * @returns {Number}
		 */
		numPages:function() {
			return Math.ceil(this.maxentries/this.opts.items_per_page);
		},
		/**
		 * Calculate start and end point of pagination links depending on 
		 * current_page and num_display_entries.
		 * @returns {Array}
		 */
		getInterval:function(current_page)  {
			var ne_half = Math.floor(this.opts.num_display_entries/2);
			var np = this.numPages();
			var upper_limit = np - this.opts.num_display_entries;
			var start = current_page > ne_half ? Math.max( Math.min(current_page - ne_half, upper_limit), 0 ) : 0;
			var end = current_page > ne_half?Math.min(current_page+ne_half + (this.opts.num_display_entries % 2), np):Math.min(this.opts.num_display_entries, np);
			return {start:start, end:end};
		}
	});
	
	// Initialize jQuery object container for pagination renderers
	$.PaginationRenderers = {}
	
	/**
	 * @class Default renderer for rendering pagination links
	 */
	$.PaginationRenderers.defaultRenderer = function(maxentries, opts) {
		this.maxentries = maxentries;
		this.opts = opts;
		this.pc = new $.PaginationCalculator(maxentries, opts);
	}
	$.extend($.PaginationRenderers.defaultRenderer.prototype, {
		/**
		 * Helper function for generating a single link (or a span tag if it's the current page)
		 * @param {Number} page_id The page id for the new item
		 * @param {Number} current_page 
		 * @param {Object} appendopts Options for the new item: text and classes
		 * @returns {jQuery} jQuery object containing the link
		 */
		createLink:function(page_id, current_page, appendopts){
			var lnk, np = this.pc.numPages();
			page_id = page_id<0?0:(page_id<np?page_id:np-1); // Normalize page id to sane value
			appendopts = $.extend({text:page_id+1, classes:""}, appendopts||{});
			if(page_id == current_page){
				lnk = $("<span class='current'>" + appendopts.text + "</span>");
			}
			else
			{
				lnk = $("<a>" + appendopts.text + "</a>")
					.attr('href', this.opts.link_to.replace(/__id__/,page_id));
			}
			if(appendopts.classes){ lnk.addClass(appendopts.classes); }
			lnk.data('page_id', page_id);
			return lnk;
		},
		// Generate a range of numeric links 
		appendRange:function(container, current_page, start, end, opts) {
			var i;
			for(i=start; i<end; i++) {
				this.createLink(i, current_page, opts).appendTo(container);
			}
		},
		getLinks:function(current_page, eventHandler) {
			var begin, end,
				interval = this.pc.getInterval(current_page),
				np = this.pc.numPages(),
				fragment = $("<div class='pagination'></div>");
			
			// Generate "Previous"-Link
			if(this.opts.prev_text && (current_page > 0 || this.opts.prev_show_always)){
				fragment.append(this.createLink(current_page-1, current_page, {text:this.opts.prev_text, classes:"prev"}));
			}
			// Generate starting points
			if (interval.start > 0 && this.opts.num_edge_entries > 0)
			{
				end = Math.min(this.opts.num_edge_entries, interval.start);
				this.appendRange(fragment, current_page, 0, end, {classes:'sp'});
				if(this.opts.num_edge_entries < interval.start && this.opts.ellipse_text)
				{
					jQuery("<span>"+this.opts.ellipse_text+"</span>").appendTo(fragment);
				}
			}
			// Generate interval links
			this.appendRange(fragment, current_page, interval.start, interval.end);
			// Generate ending points
			if (interval.end < np && this.opts.num_edge_entries > 0)
			{
				if(np-this.opts.num_edge_entries > interval.end && this.opts.ellipse_text)
				{
					jQuery("<span>"+this.opts.ellipse_text+"</span>").appendTo(fragment);
				}
				begin = Math.max(np-this.opts.num_edge_entries, interval.end);
				this.appendRange(fragment, current_page, begin, np, {classes:'ep'});
				
			}
			// Generate "Next"-Link
			if(this.opts.next_text && (current_page < np-1 || this.opts.next_show_always)){
				fragment.append(this.createLink(current_page+1, current_page, {text:this.opts.next_text, classes:"next"}));
			}
			$('a', fragment).click(eventHandler);
			return fragment;
		}
	});
	
	// Extend jQuery
	$.fn.pagination = function(maxentries, opts){
		
		// Initialize options with default values
		opts = jQuery.extend({
			items_per_page:10,
			num_display_entries:11,
			current_page:0,
			num_edge_entries:0,
			link_to:"#",
			prev_text:"Prev",
			next_text:"Next",
			ellipse_text:"...",
			prev_show_always:true,
			next_show_always:true,
			renderer:"defaultRenderer",
			load_first_page:false,
			callback:function(){return false;}
		},opts||{});
		
		var containers = this,
			renderer, links, current_page;
		
		/**
		 * This is the event handling function for the pagination links. 
		 * @param {int} page_id The new page number
		 */
		function paginationClickHandler(evt){
			var links, 
				new_current_page = $(evt.target).data('page_id'),
				continuePropagation = selectPage(new_current_page);
			if (!continuePropagation) {
				evt.stopPropagation();
			}
			return continuePropagation;
		}
		
		/**
		 * This is a utility function for the internal event handlers. 
		 * It sets the new current page on the pagination container objects, 
		 * generates a new HTMl fragment for the pagination links and calls
		 * the callback function.
		 */
		function selectPage(new_current_page) {
			// update the link display of a all containers
			containers.data('current_page', new_current_page);
			links = renderer.getLinks(new_current_page, paginationClickHandler);
			containers.empty();
			links.appendTo(containers);
			// call the callback and propagate the event if it does not return false
			var continuePropagation = opts.callback(new_current_page, containers);
			return continuePropagation;
		}
		
		// -----------------------------------
		// Initialize containers
		// -----------------------------------
		current_page = opts.current_page;
		containers.data('current_page', current_page);
		// Create a sane value for maxentries and items_per_page
		maxentries = (!maxentries || maxentries < 0)?1:maxentries;
		opts.items_per_page = (!opts.items_per_page || opts.items_per_page < 0)?1:opts.items_per_page;
		
		if(!$.PaginationRenderers[opts.renderer])
		{
			throw new ReferenceError("Pagination renderer '" + opts.renderer + "' was not found in jQuery.PaginationRenderers object.");
		}
		renderer = new $.PaginationRenderers[opts.renderer](maxentries, opts);
		
		// Attach control events to the DOM elements
		var pc = new $.PaginationCalculator(maxentries, opts);
		var np = pc.numPages();
		containers.bind('setPage', {numPages:np}, function(evt, page_id) { 
				if(page_id >= 0 && page_id < evt.data.numPages) {
					selectPage(page_id); return false;
				}
		});
		containers.bind('prevPage', function(evt){
				var current_page = $(this).data('current_page');
				if (current_page > 0) {
					selectPage(current_page - 1);
				}
				return false;
		});
		containers.bind('nextPage', {numPages:np}, function(evt){
				var current_page = $(this).data('current_page');
				if(current_page < evt.data.numPages - 1) {
					selectPage(current_page + 1);
				}
				return false;
		});
		
		// When all initialisation is done, draw the links
		links = renderer.getLinks(current_page, paginationClickHandler);
		containers.empty();
		links.appendTo(containers);
		// call callback function
		if(opts.load_first_page) {
			opts.callback(current_page, containers);
		}
	} // End of $.fn.pagination block
	
})(jQuery);
/*
	jQuery Bubble Popup v.2.3.1
	http://maxvergelli.wordpress.com/jquery-bubble-popup/
	
	Copyright (c) 2010 Max Vergelli
	
	Permission is hereby granted, free of charge, to any person obtaining a copy
	of this software and associated documentation files (the "Software"), to deal
	in the Software without restriction, including without limitation the rights
	to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
	copies of the Software, and to permit persons to whom the Software is
	furnished to do so, subject to the following conditions:
	
	The above copyright notice and this permission notice shall be included in
	all copies or substantial portions of the Software.
	
	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
	THE SOFTWARE.
*/

eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(6(a){a.1j.3C=6(){4 c=X;a(W).1g(6(d,e){4 b=a(e).1K("1U");5(b!=X&&7 b=="1a"&&!a.19(b)&&!a.18(b)&&b.3!=X&&7 b.3=="1a"&&!a.19(b.3)&&!a.18(b.3)&&7 b.3.1v!="1w"){c=b.3.1v?U:Q}12 Q});12 c};a.1j.45=6(){4 b=X;a(W).1g(6(e,f){4 d=a(f).1K("1U");5(d!=X&&7 d=="1a"&&!a.19(d)&&!a.18(d)&&d.3!=X&&7 d.3=="1a"&&!a.19(d.3)&&!a.18(d.3)&&7 d.3.1V!="1w"&&d.3.1V!=X){b=c(d.3.1V)}12 Q});6 c(d){12 2z 2Q(d*2R)}12 b};a.1j.4d=6(){4 b=X;a(W).1g(6(e,f){4 d=a(f).1K("1U");5(d!=X&&7 d=="1a"&&!a.19(d)&&!a.18(d)&&d.3!=X&&7 d.3=="1a"&&!a.19(d.3)&&!a.18(d.3)&&7 d.3.1W!="1w"&&d.3.1W!=X){b=c(d.3.1W)}12 Q});6 c(d){12 2z 2Q(d*2R)}12 b};a.1j.3G=6(){4 b=X;a(W).1g(6(e,f){4 d=a(f).1K("1U");5(d!=X&&7 d=="1a"&&!a.19(d)&&!a.18(d)&&d.3!=X&&7 d.3=="1a"&&!a.19(d.3)&&!a.18(d.3)&&7 d.3.1L!="1w"&&d.3.1L!=X){b=c(d.3.1L)}12 Q});6 c(d){12 2z 2Q(d*2R)}12 b};a.1j.3H=6(){4 b=X;a(W).1g(6(d,e){4 c=a(e).1K("1U");5(c!=X&&7 c=="1a"&&!a.19(c)&&!a.18(c)&&c.3!=X&&7 c.3=="1a"&&!a.19(c.3)&&!a.18(c.3)&&7 c.3.T!="1w"){b=a("#"+c.3.T).Z>0?a("#"+c.3.T).2p():X}12 Q});12 b};a.1j.3D=6(){4 b=X;a(W).1g(6(d,e){4 c=a(e).1K("1U");5(c!=X&&7 c=="1a"&&!a.19(c)&&!a.18(c)&&c.3!=X&&7 c.3=="1a"&&!a.19(c.3)&&!a.18(c.3)&&7 c.3.T!="1w"){b=c.3.T}12 Q});12 b};a.1j.4h=6(){4 b=0;a(W).1g(6(d,e){4 c=a(e).1K("1U");5(c!=X&&7 c=="1a"&&!a.19(c)&&!a.18(c)&&c.3!=X&&7 c.3=="1a"&&!a.19(c.3)&&!a.18(c.3)&&7 c.3.T!="1w"){a(e).2h("33");a(e).2h("2S");a(e).2h("30");a(e).2h("2G");a(e).2h("2L");a(e).2h("2x");a(e).2h("2s");a(e).2h("28");a(e).1K("1U",{});5(a("#"+c.3.T).Z>0){a("#"+c.3.T).2H()}b++}});12 b};a.1j.3x=6(){4 c=Q;a(W).1g(6(d,e){4 b=a(e).1K("1U");5(b!=X&&7 b=="1a"&&!a.19(b)&&!a.18(b)&&b.3!=X&&7 b.3=="1a"&&!a.19(b.3)&&!a.18(b.3)&&7 b.3.T!="1w"){c=U}12 Q});12 c};a.1j.48=6(){4 b={};a(W).1g(6(c,d){b=a(d).1K("1U");5(b!=X&&7 b=="1a"&&!a.19(b)&&!a.18(b)&&b.3!=X&&7 b.3=="1a"&&!a.19(b.3)&&!a.18(b.3)){44 b.3}1d{b=X}12 Q});5(a.18(b)){b=X}12 b};a.1j.4e=6(b,c){a(W).1g(6(d,e){5(7 c!="1I"){c=U}a(e).1e("2S",[b,c])})};a.1j.4c=6(b){a(W).1g(6(c,d){a(d).1e("30",[b])})};a.1j.47=6(b,c){a(W).1g(6(d,e){a(e).1e("2s",[b,c,U]);12 Q})};a.1j.46=6(b,c){a(W).1g(6(d,e){a(e).1e("2s",[b,c,U])})};a.1j.3X=6(){a(W).1g(6(b,c){a(c).1e("28",[U]);12 Q})};a.1j.3U=6(){a(W).1g(6(b,c){a(c).1e("28",[U])})};a.1j.3P=6(){a(W).1g(6(b,c){a(c).1e("2L");12 Q})};a.1j.3O=6(){a(W).1g(6(b,c){a(c).1e("2L")})};a.1j.3N=6(){a(W).1g(6(b,c){a(c).1e("2x");12 Q})};a.1j.3M=6(){a(W).1g(6(b,c){a(c).1e("2x")})};a.1j.3J=6(e){4 r={2J:W,2X:[],2Y:"1U",3w:["S","13","1b"],3n:["R","13","1c"],3j:\'<3i 1y="{1N} {3g}"{36} T="{37}"> 									<38{3b}> 									<3c> 									<2y> 										<14 1y="{1N}-S-R"{2m-2Z}>{2m-2O}</14> 										<14 1y="{1N}-S-13"{2m-3u}>{2m-20}</14> 										<14 1y="{1N}-S-1c"{2m-2U}>{2m-2P}</14> 									</2y> 									<2y> 										<14 1y="{1N}-13-R"{20-2Z}>{20-2O}</14> 										<14 1y="{1N}-1H"{31}>{2T}</14> 										<14 1y="{1N}-13-1c"{20-2U}>{20-2P}</14> 									</2y> 									<2y> 										<14 1y="{1N}-1b-R"{2l-2Z}>{2l-2O}</14> 										<14 1y="{1N}-1b-13"{2l-3u}>{2l-20}</14> 										<14 1y="{1N}-1b-1c"{2l-2U}>{2l-2P}</14> 									</2y> 									</3c> 									</38> 									</3i>\',3:{T:X,1L:X,1W:X,1V:X,1v:Q,1J:Q,1r:Q,1A:Q,1Y:Q,1B:Q,25:{}},15:"S",3v:["R","S","1c","1b"],11:"27",35:["R","27","1c","S","13","1b"],2K:["R","27","1c"],32:["S","13","1b"],1n:"3Y",1p:X,1o:X,1x:{},1u:{},1H:X,1O:{},V:{11:"27",1F:Q},1i:U,2q:U,22:Q,2k:U,23:"2E",3t:["2E","2V"],26:"2V",3o:["2E","2V"],1M:3h,1P:3h,29:0,2a:0,Y:"3e",21:"3F",2b:"3e-4f/",1h:{2A:"4a",1E:"43"},1T:6(){},1S:6(){},1m:[]};h(e);6 g(v){4 w={3:{},1p:r.1p,1o:r.1o,1x:r.1x,1u:r.1u,15:r.15,11:r.11,1n:r.1n,1M:r.1M,1P:r.1P,29:r.29,2a:r.2a,23:r.23,26:r.26,V:r.V,1H:r.1H,1O:r.1O,Y:r.Y,21:r.21,2b:r.2b,1h:r.1h,1i:r.1i,2k:r.2k,2q:r.2q,22:r.22,1T:r.1T,1S:r.1S,1m:r.1m};4 t=a.3E(Q,w,(7 v=="1a"&&!a.19(v)&&!a.18(v)&&v!=X?v:{}));t.3.T=r.3.T;t.3.1L=r.3.1L;t.3.1W=r.3.1W;t.3.1V=r.3.1V;t.3.1v=r.3.1v;t.3.1J=r.3.1J;t.3.1r=r.3.1r;t.3.1A=r.3.1A;t.3.1Y=r.3.1Y;t.3.1B=r.3.1B;t.3.25=r.3.25;t.1p=(7 t.1p=="1Q"||7 t.1p=="2c")&&10(t.1p)>0?10(t.1p):r.1p;t.1o=(7 t.1o=="1Q"||7 t.1o=="2c")&&10(t.1o)>0?10(t.1o):r.1o;t.1x=t.1x!=X&&7 t.1x=="1a"&&!a.19(t.1x)&&!a.18(t.1x)?t.1x:r.1x;t.1u=t.1u!=X&&7 t.1u=="1a"&&!a.19(t.1u)&&!a.18(t.1u)?t.1u:r.1u;t.15=7 t.15=="1Q"&&o(t.15.1X(),r.3v)?t.15.1X():r.15;t.11=7 t.11=="1Q"&&o(t.11.1X(),r.35)?t.11.1X():r.11;t.1n=(7 t.1n=="1Q"||7 t.1n=="2c")&&10(t.1n)>=0?10(t.1n):r.1n;t.1M=7 t.1M=="2c"&&10(t.1M)>0?10(t.1M):r.1M;t.1P=7 t.1P=="2c"&&10(t.1P)>0?10(t.1P):r.1P;t.29=7 t.29=="2c"&&t.29>=0?t.29:r.29;t.2a=7 t.2a=="2c"&&t.2a>=0?t.2a:r.2a;t.23=7 t.23=="1Q"&&o(t.23.1X(),r.3t)?t.23.1X():r.23;t.26=7 t.26=="1Q"&&o(t.26.1X(),r.3o)?t.26.1X():r.26;t.V=t.V!=X&&7 t.V=="1a"&&!a.19(t.V)&&!a.18(t.V)?t.V:r.V;t.V.11=7 t.V.11!="1w"?t.V.11:r.V.11;t.V.1F=7 t.V.1F!="1w"?t.V.1F:r.V.1F;t.1H=7 t.1H=="1Q"&&t.1H.Z>0?t.1H:r.1H;t.1O=t.1O!=X&&7 t.1O=="1a"&&!a.19(t.1O)&&!a.18(t.1O)?t.1O:r.1O;t.Y=j(7 t.Y=="1Q"&&t.Y.Z>0?t.Y:r.Y);t.21=7 t.21=="1Q"&&t.21.Z>0?a.3d(t.21):r.21;t.2b=7 t.2b=="1Q"&&t.2b.Z>0?a.3d(t.2b):r.2b;t.1h=t.1h!=X&&7 t.1h=="1a"&&!a.19(t.1h)&&!a.18(t.1h)&&(7 10(t.1h.2A)=="2c"&&7 10(t.1h.1E)=="2c")?t.1h:r.1h;t.1i=7 t.1i=="1I"&&t.1i==U?U:Q;t.2k=7 t.2k=="1I"&&t.2k==U?U:Q;t.2q=7 t.2q=="1I"&&t.2q==U?U:Q;t.22=7 t.22=="1I"&&t.22==U?U:Q;t.1T=7 t.1T=="6"?t.1T:r.1T;t.1S=7 t.1S=="6"?t.1S:r.1S;t.1m=a.19(t.1m)?t.1m:r.1m;5(t.15=="R"||t.15=="1c"){t.11=o(t.11,r.32)?t.11:"13"}1d{t.11=o(t.11,r.2K)?t.11:"27"}1R(4 u 2r t.V){2g(u){17"11":t.V.11=7 t.V.11=="1Q"&&o(t.V.11.1X(),r.35)?t.V.11.1X():r.V.11;5(t.15=="R"||t.15=="1c"){t.V.11=o(t.V.11,r.32)?t.V.11:"13"}1d{t.V.11=o(t.V.11,r.2K)?t.V.11:"27"}16;17"1F":t.V.1F=t.V.1F==U?U:Q;16}}12 t}6 l(t){5(t==0){12 0}5(t>0){12-(1s.1t(t))}1d{12 1s.1t(t)}}6 o(v,w){4 t=Q;1R(4 u 2r w){5(w[u]==v){t=U;16}}12 t}6 k(t){5(2W.3q){1R(4 v=t.Z-1;v>=0;v--){4 u=2W.3q("1G");u.2o=t[v];5(a.4g(t[v],r.2X)>-1){r.2X.3s(t[v])}}}}6 b(t){5(t.1m&&t.1m.Z>0){1R(4 u=0;u<t.1m.Z;u++){4 v=(t.1m[u].3m(0)!="#"?"#"+t.1m[u]:t.1m[u]);a(v).1k({34:"1F"})}}}6 s(u){5(u.1m&&u.1m.Z>0){1R(4 v=0;v<u.1m.Z;v++){4 x=(u.1m[v].3m(0)!="#"?"#"+u.1m[v]:u.1m[v]);a(x).1k({34:"3f"});4 w=a(x).Z;1R(4 t=0;t<w.Z;t++){a(w[t]).1k({34:"3f"})}}}}6 m(u){4 w=u.2b;4 t=u.21;4 v=(w.2I(w.Z-1)=="/"||w.2I(w.Z-1)=="\\\\")?w.2I(0,w.Z-1)+"/"+t+"/":w+"/"+t+"/";12 v+(u.1i==U?(a.1l.1D?"2e/":""):"2e/")}6 j(t){4 u=t.2I(0,1)=="."?t.2I(1,t.Z):t;12 u}6 q(u){5(a("#"+u.3.T).Z>0){4 t="1b-13";2g(u.15){17"R":t="13-1c";16;17"S":t="1b-13";16;17"1c":t="13-R";16;17"1b":t="S-13";16}5(o(u.V.11,r.2K)){a("#"+u.3.T).1f("14."+u.Y+"-"+t).1k("3a-11",u.V.11)}1d{a("#"+u.3.T).1f("14."+u.Y+"-"+t).1k("39-11",u.V.11)}}}6 p(v){4 H=r.3j;4 F=m(v);4 x="";4 G="";4 u="";5(!v.V.1F){2g(v.15){17"R":G="1c";u="{20-2P}";16;17"S":G="1b";u="{2l-20}";16;17"1c":G="R";u="{20-2O}";16;17"1b":G="S";u="{2m-20}";16}x=\'<1G 2o="\'+F+"V-"+G+"."+(v.1i==U?(a.1l.1D?"1C":"2n"):"1C")+\'" 2w="" 1y="\'+v.Y+\'-V" />\'}4 t=r.3w;4 z=r.3n;4 K,E,A,J;4 B="";4 y="";4 D=2z 3p();1R(E 2r t){A="";J="";1R(K 2r z){A=t[E]+"-"+z[K];A=A.42();J="{"+A+"40}";A="{"+A+"}";5(A==u){H=H.1z(A,x);B=""}1d{H=H.1z(A,"");B=""}5(t[E]+"-"+z[K]!="13-13"){y=F+t[E]+"-"+z[K]+"."+(v.1i==U?(a.1l.1D?"1C":"2n"):"1C");D.3s(y);H=H.1z(J,\' 2M="\'+B+"3L-3K:3I("+y+\');"\')}}}5(D.Z>0){k(D)}4 w="";5(v.1u!=X&&7 v.1u=="1a"&&!a.19(v.1u)&&!a.18(v.1u)){1R(4 C 2r v.1u){w+=C+":"+v.1u[C]+";"}}w+=(v.1p!=X||v.1o!=X)?(v.1p!=X?"1p:"+v.1p+"1Z;":"")+(v.1o!=X?"1o:"+v.1o+"1Z;":""):"";H=w.Z>0?H.1z("{3b}",\' 2M="\'+w+\'"\'):H.1z("{3b}","");4 I="";5(v.1x!=X&&7 v.1x=="1a"&&!a.19(v.1x)&&!a.18(v.1x)){1R(4 C 2r v.1x){I+=C+":"+v.1x[C]+";"}}H=I.Z>0?H.1z("{36}",\' 2M="\'+I+\'"\'):H.1z("{36}","");H=H.1z("{3g}",v.Y+"-"+v.21);H=v.3.T!=X?H.1z("{37}",v.3.T):H.1z("{37}","");3y(H.3z("{1N}")>-1){H=H.1z("{1N}",v.Y)}H=v.1H!=X?H.1z("{2T}",v.1H):H.1z("{2T}","");J="";1R(4 C 2r v.1O){J+=C+":"+v.1O[C]+";"}H=J.Z>0?H.1z("{31}",\' 2M="\'+J+\'"\'):H.1z("{31}","");12 H}6 f(){12 1s.3A(2z 2Q().3B()/2R)}6 c(E,N,x){4 O=x.15;4 K=x.11;4 z=x.1n;4 F=x.1h;4 I=2z 3p();4 u=N.2F();4 t=10(u.S);4 y=10(u.R);4 P=10(N.2v(Q));4 L=10(N.2u(Q));4 v=10(E.2v(Q));4 M=10(E.2u(Q));F.1E=1s.1t(10(F.1E));F.2A=1s.1t(10(F.2A));4 w=l(F.1E);4 J=l(F.1E);4 A=l(F.2A);4 H=m(x);2g(K){17"R":I.S=O=="S"?t-M-z+l(w):t+L+z+w;I.R=y+A;16;17"27":4 D=1s.1t(v-P)/2;I.S=O=="S"?t-M-z+l(w):t+L+z+w;I.R=v>=P?y-D:y+D;16;17"1c":4 D=1s.1t(v-P);I.S=O=="S"?t-M-z+l(w):t+L+z+w;I.R=v>=P?y-D+l(A):y+D+l(A);16;17"S":I.S=t+A;I.R=O=="R"?y-v-z+l(J):y+P+z+J;16;17"13":4 D=1s.1t(M-L)/2;I.S=M>=L?t-D:t+D;I.R=O=="R"?y-v-z+l(J):y+P+z+J;16;17"1b":4 D=1s.1t(M-L);I.S=M>=L?t-D+l(A):t+D+l(A);I.R=O=="R"?y-v-z+l(J):y+P+z+J;16}I.15=O;5(a("#"+x.3.T).Z>0&&a("#"+x.3.T).1f("1G."+x.Y+"-V").Z>0){a("#"+x.3.T).1f("1G."+x.Y+"-V").2H();4 G="1b";4 C="1b-13";2g(O){17"R":G="1c";C="13-1c";16;17"S":G="1b";C="1b-13";16;17"1c":G="R";C="13-R";16;17"1b":G="S";C="S-13";16}a("#"+x.3.T).1f("14."+x.Y+"-"+C).2D();a("#"+x.3.T).1f("14."+x.Y+"-"+C).2p(\'<1G 2o="\'+H+"V-"+G+"."+(x.1i==U?(a.1l.1D?"1C":"2n"):"1C")+\'" 2w="" 1y="\'+x.Y+\'-V" />\');q(x)}5(x.2q==U){5(I.S<a(1q).2i()||I.S+M>a(1q).2i()+a(1q).1o()){5(a("#"+x.3.T).Z>0&&a("#"+x.3.T).1f("1G."+x.Y+"-V").Z>0){a("#"+x.3.T).1f("1G."+x.Y+"-V").2H()}4 B="";5(I.S<a(1q).2i()){I.15="1b";I.S=t+L+z+w;5(a("#"+x.3.T).Z>0&&!x.V.1F){a("#"+x.3.T).1f("14."+x.Y+"-S-13").2D();a("#"+x.3.T).1f("14."+x.Y+"-S-13").2p(\'<1G 2o="\'+H+"V-S."+(x.1i==U?(a.1l.1D?"1C":"2n"):"1C")+\'" 2w="" 1y="\'+x.Y+\'-V" />\');B="S-13"}}1d{5(I.S+M>a(1q).2i()+a(1q).1o()){I.15="S";I.S=t-M-z+l(w);5(a("#"+x.3.T).Z>0&&!x.V.1F){a("#"+x.3.T).1f("14."+x.Y+"-1b-13").2D();a("#"+x.3.T).1f("14."+x.Y+"-1b-13").2p(\'<1G 2o="\'+H+"V-1b."+(x.1i==U?(a.1l.1D?"1C":"2n"):"1C")+\'" 2w="" 1y="\'+x.Y+\'-V" />\');B="1b-13"}}}5(I.R<0){I.R=0;5(B.Z>0){a("#"+x.3.T).1f("14."+x.Y+"-"+B).1k("3a-11","27")}}1d{5(I.R+v>a(1q).1p()){I.R=a(1q).1p()-v;5(B.Z>0){a("#"+x.3.T).1f("14."+x.Y+"-"+B).1k("3a-11","27")}}}}1d{5(I.R<0||I.R+v>a(1q).1p()){5(a("#"+x.3.T).Z>0&&a("#"+x.3.T).1f("1G."+x.Y+"-V").Z>0){a("#"+x.3.T).1f("1G."+x.Y+"-V").2H()}4 B="";5(I.R<0){I.15="1c";I.R=y+P+z+J;5(a("#"+x.3.T).Z>0&&!x.V.1F){a("#"+x.3.T).1f("14."+x.Y+"-13-R").2D();a("#"+x.3.T).1f("14."+x.Y+"-13-R").2p(\'<1G 2o="\'+H+"V-R."+(x.1i==U?(a.1l.1D?"1C":"2n"):"1C")+\'" 2w="" 1y="\'+x.Y+\'-V" />\');B="13-R"}}1d{5(I.R+v>a(1q).1p()){I.15="R";I.R=y-v-z+l(J);5(a("#"+x.3.T).Z>0&&!x.V.1F){a("#"+x.3.T).1f("14."+x.Y+"-13-1c").2D();a("#"+x.3.T).1f("14."+x.Y+"-13-1c").2p(\'<1G 2o="\'+H+"V-1c."+(x.1i==U?(a.1l.1D?"1C":"2n"):"1C")+\'" 2w="" 1y="\'+x.Y+\'-V" />\');B="13-1c"}}}5(I.S<a(1q).2i()){I.S=a(1q).2i();5(B.Z>0){a("#"+x.3.T).1f("14."+x.Y+"-"+B).1k("39-11","13")}}1d{5(I.S+M>a(1q).2i()+a(1q).1o()){I.S=(a(1q).2i()+a(1q).1o())-M;5(B.Z>0){a("#"+x.3.T).1f("14."+x.Y+"-"+B).1k("39-11","13")}}}}}}12 I}6 d(u,t){a(u).1K(r.2Y,t)}6 n(t){12 a(t).1K(r.2Y)}6 i(t){4 u=t!=X&&7 t=="1a"&&!a.19(t)&&!a.18(t)?U:Q;12 u}6 h(t){a(1q).3Q(6(){a(r.2J).1g(6(u,v){a(v).1e("2G")})});a(2W).3R(6(u){a(r.2J).1g(6(v,w){a(w).1e("33",[u.3S,u.3T])})});a(r.2J).1g(6(v,w){4 u=g(t);u.3.1L=f();u.3.T=u.Y+"-"+u.3.1L+"-"+v;d(w,u);a(w).2f("33",6(y,C,B){4 N=n(W);5(i(N)&&i(N.3)&&7 C!="1w"&&7 B!="1w"){5(N.2k){4 E=a(W);4 z=E.2F();4 L=10(z.S);4 H=10(z.R);4 F=10(E.2v(Q));4 K=10(E.2u(Q));4 J=Q;5(H<=C&&C<=F+H&&L<=B&&B<=K+L){J=U}1d{J=Q}5(J&&!N.3.1Y){N.3.1Y=U;d(W,N);5(N.23=="2E"){a(W).1e("2s")}1d{5(N.22&&a("#"+N.3.T).Z>0){4 x=a("#"+N.3.T);4 A=x.2F();4 D=10(A.S);4 I=10(A.R);4 G=10(x.2v(Q));4 M=10(x.2u(Q));5(I<=C&&C<=G+I&&D<=B&&B<=M+D){}1d{a(W).1e("28")}}1d{a(W).1e("28")}}}1d{5(!J&&N.3.1Y){N.3.1Y=Q;d(W,N);5(N.26=="2E"){a(W).1e("2s")}1d{5(N.22&&a("#"+N.3.T).Z>0){4 x=a("#"+N.3.T);4 A=x.2F();4 D=10(A.S);4 I=10(A.R);4 G=10(x.2v(Q));4 M=10(x.2u(Q));5(I<=C&&C<=G+I&&D<=B&&B<=M+D){}1d{a(W).1e("28")}}1d{a(W).1e("28")}}}1d{5(!J&&!N.3.1Y){5(N.22&&a("#"+N.3.T).Z>0&&!N.3.1r){4 x=a("#"+N.3.T);4 A=x.2F();4 D=10(A.S);4 I=10(A.R);4 G=10(x.2v(Q));4 M=10(x.2u(Q));5(I<=C&&C<=G+I&&D<=B&&B<=M+D){}1d{a(W).1e("28")}}}}}}}});a(w).2f("2S",6(A,x,z){4 y=n(W);5(i(y)&&i(y.3)&&7 x!="1w"){y.3.1W=f();5(7 z=="1I"&&z==U){y.1H=x}d(W,y);5(a("#"+y.3.T).Z>0){a("#"+y.3.T).1f("14."+y.Y+"-1H").2p(x);5(y.3.1A){a(W).1e("2G",[Q])}1d{a(W).1e("2G",[U])}}}});a(w).2f("30",6(A,z){4 x=n(W);5(i(x)&&i(x.3)){4 y=x;x=g(z);x.3.T=y.3.T;x.3.1L=y.3.1L;x.3.1W=f();x.3.1V=y.3.1V;x.3.1v=y.3.1v;x.3.1J=y.3.1J;x.3.25={};d(W,x)}});a(w).2f("2G",6(A,y){4 z=n(W);5(i(z)&&i(z.3)&&a("#"+z.3.T).Z>0&&z.3.1v==U){4 x=a("#"+z.3.T);4 C=c(x,a(W),z);4 B=2;5(7 y=="1I"&&y==U){x.1k({S:C.S,R:C.R})}1d{2g(z.15){17"R":x.1k({S:C.S,R:(C.15!=z.15?C.R-(1s.1t(z.1h.1E)*B):C.R+(1s.1t(z.1h.1E)*B))});16;17"S":x.1k({S:(C.15!=z.15?C.S-(1s.1t(z.1h.1E)*B):C.S+(1s.1t(z.1h.1E)*B)),R:C.R});16;17"1c":x.1k({S:C.S,R:(C.15!=z.15?C.R+(1s.1t(z.1h.1E)*B):C.R-(1s.1t(z.1h.1E)*B))});16;17"1b":x.1k({S:(C.15!=z.15?C.S+(1s.1t(z.1h.1E)*B):C.S-(1s.1t(z.1h.1E)*B)),R:C.R});16}}}});a(w).2f("2L",6(){4 x=n(W);5(i(x)&&i(x.3)){x.3.1J=U;d(W,x)}});a(w).2f("2x",6(){4 x=n(W);5(i(x)&&i(x.3)){x.3.1J=Q;d(W,x)}});a(w).2f("2s",6(x,A,D,G){4 H=n(W);5((7 G=="1I"&&G==U&&(i(H)&&i(H.3)))||(7 G=="1w"&&(i(H)&&i(H.3)&&!H.3.1J&&!H.3.1v))){5(7 G=="1I"&&G==U){a(W).1e("2x")}H.3.1v=U;H.3.1J=Q;H.3.1r=Q;H.3.1A=Q;5(i(H.3.25)){H=H.3.25}1d{H.3.25={}}5(i(A)){4 C=H;4 F=f();H=g(A);H.3.T=C.3.T;H.3.1L=C.3.1L;H.3.1W=F;H.3.1V=F;H.3.1v=U;H.3.1J=Q;H.3.1r=Q;H.3.1A=Q;H.3.1Y=C.3.1Y;H.3.1B=C.3.1B;H.3.25={};5(7 D=="1I"&&D==Q){C.3.1W=F;C.3.1V=F;H.3.25=C}}d(W,H);b(H);5(a("#"+H.3.T).Z>0){a("#"+H.3.T).2H()}4 y={};4 B=p(H);y=a(B);y.3V("3W");y=a("#"+H.3.T);y.1k({24:0,S:"3r",R:"3r",15:"3Z",2C:"41"});5(H.1i==U){5(a.1l.1D&&10(a.1l.2t)<9){a("#"+H.3.T+" 38").2B(H.Y+"-2e")}}q(H);4 E=c(y,a(W),H);y.1k({S:E.S,R:E.R});5(E.15==H.15){H.3.1B=Q}1d{H.3.1B=U}d(W,H);4 z=3l(6(){H.3.1r=U;d(w,H);y.3k();2g(H.15){17"R":y.2d({24:1,R:(H.3.1B?"-=":"+=")+H.1n+"1Z"},H.1M,"2j",6(){H.3.1r=Q;H.3.1A=U;d(w,H);5(H.1i==U){5(a.1l.1D&&10(a.1l.2t)>8){y.2B(H.Y+"-2e")}}H.1T()});16;17"S":y.2d({24:1,S:(H.3.1B?"-=":"+=")+H.1n+"1Z"},H.1M,"2j",6(){H.3.1r=Q;H.3.1A=U;d(w,H);5(H.1i==U){5(a.1l.1D&&10(a.1l.2t)>8){y.2B(H.Y+"-2e")}}H.1T()});16;17"1c":y.2d({24:1,R:(H.3.1B?"+=":"-=")+H.1n+"1Z"},H.1M,"2j",6(){H.3.1r=Q;H.3.1A=U;d(w,H);5(H.1i==U){5(a.1l.1D&&10(a.1l.2t)>8){y.2B(H.Y+"-2e")}}H.1T()});16;17"1b":y.2d({24:1,S:(H.3.1B?"+=":"-=")+H.1n+"1Z"},H.1M,"2j",6(){H.3.1r=Q;H.3.1A=U;d(w,H);5(H.1i==U){5(a.1l.1D&&10(a.1l.2t)>8){y.2B(H.Y+"-2e")}}H.1T()});16}},H.29)}});a(w).2f("28",6(B,x){4 A=n(W);5((7 x=="1I"&&x==U&&(i(A)&&i(A.3)&&a("#"+A.3.T).Z>0))||(7 x=="1w"&&(i(A)&&i(A.3)&&a("#"+A.3.T).Z>0&&!A.3.1J&&A.3.1v))){5(7 x=="1I"&&x==U){a(W).1e("2x")}A.3.1r=Q;A.3.1A=Q;d(W,A);4 y=a("#"+A.3.T);4 z=7 x=="1w"?A.2a:0;4 C=3l(6(){A.3.1r=U;d(w,A);y.3k();5(A.1i==U){5(a.1l.1D&&10(a.1l.2t)>8){y.49(A.Y+"-2e")}}2g(A.15){17"R":y.2d({24:0,R:(A.3.1B?"+=":"-=")+A.1n+"1Z"},A.1P,"2j",6(){A.3.1v=Q;A.3.1r=Q;A.3.1A=U;d(w,A);y.1k("2C","2N");A.1S()});16;17"S":y.2d({24:0,S:(A.3.1B?"+=":"-=")+A.1n+"1Z"},A.1P,"2j",6(){A.3.1v=Q;A.3.1r=Q;A.3.1A=U;d(w,A);y.1k("2C","2N");A.1S()});16;17"1c":y.2d({24:0,R:(A.3.1B?"-=":"+=")+A.1n+"1Z"},A.1P,"2j",6(){A.3.1v=Q;A.3.1r=Q;A.3.1A=U;d(w,A);y.1k("2C","2N");A.1S()});16;17"1b":y.2d({24:0,S:(A.3.1B?"-=":"+=")+A.1n+"1Z"},A.1P,"2j",6(){A.3.1v=Q;A.3.1r=Q;A.3.1A=U;d(w,A);y.1k("2C","2N");A.1S()});16}},z);A.3.1V=f();A.3.1J=Q;d(W,A);s(A)}})})}12 W}})(4b);',62,266,'|||privateVars|var|if|function|typeof|||||||||||||||||||||||||||||||||||||||||||||false|left|top|id|true|tail|this|null|baseClass|length|parseInt|align|return|middle|td|position|break|case|isEmptyObject|isArray|object|bottom|right|else|trigger|find|each|themeMargins|dropShadow|fn|css|browser|hideElementId|distance|height|width|window|is_animating|Math|abs|tableStyle|is_open|undefined|divStyle|class|replace|is_animation_complete|is_position_changed|gif|msie|difference|hidden|img|innerHtml|boolean|is_freezed|data|creation_datetime|openingSpeed|BASE_CLASS|innerHtmlStyle|closingSpeed|string|for|afterHidden|afterShown|private_jquerybubblepopup_options|last_display_datetime|last_modified_datetime|toLowerCase|is_mouse_over|px|MIDDLE|themeName|selectable|mouseOver|opacity|last_options|mouseOut|center|hidebubblepopup|openingDelay|closingDelay|themePath|number|animate|ie|bind|switch|unbind|scrollTop|swing|manageMouseEvents|BOTTOM|TOP|png|src|html|alwaysVisible|in|showbubblepopup|version|outerHeight|outerWidth|alt|unfreezebubblepopup|tr|new|total|addClass|display|empty|show|offset|positionbubblepopup|remove|substring|me|alignHorizontalValues|freezebubblepopup|style|none|LEFT|RIGHT|Date|1000|setbubblepopupinnerhtml|INNERHTML|RIGHT_STYLE|hide|document|cache|options_key|LEFT_STYLE|setbubblepopupoptions|INNERHTML_STYLE|alignVerticalValues|managebubblepopup|visibility|alignValues|DIV_STYLE|DIV_ID|table|vertical|text|TABLE_STYLE|tbody|trim|jquerybubblepopup|visible|TEMPLATE_CLASS|250|div|model_markup|stop|setTimeout|charAt|model_td|mouseOutValues|Array|createElement|0px|push|mouseOverValues|MIDDLE_STYLE|positionValues|model_tr|HasBubblePopup|while|indexOf|round|getTime|IsBubblePopupOpen|GetBubblePopupID|extend|azure|GetBubblePopupCreationDateTime|GetBubblePopupMarkup|url|CreateBubblePopup|image|background|UnfreezeAllBubblePopups|UnfreezeBubblePopup|FreezeAllBubblePopups|FreezeBubblePopup|resize|mousemove|pageX|pageY|HideAllBubblePopups|appendTo|body|HideBubblePopup|20px|absolute|_STYLE|block|toUpperCase|10px|delete|GetBubblePopupLastDisplayDateTime|ShowAllBubblePopups|ShowBubblePopup|GetBubblePopupOptions|removeClass|13px|jQuery|SetBubblePopupOptions|GetBubblePopupLastModifiedDateTime|SetBubblePopupInnerHtml|theme|inArray|RemoveBubblePopup'.split('|'),0,{}))
// Address check via trillium
var patternNlPostalCode = /^\d{4}[a-z]{2}$/i;
var patternNlHouseNumber = /^\d{1,10}$/i;
var focusedId;

function validateAddressNl(pcId, hnId, ctId, stId) {
	var pcValid = isPostalCodeValidNl(pcId);
	var hnValid = isHouseNumberValidNl(hnId);
	if (pcValid) {
		var postalCode = $("#"+pcId).attr("value");
		postalCode = postalCode.replace(/\s/g,"");
		var pcode = postalCode.substring(0,4) +  " " + postalCode.substring(4,6).toUpperCase();
		$("#"+pcId).attr("value", pcode);
		$("#"+pcId).removeClass("ValidationError");
		$("[for=" + pcId + "]").removeClass("ValidationError");
	} else {
		$("[for=" + pcId + "]").addClass("ValidationError");
		$("#"+pcId).addClass("ValidationError");
	}
	if(hnValid) {
		$("#"+hnId).removeClass("ValidationError");
		$("[for=" + hnId + "]").removeClass("ValidationError");
	} else {
		$("[for=" + hnId + "]").addClass("ValidationError");
		$("#"+hnId).addClass("ValidationError");
	}
	if (focusedId == pcId.replace("\\","") || focusedId == hnId.replace("\\","")) {
		return;
	}
	if (!hnValid || !pcValid) {
		alert (errorMsgAddress);
		return;
	}
	validateAddressRemoteNl(pcId, hnId, ctId, stId);
}

function isPostalCodeValidNl(pcId) {
	var postalCode = $("#"+pcId).attr("value");
	postalCode = postalCode.replace(/\s/g,"");
	return patternNlPostalCode.test(postalCode);
}

function isHouseNumberValidNl(hnId) {
	var houseNumber = $("#"+hnId).attr("value");
	return patternNlHouseNumber.test(houseNumber);
}

function validateAddressRemoteNl(pcId, hnId, ctId, stId) {
	var postalCode = $("#"+pcId).attr("value");
	var houseNumber = $("#"+hnId).attr("value");
	$.post("/store/checkAddress/nl",{"postalCode": postalCode, "houseNumber":houseNumber},
		function(data){
			if (data.available == "true") {
				$("#"+idStreet).attr('disabled', true);
				$("#"+idCity).attr('disabled', true);
				if (data.valid == "true") {
					$("#"+ctId).attr("value", data.city);
					$("#"+stId).attr("value", data.street);
				} else {
					$("#"+ctId).attr("value", "");
					$("#"+stId).attr("value", "");
					alert(errorMsgAddress);
				}
			} else {
				$("#"+idStreet).removeAttr('disabled');
				$("#"+idCity).removeAttr('disabled');
			}
		},"json"
	);
}
