//////////////////////////////////////////////////////////////////////////////////
function mslib(){
	
	mslib.prototype.getMousePos = function(E){
		var pos = new Object();
		with(E){
			pos.x = parseInt(clientX + document.body.scrollLeft + document.documentElement.scrollLeft ,10);
			pos.y = parseInt(clientY + document.body.scrollTop  + document.documentElement.scrollTop, 10);
		}// end with
 	 return(pos);	
	}//end function
	
	mslib.prototype.getScrollPos = function(){
		var pos = new Object();
		pos.x = Math.max(document.body.scrollLeft, document.documentElement.scrollLeft);
		pos.y = Math.max(document.body.scrollTop, document.documentElement.scrollTop);
		return(pos);
	}
	
	mslib.prototype.stringToTimeStamp = function(FromString){
		if(FromString = mslib.prototype.stringToDate(FromString)){
			with(FromString){	
				return(
					parseInt(Date.UTC(getFullYear(),getMonth(),getDate())/1000)
				);
			}//end with
		}//end if
		return(false);
	}//end method
	
	mslib.prototype.dateToTimeStamp = function(FromDate){
		if(typeof(FromDate) == 'object'){
			if(typeof(FromDate.getFullYear) == 'function'){
				return(
					mslib.prototype.stringToTimeStamp(
						mslib.prototype.dateToString(
							FromDate				
						)								 
					)
				);
			}//end if
		}//end if
		return(false);
	}//end method
	
	mslib.prototype.stringToDate = function(FromString){
			var reg 	= 	/^\s*(\d{1,2})\.(\d{1,2})\.([\d]{4}|[\d]{2})\s*$/;
			var toDate	=	reg.exec(FromString);
			if(toDate){
			/* Wann Jahr zweistellig */
			if(toDate[3].length == 2){
				with([new Date().getFullYear().toString().substring(0,2), toDate[3]]){
					toDate[3] = join("");
				}//end with
			}//end if
		
			/*Datumsobject Zurückliefern*/
			return(new Date(toDate[3], toDate[2]-1, toDate[1]));
		}//end if
		return(false);		
	}//end method
	
	mslib.prototype.dateToString = function(FromDate){
		var format = function(FromDate){
			while(FromDate.toString().length < 2){
				FromDate = [0, FromDate].join("");
			}//end while
			return(FromDate);
		}//end of format
				
		if(typeof(FromDate) == 'object'){
			if(typeof(FromDate.getFullYear) == 'function'){
				with(FromDate){
					return(
						[format(getDate()), format(getMonth()+1), getFullYear()].join(".")
					);
				}//end with
			}//end if
		}//end if				
	}//end method
	
	/* function */
	mslib.prototype.inArray = function(Member, Members){
		for(var member in Members){
			if(Members[member] === Member){
				return(true);
			}//end if
		}//end for
		return(false);
	}//end function
	
	
	/* function  */
	mslib.prototype.removeChildNodes  = function(ParentNode, DontTouch){
		
		var childNodes = ParentNode.childNodes;
		
		for(var i=0;i<childNodes.length;i++){
			if(!mslib.prototype.inArray(childNodes[i].nodeType, DontTouch)){
				ParentNode.removeChild(childNodes[i]);
			}//end if
		}//end for
		
		return(i);
		
	}//end function
	
	/* Ajax */
	mslib.prototype.ajax = function(StringFile, CallBack, DomElement){
		var http = (window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest());
		var post = typeof(DomElement) == 'object' ? 'XDoc='+encodeURI(new XDoc().serialize(DomElement)) : null;
		with(http){	
			open("POST", StringFile, true);
			onreadystatechange = function(){
				if(readyState == 4){
						
					if(status == 200){
						return(CallBack(responseText));
					}//end if
				
					/*
					if(status == 412){
						
					}//end if
					*/
					
				}//end if
			}//end function
			http.setRequestHeader("Content-Type", "text/plain;charset=UTF-8;application/x-www-form-urlencoded");
			http.send(post);
		}//end with	
	}//end function
	
}//end class
//////////////////////////////////////////////////////////////////////////////////////////////////////////
function msFade(Element, Direction, Opacity, MilliSec){
	
	if(!msFade.prototype.onfade){
		msFade.prototype.onfade = [];
	}//end if
	
	var findElementIndex = function(Element){
		for(var i=msFade.prototype.onfade.length-1;i>=0;i--){
			if(msFade.prototype.onfade[i] == Element){
				return(i);
			}//end if
		}//end for
		return(false);
	}//end function
	
	/* Element eine Nummer zuweisen  */
	var index = false;
	if(typeof(Element) == 'object'){
		index = findElementIndex(Element);
		if(typeof(index) != "number"){
				msFade.prototype.onfade.push(Element);
				index = findElementIndex(Element);
		}//end switch
	}//end if
	
	var fadeElementIn = function(Index, Opacity, Speed){
   		var timer = 0;
		for(var i = 0; i <= Opacity; i++) {
   			window.setTimeout("msFade.prototype.setOpacity('" + Index + "','" + i + "')",(timer * Speed));
    		timer++;
		}//END FOR
	}//end function

	var fadeElementOut = function(Index, Opacity, Speed){
		var timer = 0;
		for(var i = 100; i >= 100-Opacity; i--) {
   			window.setTimeout("msFade.prototype.setOpacity('" + Index + "','" + i + "')",(timer * Speed));
    		timer++;
   		}//end for
	}//end function
	
	/* Setzt Opacity */
	msFade.prototype.setOpacity = function(Index, Opacity){
		msFade.prototype.onfade[Index].style.opacity = parseFloat(Opacity/100);
		with(msFade.prototype.onfade[Index].style){
			visibility 		= "visible";
			MozOpacity 		=  	parseFloat(Opacity/100);	
			filter 			= 	"alpha(opacity=" + Opacity +")";
			if(Opacity == 0){
				visibility = "hidden";
			}//end if
		}//end with
	}//end function
	
	//Geschwindigkeit
	var speed = Math.round(MilliSec / 100);
	
	//Element ausblenden
	if(Direction <= 0){
		fadeElementOut(index, Opacity, speed);	
	}//end if
	
	//Element einblenden
	if(Direction >= 0){
		fadeElementIn(index, Opacity, speed);
	}//end if
	
}//end class fade
//////////////////////////////////////////////////////////////////////////////////////////////////////////
function XDoc(){
		
	var http			= new Object();
	
	this.browser 		= window.ActiveXObject ? false : true;
	this.xml	 		= false;
	this.xsl	 		= false;
	this.xslt			= false;
	this.save			= false;

	if(this.browser){/* Mozilla, Safari */
		
		http = new XMLHttpRequest();
			
		/* XML Fragment aus String erstellen */
		var loadFromString = function(StringFrom){
			return(new DOMParser().parseFromString(StringFrom, "text/xml"));
		}//end function
		
		/* Lädt XML vom String */
		XDoc.prototype.loadXmlFromString = function(StringXml){
			this.xml = loadFromString(StringXml); 
		}//end function
		
		/* Lädt XML von DomElement */
		XDoc.prototype.loadXmlFromDom = function(DomElement){
			if(typeof(DomElement) == 'object'){
				this.loadXmlFromString(this.serialize(DomElement));
			}//end if
		}//end function
		
		/* Lädt XML vom Server */
		XDoc.prototype.loadXmlFromServer = function(StringFile, DomElement){
			this.xml = loadFromString(this.saveToServer(StringFile, DomElement));
		}//end function
		
		/* Lädt XSL vom String */
		XDoc.prototype.loadXslFromString = function(StringXsl){
			this.xsl = loadFromString(StringXsl); 
		}//end function
		
		/* Lädt XSL von DomElement */
		XDoc.prototype.loadXslFromDom = function(DomElement){
			if(typeof(DomElement) == 'object'){
				this.xsl = this.loadXslFromString(this.serialize(DomElement));
			}//end if
		}//end function

		/* Lädt Xsl vom Server */
		XDoc.prototype.loadXslFromServer = function(StringFile, DomElement){
			this.xsl = loadFromString(this.saveToServer(StringFile,false)); 
		}//end function
		
		/* XML transformieren */
		XDoc.prototype.transform = function(){
			with(new XSLTProcessor()){
				importStylesheet(this.xsl);		
				this.xslt = loadFromString(this.serialize(transformToDocument(this.xml)));
				return(this.serialize());
			}//end with
			
			return(false);
		
		}//end function
		
		/* DomElement oder internes HTML nach String konvertieren */
		XDoc.prototype.serialize = function(DomElement){
			if(arguments.length==1 && typeof(arguments[0]) == 'object'){
				return(new XMLSerializer().serializeToString(DomElement));
			}//end if
			else{
				return(new XMLSerializer().serializeToString(this.xslt));
			}//end else
		}//end function
		
		/* XPAth query */
		XDoc.prototype.query = function(StringQuery, DomElement){
			var ergebnisse = [] , next;
			with(new XPathEvaluator()){
				DomElement = typeof(DomElement) == 'object' ? DomElement : this.xml;
				with(evaluate(StringQuery, DomElement, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null)){
					while(next=iterateNext()){
						ergebnisse.push(next);
					}//end while
				}//end with
			}//end with
			return(ergebnisse);
		}//end function
		
	}//end if
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	else{/* IE  */
		
		http = new ActiveXObject("Microsoft.XMLHTTP");
		
		/* Lädt XML vom String */
		XDoc.prototype.loadXmlFromString = function(StringXml){
			this.xml = new ActiveXObject("Microsoft.XMLDOM");
			this.xml.loadXML(StringXml);
		}//end function
		
		/* Lädt XML von DomElement */
		XDoc.prototype.loadXmlFromDom = function(DomElement){
			if(typeof(DomElement) == 'object'){
				this.loadXmlFromString(this.serialize(DomElement));
			}//end if
		}//end function
		
		/* Lädt XML vom Server */
		XDoc.prototype.loadXmlFromServer = function(StringFile, DomElement){
			this.xml = new ActiveXObject("Microsoft.XMLDOM");
			this.xml.loadXML(this.saveToServer(StringFile, DomElement));
		}//end function
		
		/* Lädt Xsl vom String */
		XDoc.prototype.loadXslFromString = function(StringXsl){
			this.xsl = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
			this.xsl.loadXML(StringXsl); 
		}//end function
		
		/* Lädt Xsl von DomElement */
		XDoc.prototype.loadXslFromDom = function(DomElement){
			if(typeof(DomElement) == 'object'){
				this.loadXslFromString(this.serialize(DomElement));
			}//end if
		}//end function
		
		/* Lädt Xsl vom Server */
		XDoc.prototype.loadXslFromServer = function(StringFile, DomElement){
			this.xsl = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
			this.xsl.loadXML(this.saveToServer(StringFile, DomElement));
		}//end function
	
		/* Wandelt DomElement oder Ergebnis einer Transformstion in String um */
		XDoc.prototype.serialize = function(DomElement){
			if(arguments.length==1){
				if(typeof(arguments[0]) == 'object'){
					return(DomElement.xml);
				}//end if
			}//end if
			return(this.xslt.xml);
		}//end function
		
		/* XML transformieren */
		XDoc.prototype.transform = function(){
			with(new ActiveXObject("MSXML2.XSLTemplate")){
				stylesheet = this.xsl;
				with(createProcessor()){
					input = this.xml; transform();
					this.xslt = new ActiveXObject("Microsoft.XMLDOM");
					this.xslt.loadXML(output);
				}//end with
				return(this.xslt.xml);
			}//end with
			return(false);
		}//end function
	
		/* Xpath Anfrage  */
		XDoc.prototype.query = function(StringQuery, DomElement){
			DomElement = typeof(DomElement) == 'object' ? DomElement : this.xml;
			return(DomElement.selectNodes(StringQuery));
		}//end function
	
	}//end else
	
	/* Kompatibel mit allen Browsern */
		
	/* Kommunikation mit Server */
	XDoc.prototype.exchange = function(StringFile, DomElement){		
		with(http){
			open("POST", StringFile , false);
			setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			send(typeof(DomElement) == 'object' ? 'XDoc='+encodeURI(this.serialize(DomElement)) : null); 		
			
			return(responseText);
			
		}//end with
	}//end function
	
	/* Speichert XML zum Server (synchron) */
	XDoc.prototype.saveToServer = function(StringFile, DomElement){
		return(this.save = this.exchange(StringFile, (typeof(DomElement) == 'object' ? DomElement : this.xml), false));
	}//end function

}//end function
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//Kalenderklasse
function msc(){
	
	/* Pfade für XML und XSL, muss an das Portal angepasst werden */
	if(!msc.prototype.xmlPath){
		msc.prototype.xmlPath = "/js/mslib.msc.xml.php";
	}//end if
	
	if(!msc.prototype.xslPath){
		msc.prototype.xslPath = "/js/mslib.msc.xsl.php";
	}//end if
	
	/* Pfade für Icon und Ajax Loader,  muss an das Portal angepasst werden */
	if(!msc.prototype.iconPath){
		msc.prototype.iconPath = "/img/mslib.msc.icon.png";
	}//end if
	
	/* Pfade für Icon und Ajax Loader,  muss an das Portal angepasst werden */
	if(!msc.prototype.loaderPath){
		msc.prototype.loaderPath = "/img/mslib.msc.loader.gif";
	}//end if
	
	
	/* Ab hier nichts mehr ändern */
	
	// Default Werte setzen 
	
	/* Animation */
	if(!msc.prototype.button){
		msc.prototype.button = {};
	}//end if 
	
	/* Anfangsdatum */
	if(!msc.prototype.startDate){
		msc.prototype.startDate = new Date();
	}//end if 	
	
	/* Positionierung im Dokument */
	if(!msc.prototype.position){
		msc.prototype.position = false;
	}//end if
	
	/* mit oder ohne Animation */
	msc.prototype.withFade = 300;
	
	/* Sprache */
	if(!msc.prototype.lang){
		msc.prototype.lang = "de";
	}//end if
	
	/* Zeitraum */
	if(!msc.prototype.window){
		msc.prototype.window = [new Date().getFullYear()-1,new Date().getFullYear()+1];
	}//end if
	
	/* Rückgabefunktion */
	if(!msc.prototype.callBack){
		msc.prototype.callBack 	= function(){
			for(var i=0;i<arguments.length;i++){
				alert(arguments[i]);	
			}//end for
		}//end if
	}//end if
	
	
	
	// Default Werte mit Argumenten überschreiben
	for(var i=0;i<arguments.length;i++){
		
		/* Startdatum, Positionierung und Intervall Jahre */
		if(typeof(arguments[i]) == 'object'){
			
			with(arguments[i]){
				
				if(typeof(getFullYear) == 'function'){
					msc.prototype.startDate = arguments[i];
				}//end if
				if(typeof(clientX) == "number"){
					msc.prototype.position = new mslib().getMousePos(arguments[i]);
				}//end if
				if(typeof(reverse) == 'function'){
					msc.prototype.window = arguments[i];
				}//end if
				if(typeof(src) == 'string'){
					msc.prototype.button = arguments[i];
				}//end if
			}//end with
		}//end if
		
		/* Sprache */
		if(typeof(arguments[i]) == 'string'){
			msc.prototype.lang = arguments[i];
		}//end if
		
		/* CallBack */
		if(typeof(arguments[i]) == 'function'){
			msc.prototype.callBack = arguments[i];
		}//end if
	
		/* Geschwindigkeit Fade */
		if(typeof(arguments[i]) == 'number'){
			msc.prototype.withFade = arguments[i];
		}//end if
	
	}//end for
	
	/* Element für Ausgabe erzeugen */
	if(!msc.prototype.container){
		msc.prototype.container = document.body.appendChild(document.createElement("div"));
	}//end if
	

	/* Element für Ausgabe an Mausposition setzen*/
	with(msc.prototype.container){
		style.position 	= "absolute";
		if(msc.prototype.position){
			style.top			= 	(msc.prototype.position.y-10)	+	"px";
			style.left			=	(msc.prototype.position.x+10)	+ 	"px";
			style.visibility	= 	"hidden";		
		}//end if		
		msc.prototype.button.src = msc.prototype.loaderPath;
	}//end with

	/* Funktion zum schließen des Kalenders */
	msc.prototype.close = function(){
		new msFade(msc.prototype.container, -1, 100, msc.prototype.withFade = 150);
	}//end if
	
	var calendar = new XDoc();
	
	if(!msc.prototype.xml || !msc.prototype.xsl){
		
		msc.prototype.loadXml = function(XML){
			with(calendar){
				loadXmlFromString(XML);
				msc.prototype.xml = serialize(xml);
				return(mslib.prototype.ajax(msc.prototype.xslPath, msc.prototype.loadXsl))
			}//end with
		}//end function 
		
		msc.prototype.loadXsl = function(XSL){
			with(calendar){		
				loadXslFromString(XSL);
				msc.prototype.xsl = serialize(xsl);
				return(new msc());
			}//end with
		}//end function
		
		return(mslib.prototype.ajax(msc.prototype.xmlPath, msc.prototype.loadXml));
		
	}//end if
	
	/* xml und xsl laden */
	calendar.loadXmlFromString(msc.prototype.xml);
	calendar.loadXslFromString(msc.prototype.xsl);
	
	/* Zeiger auf Konten Jahre setzen */
	var years 	= calendar.query("/calendar/years")[0];
	/* Zeiger auf Konten Tage setzen */
	var days 	= calendar.query("/calendar/days")[0];
	/* Zeiger auf Konten heutiges Datum setzen */
	var today 	= calendar.query("/calendar/today")[0];
	/* Heutiges Datum ermitteln uns setzen */
	with(new Date()){
		today.setAttribute("year",getFullYear());
		today.setAttribute("month",getMonth());
		today.setAttribute("day",getDate());
	}//end with
	
	with(msc.prototype.startDate){
		
		setDate(1);
		
		/* Presets */
		calendar.xml.documentElement.setAttribute("currentLang", this.lang);
		calendar.xml.documentElement.setAttribute("currentMonth", getMonth());
		calendar.xml.documentElement.setAttribute("currentYear", getFullYear());
	
		/* Jahre setzen */
		msc.prototype.window.push(getFullYear());
		msc.prototype.window.sort(function(a,b){return(a - b);});
		for(var i=msc.prototype.window[msc.prototype.window.length-1];i>=msc.prototype.window[0];i--){
			var year = years.appendChild(calendar.xml.createElement("year"));
				year.setAttribute("value", i);
		}//end for
		
		/* Tage setzen */
		var daysBack = getDay() ? getDay()-1 : 6;
		for(var i=(1-daysBack);i<=(42-daysBack);i++){
			var day = days.appendChild(calendar.xml.createElement("day"));
			with(new Date(getFullYear(), getMonth(), i)){
				day.setAttribute("year", getFullYear());
				day.setAttribute("month", getMonth());
				day.setAttribute("day", getDate());
				day.setAttribute("weekday", getDay());
			}//end with
		}//end with
	
	}//end with
	
	/* Ausgabe ins Dokument */
	msc.prototype.container.innerHTML = calendar.transform();
	msc.prototype.button.src		  = msc.prototype.iconPath;	
	new msFade(msc.prototype.container, 1, 100, msc.prototype.withFade);
		
}//end class

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
msc.prototype.setContainer = function(Id){
		
	if(!msc.prototype.container){
		msc.prototype.container = document.body.appendChild(document.createElement("div"));
	}//end if
		
	msc.prototype.container.id = Id;
			
}//end function
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function msDatePicker(nameElement, Event, Lang, Position){
	
	/* aktueller Kontext */
	msDatePicker.prototype.context = {
		
		"from"	:	{
			"input"	:	{},
			"img"	:	{}
		},
		
		"to"	:	{
			"input"	:	{},
			"img"	:	{}
		},
		
		"when"		:	""
		
	};
	
	if(typeof(msDatePicker.prototype.window != "object")){
		msDatePicker.prototype.window = [new Date().getFullYear(),new Date().getFullYear()+1];	
	}//end if
	
	/* Default Funtion, kann von "Außen" überschrieben werden */
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//alert(typeof(msDatePicker.prototype.clearInputErrors));
	
	if(typeof(msDatePicker.prototype.clearInputErrors) != "function" ){
		
		msDatePicker.prototype.clearInputErrors = function(){
			
			with(new mslib()){
					
				var today		= dateToTimeStamp(new Date());
				var from 		= msDatePicker.prototype.context.from.input;
				var fromStamp	= stringToTimeStamp(from.value);
				var to 			= msDatePicker.prototype.context.to.input;
				var toStamp		= stringToTimeStamp(to.value);	
		
				/* Von liegt in Vergangenheit */
				if(fromStamp){
					if(fromStamp < today){
						from.value 	= dateToString(new Date());
						fromStamp	= stringToTimeStamp(from.value);
					}//end if
				}//end if
		
				/* Bis liegt in Vergangenheit */
				if(toStamp){
					if(toStamp < today){
						to.value 	= dateToString(new Date());
						toStamp		= stringToTimeStamp(to.value);
					}//end if
				}//end if
		
				/*bis liegt vor von*/
				if(fromStamp && toStamp){
					if(fromStamp > toStamp){
						to.value = "";
					}//end if
				}//end if
					
				/* keine Bisdatum angegeben, dann automatisch 1 Woche auf vonstamp*/
				if(!to.value){
					with(stringToDate(from.value)){
						to.value = dateToString(new Date(getFullYear(),getMonth(),getDate()+7));
						
					}//end with	
				}//end if
				
			}//end with
				
		}//end function
		
	}//end if
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	/* Callback function für Kalender */
	msDatePicker.prototype.callback = function(DateObject, DateString){
		
		with(msDatePicker.prototype.context){
			
			if(when == "setFrom"){
				
				from.input.value 	= 	new mslib().dateToString(DateObject);	
				from.input.title	=	DateString;
				
				if(typeof(from.input.onchange) == "function"){
					from.input.onchange();
				}//end if
				
			}//end with
			
			if(when == "setTo"){
				
				to.input.value 	= 	new mslib().dateToString(DateObject);	
				to.input.title	=	DateString;	
				
				if(typeof(to.input.onchange) == "function"){
					to.input.onchange();
				}//end if
				
			}//end with
		
			
			/* Eingabefehler korrigieren */
			msDatePicker.prototype.clearInputErrors(); 
			
		}//end with
		
	};
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	/* testen ob Eingabeelemente vorhanden sind */
	if(document.getElementsByName(nameElement.name).length == 2){
		
		if(typeof(Draggable) == "function"){
			msc.prototype.setContainer("container");
			new Draggable("container", {handle: "handle"});
		}//end if
		
		
		/* Eingabeblöcke identifizieren  */
		var from 	= 	document.getElementsByName(nameElement.name)[0];
		var to 		= 	document.getElementsByName(nameElement.name)[1];
		var start	=	new Date();
		var	img		=	false;
		
		// from.appendChild(msc.prototype.container);
		
		
		// Zeilenumbrüche, Kommentare usw entfernen
		with(new mslib()){
			removeChildNodes(from, [1]);
			removeChildNodes(to, [1]);
		}//end with
		
		/* input und image aus from */
		for(var i=0;i<from.childNodes.length;i++){
			
			if(from.childNodes[i].type == "text"){
				msDatePicker.prototype.context.from.input 	= from.childNodes[i];
				
				msDatePicker.prototype.context.from.input.onkeydown = function(){
					// msc.prototype.close();
				}
				
			}//end if
			
			if(from.childNodes[i].src){
				msDatePicker.prototype.context.from.img = from.childNodes[i];
			}//end if
			
		}//end for
		
		/* input und image aus to */
		for(var i=0;i<to.childNodes.length;i++){
			
			if(to.childNodes[i].type == "text"){
				msDatePicker.prototype.context.to.input = to.childNodes[i];
			}//end if
			
			if(to.childNodes[i].src){
				msDatePicker.prototype.context.to.img= to.childNodes[i];
			}//end if
			
		}//end for
		
		/* From oder to gewählt, Anfangsdatum bestimmen, From und To aufeinander abstimmen */
		if(from == nameElement){
			msDatePicker.prototype.context.when = "setFrom";
			img = msDatePicker.prototype.context.from.img;
			if(!(start=new mslib().stringToDate(msDatePicker.prototype.context.from.input.value))){
				start = new Date();
			}//end if
		}//end if
		else{
			msDatePicker.prototype.context.when = "setTo";
			img = msDatePicker.prototype.context.to.img;
			if(!(start = new mslib().stringToDate(msDatePicker.prototype.context.to.input.value))){
				if(!(start=new mslib().stringToDate(msDatePicker.prototype.context.from.input.value))){
					start = new Date();
				}//end if
			}//end if
		}//end else
		
		/* Positionierung */
		if(typeof(Position) == "object"){
			with(Position){
				Position.clientX =	Position.clientX+= Event.clientX;
				Position.clientY =	Position.clientY+= Event.clientY;	
			}//end with
		}//end if
		else{
			Position = Event;
		}//end else
		
		
		/* Kalender aufrufen */
		new msc(
			msDatePicker.prototype.callback,
			start,
			msDatePicker.prototype.window,
			Position,
			Lang,
			img
		);


	}//end if
				
}//end class
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
