
    // --------------------------------------------------------------------------------------------
    //
    //          COPYRIGHT BY STEIDLE NEW MEDIA (www.steidle.net)
    //
    // --------------------------------------------------------------------------------------------
    //              Name : formInput.js
    //              Type : javascript-Inlude-Page
    //
    //           Project : Components Steidle new media gmbh
    //            Author : Lothar Steidle - lothar@steidle.net
    //              Date : 27.10.2011 / Version 1.6
    //
    //       Description : formular framework
    //
    //
    //
    // --------------------------------------------------------------------------------------------
    // Revision / Bugfix : 26.10.2011 - Fix für chrome
	// --------------------------------------------------------------------------------------------
    //              todo : 
    // --------------------------------------------------------------------------------------------
    //            tested : FireFox 1.5 (winXP)
    //
    // --------------------------------------------------------------------------------------------

	var formInputID=1;
	function formInputInit(e)	
		{		
		x = new formInput(e);
		}
	
	function formInput(el)
	{
	    this.bdebug = false;
	
        var ua = navigator.userAgent;
        
	    this.isGecko = ua.indexOf('Gecko') != -1;
	    this.isSafari = ua.indexOf('Safari') != -1;
	    this.isOpera = ua.indexOf('Opera') != -1;
	    this.isWebForms = false;//(ua.indexOf('Opera/9') != -1 || ua.indexOf('Chrome') != -1);

	    this.oError=null;
		this.calenderDIV=null;
		this.oYear=null;
		this.oMonth=null;
		this.oDate;
		
		// language
        
	    this.months = [
				      ["January", "February", "March", "April",	"May", "June", "July", "August","September", "October", "November", "December"],    // en
				      ["Januar","Febuar","M&auml;rz","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],             // de
				      ["janvier","fevrier","mars","avril","mai","juin","juillet","aout","septembre","octobre","novembre","decembre"],               // fr
				      ["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"],      // it
				      ["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],           // es
				      ["Januari","Februari","Maart","April","Mei","Juni","Juli","Augustus","September","Oktober","November","December"],            // nl
				      ["Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"]               // sv
				      ];

	    this.days = [
				      ["Mo","Tu","We","Th","Fr","Sa","Su"], // en
				      ["Mo","Di","Mi","Do","Fr","Sa","So"], // de
				      ["Lu","Ma","Me","Je","Ve","Sa","Di"], // fr
				      ["Lu","Ma","Me","Gi","Ve","Sa","Do"], // it
				      ["Lu","Ma","Mi","Ju","Bu","S&aacute;","Do"], // es
				      ["Ma","Di","Wo","Do","Vr","Za","Zo"], // nl
				      ["M&aring;","Ti","On","To","Fr","L&ouml;","S&ouml;"] // sv
				      ];


	    this.infos = [
				     ["Calendar"],      // en
				     ["Kalender"],      // de
				     ["Calendrier"],    // fr
				     ["Calendari"],     // it
				     ["Calendario"],    // es
				     ["Kalender"],      // nl
				     ["Kalendrar"],     // sv
				    ];
		
		this.uniqueID = "formInput_" + formInputID++;
		this.element = el;		
        
        this.element.c = this;  // Klasse
        this.element.onblur = this.blur;
        this.element.onfocus = this.focus;
        
        this.imgpath    = el.getAttribute("imgpath");
        this.lang       = el.getAttribute("lang");	    
        this.typ        = el.getAttribute("type");	
        if (this.typ=="mydate") 
            this.typ="date";
        if (this.typ==undefined)
            this.typ="text";
        this.value      = el.getAttribute("value");	
        this.errMessage = el.getAttribute("errMessage");
        this.must       = el.getAttribute("must");
        
        //alert(this.value);
        
        if (this.must=="yes" && this.value!="" && this.value!=null) this.element.className="formvalid"; 
        //if (this.must=="yes" && this.text!="" && this.element.tagName=="TEXTAREA") this.element.className="formvalid"; 
        
        switch (this.lang)
            {
			case "de" :				
				this.langIndex = 1;				
				break
			case "fr" :				
				this.langIndex = 2;				
				break
			case "it" :				
				this.langIndex = 3;				
				break
			case "es" :				
				this.langIndex = 4;				
				break
			case "nl" :				
				this.langIndex = 5;				
				break
			case "sv" :				
				this.langIndex = 6;				
				break
			default:
				this.langIndex = 0;				
				break
            }
        //this.showMessage(this.errMessage);
        
	    switch (this.typ)
		    {
		    case "date":
		    case "mydate":
            case "sdate":
	            var oImg = null;
                
                //if (!this.isWebForms)
                    {		    
		            imgs = this.element.parentNode.getElementsByTagName("IMG");
			        for (i=0;i<imgs.length;i++)
			            {
		                if (imgs[i].src.indexOf("behaviors/images/calendar.gif")>0) oImg=imgs[i];
			            }
			        if (oImg==null)
			        {
			            oImg = document.createElement("IMG");				    
			            oImg.src =this.imgpath  + "calendar.gif";//this.document.URLUnencoded.replace(/formInput\.htc/,"") + "images/calendar.gif";
			            //oImg.onclick = showCalendar;
			            oImg.style.cssText = "cursor:pointer;cursor:hand;";				            
			            oImg.align="absmiddle";
			            oImg.id = "calendar";
			            oImg.hspace=1;
    			        
			            oImg.style.cssText="margin-bottom:2px;";
			            oImg.title = this.infos[this.langIndex];
			        }
                    oImg.c = this;
                    oImg.onclick = this.showCalendar;
                    temp = document.createElement("SPAN");
                    temp.style.cursor = "pointer";
                    temp.appendChild(oImg);
			        this.element.parentNode.appendChild(temp);					
			        
                }	
			    
    			
			    break;
		    case "text":
		    case "select":
			    //alert("init "+ 	element.all[0].selectedIndex);
			    break;
    				
		    default:
			    //element.all[0].value = trim(element.all[0].value);
    		
		    }	
	
	
	}
formInput.prototype.focus = function()
	{	
    this.c.showMessage("");
	}
	

formInput.prototype.doblur=function(bSHOWERR)
	{
	var s;
	//
	
	var bOK = false;
	try{
			switch (this.element.tagName)
				{
				case "SELECT":
					s = this.element.options[this.element.selectedIndex].value;					
					break;
				case "TEXTAREA":
					s = this.element.value;
					break;
				default:
					s = this.element.value;	
				}
		} 
	catch (e) {return;}
	
	
	//alert("blur " + this.element.tagName + "|" + s + "|");	
	if ((s=="") || ((this.element.tagName=="SELECT") && (s=="0")))
		{
		
		this.showMessage("");
		
		if (this.must=="yes")
		    {
			this.element.className = "formmust";			
			if (bSHOWERR) 
				{
				this.showMessage(this.errMessage) 
				this.element.focus();
				}
			}
		else
			{
			bOK = true;		
			this.element.className = "formvalid";
			}
		}
	else
		{
		this.showMessage("");
		this.element.className = "formvalid";
	
	switch (this.typ.toLowerCase())
		{
		case "date":
		case "mydate":												
						
			if ((this.calendarStringToDate(this.element.value))) 
				bOK = true;
			else
				{
				if (bSHOWERR) this.showMessage(this.c.errMessage);
				bOK=false;
				}

			break;
			
		case "email":
			
			re = /^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
			r = this.element.value.match(re);
			//alert(r + " " + bSHOWERR);
			if (r==null) 
				{
				if (bSHOWERR) this.showMessage(this.errMessage) 
				bOK=false;
				}
			else 
				bOK = true;
				
			break;

		case "url":			
			
			re = /^(http|https|ftp)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?\/?([a-zA-Z0-9\-\._\?\,\'/\\\+&amp;%\$#\=~])*$/;
			r = this.element.value.match(re);
			if (r==null) 
				{
				if (bSHOWERR) this.c.showMessage(this.errMessage) 
				bOK=false;
				}
			else 
				bOK = true;
			
			break;
		case "number":	
		case "float":
			if (!isNaN(parseFloat(this.element.value))) 			
				bOK = true;
			else
				{
				if (bSHOWERR) this.showMessage(this.c.errMessage);
				bOK=false;
				}
			break;
		
			
		default:		
		    bOK = true;
		    break;
		    
	    }
		this.element.className = bOK ? "formvalid" : "formerror";
        }	    
    return false;        
	
	}
	
formInput.prototype.blur = function()
	{
	return this.c.doblur(true);
	}

formInput.prototype.showMessage = function(strMessage)
	{
	if (this.oError==null)
	    {
	    this.oError = document.createElement("DIV");
	    this.element.parentNode.appendChild(this.oError);
	    }
	 
	this.oError.innerHTML = strMessage;

    this.oError.style.cssText = "border:1px solid red;background-color:white;color:red;padding:5px;"
	this.oError.style.position = "absolute";
	if (strMessage=="")
	    this.oError.style.display="none";
    else
        this.oError.style.display = "block";

    var pos = this.getAbsolutePos(this.element);
    this.oError.style.left = (pos.x2+((this.typ=="date") ? 24 : 2)) + 'px' ;
    this.oError.style.top = pos.y1 + 'px';
    this.oError.style.zIndex=100;

	//this.debug("showerror " + this.getAbsolutePos(this.element).y1);
	
	
	}

formInput.prototype.getAbsolutePos = function(element)
{
    var pos = { x1: element.offsetLeft, y1: element.offsetTop };
    if (element.offsetParent) {
    var par = this.getAbsolutePos(element.offsetParent);
    pos.x1 += par.x1;
    pos.y1 += par.y1;
    }
    pos.x2 = pos.x1 + ( pos.w = element.offsetWidth  ) - 1;
    pos.y2 = pos.y1 + ( pos.h = element.offsetHeight ) - 1;
    return pos;
}


formInput.prototype.setError = function()
	{
	this.element.className = "formerror";	    
	try 
	    {
		this.element.focus();
		} 
		catch (e) {}
	
	this.showMessage(this.errMessage);
	}


// Called from submit behavior to check if this element is valid
formInput.prototype.isValid = function()
	{
	
	this.doblur(false);
	var valid=false;
	//element.innerHTML += element.errMessage + " " + element.valid + "<br>";
	//alert(this.element.className + " " + this.element.id);
	if ((this.element.className.toLowerCase() == "formvalid") || (this.element.getAttribute("valid")=="true"))		
		valid= true;
	else
		{
		if ((this.element.className.toLowerCase() == "formvalid"))		
			valid= true;
		else
			{
			valid= false;
			}
		}

    return valid;

	}



formInput.prototype.debug = function(str)
{
    if (this.bdebug)
        {
        var div = document.getElementById("debug");
        if (div==undefined)    
            {
            div = document.createElement("textarea");
            div.id="debug";
            div.rows = 10;
            div.cols = 80;
            document.forms[0].appendChild(div);
            }
        div.innerHTML += str + "\n";
        }
}







    formInput.prototype.addEvent = function(obj, evType, fn, useCapture)
        {
        if (obj.addEventListener)
            {
            obj.addEventListener(evType, fn, true);
            return true;
            } 
        else if (obj.attachEvent)
            {
            var r = obj.attachEvent("on"+evType, fn);
            return r;
            } 
        else 
            {
            //alert("Handler could not be attached");
            }
        } 

    formInput.prototype.getButton = function(name,titel,func)
    {
    
		oButton = document.createElement("button");
		//oButton.id = uniqueID + "addnewbutton";
		oButton.className = "formControlElement";
		oButton.title = titel;
		oButton.innerHTML = name;
		//this.addEvent(oButton,"click",func,false);
		oButton.onclick = func;
		//Listener.add(oButton, "click", func,this);

		oButton.c = this;
		return oButton;
    
    }
    
    formInput.prototype.showCalendar = function()
    {
        var self = this.c;
        self.showMessage("");
	    if (self.value=="") 
		    self.oDate = new Date();
	    else
		    {
		    self.oDate = self.calendarStringToDate(self.value);
		    if (isNaN(self.oDate)) self.oDate = new Date();
		    }
		        
        if (self.calenderDIV==null)
            {
            
            self.calenderDIV = document.createElement("DIV");
            self.element.parentNode.appendChild(self.calenderDIV);
            self.calendarCreateTable(self.calenderDIV,self.oDate);
            //window.addEventListener('click',this.closeCalendar,false);
            }
        
        //alert(self.calenderDIV.style.display == "block");
        if (self.calenderDIV.style.display == "block")    
            {
            self.calenderDIV.style.display = "none";
            }
        else
            {
            self.calendarUpdateTable(self.calenderDIV,self.oDate);        
		    self.calenderDIV.style.display = "block";
		    self.calenderDIV.style.position = 'absolute';
		    pos = self.getAbsolutePos(self.element);
		    self.calenderDIV.style.left = pos.x1 + 'px';
		    self.calenderDIV.style.top = pos.y2 + 'px';
            self.calenderDIV.style.zIndex=100;
            self.calenderDIV.focus();
            //self.calenderDIV.addEventListener("blur",function(){alert('by')},false);
            //self.calenderDIV.onblur=function() {this.style.display="none";}
            }        

        return false;
    }

formInput.prototype.closeCalendar=function()
{
}

formInput.prototype.calendarUpdateTable=function(el,d)
	{		
	var rows = 6;var cols = 7;var week = 0;		
	var tmpDate = new Date(d);
	var orginalDate = new Date(d);
	var today = new Date();
	
	var trs = el.firstChild.tBodies[0].rows;
	

	for (i=0; i<6 ; i++)
		for (e=0; e<7; e++)
			trs[i+3].cells[e].innerHTML="";
	
	for ( i = 1; i < 32; i++ )
		{
			
		tmpDate.setDate( i );
		if (tmpDate.getMonth()==orginalDate.getMonth())
			{
			var weekDay = ( tmpDate.getDay()+1) % 7;
			var colIndex = (weekDay + 5) % 7;				
			var isToday = (tmpDate.getDate() == today.getDate()) && (tmpDate.getMonth() == today.getMonth()) &&	(tmpDate.getFullYear() == today.getFullYear());
			var isValue = false;
			
			try{
			isValue=(tmpDate.getDate() == this.oDate.getDate()) && (tmpDate.getMonth() == this.oDate.getMonth()) &&	(tmpDate.getFullYear() == this.oDate.getFullYear());			
            }catch(e){}
			tmpCell = trs[week+3].cells[colIndex];		
			tmpCell.style.cursor = "pointer";
			tmpCell.innerHTML=i;
			
			if (isToday) 
			    {
			    tmpCell.style.color = "red";
			    tmpCell.today="true";
			    }
			else
			    {
			    tmpCell.today="false";
			    }
			    
			if (isValue)
			    {
				tmpCell.style.backgroundColor = "highlight";
				tmpCell.style.color = "highlighttext";
				}
			}
		if ( colIndex == 6 ) week++;	
						
		}			
	}

formInput.prototype.calendarMouseOver=function()
	{
	var oEl = this;
	if (oEl.innerHTML!="&nbsp;" && oEl.innerHTML!=" " && oEl.innerHTML!="")
		{		
		oEl.style.backgroundColor = "highlight";			
		oEl.style.color = "highlighttext";			
		}
	
	return false;
	}

formInput.prototype.calendarMouseOut=function()
	{
	var oEl = this;
	if (oEl.innerHTML!="&nbsp;")
		{
		oEl.style.backgroundColor = "";			
		oEl.style.color = "";
		if (oEl.today=="true")
		    oEl.style.color="red";			
		}
	return false;
	}

formInput.prototype.calendarClick=function()
	{
	var d;
	var oEl = this;
	var self = this.c;
	
	var sYear = self.oYear.options[self.oYear.selectedIndex].value;
	var sMonth = self.oMonth.options[self.oMonth.selectedIndex].value;
	var sDay = oEl.innerHTML;
    
    //alert(sMonth + "d:" + sDay);
	self.element.value = self.calendarDateToString(new Date(sYear,sMonth,sDay));
	oDate = new Date(sYear,sMonth,sDay);
	self.calenderDIV.style.display="none";
	self.element.className = "formvalid";
	return false;
	}

formInput.prototype.calendarDateToString=function(d)
	{	
    var l = this.lang;
    if (this.isWebForms)
        l = "html5";
	
	switch (l)
		{
		case "en_us":
			return (parseInt(d.getMonth())+1) + "/" + d.getDate() + "/" + d.getFullYear();
			break;		
		case "nl":
			return d.getDate() + "-" + (parseInt(d.getMonth())+1) + "-" + d.getFullYear();
			break;		
		case "sv":
			return d.getFullYear() + "-" + (parseInt(d.getMonth())+1) + "-" + d.getDate();
			break;		
		case "de":
			return d.getDate() + "." + (parseInt(d.getMonth())+1) + "." + d.getFullYear();
			break;		
		case "html5":					            
            var sd = parseInt(d.getDate())<10 ? "0" + d.getDate() : d.getDate();
            var sm = parseInt(d.getMonth())+1<10 ? "0" + (parseInt(d.getMonth())+1) : (parseInt(d.getMonth())+1);
            
			return d.getFullYear() + "-" + sm + "-" + sd;		
			break;
		default:					
			return d.getDate() + "/" + (parseInt(d.getMonth())+1) + "/" + d.getFullYear();		
			break;
		}
		
	}
	
formInput.prototype.calendarStringToDate = function(str)
	{	
	//alert(str);
    var l = this.lang;
    if (this.isWebForms)
        l = "html5";

	switch (l)
		{
		case "de":
			
			re = /^(\d{1,2})\.(\d{1,2})\.(\d{4})$/;
			var arr = re.exec(str);
			y = RegExp.$3;m = RegExp.$2;d = RegExp.$1;		
			break;		

		case "nl":
			
			re = /^(\d{1,2})-(\d{1,2})-(\d{4})$/;
			var arr = re.exec(str);
			y = RegExp.$3;m = RegExp.$2;d = RegExp.$1;		
			break;		

		case "sv":
			
			re = /^(\d{4})-(\d{1,2})-(\d{1,2})$/;
			var arr = re.exec(str);
			y = RegExp.$1;m = RegExp.$2;d = RegExp.$3;		
			break;		

		case "en_us":

			re = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/;
			var arr = re.exec(str);			
			y = RegExp.$3;
			m = RegExp.$2;
			d = RegExp.$1;
			
			break;

		case "html5":

			re = /^(\d{4})-(\d{1,2})-(\d{1,2})$/;
			var arr = re.exec(str);			
			y = RegExp.$1;
			m = RegExp.$2;
			d = RegExp.$3;
			
			break;

		default:

			re = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/;
			var arr = re.exec(str);			
			y = RegExp.$3;
			m = RegExp.$2;
			d = RegExp.$1;
			
			break;

		}


		if ( ((y>1900) && (y<2100) && (y!="")) && ((m>0) && (m<13) && (m!="")) && ((d>0) && (d<32) && (d!="")) )	
			{
			
			d = new Date(y,m-1,d,0,0,0);			
			}
		else d=false;

		return d;
	}


formInput.prototype.calendarChange=function()
	{
	var self;
	if (this.c)
	    self = this.c;
	else
	    self = this;
	var sYear = self.oYear.options[self.oYear.selectedIndex].value;
	var sMonth = self.oMonth.options[self.oMonth.selectedIndex].value;	
	self.calendarUpdateTable(self.calenderDIV,new Date(sYear,sMonth,1));
	}

formInput.prototype.calendarCreateTable = function(el,d)
	{
	
	    var m="",y="";
	    try {
	    m = d.getMonth();
	    y = d.getFullYear();
	    }	catch (e) { d=new Date()}
    	
	
	
	if (m=="") m = d.getMonth();
	if (y=="") y = d.getFullYear();
	
	//alert(m + " " + y);
	sHTML =	 "<table onselect=\"return false;\" border=0 oncontextmenu=\"return false;\" cellspacing=0 style=\"background-color:buttonface; font-family: Verdana; font-size: 11px; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 2px solid; BORDER-TOP: buttonhighlight 1px solid; BORDER-BOTTOM: buttonshadow 1px solid;\" width=200 height=180>";

	s="<select style=\"font-size:10px;\" id=month_" + this.uniqueID + ">";
	for (i=0;i<12;i++)
		{
		s = s + "<option value=" + i + " ";
		if (m==i) s += "selected";
		s = s + ">" + this.months[this.langIndex][i] + "</option>";
		}
	
	s += "</select>";

	sy="<select style=\"font-size:10px;\" id=year_" + this.uniqueID + ">";
	for (i=1900;i<=2030;i++)
		{
		sy = sy + "<option value=" + i + " ";
		if (y==i) sy += "selected";
		sy = sy + ">" + i + "</option>";
		}
	
	sy += "</select>";

	sHTML += "<tr><td colspan=7 align=center onselectstart='return false;'><a id=\"previous_" + this.uniqueID + "\" style=\"padding:0px;font-size:20px;font-family:webdings;cursor:pointer;border:0;background-image:url();\"><img style=\"border:0\" src='behaviors/images/btn_previous.gif' /></a>" + s + sy + "<a id=\"next_" + this.uniqueID + "\" style=\"background-image:url();padding:0px;font-size:20px;font-family:webdings;cursor:pointer;border:0\"><img style=\"border:0\" src=\"behaviors/images/btn_next.gif\" /></a></td></tr>";
	sHTML += "<tr><td style=\"BORDER-BOTTOM: buttonshadow 1px solid\" align=center>" + this.days[this.langIndex][0] + "</td><td align=center style=\"BORDER-BOTTOM: buttonshadow 1px solid\" align=center>" + this.days[this.langIndex][1] + "</td><td style=\"BORDER-BOTTOM: buttonshadow 1px solid\" align=center>" + this.days[this.langIndex][2] + "</td><td style=\"BORDER-BOTTOM: buttonshadow 1px solid\" align=center>" + this.days[this.langIndex][3] + "</td><td style=\"BORDER-BOTTOM: buttonshadow 1px solid\" align=center>" + this.days[this.langIndex][4] + "</td><td style=\"xbackground-color:graytext;BORDER-BOTTOM: buttonshadow 1px solid\" align=center>" + this.days[this.langIndex][5] + "</td><td style=\"xbackground-color:graytext;BORDER-BOTTOM: buttonshadow 1px solid\" align=center>" + this.days[this.langIndex][6] + "</td></tr><tr>";
//	sHTML += "<tr><td style=\"BORDER-BOTTOM: buttonshadow 1px solid\" align=center>Mo</td><td align=center style=\"BORDER-BOTTOM: buttonshadow 1px solid\" align=center>Di</td><td style=\"BORDER-BOTTOM: buttonshadow 1px solid\" align=center>Mi</td><td style=\"BORDER-BOTTOM: buttonshadow 1px solid\" align=center>Do</td><td style=\"BORDER-BOTTOM: buttonshadow 1px solid\" align=center>Fr</td><td style=\"BORDER-BOTTOM: buttonshadow 1px solid\" align=center>Sa</td><td style=\"xbackground-color:graytext;BORDER-BOTTOM: buttonshadow 1px solid\" align=center>So</td></tr><tr>";
	
	for (i=0; i<6*7; i++)
		{
		
		if (i % 7 == 0) 
			sHTML += "</tr><tr>";
			
		sHTML += "<td align=\"center\">empty</td>";
		}
	
	sHTML += "</tr></table>";

	el.innerHTML = sHTML;	
	el.c=this;
	
	otds=el.childNodes[0].getElementsByTagName("TD");
	
	for (i=0; i<otds.length; i++)
		{
		//alert(otds[i].innerHTML);
		if (otds[i].innerHTML=="empty")				
			{
			//alert(otds[i]);
			otds[i].c = this;
			otds[i].onclick= this.calendarClick;
			otds[i].onmouseover = this.calendarMouseOver;
			otds[i].onmouseout = this.calendarMouseOut;
			}
		}
	this.oYear = document.getElementById("year_" + this.uniqueID);
	this.oMonth = document.getElementById("month_" + this.uniqueID);
    this.oYear.c=this.oMonth.c=this;

    document.getElementById("previous_" + this.uniqueID).c = this;
    document.getElementById("previous_" + this.uniqueID).onclick=function () {
	  	if (this.c.oMonth.selectedIndex>0)
	  	    {
	  		this.c.oMonth.selectedIndex--;
			}
		else
		    {
		    this.c.oMonth.selectedIndex=11;
		    this.c.oYear.selectedIndex--;
			}
		this.c.calendarChange();
		};
    
    document.getElementById("next_" + this.uniqueID).c = this;
    document.getElementById("next_" + this.uniqueID).onclick=function () {
	  	if (this.c.oMonth.selectedIndex<11)
	  	    {
	  		this.c.oMonth.selectedIndex++;
			}
		else
		    {
		    this.c.oMonth.selectedIndex=0;
		    this.c.oYear.selectedIndex++;
			}
		this.c.calendarChange();
		};

    
	this.oYear.onchange = this.calendarChange;
	this.oMonth.onchange = this.calendarChange;
	
	}




