(function(){
	
	var Class = {
		
	  extend : function(parent, def) {
	  	var func, mixins = [], i, mixin;
	  	
	    if(arguments.length === 1) {
	    	def = parent;
	    	parent = null;
	    }
	    if(arguments.length === 3) {
		    func = function() {
		      if(!Class.extending) {
		      	this.init.apply(this, arguments);
		      }
		    };
		  }
		  else {
		    func = function() {
		      if(!Class.extending) {
		      	this.initialize.apply(this, arguments);
		      }
		    };
		  }
	    if(typeof(parent) === 'function') {
	      Class.extending = true;
	      if(arguments.length === 3) {
	      	func.prototype = new parent(arguments[2]);
	      }
	      else {
	      	func.prototype = new parent();
	      }
	      delete Class.extending;
	    }
	    if(def && def.include) {
	      if(def.include.reverse) {
	        // methods defined in later mixins should override prior
	        mixins = mixins.concat(def.include.reverse());
	      }
	      else {
	        mixins.push(def.include);
	      }
	      delete def.include; // clean syntax sugar
	    }	    
	    if(def) {
	    	Class.inherit(func.prototype, def);
	    }
	    for(i = 0; (mixin = mixins[i]); i++) {
	      Class.mixin(func.prototype, mixin);
	    }	    
	    return func;
	  },	  

	  mixin : function(dest, src, clobber) {
	  	var prop;
	  	
	    clobber = clobber || false;
	    if(typeof(src) !== 'undefined' && src !== null) {
	      for(prop in src) {      	
	        if(clobber || (!dest[prop] && typeof(src[prop]) === 'function')) {
	          dest[prop] = src[prop];
	        }
	      }
	    }
	    return dest;
	  },	  
	
	  inherit : function(dest, src, fname) {
	  	var ancestor, descendent, method, prop;
	  	
	    if(arguments.length == 3) {
	      ancestor = dest[fname];
	      descendent = src[fname];
	      method = descendent;
	      descendent = function() {
	      	var ref, result;
	      	
	        ref = this.parent;
	        this.parent = ancestor;
	        result = method.apply(this, arguments);
	        ref ? this.parent = ref : delete this.parent;
	        return result;
	      };
	      // mask the underlying method
	      descendent.valueOf = function() {
	      	return method;
	      };
	      descendent.toString = function() {
	      	return method.toString();
	      };
	      dest[fname] = descendent;
	    }
	    else {
	      for(prop in src) {
	        if(dest[prop] && typeof(src[prop]) === 'function') {
	          Class.inherit(dest, src, prop);
	        }
	        else {
	          dest[prop] = src[prop];
	        }
	      }
	    }
	    return dest;
	  }
					  
	};
	
// =================================================================================================
	
		// setting up packages
	ch = {};
	ch.clx = {};
	
// =================================================================================================

	ch.clx.Page = {
		
		HOME_GRID : "homegrid",
		SUB_GRID : "subgrid",
		PROC_GRID : "procgrid",
		LARGE_TABLE_GRID : "largetablegrid",
		
		getGridType : function() {
			var me = this, jBody = $("body");
			
			if(jBody.hasClass(me.HOME_GRID)) {
				return me.HOME_GRID;
			}
			if(jBody.hasClass(me.SUB_GRID)) {
				return me.SUB_GRID;
			}
			if(jBody.hasClass(me.PROC_GRID)) {
				return me.PROC_GRID;
			}
			if(jBody.hasClass(me.LARGE_TABLE_GRID)) {
				return me.LARGE_TABLE_GRID;
			}
		},
		
		adjustColumnHeight : function(jNode) {
			var me = this,
			columnHeight,
			cols, colMaxHeight = 0;
			
			// Column Data Height
			jNode.find("div.row").each(function() {
				if(!$(this).hasClass("zoom-image")) {
					if(!this.columnHeightAdjusted_) {			
						cols = $(this).find("div.column");
						cols.each(function() {
							columnHeight = $(this).height();
							if(columnHeight > colMaxHeight) {
								colMaxHeight = columnHeight;
							}
						});
						if(colMaxHeight > 0) {
							this.columnHeightAdjusted_ = true;
							cols.css("height", colMaxHeight + 1);
						}
						columnHeight = 0;
						colMaxHeight  = 0;
					}
				}
			});
		},
		
		addBreadcrumbImage : function(node) {	
			var jNode = $(node), imgPath = jNode.css("background-image");
			
			imgPath = imgPath.replace(/^(url\("|url\()/, "").replace(/("\)|\))$/, "");
			jNode.append("<img src='"+ imgPath +  "' alt='' />");
			jNode.css("background-image","none");
		}
		
	};

// =================================================================================================

	ch.clx.Observable = Class.extend({
	
		eventListeners_ : null,
		
		initialize : function() {
			var me = this;
			
			me.eventListeners_ = {};
		},
		
		addListener : function(type, listenerFct) {
			var me = this;
			
			me.bindListener(type, listenerFct, null);
		},
		
		bindListener : function(type, listenerFct, boundTo) {
			var me = this, index = 0;
			
			if(!me.eventListeners_[type]) {
				me.eventListeners_[type] = [{listenerKey:listenerFct, context:boundTo}];
			}
			else {
				index = me.eventListeners_[type].push({listenerKey : listenerFct, context : boundTo});
				index = index - 1;
			}
			return {evtType:type, listenerIndex:index};
		},
			
		removeListener : function(handle) {
			var me = this;
			
			if(me.eventListeners_[handle.evtType] && me.eventListeners_[handle.evtType ][handle.listenerIndex]) {
				me.eventListeners_[handle.evtType][handle.listenerIndex] = null;
			}
		},
			
		fire : function(type, args) {
			var me = this, i, eventListener, arg;
			
			if(!me.eventListeners_[type]) {
				return true;
			}
			for(i = 0; i < me.eventListeners_[type].length; i++) {
				eventListener = me.eventListeners_[type][i];
				if(eventListener) {
					arg = (args ? args : []);
					eventListener.listenerKey.apply(eventListener.context, arg);
				}
			}
		}
	
	});
	
// =================================================================================================	
	
	ch.clx.Cookie = {
		
		getCookie : function(name) {
			var n = name + "=", tokens = document.cookie.split( ";" ), i, token;
			
			for(i = 0; i < tokens.length; i++) {
				token = tokens[i].replace(/^( )*/, "");
				if(token.indexOf(n) === 0) {
					return token.substring(n.length, token.length);
				}
			}
			return null;
		},
		
		setCookie : function(name, value, days) {
			var expires = "", date;
			
			if(days) {
				date = new Date();
				date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
				expires = "; expires=" + date.toGMTString();
			}
			document.cookie = name + "=" + escape(value) + expires + "; path=/";
		},
		
		eraseCookie : function(name) {
			ch.clx.Cookie.setCookie(name, "", -1);
		}
		
	};
	
// =================================================================================================	
	
	ch.clx.HashTable = Class.extend({	
		
		items_ : null,
		length_ : 0,
		
		initialize : function() {
			var me = this;
			
			me.items_ = {};
		},
			
		get : function(key) {
			var me = this;
			
			if(me.items_[key]) {
				return me.items_[key];
			}
			else {
				return null;
			}
		},
		
		clear : function() {
			var me = this, key;
			
			for(key in me.items_) {
				me.remove(key);
			}
			me.items_ = {};
		},
		
		add : function(key, item) {
			var me = this;
			
			me.items_[key] = item;
			me.length_++;
			return item;
		},
		
		remove : function(key) {
			var me = this;
			
			if(me.get(key)) {
				me.items_[key] = null;
				me.length_--;
			}
		},
		
		each : function(f) {
			var me = this, item, res;
			
			for(item in me.items_) {
				res = me.items_[item];
				if(res) {
					f(res);
				}
			}
		},
		
		length : function() {
			var me = this;
			
			return me.length_;
		}
		
	});

// =================================================================================================

	ch.clx.TabContainer = Class.extend({
		
		rootNode : null,
		activeItem : null,
		body_ : null,
		panes_ : null,
		tabs_ : null,
		
		initialize : function(rootNode) {
			var me = this;
			
			me.rootNode = $(rootNode);
			me.body_ = me.rootNode.find("div.tabs-body");
			me.panes_ = me.rootNode.find("div.tabs-body div.container");
			me.tabs_ = me.rootNode.find("ul.tabs a");

			me.tabs_.each(function() {
				this.href = "javascript:void(0);";
				$(this).click(function() {
					me.handleClick.apply(me, [this]);
					this.blur();
				});
				$(this).mouseover(function() {
					$(this.parentNode).addClass("over");
				});
				$(this).mouseout(function() {
					$(this.parentNode).removeClass("over");
				});
				if(this.parentNode.className && this.parentNode.className.match(/current/)) {
					$(this).click();
				}
			});
		},
		
		handleClick : function(item) {
			var me = this, currentPane;
			
			if(me.activeItem) {
				$(me.activeItem.parentNode).removeClass("current");
				me.panes_.eq(me.tabs_.index(me.activeItem)).removeClass("current");
				me.panesOpen_ = "2";
			}
			if(me.activeItem != item) {
				if(!me.body_.hasClass("open")) {
					me.body_.addClass("open");
					me.panesOpen_ = "1";
				}
				me.activeItem = item;
				$(item.parentNode).addClass("current");
				currentPane = me.panes_.eq(me.tabs_.index(item));
				currentPane.addClass("current");
				ch.clx.Page.adjustColumnHeight(currentPane);
			}
			else {
				me.activeItem = null;
				me.body_.removeClass("open");
			}
		}
		
	});
	
// =================================================================================================	
	
	ch.clx.Hierarchy = Class.extend({
		
		TYPE_NO_IMG : 1,
		
		rootNode : null,
		type_ : null,
		
		initialize : function(rootNode) {
			var me = this,
					titleHeight = 0,
					imgHeight = 0,
					textHeight = 0,
					i, th, ih, ph, j, boxes, index, img, diff, startIndex, totalheight;
					
			me.rootNode = rootNode;
			
			if($(rootNode).find("img").length === 0) {
				me.type_ = me.TYPE_NO_IMG;
				$(rootNode).find("a").hide();
			}
			
			boxes = $(rootNode).find("li.body");		
				
			for(i = 0; i < boxes.length; i++) {
				index = i + 1;
				ih = 0;
				th = $(boxes[i]).find("h2").height();
				ph = $(boxes[i]).find("div").height();				
				if(me.type_ !== me.TYPE_NO_IMG) {
					ih = $(boxes[i]).find("img").height();
 				}
 				
				if(th > titleHeight) {
					titleHeight = th;
				}
				if(ih > imgHeight) {
					imgHeight = ih;
				}
				if(ph > textHeight) {
					textHeight = ph;
				}
				
				if(index % 3 === 0 || index === boxes.length) {
					if(index === boxes.length && index % 3 !== 0) {					
						startIndex = boxes.length % 3;
					}
					else {
						startIndex = 3;
					}
					
					for(j = index - startIndex; j < index; j++) {
							
						if(imgHeight !== 0) {
							img = $(boxes[j]).find("a");
							diff = titleHeight - $(boxes[j]).find("h2").height();
							if(diff > 0) {
								img.css("padding-top", 20 + diff + "px");
							}
							img.css("height", imgHeight + "px");
							ih = $(boxes[j]).find("img").height();
							if(ih < imgHeight) {
								$(boxes[j]).find("img").css("margin-top", (imgHeight - ih) / 2 + "px");
							}
						}
						else {
							diff = titleHeight - $(boxes[j]).find("h2").height();
							if(diff > 0) {
								$(boxes[j]).find("div").css("padding-top", diff + "px");
							}
						}
						if(textHeight !== 0) {
							$(boxes[j]).find("div").css("height", textHeight + "px");
						}				
					}
					
					titleHeight = 0;
					imgHeight = 0;
					textHeight = 0;
					$(boxes[i]).addClass("last");
				}
				
				$(boxes[i]).addClass("clickable").
				click(function() {
					window.location.href = $(this).find("a").attr("href");
				}).
				mouseover(function() {
					className = "over";
					if($.browser.msie && $.browser.version == "6.0" && $(this).hasClass("last")) {
						className = "body-last-over";
					}
					$(this).addClass(className);
				}).
				mouseout(function() {
					className = "over";
					if($.browser.msie && $.browser.version == "6.0" && $(this).hasClass("last")) {
						className = "body-last-over";
					}
					$(this).removeClass(className);
				});
						
			}
		}
		
	});
	
// =================================================================================================		
	
	ch.clx.ModalDialog = Class.extend(ch.clx.Observable, {
		
		rootNode : null,
		overlay_ : null,
		dialog_ : null,
		state_ : "hidden",
		currentDialog_ : null,
		FADE_IN_TIME : 800,
		FADE_OUT_TIME : 800,
		
		initialize : function() {
			var me = this;
			
			me.parent();
				 // for ie6
			if ($.browser.msie && $.browser.version < 7) {
				$("body").append('<iframe src="javascript:false;" id="ie6ModalDialogZIndexFix"></iframe><div id="overlayBG"></div><div id="dialog"></div>');
				me.overlay_ = $("div#overlayBG, iframe#ie6ModalDialogZIndexFix");
			}
				// for all others
			else {
				$("body").append("<div id='overlay'></div><div id='dialog'></div>");
				me.overlay_ = $("div#overlay");
			}
			me.dialog_ = $("div#dialog");
		},
		
		show : function() {
			var me = this;
			
			if($.browser.msie) {
				$("html").css("overflow", "hidden");
			}
			me.overlay_.show().css({
				opacity : "0"
			}).fadeTo(me.FADE_IN_TIME, 0.75);
			me.dialog_.fadeIn(me.FADE_IN_TIME, function() {
				me.state_ = "visible";
				me.fire("show");
			});			
		},
				
		hide : function() {
			var me = this;
				
			me.overlay_.fadeTo(me.FADE_OUT_TIME, 0, function(){
				me.overlay_.hide();
			});
			me.dialog_.fadeOut(me.FADE_OUT_TIME, function() {
				me.dialog_.hide();
				if($.browser.msie) {
					$("html").css("overflow", "");
				}
				me.removeContent_();			
				me.state_ = "hidden";	
				me.fire("hide");
			});			
		},
				
		setSize : function(size) {
			var me = this;
		
			me.dialog_.css({
				width : size.width,
				height : size.height,
				"margin-left" : - Math.floor(size.width / 2)
			});
		},
		
		setDialog : function(dialog) {
			var me = this;
			
			me.removeContent_();			
			me.currentDialog_ = dialog;
			me.setContent_(me.currentDialog_.getContent());
		},
		
		setContent_ : function(jNode) {
			var me = this;
			
			me.dialog_.append(jNode);			
		},
		
		getContent_ : function() {
			var me = this;
			
			return me.dialog_.children();
		},
		
		removeContent_ : function() {
			var me = this;
			
			if(me.currentDialog_) {
				me.currentDialog_.remove();
				me.currentDialog_ = null;
			}
		},
		
		verticalAlign : function() {
			var me = this, domDialog = me.dialog_.get(0);
      
      me.dialog_.css("margin-top", 0 - parseInt(domDialog.offsetHeight / 2) + (document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + "px");
		}
		
	});
				
// =================================================================================================

	ch.clx.Dialog = Class.extend({
		
		rootNode : null,
		
		initialize : function() {
			var me = this;
			
		},
		
		show : function() {
			var me = this;		
		
			ch.clx.ModalDialog.instance.setSize(me.getSize());
			if($.browser.msie && $.browser.version < 7) {
				ch.clx.ModalDialog.instance.verticalAlign();
			}
			ch.clx.ModalDialog.instance.setDialog(me);
			ch.clx.ModalDialog.instance.show();
		},
		
		hide : function() {
			var me = this;
			
			ch.clx.ModalDialog.instance.hide();
		},		
		
		getSize : function() {
			var me = this;
			
			return {
				width : 100,
				height : 100
			};
		},
		
		getContent : function() {
			var me = this;
			
				// just a placeholder
			if(!me.rootNode) {
				me.rootNode = $('<div style="width:100px;height:100px;background-color:yellow;">placeholder</div>');			
				me.rootNode.click(function() {
					me.hide();
				});
			}
			
			return me.rootNode.show();
		},
		
		remove : function() {
			var me = this;
			
			me.rootNode.parent().children().remove();
		}
		
	});
	
// =================================================================================================

	/*
		ch.clx.LoginDialog
		
		publicMethods:
		
			show()
			hide()
			getSize()
			getContent()
			remove()
			setContent(String content)
			redraw()
		
	*/
	
	ch.clx.LoginDialog = Class.extend(ch.clx.Dialog, {
		
		rootNode : null,
		DIALOG_WIDTH : 778,
		DIALOG_HEIGHT : "auto",
		enterHandler_ : null,
		
		initialize : function(rootNode) {
			var me = this;
			
			me.rootNode = $(rootNode);
				// init links which will show the login-dialog
			$("a.loginlayer").attr("href", "javascript:void(0);").click(function() {
				this.blur();
				me.show();
			});
				// init links which will hide the login-dialog
			me.rootNode.find("span.close a").attr("href", "javascript:void(0);").click(function() {
				this.blur();
				me.hide();
			});
			me.initEnterHandler_();
			
			me.parent();
		},
		
		initEnterHandler_ : function() {
			var me = this;
			
			me.enterHandler_ = new ch.clx.EnterHandler(me.rootNode);
			me.enterHandler_.addListener("enter", me.rootNode.find("ul.foot a:first").attr("onclick"));
		},
		
		getSize : function() {
			var me = this;
			
			return {
				width : me.DIALOG_WIDTH,
				height : me.DIALOG_HEIGHT
			};
		},
		
		getContent : function() {
			var me = this;
			
			return me.parent();
		},
		
		remove : function() {
			var me = this;
			
			$("body").append(me.rootNode.hide());
		},
		
		/*
			method allows to replace the login-layer content by some new content (e.g. loaded by an ajax request),
			and then calls the redraw() method with a small delay to update and reintialize event handlers
		*/
		setContent : function(content) {
			var me = this;
		
			me.rootNode.replaceWith(content);
			window.setTimeout(function() {			
				me.redraw();
			}, 50);
			
		},
		
		redraw : function() {
			var me = this;
			
				// point rootNode to the new node
			me.rootNode = $("div#loginbox");
				// add event-handlers to enable submitting by hitting enter-key
			me.initEnterHandler_();
				// init links which will hide the login-dialog				
			me.rootNode.find("span.close a").attr("href", "javascript:void(0);").click(function() {
				this.blur();
				me.hide();
			});
		}
		
	});
	
// =================================================================================================	
	
	ch.clx.EnterHandler = Class.extend(ch.clx.Observable, {
		
		rootNode : null,
		fields_ : null,
		
		initialize : function(jRootNode) {
			var me = this;
			
			me.rootNode = jRootNode;

				// these fields will be observed if they have focus
			me.fields_ = me.rootNode.find("input.submitable").keypress(function(evt) {
				me.handleKeyPress(evt);
			});
				// fix safari: prevent default action on login-forms as it always submits the form on enter which causes a page reload
			if($.browser.safari) {
				me.fields_.parents("form:first").submit(function() {
					return false;
				});
			}		
			me.parent();		
		},
		
		handleKeyPress : function(evt) {
			var me  = this;
			
			if(evt.keyCode === 13) {
				me.fire("enter");
			}			
		}		
	
	});		
	
// =================================================================================================

	ch.clx.MovieDialog = Class.extend(ch.clx.Dialog, {
		
		rootNode : null,
		openerHandle_ : null,
		contentSrc_ : null,
		DIALOG_WIDTH : 600,
		DIALOG_HEIGHT : 300,
		
		initialize : function(openerHandle) {
			var me = this, dimensions = openerHandle.className.match(/([0-9])+x([0-9])+/);
			
			if(dimensions) {
				dimensions = dimensions[0].split("x");
				me.DIALOG_WIDTH = dimensions[0];
				me.DIALOG_HEIGHT = dimensions[1];
			}
			me.openerHandle_ = $(openerHandle)	;
			me.contentSrc_ = me.openerHandle_.attr("href");
			me.rootNode = $('<iframe src="' + me.contentSrc_ + '" class="movieframe" style="width:' + me.DIALOG_WIDTH + 'px;height:' + me.DIALOG_HEIGHT + 'px;" frameborder="0"></iframe>');
			me.openerHandle_.click(function(){
				this.blur();
				me.show();
			}).attr("href", "javascript:void(0);");
			
			ch.clx.ModalDialog.instance.bindListener("show", me.handleShow, me);
			me.parent();
		},
		
		getSize : function() {
			var me = this;
			
			return {
				width : me.DIALOG_WIDTH,
				height : me.DIALOG_HEIGHT
			};
		},
		
		getContent : function() {
			var me = this;
			
			return me.rootNode;
		},
		
		handleShow : function() {
			var me = this;
			
			if($.browser.msie && $.browser.version < 7) {
				me.rootNode.attr("src", me.contentSrc_);
			}
		}
		
	});
	
// =================================================================================================

	ch.clx.WaitingDialog = Class.extend(ch.clx.Dialog, {
		
		rootNode : null,
		DIALOG_WIDTH : 545,
		DIALOG_HEIGHT : "auto",
		
		initialize : function(rootNode) {
			var me = this;
			
			me.rootNode = $(rootNode)	;
			me.parent();
		},
		
		getSize : function() {
			var me = this;
			
			return {
				width : me.DIALOG_WIDTH,
				height : me.DIALOG_HEIGHT
			};
		},
		
		getContent : function() {
			var me = this;
			
			return me.parent();
		}
		
	});

// =================================================================================================	

	ch.clx.DisclaimerDialog = Class.extend(ch.clx.Dialog, {
		
		rootNode : null,
		content_ : null,
		contentSrc_ : null,
		DIALOG_WIDTH : 600,
		DIALOG_HEIGHT : 300,		
		
		initialize : function(rootNode) {
			var me = this;
			
			me.rootNode = $(rootNode);
				// init links which will show the login-dialog
			$("a.disclaimerlayer").attr("href", "javascript:void(0);").click(function() {
				this.blur();
				me.show();
			});
				// init links which will hide the login-dialog
			me.rootNode.find("span.close a").attr("href", "javascript:void(0);").click(function() {
				this.blur();
				me.hide();
			});		
			me.rootNode.find("span.closeButtonLeft a").attr("href", "javascript:void(0);").click(function() {
				this.blur();
				me.hide();
			});					
			me.rootNode.find("span.closeButtonRight a").attr("href", "javascript:void(0);").click(function() {
				this.blur();
				me.hide();
			});		
			me.parent();
		},
		
		getSize : function() {
			var me = this;
			
			return {
				width : me.DIALOG_WIDTH,
				height : me.DIALOG_HEIGHT
			};
		},
		
		getContent : function() {
			var me = this;
			
			return me.parent();
		},
		
		remove : function() {
			var me = this;
			
			$("body").append(me.rootNode.hide());
		}
		
	});
	
// =================================================================================================
	ch.clx.DirectHelp = Class.extend({		
	
		rootNode: null,
		icon: null,
		message: null,
		shadow: null,
		state: null,
		iframe: null,
		
		initialize : function(rootNode) {
			var me = this;
			
			me.state = "closed";
			me.rootNode = $(rootNode);
			me.icon = me.rootNode.find("a:first");
			me.icon.attr("href", "javascript:void(0);");
			me.message = me.rootNode.find("span.message");
			
			me.message.append('<div id="shadow" class="shadow"></div>');
			me.shadow = me.message.find("div.shadow");	
			$("body").append(me.message);

			if($.browser.msie && $.browser.version < 7) {
				me.shadow.append('<div></div>');
			}
							
			me.icon.click(function() {
				if(me.icon.hasClass("isOpen")) {
						me.close.call(me);
				} else {
						me.open.call(me, this);
				}
				this.blur();
			});
			
			me.message.find("a.close-icon").attr("href", "javascript:void(0);").click(function() {
					me.close.call(me);
			});
		
				// fix IE6
			if($.browser.msie && $.browser.version < 7) {
				var iframeId = "_" + (Math.random() + "").substr(2);
				var iframe = "<iframe id=\"" + iframeId + "\" scrolling=\"no\" frameborder=\"0\" src=\"javascript:false;\" style=\"display:none; position:absolute; width:1px; height:1px;\"></iframe>";
				me.message.get(0).insertAdjacentHTML('afterEnd', iframe);
				me.iframe = $(iframeId);
			}
		},
		
		open : function(node) {
			var me  = this, coords = [], offset = $(node).offset(), availableWidth = $("body").width(), left;
			
			if(me.message.hasClass("with-icon")) {
				coords[0] = offset.left-170;
				coords[1] = offset.top-20;
			} 
			else {
				coords[0] = offset.left;
				coords[1] = offset.top;
			}

			if(me.state !== "open" || me.state === "closed") {
				me.message.css({
					display : "block"
				});
				if(availableWidth - (coords[0] + 29) < me.message.width()) {
					left = coords[0] - me.message.width() - 10;
				}
				else {
					left = coords[0] + 29;
				}
				me.message.css({
					left : left + "px",
					top : coords[1] - me.message.height() + "px"
				});					
				me.shadow.css({
					height : me.message.height() + 10 + "px",
					width : me.message.width() + 10 + "px"
				});
				me.state = "open";
		
					// fix IE6
				if(me.iframe) {
					me.iframe.css({
						height : me.message.height() + "px",
						width : me.message.width() + "px",
						left : (coords[0] + 29) + "px",
						top : (coords[1] - this.message.height()) + "px"
					}).show();
				}
			}
			me.icon.addClass("isOpen");
		},
		
		close : function() {
			var me = this;
			
			me.message.css({
				display : "none"
			});
			me.state = "closed";
	
				// fix IE6
			if(me.iframe) {
				me.iframe.hide();
			}
			
			me.icon.removeClass("isOpen");
		}
	
	});
	
// =================================================================================================	

	ch.clx.Hideable = Class.extend(ch.clx.Observable, {
		
		rootNode : null,
		closeButton_ : null,
		openButton_ : null,
		isHidden_ : null,

		initialize : function(rootNode) {
			var me = this;
			
			me.parent();
			me.rootNode = $(rootNode);
			me.closeButton_ = me.rootNode.find("ul.hide li:last").addClass("visible");
			me.openButton_ = me.rootNode.find("ul.hide li:first").addClass("hidden");
			
			me.openButton_.find("a").click(function(){
				me.openButton_.hide();
				me.closeButton_.show();
				me.isHidden_ = false;
				me.fire("show");
			}).attr("href", "javascript:void(0);");
			
			me.closeButton_.find("a").click(function(){
				me.closeButton_.hide();
				me.openButton_.show();
				me.isHidden_ = true;
				me.fire("hide");
			}).attr("href", "javascript:void(0);");
		},
		
		initState : function() {
			var me = this, currentIndex = me.rootNode.find("ul.hide li").index(me.rootNode.find("ul.hide li.current").get(0));
			
			if(currentIndex < 1) {			
				me.trigger("hide");
			} 
			else {
				me.trigger("show");
			}
		},
		
		isHidden : function() {
			var me = this;
			
			return me.isHidden_;
		},
		
		trigger : function(type) {
			var me = this;
			
			if(type === "show") {
				me.openButton_.find("a").trigger("click");
			}
			else if(type === "hide") {
				me.closeButton_.find("a").trigger("click");
			}
		}
		
	});	

// =================================================================================================	

	ch.clx.HideableParagraph = Class.extend(ch.clx.Hideable, {
		
		body_ : null,

		initialize : function(rootNode) {
			var me = this;
			
			me.parent(rootNode);
			me.body_ = me.rootNode.find("div.body");
			
			me.bindListener("show", function() {
				me.body_.show();
			});
			me.bindListener("hide", function() {
				me.body_.hide();
			});
			me.initState();
		}
		
	});

// =================================================================================================

	/*
		ch.clx.ShoppingCart
		
		publicMethods:
		
			reload(URL)
			wait()
			endWait()
		
	*/

	ch.clx.ShoppingCart = Class.extend({
		
		rootNode : null,
		scrollable_ : null,
		slider_ : null,
		content_ : null,
		hideUnhide_ : null,
		items_ : null,
		sliderInitialized_ : false,
		nrOfItemsNode_ : null,
		subTotalNode_ : null,
		doContinousSliding_ : false,
		activeSliderHandle_ : null,
		continousSliderIntervall_ : null,
		title_ : null,
		body_ : null,
		isWaiting_ : null,
		waitinglayer_ : null,
		clock_ : null,

		initialize : function(rootNode) {
			var me = this, max, item, cookieHidableState;
			
			me.rootNode = $(rootNode);			
			me.nrOfItemsNode_ = me.rootNode.find("tr.cart-nr-of-items, table.cart-nr-of-items");
			me.subTotalNode_ = me.rootNode.find("tr.cart-sub-total, table.cart-sub-total");
			me.scrollable_ = me.rootNode.find("div.scrollable:first");
			me.content_ = me.scrollable_.find("div.content");
			me.title_ = me.rootNode.find("h2.title");
			me.body_ = me.rootNode.find("div.body");
			me.body_.after("<div id='waitinglayer'></div><img id='clock' src='/base/image/loading.gif' alt='' />");
			me.waitinglayer_ = me.rootNode.find("div#waitinglayer");
			me.clock_  = me.rootNode.find("img#clock");
			me.items_ = me.content_.find("dl.items dt");
			
				// on large-table pages the cart is collapsed per default
			if(ch.clx.Page.getGridType() === ch.clx.Page.LARGE_TABLE_GRID) {
				ch.clx.Cookie.setCookie("gui_cart_hidable_state", "collapsed");
			}
			
				// get state of hidable from cookie
			cookieHidableState = ch.clx.Cookie.getCookie("gui_cart_hidable_state");
			
				// make title clickable and register event-handler
			me.title_.click(function() {
				me.checkOut_();
			});
			
				// initialize delete and update buttons
			me.rootNode.find("a.delete, a.update").each(function() {
				this.cart = me;
			}).click(function() {
				this.blur();
			}).attr("href", "javascript:void(0)");
			
				// register event-handler on checkout button
			//me.rootNode.find("ul.foot a").attr("href", "javascript:void(0);").click(function() {
			//	me.checkOut_();
			//	this.blur();
			//});
			
				// fix title for safari and mac-browsers
			if($.browser.safari || navigator.platform.match(/Mac/)) {
				me.title_.css("padding-bottom", "8px");
			}			
			
				// do we need a scroll-bar
			if(me.content_.height() >= 225) {				
				me.setSlider_();				
			}
			
				// initialize the hide/unhide functionality
			me.rootNode.find("ul.hide").each(function() {
				me.hideUnhide_ = new ch.clx.Hideable(rootNode);
				me.hideUnhide_.bindListener("show", function() {
					me.expand_.apply(me, arguments);
				});
				me.hideUnhide_.bindListener("hide", function() {
					me.collapse_.apply(me, arguments);
				});				
				me.hideUnhide_.initState();
			});
			
				// do we have to open the cart right after initialization?
			if(me.items_.length > 0) {
				if(!cookieHidableState || cookieHidableState === "expanded") {
					me.hideUnhide_.trigger("show");
				}
			}
			else {
				ch.clx.Cookie.eraseCookie("gui_cart_hidable_state");
			}
		},
		
		setSlider_ : function() {
			var me = this, max;
			
			if(!me.sliderInitialized_) {
					// set css
				me.scrollable_.css({
					background : "transparent url(/base/image/bg_service_cart_scrollable.gif) right top no-repeat",
					height : "219px"
				});
				me.content_.css({
					position : "absolute"
				});
				
					// append the dom-nodes for the scrollbar
				me.scrollable_.append('<div class="slider"><div class="slider-handle"></div></div><div class="handle-top"></div><div class="handle-bottom"></div><div class="border-bottom"></div>');
				
					// add event-listeners to handles
				me.scrollable_.find("div.handle-top, div.handle-bottom").mousedown(function() {
					me.continousSlide_.call(me, $(this));
				}).
				dblclick(function() {
					me.stepSlider_.call(me, $(this), (max / 5));
				});
				$(document).mouseup(function() {
					me.continousSlideStop_.call(me, max);
				});
				
				me.sliderInitialized_ = true;
			}
			
				// the max value for the scrollbar handle
			max = (me.content_.height() - 219 -6);						
			
				// init the slider (scrollbar)
			me.slider_ = me.scrollable_.find("div.slider").slider({
				min : -6,
				handle : "div.slider-handle",
				axis : "vertical",
				max : max, 
				startValue : -6,
				slide : function(e, ui) {
					me.content_.css({"top": - Math.round(ui.value)});		
				},
				change : function(e, ui) {
					me.content_.css({"top": - Math.round(ui.value)});
				}
			});

		},
		
		continousSlide_ : function(handle) {
			var me = this;
			
			me.activeSliderHandle_ = handle;
			me.doContinousSliding_ = true;
			window.setTimeout(function() {
				if(me.doContinousSliding_ && me.activeSliderHandle_) {
					me.doContinousSliding_ = false;
					
					me.continousSliderIntervall_ = window.setInterval(function() {
						me.stepSlider_.call(me, me.activeSliderHandle_, 5);
					}, 10);
				}
			}, 200);			
		},
		
		continousSlideStop_ : function(max) {
			var me = this;
			
				// clear intervall for slider
			if(me.continousSliderIntervall_) {
				window.clearInterval(me.continousSliderIntervall_);
				me.continousSliderIntervall_ = null;
			}
			
				// do a slider step
			if(me.doContinousSliding_ && me.activeSliderHandle_) {
				me.doContinousSliding_ = false;
				me.stepSlider_(me.activeSliderHandle_, (max / 5));
			}
			me.activeSliderHandle_ = null;			
		},
		
		stepSlider_ : function(handle, step) {
			var me = this;

			if(handle.hasClass("handle-bottom")) {
				me.slider_.slider("moveTo", "+=" + step);
				me.content_.css({"top": - Math.round(me.slider_.slider("value"))});
			}
			else {
				me.slider_.slider("moveTo", "-=" + step);
				me.content_.css({"top": - Math.round(me.slider_.slider("value"))});
			}
		},
		
		removeSlider_ : function() {
			var me = this;
			
			if(me.sliderInitialized_) {
					// reset css
				me.scrollable_.css({
					background : "none",
					height : "auto"
				});
				me.content_.css({
					position : "static"
				});
							
					// remove the dom-nodes from the scrollbar
				(me.scrollable_.find("div.slider, div.handle-top, div.handle-bottom, div.border-bottom")).remove();
				me.sliderInitialized_ = false;
			}
		},
		
		checkOut_ : function() {
			var me = this;
			if(!me.isWaiting_) {
				var doc = this.document;
				// hilti code
				// sets the url to shop cart
				var currentURL = location.href
				var nextURL = '';
				
				var shopcartURL = '/page/module/order/ordr_shopcart.jsf'; 
				if (currentURL.indexOf('/page/')==-1) {
					if (currentURL.indexOf("/#")!=-1) {
						// http://www.hilti.ch/holch/#?lang=de --> http://www.hilti.ch/holch/page/module/order/ordr_shopcart.jsf
						currentURL = currentURL.substring(0,currentURL.indexOf("/#"));
					}
					else if (currentURL.lastIndexOf('/') == (currentURL.length-1)) {
						currentURL = currentURL.substring(0,currentURL.length-1);
					}
					nextURL = currentURL + shopcartURL;
				} else {
					var pattern = new RegExp('[\x2f]page[\x2f][^\x00]*', 'g');
					nextURL = currentURL.replace(pattern, shopcartURL); //
				}
				
				// alert ('currentURL:'+currentURL+'\n'+'nextURL:'+nextURL);
				window.location = nextURL;
			}
		},
		
		expand_ : function() {
			var me = this;
			
			me.scrollable_.show();
			me.rootNode.find("ul.hide").css({
				"padding-top" : "10px"
			});
			me.repaintSlider_();			
			me.nrOfItemsNode_.hide();
			me.rootNode.find("span.button-type4").show();
			ch.clx.Cookie.setCookie("gui_cart_hidable_state", "expanded");
		},
		
		collapse_ : function() {
			var me = this;
			
			me.scrollable_.hide();
			me.rootNode.find("ul.hide").css({
				"padding-top" : "0"
			});			
			me.nrOfItemsNode_.show();
			me.rootNode.find("span.button-type4").hide();
			ch.clx.Cookie.setCookie("gui_cart_hidable_state", "collapsed");
		},
		
		repaintSlider_ : function() {
			var me = this;

			if(me.slider_) {
				me.slider_.slider("moveTo", -6);
				me.slider_.slider("destroy");
				delete me.slider_;				
			}
			if(me.content_.height() >= 225) {
				me.setSlider_();
			}
			else {
				me.removeSlider_();
			}
		},
		
		wait : function() {
			var me = this, bodyheight = me.body_.height()+16;
			
			me.isWaiting_ = true;
			
			if(me.slider_) {
				me.slider_.slider("disable");
			} 

			me.waitinglayer_.css({
				"height":bodyheight + "px",
				"opacity":"0.70",
				"display":"block"
			});
			
			me.clock_.show().css("top",29+bodyheight/2-8 + "px");
			
			if($.browser.msie && $.browser.version < 7) {
				window.event.cancelBubble = true;
      	window.event.returnValue = false;
      }
		},
		
		endWait : function() {
				var me = this;
		
				me.waitinglayer_.css("display","none");
				me.clock_.hide();
				
				me.isWaiting_ = null;
		},
		
		reload : function(fragment) {
			var me = this;
			
			if(fragment === "http://some.delete.url") {
				alert("Let's remove this item from the cart.");
				return;
			}
			else if(fragment === "http://some.update.url") {
				alert("Let's update the carts quantities.");
				return;
			}
			
			me.wait();
			me.rootNode.parent().load(fragment, null, function() {
				me.rootNode.parent().remove("div.shopping-cart");
				me.endWait();
				delete me;
				
					// init shopping cart
				$("div#serviceArea div.shopping-cart").each(function(){
					shoppingCart = new ch.clx.ShoppingCart(this);
				});
				
				shoppingCart.rootNode.find("span.direct-help").each(function() {
					new ch.clx.DirectHelp(this);
				});
				
			});
		},
		
		// Mike - shopcart refresh 
		// -> - start routine to show sandclock and fade out
		m_start : function() {
			var me = this;		
			me.wait();			
		},

		// Mike - shopcart refresh 
		// -> - stop routine to hide sandclock re-render shopcart (+slider)
		m_end : function() {
			var me = this;
			me.endWait();
			delete me;
				// init shopping cart
				$("div#serviceArea div.shopping-cart").each(function(){
					shoppingCart = new ch.clx.ShoppingCart(this);
				});
				
				shoppingCart.rootNode.find("span.direct-help").each(function() {
					new ch.clx.DirectHelp(this);
				});

				// re-init quick order				
				$("div#serviceArea form#quickorderForm").each(function(){
					new ch.clx.DirectHelp(this);
				});				
		}
		
	});

// =================================================================================================


	ch.clx.ProductFinder = Class.extend({
		
		rootNode : null,
		activeTab_ : null,
		
		initialize : function(rootNode) {
			var me = this, current;
			
			me.rootNode = $(rootNode);
			me.rootNode.find("div.tab").each(function() {
				var jTab = $(this);
				
				jTab.find("h2.tabtitle a").attr("href", "javascript:void(0);");
				if(jTab.hasClass("current")) {
					current = jTab;
				}
				else {						
					me.hide(jTab);
				}
				jTab.find("h2.tabtitle").click(function() {				
					me.handleClick.call(me, jTab);
					this.blur();
				})
				.mouseover(function() {
					me.handleMouseOver.call(me, jTab);
				})
				.mouseout(function() {
					me.handleMouseOut.call(me, jTab);
				});
			});
			if(current) {
				me.show(current);
			}			
		},
		
		handleClick : function(tab) {
			var me = this;
			
			if(tab.hasClass("current")) {
				me.hide(tab, 500);
			}
			else {
				me.show(tab, 500);
			}				
		},
		
		handleMouseOver : function(tab) {
			var me = this, extension;
			
			if ($.browser.msie && $.browser.version < 7) {
				extension = "gif";
			}
			else {
				extension = "png";
			}
			
			if(tab.hasClass("current")) {
				//
			}
			else {
				if(tab.hasClass("top")) {
					tab.css("background-image","url(/base/image/bg_service_tab_top_hover." + extension +")");
				}
				else if(tab.hasClass("bottom")) {
					tab.css("background-image","url(/base/image/bg_service_tab_bottom_hover." + extension +")");
						if ($.browser.safari) {
								tab.css("padding-top","1px");
						}
				} 
				else {
					tab.css("background-image","url(/base/image/bg_service_tab_middle_hover." + extension +")");
				}
			}
		},
		
		handleMouseOut : function(tab) {
			var me = this, extension;
			
			if ($.browser.msie && $.browser.version < 7) {
				extension = "gif";
			}
			else {
				extension = "png";
			}
			
				if(tab.hasClass("top")) {
					tab.css("background-image","url(/base/image/bg_service_tab_top." + extension +")");
				}
				else if(tab.hasClass("bottom")) {
					if(tab.hasClass("current")) {
							tab.css("background-image","url(/base/image/bg_service_tab_middle." + extension +")");
						}
						else {
								tab.css("background-image","url(/base/image/bg_service_tab_bottom." + extension +")");
						}
				} 
				else {
					tab.css("background-image","url(/base/image/bg_service_tab_middle." + extension +")");
				}
		},
		
		show : function(tab, duration) {
			var me = this;
			if(me.activeTab_) {
				me.hide(me.activeTab_, 500);
			}
			me.activeTab_ = tab;
			
			if(!duration || duration === 0) {
				tab.find("div.tab-body").show();
			}
			else {
					if ($.browser.safari && $.browser.version < 500) { // slideDown don't Work on Safari WebKit smaller then 500
						tab.find("div.tab-body").show();
					}
					else {
						tab.find("div.tab-body").slideDown(duration);
					}

			}
			tab.addClass("current");
			
			if(tab.hasClass("bottom")) {
				if ($.browser.msie && $.browser.version < 7) {
					tab.css({
							padding : "0 18px 0 0",
							background : "transparent url(/base/image/bg_service_tab_middle.gif) repeat-y 0 0"
					});
				}
				else {
					tab.css({
							padding : "0 18px 0 0",
							background : "transparent url(/base/image/bg_service_tab_middle.png) repeat-y 0 0"
					});	
				}

				tab.find("div.tab-body").css("padding-bottom","0");
				me.rootNode.append("<div class='footer'></div>");
				tab.find("h2.tabtitle").css("border-bottom","1px solid #CCCCCC");
			}
		},
		
		hide : function(tab, duration) {
			var me = this;
			
			me.activeTab_ = null;
			if(!duration || duration === 0) {
				tab.find("div.tab-body").hide();
			}
			else {
				tab.find("div.tab-body").slideUp(duration, function() {
					me.hideLastItem.call(me, tab)
				});
			}			
			tab.removeClass("current");	
		},
		
		hideLastItem : function(tab) {
			var me = this;
			
			if(tab.hasClass("bottom")) {			
				if ($.browser.msie && $.browser.version < 7) {
					tab.css({
							background : "transparent url(/base/image/bg_service_tab_bottom.gif) no-repeat left bottom",
							"padding-bottom" : "4px"
					});
				}
				else {
					tab.css({
							background : "transparent url(/base/image/bg_service_tab_bottom.png) no-repeat left bottom",
							"padding-bottom" : "4px"
					});	
				}
				
				me.rootNode.find("div.footer").remove();
				tab.find("h2.tabtitle").css("border-bottom","0");
			}
		}
			
	});
	
// =================================================================================================	

	ch.clx.ServiceContainer = Class.extend({

		rootNode : null,
		content_ : null,
		hideUnhide_ : null,
		initialized_ : false,

		initialize : function(rootNode) {
			var me = this;
			
			me.rootNode = $(rootNode);			
			me.content_ = me.rootNode.find("div.content");
			
			me.rootNode.find("ul.hide").each(function() {
				me.hideUnhide_ = new ch.clx.Hideable(rootNode);
				me.hideUnhide_.bindListener("show", function() {
					me.expand.call(me);
				});
				me.hideUnhide_.bindListener("hide", function() {	
					me.collapse.call(me);
				});				
				me.hideUnhide_.initState();
				me.initialized_ = true;
			}); 
		},
		
		collapse : function() {
			var me = this;
			
			me.rootNode.find("div.foot").show();
			me.rootNode.find("ul.foot").hide();
			
			if(me.initialized_) {
				me.rootNode.find("div.show").slideUp(500);
				me.rootNode.find("div.hidden").slideDown(500);
			}
			else {
				me.rootNode.find("div.hidden").show();
				me.rootNode.find("div.show").hide();
			}							
				
			me.rootNode.find("ul.hide").css("padding-bottom","0");
		},
		
		expand : function() {
			var me = this;
			
			me.rootNode.find("div.foot").hide();
			me.rootNode.find("ul.foot").show();
			me.rootNode.find("div.hidden").hide();
			if(me.initialized_) {
				me.rootNode.find("div.show").slideDown(500);
			}
			else {
				me.rootNode.find("div.show").show();
			}
			me.rootNode.find("ul.hide").css("padding-bottom","5px");
		}
		
	});

// =================================================================================================	

		// extending the datepicker Class from jQuery ui
	(function() {
			
    //Language BS - Bosnian
    jQuery.datepicker.regional['bs'] = {
      currentText: 'Danas',
      monthNames: ['Siječanj','Veljača','Ožujak','Travanj','Svibanj','Lipanj','Srpanj','Kolovoz','Rujan','Listopad','Studeni','Prosinac'],
      monthNamesShort: ['Sij','Velj','Ožu','Tra','Svi','Lip','Srp','Kol','Ruj','Lis','Stu','Pro'],
      dayNames: ['Nedjelja','Ponedjeljak','Utorak','Srijeda','Četvrtak','Petak','Subota'],
      dayNamesShort: ['Ned','Pon','Uto','Sri','Čet','Pet','Sub'],
      dayNamesMin: ['Ne','Po','Ut','Sr','Če','Pe','Su']
    };

    //Language BG - Bulgarian
    jQuery.datepicker.regional['bg'] = {
      currentText: 'днес',
      monthNames: ['Януари','Февруари','Март','Април','Май','Юни','Юли','Август','Септември','Октомври','Ноември','Декември'],
      monthNamesShort: ['Яну','Фев','Мар','Апр','Май','Юни','Юли','Авг','Сеп','Окт','Нов','Дек'],
      dayNames: ['Неделя','Понеделник','Вторник','Сряда','Четвъртък','Петък','Събота'],
      dayNamesShort: ['Нед','Пон','Вто','Сря','Чет','Пет','Съб'],
      dayNamesMin: ['Не','По','Вт','Ср','Че','Пе','Съ']
    };

    //Language HR - Crotatian
    jQuery.datepicker.regional['hr'] = {
      currentText: 'Danas',
      monthNames: ['Siječanj','Veljača','Ožujak','Travanj','Svibanj','Lipanj','Srpanj','Kolovoz','Rujan','Listopad','Studeni','Prosinac'],
      monthNamesShort: ['Sij','Velj','Ožu','Tra','Svi','Lip','Srp','Kol','Ruj','Lis','Stu','Pro'],
      dayNames: ['Nedjelja','Ponedjeljak','Utorak','Srijeda','Četvrtak','Petak','Subota'],
      dayNamesShort: ['Ned','Pon','Uto','Sri','Čet','Pet','Sub'],
      dayNamesMin: ['Ne','Po','Ut','Sr','Če','Pe','Su']
    };

    //Language CZ - Czech
		jQuery.datepicker.regional['cz'] = {
			currentText: 'Dnes',
			monthNames: ['Leden','Únor','Březen','Duben','Květen','Červen','Červenec','Srpen','Září','Říjen','Listopad','Prosinec'],
			monthNamesShort: ['led','úno','bře','dub','kvě','čer','čvc','srp','zář','říj','lis','pro'],
			dayNames: ['Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota','Neděle'],
			dayNamesShort: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'],
			dayNamesMin: ['ne','po','út','st','čt','pá','so']
		};
			
			//Language DE - German
		jQuery.datepicker.regional['de'] = {
			altText : 'Datum Auswahl',
			currentText: 'Heute',
			monthNames: ['Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'],
			monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Dez'],
			dayNames: ['Sonntag', 'Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
			dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
			dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa']
		};
	
    //Language DA - Danish
		jQuery.datepicker.regional['da'] = {
			currentText: 'I dag',
			monthNames: ['Januar','Februar','Marts','April','Mai','Juni','Juli','August','September','Oktober','November','December'],
			monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun','Jul','Aug','Sep','Okt','Nov','Dec'],
			dayNames: ['Søndag','Mandag','Tirsdag','Onsdag','Torsdag','Fredag','Lørdag'],
			dayNamesShort: ['Søn','Man','Tir','Ons','Tor','Fre','Lør'],
			dayNamesMin: ['Sø','Ma','Ti','On','To','Fr','Lø']
		};		

		//Language EN - English
		jQuery.datepicker.regional['en'] = {
			altText : 'Date Picker',
			currentText: 'Today',
      monthNames: ['January','February','March','April','May','June','July','August','September','October','November','December'],
      monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
      dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
			dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
			dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa']
		};

    //Language ET - Estonian
		jQuery.datepicker.regional['et'] = {
			currentText: 'Täna',
			monthNames: ['Jaanuar','Veebruar','Märts','Aprill','Mai','Juuni','Juuli','August','September','Oktober','November','Detsember'],
			monthNamesShort: ['Jaan','Veebr','Märts','Apr','Mai','Jun','Jul','Aug','Sept','Okt','Nov','Dets'],
			dayNames: ['Pühapäev', 'Esmaspäev','Teisipäev','Kolmapäev','Neljapäev','Reede','Laupäev'],
			dayNamesShort: ['P','E','T','K','N','R','L'],
			dayNamesMin: ['P','E','T','K','N','R','L']
		};

    //Language ES - Spanish
		jQuery.datepicker.regional['es'] = {
			currentText: 'Hoy',
			monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
			monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun','Jul','Ago','Sep','Oct','Nov','Dic'],
			dayNames: ['Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado'],
			dayNamesShort: ['Dom','Lun','Mar','Mié','Juv','Vie','Sáb'],
			dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','Sá']
		};

    //Language FI - Finnish
		jQuery.datepicker.regional['fi'] = {
			currentText: 'Tänään',
			monthNames: ['Tammikuu','Helmikuu','Maaliskuu','Huhtikuu','Toukokuu','Kesäkuu','Heinäkuu','Elokuu','Syyskuu','Lokakuu','Marraskuu','Joulukuu'],
			monthNamesShort: ['Tammi','Helmi','Maalis','Huhti','Touko','Kesä','Heinä','Elo','Syys','Loka','Marras','Joulu'],
			dayNames: ['Sunnuntai','Maanantai','Tiistai','Keskiviikko','Torstai','Perjantai','Lauantai'],
			dayNamesShort: ['Su','Ma','Ti','Ke','To','Pe','La'],
			dayNamesMin: ['Su','Ma','Ti','Ke','To','Pe','La']
		};

    //Language FR - French
    jQuery.datepicker.regional['fr'] = {
      currentText: 'Aujourd hui',
      monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
      monthNamesShort: ['Janv','Févr','Mar','Avr','Mai','Juin','Juil','Août','Sept','Oct','Nov','Déc'],
      dayNames: ['Lundi', 'Mardi','Mercredi','Jeudi','Vendredi','Samedi','Dimanche'],
      dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
      dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa']
    };

    //Language GR - Greek
		jQuery.datepicker.regional['el'] = {
			currentText: 'Σήμερα',
			monthNames: ['Ιανουάριος','Φεβρουάριος','Μάρτιος','Απρίλιος','Μάιος','Ιούνιος','Ιούλιος','Αύγουστος','Σεπτέμβριος','Οκτώβριος','Νοέμβριος','Δεκέμβριος'],
			monthNamesShort: ['Ιαν','Φεβ','Μαρ','Απρ','Μαι','Ιουν','Ιουλ','Αυγ','Σεπ','Οκτ','Νοε','Δεκ'],
			dayNames: ['Κυριακή','Δευτέρα','Τρίτη','Τετάρτη','Πέμπτη','Παρασκευή','Σάββατο'],
			dayNamesShort: ['Κυρ','Δευ','Τρι','Τετ','Πεμ','Παρ','Σαβ'],
			dayNamesMin: ['Κυ','Δε','Τρ','Τε','Πε','Πα','Σα']
		};

    //Language HU - Hungarian
		jQuery.datepicker.regional['hu'] = {
			currentText: 'ma',
			monthNames: ['január', 'február', 'március', 'április', 'május', 'június','július', 'augusztus', 'szeptember', 'október', 'november', 'december'],
			monthNamesShort: ['jan', 'feb', 'márc', 'ápr', 'máj', 'jún','júl', 'aug', 'szept', 'okt', 'nov', 'dec'],
			dayNames: ['vasárnap', 'hétfő', 'Kedd', 'szerda', 'csütörtök', 'péntek', 'szombat'],
			dayNamesShort: ['v', 'h', 'k', 'sze', 'cs', 'p', 'szo'],
			dayNamesMin: ['v', 'h', 'k', 'sze', 'cs', 'p', 'szo']
		};

    //Language IT - Italian
    jQuery.datepicker.regional['it'] = {
      currentText: 'Oggi',
      monthNames: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'],
      monthNamesShort: ['Gen','Feb','Mar','Apr','Mag','Giu','Lug','Ago','Set','Ott','Nov','Dic'],
      dayNames: ['Domenica','Lunedì','Martedì','Mercoledì','Giovedì','Venerdì','Sabato'],
      dayNamesShort: ['Dom','Lun','Mar','Mer','Gio','Ven','Sab'],
      dayNamesMin: ['Do','Lu','Ma','Me','Gio','Ve','Sa']
    };
		
			//Language JA - Japanese
		jQuery.datepicker.regional['ja'] = {
			altText : 'altJapanese',
			currentText: '&#20170;&#26085;', 
			monthNames: ['1&#26376;','2&#26376;','3&#26376;','4&#26376;','5&#26376;','6&#26376;','7&#26376;','8&#26376;','9&#26376;','10&#26376;','11&#26376;','12&#26376;'],
			monthNamesShort: ['1&#26376;','2&#26376;','3&#26376;','4&#26376;','5&#26376;','6&#26376;','7&#26376;','8&#26376;','9&#26376;','10&#26376;','11&#26376;','12&#26376;'],
			dayNames: ['&#26085;','&#26376;','&#28779;','&#27700;','&#26408;','&#37329;','&#22303;'],
			dayNamesShort: ['&#26085;','&#26376;','&#28779;','&#27700;','&#26408;','&#37329;','&#22303;'],
			dayNamesMin: ['&#26085;','&#26376;','&#28779;','&#27700;','&#26408;','&#37329;','&#22303;']
		};
		
    //Language KO - Korean
		jQuery.datepicker.regional['ko'] = {
			currentText: '금일',
			monthNames: ['1월','2월','3월','4월','5월','6월','7월','8월','9월','10월','11월','12월'],
			monthNamesShort: ['1월','2월','3월','4월','5월','6월','7월','8월','9월','10월','11월','12월'],
			dayNames: ['일요일','월요일','화요월','수요일','목요일','금요일','토요일'],
			dayNamesShort: ['일','월','화','수','목','금','토'],
			dayNamesMin: ['일','월','화','수','목','금','토']
		};

    //Language LT - Lithuanian
		jQuery.datepicker.regional['lt'] = {
			currentText: 'Šiandien',
			monthNames: ['Sausis','Vasaris','Kovas','Balandis','Gegužė','Birželis','Liepa','Rugpjūtis','Rugsėjis','Spalis','Lapkritis','Gruodis'],
			monthNamesShort: ['Saus','Vas','Kov','Bal','Geg','Birž.','Liep','Rugpj','Rugs','Spal','Lapkr','Gruod'],
			dayNames: ['Sekmadienis','Pirmadienis','Antradienis','Trečiadienis','Ketvirtadienis','Penktadienis','Šeštadienis'],
			dayNamesShort: ['Sek','Pir','Ant','Tre','Ket','Pen','Šeš'],
			dayNamesMin: ['Se','Pr','An','Tr','Ke','Pe','Še']
		};

    //Language LV - Latvian
		jQuery.datepicker.regional['lv'] = {
			currentText: 'Šodien',
			monthNames: ['JanvÄris','FebruÄris','Marts','AprÄ«lis','Maijs','JÅ«nijs','JÅ«lijs','Augusts','Septembris','Oktobris','Novembris','Decembris'],
			monthNamesShort: ['Jan','Feb','Mar','Apr','Mai','JÅ«n','JÅ«l','Aug','Sep','Okt','Nov','Dec'],
			dayNames: ['Sestdiena','Pirmdiena','Otrdiena','TreÅ¡diena','Ceturtdiena','Piektdiena','Sestdiena'],
			dayNamesShort: ['svt','prm','otr','tre','ctr','pkt','sst'],
			dayNamesMin: ['Sv','Pr','Ot','Tr','Ct','Pk','Ss']
		};

    //Language MS - Malaysian
		jQuery.datepicker.regional['ms'] = {
			currentText: 'hari ini',
			monthNames: ['Januari','Februari','Mac','April','Mei','Jun','Julai','Ogos','September','Oktober','November','Disember'],
			monthNamesShort: ['Jan','Feb','Mac','Apr','Mei','Jun','Jul','Ogo','Sep','Okt','Nov','Dis'],
			dayNames: ['Ahad','Isnin','Selasa','Rabu','Khamis','Jumaat','Sabtu'],
			dayNamesShort: ['Aha','Isn','Sel','Rab','Kha','Jum','Sab'],
			dayNamesMin: ['Ah','Is','Se','Ra','Kh','Ju','Sa']
		};

    //Language NL - Dutch
    jQuery.datepicker.regional['nl'] = {
      currentText: 'Vandaag',
      monthNames: ['Januari', 'Februari', 'Maart', 'April', 'Mei', 'Juni','Juli', 'Augustus', 'September', 'Oktober', 'November', 'December'],
      monthNamesShort: ['Jan', 'Feb', 'Maa', 'Apr', 'Mei', 'Jun','Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'],
      dayNames: ['Zondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrijdag', 'Zaterdag'],
      dayNamesShort: ['Zon', 'Maa', 'Din', 'Woe', 'Don', 'Vri', 'zat'],
      dayNamesMin: ['Zo', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'za']
    };

    //Language PL - Polish
		jQuery.datepicker.regional['pt'] = {
			currentText: 'Dziś',
			monthNames: ['Styczeń','Luty','Marzec','Kwiecień','Maj','Czerwiec','Lipiec','Sierpień','Wrzesień','Październik','Listopad','Grudzień'],
			monthNamesShort: ['Sty','Lu','Mar','Kw','Maj','Cze','Lip','Sie','Wrz','Pa','Lis','Gru'],
			dayNames: ['Niedziela','Poniedzialek','Wtorek','Środa','Czwartek','Piątek','Sobota'],
			dayNamesShort: ['Nie','Pon','Wt','Śr','Czw','Pt','Sob'],
			dayNamesMin: ['Nie','Pon','Wt','Śr','Czw','Pt','Sob']
		};    
    
    //Language PT - Portuguese
		jQuery.datepicker.regional['pt'] = {
			currentText: 'Hoje',
			monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
			monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set','Out','Nov','Dez'],
			dayNames: ['Domingo','Segunda-feira','Terça-feira','Quarta-feira','Quinta-feira','Sexta-feira','Sabado'],
			dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'],
			dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab']
		};    

    //Language RO - Romanian
		jQuery.datepicker.regional['ro'] = {
			currentText: 'Astazi',
			monthNames: ['Ianuarie','Februarie','Martie','Aprilie','Mai','Iunie','Iulie','August','Septembrie','Octombrie','Noiembrie','Decembrie'],
			monthNamesShort: ['Ian', 'Feb', 'Mar', 'Apr', 'Mai', 'Iun','Iul', 'Aug', 'Sep', 'Oct', 'Noi', 'Dec'],
			dayNames: ['Duminica', 'Luni', 'Marti', 'Miercuri', 'Joi', 'Vineri', 'Sâmbata'],
			dayNamesShort: ['Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sâm'],
			dayNamesMin: ['Du','Lu','Ma','Mi','Jo','Vi','Sâ']
		};    

    //Language RU
		jQuery.datepicker.regional['ru'] = {
			currentText: 'Сегодня',
			monthNames: ['Январь','Февраль','Март','Апрель','Май¹','Июнь','Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],
			monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн','Июл','Авг','Сен','Окт','Ноя','Дек'],
			dayNames: ['Воскресенье','Понедельник','Вторник','Среда','Четверг','Пятница','Суббота'],
			dayNamesShort: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],
			dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб']
		};    

    //Language SV - Swedish
		jQuery.datepicker.regional['sv'] = {
			currentText: 'Idag',
			monthNames: ['Januari','Februari','Mars','April','Maj','Juni','Juli','Augusti','September','Oktober','November','December'],
			monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun','Jul','Aug','Sep','Okt','Nov','Dec'],
			dayNames: ['Söndag','Måndag','Tisdag','Onsdag','Torsdag','Fredag','Lördag'],
			dayNamesShort: ['Sön','Mån','Tis','Ons','Tor','Fre','Lör'],
			dayNamesMin: ['Sö','Må','Ti','On','To','Fr','Lö']
		};

    //Language SL - Slovenian
		jQuery.datepicker.regional['sl'] = {
			currentText: 'Trenutni',
			monthNames: ['Januar','Februar','Marec','April','Maj','Junij','Julij','Avgust','September','Oktober','November','December'],
			monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun','Jul','Avg','Sep','Okt','Nov','Dec'],
			dayNames: ['Nedelja','Ponedeljek','Torek','Sreda','&#x10C;etrtek','Petek','Sobota'],
			dayNamesShort: ['Ned','Pon','Tor','Sre','&#x10C;et','Pet','Sob'],
			dayNamesMin: ['Ne','Po','To','Sr','&#x10C;e','Pe','So']
		};

    //Language SK - Slovakian
		jQuery.datepicker.regional['sk'] = {
			currentText: 'Dnes',
			monthNames: ['Január','Február','Marec','Apríl','Máj','Jún','Júl','August','September','Október','November','December'],
			monthNamesShort: ['Jan','Feb','Mar','Apr','Máj','Jún','Júl','Aug','Sep','Okt','Nov','Dec'],
			dayNames: ['Pondelok','Utorok','Streda','Štvrtok','Piatok','Sobota','Nedeľa'],
			dayNamesShort: ['Po','Ut','St','Št','Pia','So','Ne'],
			dayNamesMin: ['Po','Ut','St','Št','Pia','So','Ne']
		};

    //Language TH - Thai
		jQuery.datepicker.regional['th'] = {
			currentText: 'วันนี้',
			monthNames: ['มกราคม','กุมภาพันธ์','มีนาคม','เมษายน','พฤษภาคม','มิถุนายน','กรกฏาคม','สิงหาคม','กันยายน','ตุลาคม','พฤศจิกายน','ธันวาคม'],
			monthNamesShort: ['ม.ค.','ก.พ.','มี.ค.','เม.ย.','พ.ค.','มิ.ย.','ก.ค.','ส.ค.','ก.ย.','ต.ค.','พ.ย.','ธ.ค.'],
			dayNames: ['อาทิตย์','จันทร์','อังคาร','พุธ','พฤหัสบดี','ศุกร์','เสาร์'],
			dayNamesShort: ['อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'],
			dayNamesMin: ['อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.']
		};
		
    //Language TR - Turkish
		jQuery.datepicker.regional['tr'] = {
			currentText: 'bugÃ¼n',
			monthNames: ['Ocak','Åžubat','Mart','Nisan','MayÄ±s','Haziran','Temmuz','AÄŸustos','EylÃ¼l','Ekim','KasÄ±m','AralÄ±k'],
			monthNamesShort: ['Oca','Åžub','Mar','Nis','May','Haz','Tem','AÄŸu','Eyl','Eki','Kas','Ara'],
			dayNames: ['Pazar','Pazartesi','SalÄ±','Ã‡arÅŸamba','PerÅŸembe','Cuma','Cumartesi'],
			dayNamesShort: ['Pz','Pt','Sa','Ã‡a','Pe','Cu','Ct'],
			dayNamesMin: ['Pz','Pt','Sa','Ã‡a','Pe','Cu','Ct']
		};		

    //Language UK - Ukrainian
		jQuery.datepicker.regional['uk'] = {
			currentText: 'Ð¡ÑŒÐ¾Ð³Ð¾Ð´Ð½Ñ–',
			monthNames: ['Ð¡Ñ–Ñ‡ÐµÐ½ÑŒ','Ð›ÑŽÑ‚Ð¸Ð¹','Ð‘ÐµÑ€ÐµÐ·ÐµÐ½ÑŒ','ÐšÐ²Ñ–Ñ‚ÐµÐ½ÑŒ','Ð¢Ñ€Ð°Ð²ÐµÐ½ÑŒ','Ð§ÐµÑ€Ð²ÐµÐ½ÑŒ','Ð›Ð¸Ð¿ÐµÐ½ÑŒ','Ð¡ÐµÑ€Ð¿ÐµÐ½ÑŒ','Ð’ÐµÑ€ÐµÑÐµÐ½ÑŒ','Ð–Ð¾Ð²Ñ‚ÐµÐ½ÑŒ','Ð›Ð¸ÑÑ‚Ð¾Ð¿Ð°Ð´','Ð“Ñ€ÑƒÐ´ÐµÐ½ÑŒ'],
			monthNamesShort: ['Ð¡Ñ–Ñ‡','Ð›ÑŽÑ‚','Ð‘ÐµÑ€','ÐšÐ²Ñ–','Ð¢Ñ€Ð°','Ð§ÐµÑ€','Ð›Ð¸Ð¿','Ð¡ÐµÑ€','Ð’ÐµÑ€','Ð–Ð¾Ð²','Ð›Ð¸Ñ','Ð“Ñ€Ñƒ'],
			dayNames: ['Ð½ÐµÐ´Ñ–Ð»Ñ','Ð¿Ð¾Ð½ÐµÐ´Ñ–Ð»Ð¾Ðº','Ð²Ñ–Ð²Ñ‚Ð¾Ñ€Ð¾Ðº','ÑÐµÑ€ÐµÐ´Ð°','Ñ‡ÐµÑ‚Ð²ÐµÑ€','Ð¿\'ÑÑ‚Ð½Ð¸Ñ†Ñ','ÑÑƒÐ±Ð¾Ñ‚Ð°'],
			dayNamesShort: ['Ð½ÐµÐ´','Ð¿Ð½Ð´','Ð²Ñ–Ð²','ÑÑ€Ð´','Ñ‡Ñ‚Ð²','Ð¿Ñ‚Ð½','ÑÐ±Ñ‚'],
			dayNamesMin: ['ÐÐ´','ÐŸÐ½','Ð’Ñ‚','Ð¡Ñ€','Ð§Ñ‚','ÐŸÑ‚','Ð¡Ð±']
		};

    //Language ZH - Chinese
		jQuery.datepicker.regional['zh'] = {
			currentText: '今天',
			monthNames: ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月'],
			monthNamesShort: ['一','二','三','四','五','六','七','八','九','十','十一','十二'],
			dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
			dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
			dayNamesMin: ['日','一','二','三','四','五','六']
		};
		
		jQuery.datepicker._selectToday = function(_id) {
			var date = new Date();
			var td = document.createElement("td");
			var a = document.createElement("a");
			a.appendChild(document.createTextNode(date.getDate()));
			td.appendChild(a);
			this._selectDay(_id, date.getMonth(), date.getFullYear(), td);
		};
		
	 jQuery.datepicker._updateDatepicker = function(inst) {
	 		if(!inst.__title) {
				inst.__title = $("input.datepicker_title").attr("value");
				if(!inst.__title) {
					inst.__title = "Datepicker";
				}
			}
			inst._datepickerDiv.empty().append(inst._generateDatepicker());
			var numMonths = inst._getNumberOfMonths();
			if(numMonths[0] != 1 || numMonths[1] != 1) {
				inst._datepickerDiv.addClass('datepicker_multi');
			}
			else {
				inst._datepickerDiv.removeClass('datepicker_multi');
			}
			if(inst._get('isRTL')) {
				inst._datepickerDiv.addClass('datepicker_rtl');
			}
			else {
				inst._datepickerDiv.removeClass('datepicker_rtl');
			}
			if(inst._input && inst._input[0].type != 'hidden') {
				$(inst._input[0]).focus();		
			}
			inst._datepickerDiv.find("div.datepicker_current").empty().text(inst._get('monthNames')[inst._drawMonth] + " " + inst._drawYear);
			inst._datepickerDiv.find("div.datepicker_oneMonth").append('<div class="today"><span><a onclick="jQuery.datepicker._selectToday(' + inst._id + ');">' + inst._get('currentText') + '</a></span></div>');
			inst._datepickerDiv.find("div.datepicker_control").prepend('<h3>' + inst.__title + '</h3>');
			inst._datepickerDiv.append('<div class="shadow"></div>');
			inst._datepickerDiv.find("div.shadow").css({
				height : inst._datepickerDiv.height() + 2 + "px",
				width : inst._datepickerDiv.width() + 2 + "px"
			});
		};
		
		jQuery.datepicker._findPos = function(obj) {
	  	while(obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
	    	obj = obj.nextSibling;
	    }
	    var position = $(obj).offset();
		  return [position.left + 28 + obj.offsetWidth, position.top - obj.offsetHeight];
		};
	})();
	
// =================================================================================================

	ch.clx.DatePicker = Class.extend({
		
		rootNode : null,
		
		initialize : function(rootNode) {
			var me = this, dateFormat, lang, buttonText;
					
			me.rootNode = $(rootNode);			
			
			dateFormat = $("input.datepicker_dateformat").attr("value"),
			lang = $("input.datepicker_lang").attr("value");
					
			if(!dateFormat) {
				dateFormat = "mm/dd/yy";
			}
			
			if(!lang) {
				/* default language */
				$.datepicker.setDefaults($.datepicker.regional['']);
				buttonText = "Date Picker";
			} 
			else {
				$.datepicker.setDefaults($.datepicker.regional[lang]);
				buttonText = jQuery.datepicker.regional[lang]['altText']
			} 

			me.rootNode.datepicker({
				beforeShowDay : $.datepicker.noWeekends,
				dateFormat : dateFormat,
				showOn : 'button',
				buttonText : buttonText,
				buttonImage : '/base/image/ico_datepicker.gif', 
				buttonImageOnly : true,
				showAnim : 'fadeIn', 
        speed : '800',
        firstDay : 1,
        changeFirstDay : false,
        prevText : '&nbsp;',
        nextText : '&nbsp;',
        changeMonth : false,
        changeYear : false,
        closeText : '&nbsp;',
        mandatory : true
       });
       
    }
    
  });

// =================================================================================================
	
	ch.clx.ActivatorSwitch = Class.extend({
		
		acitvators_ : null,
		currentActivator_ : null,
		
		initialize : function() {
			var me = this;
			
			me.acitvators_ = [];
		},
		
		addActivator : function(activator) {
			var me = this;
			
			activator.bindListener("activate", me.handleActivate, me);
			me.acitvators_.push(activator);
		},
		
		handleActivate : function(activator) {
			var me = this, i;
			
			for(i = 0; i < me.acitvators_.length; i++) {
				if(activator !== me.acitvators_[i]) {
					me.acitvators_[i].deactivate();
				}
			}
		}
		
	});
	
	ch.clx.ActivatorSwitch.switches = {};
	
// =================================================================================================	

	ch.clx.Activator = Class.extend(ch.clx.Observable, {
		
		rootNode : null,
		elements_ : null,
		labels_ : null,
		
		initialize : function(rootNode) {
			var me = this, elementIds, labelSelector = [], i;
			
			me.parent();
			me.rootNode = $(rootNode);

			elementIds = me.rootNode.attr("value").split(",");
			if(elementIds.length > 0) {
				me.elements_ = $("#" + elementIds.join(",#"));
				for(i = 0; i < elementIds.length; i++) {
					labelSelector.push("label[for=" + elementIds[i] + "]");
				}
				me.labels_ = $(labelSelector.join(","));
			}
			
			if(me.rootNode.attr("checked") === true) {
				me.activate();
			}
			else {
				me.deactivate();
			}
					
			me.rootNode.click(function(){
				me.activate();
			});
					
    },
    
    activate : function() {
    	var me = this;
    	
    	me.elements_.each(function() {
    		var element = $(this);
    		if(element.hasClass("datepicker")) {
		    	element.removeClass("disabled");
		    	element.removeAttr("disabled");
		    	element.datepicker('enable'); 
		    }
		    else if(element.hasClass("text")) {
		    	element.removeClass("disabled");
		    	element.removeAttr("disabled");
		    }	
		    else if(element.hasClass("area")) {
		    	element.removeClass("disabled");
		    	element.removeAttr("readonly");
		    }	
		    else { // select
		    	element.removeClass("disabled");
		    	element.removeAttr("disabled");
		    }
    	});
    	
    	me.labels_.each(function() {
    		var element = $(this);
		    	element.removeClass("disabled");
    	}); 
    	
    	me.fire("activate", [me]);
    },
    
    deactivate : function() {
    	var me = this;
    	
    	me.elements_.each(function() {
    		var element = $(this);
    		if(element.hasClass("datepicker")) {
		    	element.addClass("disabled");
		    	element.attr("disabled","disabled");
		    	element.datepicker('disable'); 
		    }
    		else if(element.hasClass("text")) {
    			element.addClass("disabled");
		    	element.attr("disabled","disabled");
    		}
		    else if(element.hasClass("area")) {
		    	element.addClass("disabled");
		    	element.attr("readonly","readonly");
		    }	
		    else { // select
		    	element.addClass("disabled");
		    	element.attr("disabled","disabled");
		    }
    	});   
    	
    	me.labels_.each(function() {
    		var element = $(this);
		    	element.addClass("disabled");
    	});  	

  	}    
    
  });
   
// =================================================================================================	

	ch.clx.ProductSlider = Class.extend({  
			
		rootNode : null,
		scrollable_ : null,
		slider_ : null,
		activeSliderHandle_ : null,
		doContinousSliding_ : null,
		totalWidth_ : null,
			
		initialize : function(rootNode) {
			var me = this, scrollItemWidth, scrollTotalItems;
			
			me.rootNode = $(rootNode);			
			me.scrollable_ = me.rootNode.find("div.content");
			me.content_ = me.rootNode.find("div.content ul");
			scrollItemWidth = me.scrollable_.find("li.item").width(),
			scrollTotalItems = me.scrollable_.find("li.item").length;			
			me.totalWidth_ = scrollTotalItems * scrollItemWidth;
			
			me.content_.css({
				"position":"absolute",
				"width": me.totalWidth_
			});
			
			(scrollTotalItems > 2) ? me.setSlider_() : me.scrollable_.css("width","auto");	
			
			me.content_.find("li.item").addClass("clickable").click(function() {
				window.location.href = $(this).find("a").attr("href");
			});	

		},
			
		
		setSlider_ : function() {
			var me = this, max = me.totalWidth_ - 540;
	
				// init the slider (scrollbar)
			me.slider_ = me.rootNode.find("div.slider").slider({
				min : 0,
				handle : "div.slider-handle",
				axis : "horizontal",
				max : max, 
				startValue : 1,
				slide : function(e, ui) {
					me.content_.css({"left": - Math.round(ui.value)});		
				},
				change : function(e, ui) {
					me.content_.css({"left": - Math.round(ui.value)});
				}
			});
			
				// add event-listeners to handles
			me.rootNode.find("a.prev, a.next").mousedown(function() {
				this.href = "javascript:void(0);";
				me.continousSlide_.call(me, $(this));
			}).
			dblclick(function() {
				me.stepSlider_.call(me, $(this), (max / 5));
			});
			$(document).mouseup(function() {
				me.continousSlideStop_.call(me, max);
			});
							
		},
		
		continousSlide_ : function(handle) {
			var me = this;
			
			me.activeSliderHandle_ = handle;
			me.doContinousSliding_ = true;
			window.setTimeout(function() {
				if(me.doContinousSliding_ && me.activeSliderHandle_) {
					me.doContinousSliding_ = false;
					me.continousSliderIntervall_ = window.setInterval(function() {
						me.stepSlider_.call(me, me.activeSliderHandle_, 5);
					}, 10);
				}
			}, 200);			
		},
		
		continousSlideStop_ : function(max) {
			var me = this;
			
				// clear intervall for slider
			if(me.continousSliderIntervall_) {
				window.clearInterval(me.continousSliderIntervall_);
				me.continousSliderIntervall_ = null;
			}
			
				// do a slider step
			if(me.doContinousSliding_ && me.activeSliderHandle_) {
				me.doContinousSliding_ = false;
				me.stepSlider_(me.activeSliderHandle_, (max / 5));
			}
			me.activeSliderHandle_ = null;			
		},
		
		stepSlider_ : function(handle, step) {
			var me = this;

			if(handle.hasClass("next")) {
				me.slider_.slider("moveTo", "+=" + step);
				me.content_.css({"left": - Math.round(me.slider_.slider("value"))});
			}
			else {
				me.slider_.slider("moveTo", "-=" + step);
				me.content_.css({"left": - Math.round(me.slider_.slider("value"))});
			}
		}
		
	});
	
// =================================================================================================		

	ch.clx.ImageZoom = Class.extend({  

		rootNode : null,
		imagecolumn_ : null,
		textcolumn_ : null,
		icon_ : null,
		image_ : null,
		imagesrc_ : null,
		
		initialize : function(rootNode) {
			var me = this;
			
			me.rootNode = $(rootNode);		
			me.imagecolumn_ = me.rootNode.find("div.column:first-child");
			me.textcolumn_ = me.rootNode.find("div.column:last-child");
			me.icon_ = me.rootNode.find("span.icon");
			me.image_ = me.rootNode.find("img");
			me.imagesrc_ = {};
			me.imagesrc_.small = me.image_.attr("src");
			//me.imagesrc_.large = me.imagesrc_.small.substr(0, me.imagesrc_.small.lastIndexOf(".")) + "_large" + me.imagesrc_.small.substr(me.imagesrc_.small.lastIndexOf("."), me.imagesrc_.small.length);
      me.imagesrc_.large = me.imagesrc_.small.replace(/prodmedium/,"prodlarge");
			
			if ($.browser.msie && $.browser.version < 7) {
				$("div.zoom-image div.column:first-child").each(function(){
					var me = $(this);
					me.addClass("first-child");		
				});		
			}
			
			me.imagecolumn_.addClass("clickable").click(function() {
				me.handeClick_();
			});	
		},
		
		handeClick_ : function() {
			var me = this;
			if(me.imagecolumn_.hasClass("m")) {
				me.zoomIn_();
			} 
			else {
				me.zoomOut_();
			}
		},
		
		zoomIn_ : function() {
			var me = this;
			
			me.imagecolumn_.removeClass("m").addClass("l");
			me.icon_.removeClass("plus").addClass("minus");
			me.textcolumn_.hide();
			
			me.image_.attr("src", me.imagesrc_.large);
			
		},
		
		zoomOut_ : function() {
			var me = this;
			
			me.imagecolumn_.removeClass("l").addClass("m");
			me.icon_.removeClass("minus").addClass("plus");
			me.textcolumn_.show();
			
			me.image_.attr("src", me.imagesrc_.small);
			
		}
		
		
	});
	
// =================================================================================================	
	
})();