/**
 * Curso Api
 *
 * @copyright Curso eG
 * 
 */
/**
 * Calculators Manager
 */
var calManager;
/**
 * 
 */
var calendar;

function validateForm(obj){
	if(!obj.isValide() )
		return;
	if( obj )
		obj.performAction();
};
/*
 * invoke call method to this object.
 */
function invokeMethodObj(obj){
	if( obj )
		obj.performAction();
};
function tabToMenu(divPrefix, limit, toShow ){
	for(var i=1; i<=limit;i++){
		var divElemN = divPrefix+i;
		var divElem  = document.getElementById(divElemN);
		if( i== toShow){
			divElem.style.visibility='visible';
		}else{
			divElem.style.visibility='hidden';
		}	
	}
}
/*
 * call calculator tab which has index number und tab name
 * @param {Object} index the tab index
 * @param {Object} tab the name
 * 
 */
function doCall(index, tab){
	if( calManager == null){
		calManager = new Calculators();
	}
	if( tab != null){
		calManager.showNewTab(index,tab);	
	}
};
/**
 * 
 * @param {Object} refId
 */
function openWindow(refId,beanid){
	var myAction =CursoWeb.createAbsolutMappingAction("bean-details.do?invoke=bean"+beanid+"&cid="+refId);
	window.open(myAction, "Zweitfenster", "scrollbars=1,width=600,height=600,left=200,top=200");
};
/**
 * 
 */
function disableOrEnable(actPerformer,textListener,listListener, myform){
	CursoUtils.disableOrEnableText(actPerformer, textListener,"cdisable", "ctext");
	CursoUtils.disableOrEnableElem(actPerformer, listListener, "clistdis","clist",myform);
};
/**
 * 
 */
function MyInstance(suffix){
	
	/*
 	 *
 	 */
 	this.getDoAction= function(){
		return CursoWeb.createAbsolutMappingAction(suffix+".do");
 	};
 	/*
 	 * 
 	 */
 	this.performAction= function(){
		var url = this.getDoAction();
		window.location.href= url;
 	};

};
/**
 * 
 * @param {Object} itemId
 * @param {Object} categoryId
 * @param {Object} titel
 * @param {Object} sectionId
 */
function Details(itemId,categoryId,titel,sectionId){
	/*
 	 *
 	 */
 	this.getDoAction= function(){
		var post = "itemId="+itemId+"&categoryId="+categoryId+"&invoke=section"+sectionId+"&"+titel;
		return CursoWeb.createAbsolutMappingAction("details.do?"+post);
 	};
 	/*
 	 * 
 	 */
 	this.performAction= function(){
		var url = this.getDoAction();
		window.location.href= url;
 	};
};
/**
 * 
 * @param {Object} itemId
 * @param {Object} categoryId
 * @param {Object} titel
 * @param {Object} sectionId
 */
function Details4(itemId,categoryId,titel,sectionId){
	/*
 	 *
 	 */
 	this.getDoAction= function(){
		var post = "itemId="+itemId+"&categoryId="+categoryId+"&invoke=section"+sectionId+"&"+titel;
		return CursoWeb.createAbsolutMappingAction("details4.do?"+post);
 	};
 	/*
 	 * 
 	 */
 	this.performAction= function(){
		var url = this.getDoAction();
		window.location.href= url;
 	};
};
/**
 * 
 * @param {Object} itemId
 * @param {Object} categoryId
 * @param {Object} titel
 * @param {Object} sectionId
 * @param {Object} detailsNum
 */
function Details2(itemId,categoryId,titel,sectionId, detailsNum){
	/*
 	 *
 	 */
 	this.getDoAction= function(){
		var post = "itemId="+itemId+"&categoryId="+categoryId+"&invoke=section"+sectionId+"&"+titel;
		var myAction = CursoUtils.buildAction("details","do",detailsNum,post);
		return CursoWeb.createAbsolutMappingAction(myAction);
 	};
 	/*
 	 * 
 	 */
 	this.performAction= function(){
		var url = this.getDoAction();
		window.location.href= url;
 	};
};
/**
 * 
 * @param {Object} __method__
 * @param {Object} cid
 */
function PrepareBooking(__method__,condId, cid , flag, param1, param2, param3){
	//
 	this.doAction="tageld.do";
 	//
 	this.sync=true;
 	//
	this.myWaitId;
	//
    this.targetID ="result"+cid;
    //
    this.COLSPAN =5;
	/*
 	 *
 	 */
 	this.getDoAction= function(){
		return CursoWeb.createMappingAction("preparebooking.do?invoke="+__method__+"&cid="+condId+"&id="+flag+"&csid="+cid+"&price="+param3);
 	};

 	/*
 	 * 
 	 */
 	this.performAction= function(){
 		var con = new AjaxConnector();
 		con.fireRequest(this);
 	};
 	/*
 	 *
 	 */
 	this.handelResponse= function(response){
		CursoUtils.addContentToDiv(this.targetID,response,this.COLSPAN);
 	 };
 	/*
 	 *
 	 */
 	this.waiting=function(){
		
 	};
	/*
	 * 
	 */
	this.disableWaiting=function(){
		//CursoUtils.StopWaiting(this.myWaitId);
	};
	/*
	 * 
	 */
    this.isSync =function(){
		return this.sync;
	};
	/*
	 * 
	 */
	this.isValide =function(){
		return true;	
	};
};
/**
 * 
 * @param {Object} __method__
 * @param {Object} cid
 */
function TransportBooking(__method__,cid){
	//
 	this.sync=true;
 	//
 	this.mymethod=0;
	//
    this.targetID ="result"+cid;
	//
	this.myWaitId;
	//
	this.formToSend ="formTransBooking"+cid;
 	
 	/*
 	 *
 	 */
 	this.getPostForm = function(){
		var myform = document.getElementsByName(this.formToSend);
		var mybody =CursoUtils.getNameValueAsString(Form.getElements(myform[0]));
		return mybody;
 	};
 	/*
 	 *
 	 */
 	this.getDoAction= function(){
		return CursoWeb.createMappingAction("findtrans.do?invoke="+__method__);
 	};
 	/*
 	 * 
 	 */
 	this.performAction= function(){
 		var con = new AjaxConnector();
 		con.firePostRequest(this);
 	};
 	/*
 	 *
 	 */
 	this.handelResponse= function(response){
		CursoUtils.addContentToDiv(this.targetID,response,this.COLSPAN);
 	 };
 	/*
 	 *
 	 */
 	this.waiting=function(){
		CursoUtils.buildWaitingDiv(cid);
 	};
	/*
	 * 
	 */
	this.disableWaiting=function(){
		//CursoUtils.StopWaiting(this.myWaitId);
	};
	/*
	 * 
	 */
    this.isSync =function(){
		return this.sync;
	};
	/*
	 * 
	 */
	this.isValide =function(){
		return true;		
	};
};
/**
 * 
 * @param {Object} beanId
 */
function  InsuranceBookingForm(beanId){
	/*
 	 *
 	 */
 	this.getDoAction= function(){
		return CursoWeb.createHTTPSRequest("insurance-callbooking.do?id="+beanId);
 	};
 	/*
 	 * 
 	 */
 	this.performAction= function(){
		var url = this.getDoAction();
		window.location.href= url;
 	};
};
/*
 *
 */
function InsuranceBooking(){
	//
	//
 	this.sync=true;
 	//
	this.myWaitId;
	//
	this.myform="insuranceBooking";
	//
	this.targetID="insurancebookingDiv";
 	/*
 	 *
 	 */
 	this.getPostForm = function(){
		this.myform = document.forms[this.myform];
		var mybody =CursoUtils.getNameValueAsString(this.myform);
		return mybody;
 	};
 	/*
 	 *
 	 */
 	this.getDoAction= function(){
		var mybody = this.getPostForm();
		return CursoWeb.createMappingAction("insurance-booking.do?"+mybody);
 	};
 	/*
 	 * 
 	 */
 	this.performAction= function(){
 		var con = new AjaxConnector();
 		con.firePostRequest(this);
 	};
 	/*
 	 *
 	 */
 	this.handelResponse= function(response){
		CursoUtils.addContentToDiv(this.targetID,response,this.COLSPAN);
 	 };
 	/*
 	 *
 	 */
 	this.waiting=function(){
	
 	};
	/*
	 * 
	 */
	this.disableWaiting=function(){
		
	};
	/*
	 * 
	 */
    this.isSync =function(){
		return this.sync;
	};
	/*
	 * 
	 */
	this.isValide =function(){
		//
		var validation = true;
		//
		var myform = document.getElementsByName(this.myform);
		//
		var myAry = CursoUtils.getNameValueAsHash(myform[0]);
		//
		var arryChars= new Array(
			"name","surname","streetNumber",
			"phoneDay","mobile","fax"
		);
		var arryPay1= new Array(
			"accountHolder","accountNumber","bankCode"
		);
		var arryPay2= new Array(
			"cardHolder","cardType","cardNumber",
			"dateExpire"
		);
	    //
		var arryIns  = new Array(
			"nameInsured","surnameInsured","birthInsured"
		)
		for(var i=0;i < arryChars.length;i++){
			//validate tripper 1
			if( !CursoValidator.validateString(myAry[arryChars[i]].getMyField(),"Feld ist erfordarlich")){
				validation = false;
			}
		}
		//var isPerCreditCard = 
		//if( )

		return validation;
	};	
};
/**
 * 
 * @param {Object} ThisForm
 */
function Insurance( ThisForm , cId){
	//
	this.targetNode = "contentPanel";
	//
	this.CALLs ={
		c1 : "?call=requestOffer"
	};
	//
 	this.sync=true;
 	//
	this.myWaitId;
 	/*
 	 *
 	 */
 	this.getPostForm = function(){
		this.myform = document.forms[ThisForm];
		var mybody =CursoUtils.getNameValueAsString(this.myform);
		return mybody;
 	};
 	/*
 	 *
 	 */
 	this.getDoAction= function(){
		return CursoWeb.createMappingAction("insurance.do"+this.CALLs[cId]);
 	};
 	/*
 	 * 
 	 */
 	this.performAction= function(){
 		var con = new AjaxConnector();
 		con.firePostRequest(this);
 	};
 	/*
 	 *
 	 */
 	this.handelResponse= function(response){
		CursoUtils.addRowTableDefault(this.targetNode,response);
 	 };
 	/*
 	 *
 	 */
 	this.waiting=function(){
	
 	};
	/*
	 * 
	 */
	this.disableWaiting=function(){
		
	};
	/*
	 * 
	 */
    this.isSync =function(){
		return this.sync;
	};
	/*
	 * 
	 */
	this.isValide =function(){
		return true;
	};
	
};
function CreditCard(){
	//
	this.myform="bookingForm";
	//
	this.booking= new Booking();
	//
	this.visArr = new Array();
	//
	this.toCollaps="tripper_";
	//
 	this.sync=true;
 	//
	this.myWaitId;
	
	this.targetNode = "contentPanel";
 	/*
 	 *
 	 */
 	this.getPostForm = function(){
		var myform = document.forms[this.myform];
		var mybody =CursoUtils.getNameValueAsString(myform);
		return mybody;
 	};
 	/*
 	 *
 	 */
 	this.getDoAction= function(){
		return CursoWeb.createMappingAction("booking.do?invoke=bCard");
 	};
 	/*
 	 * 
 	 */
 	this.performAction= function(){
		for(var i=1;i<6;i++){
			var elem = document.getElementById(this.toCollaps+i);
			var elemVis =elem.style.visibility
			if( elemVis !='collapse')
				this.visArr.push(i);
			elem.style.visibility='collapse';
		}
 		var con = new AjaxConnector();
 		con.firePostRequest(this);
 	};
 	/*
 	 *
 	 */
 	this.handelResponse= function(response){
		if(response==100){
			this.booking.performAction();
		}else{
		   for(var j=0;j<this.visArr.length;j++){
		   		var elem = document.getElementById(this.toCollaps+this.visArr[j]);
		   		elem.style.visibility='visible';
			}
		}
 	 };
 	/*
 	 *
 	 */
 	this.waiting=function(){
		CursoUtils.showWaitingforLoad(this.targetNode);
 	};
	/*
	 * 
	 */
	this.disableWaiting=function(){
		
	};
	/*
	 * 
	 */
    this.isSync =function(){
		return this.sync;
	};
	/*
	 * 
	 */
	this.isValide =function(){
		return this.booking.isValide();
	};	
};
/*
 *
 */
function CTF(){
	//
	//
 	this.sync=true;
 	//
	this.myWaitId;
	//
	this.myform="ctformbean";
	//
	this.targetNode="contentPanel";
 	/*
 	 *
 	 */
 	this.getPostForm = function(){
		var mybody =CursoUtils.getNameValueAsString(this.myform);
		return mybody;
 	};
 	/*
 	 *
 	 */
 	this.getDoAction= function(){
		return CursoWeb.createMappingAction("ctfaction.do");
 	};
 	/*
 	 * 
 	 */
 	this.performAction= function(){
 		var con = new AjaxConnector();
 		con.firePostRequest(this);
 	};
 	/*
 	 *
 	 */
 	this.handelResponse= function(response){
		CursoUtils.addRowTableDefault(this.targetNode,response);
 	 };
 	/*
 	 *
 	 */
 	this.waiting=function(){
	
 	};
	/*
	 * 
	 */
	this.disableWaiting=function(){
		
	};
	/*
	 * 
	 */
    this.isSync =function(){
		return this.sync;
	};
	/*
	 * 
	 */
	this.isValide =function(){
		var validation = true;
		this.myform = document.forms[this.myform];
		var myAry = CursoUtils.getNameValueAsHash(this.myform);
		//validate tripper 1
		if( !CursoValidator.validateString(myAry['name'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateString(myAry['firstname'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateString(myAry['tel'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateEmail(myAry['mail'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		return validation;
	};	
};
/*
 *
 */
function Booking(){
	//
	//
 	this.sync=true;
 	//
	this.myWaitId;
	//
	this.myform="bookingForm";
	//
	this.targetNode="contentPanel";
 	/*
 	 *
 	 */
 	this.getPostForm = function(){
		var mybody =CursoUtils.getNameValueAsString(this.myform);
		return mybody;
 	};
 	/*
 	 *
 	 */
 	this.getDoAction= function(){
		return CursoWeb.createMappingAction("booking.do");
 	};
 	/*
 	 * 
 	 */
 	this.performAction= function(){
 		var con = new AjaxConnector();
 		con.firePostRequest(this);
 	};
 	/*
 	 *
 	 */
 	this.handelResponse= function(response){
		CursoUtils.addRowTableDefault(this.targetNode,response);
 	 };
 	/*
 	 *
 	 */
 	this.waiting=function(){
	
 	};
	/*
	 * 
	 */
	this.disableWaiting=function(){
		
	};
	/*
	 * 
	 */
    this.isSync =function(){
		return this.sync;
	};
	/*
	 * 
	 */
	this.isValide =function(){
		var validation = true;
		this.myform = document.forms[this.myform];
		var myAry = CursoUtils.getNameValueAsHash(this.myform);
		//validate tripper 1
		if( !CursoValidator.validateString(myAry['travlerUserName'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateString(myAry['travlerUserFirstname'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateString(myAry['nationality'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateDate(myAry['travlerUserBirthday'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateString(myAry['bookingName'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateString(myAry['bookingFirstname'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateString(myAry['bookingStreet'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateString(myAry['bookingStreetNumber'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateDate(myAry['bookingBirthday'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateNumber(myAry['bookingPlz'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateString(myAry['bookingCity'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateEmail(myAry['bookingEmail'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateString(myAry['bookingTelefon'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateNumber(myAry['bookingCreditCartNumber'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateNumber(myAry['verification'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateCheckbox(myAry['agb'].getMyField(),"AGB Feld ist nicht aktiviert.")){
			validation = false;
		}
		return validation;
	};	
};
/*
 *
 */
function Booking2(){
	//
	//
 	this.sync=true;
 	//
	this.myWaitId;
	//
	this.myform="bookingForm";
	//
	this.targetNode="contentPanel";
 	/*
 	 *
 	 */
 	this.getPostForm = function(){
		var mybody =CursoUtils.getNameValueAsString(this.myform);
		return mybody;
 	};
 	/*
 	 *
 	 */
 	this.getDoAction= function(){
		return CursoWeb.createMappingAction("booking.do");
 	};
 	/*
 	 * 
 	 */
 	this.performAction= function(){
 		var con = new AjaxConnector();
 		con.firePostRequest(this);
 	};
 	/*
 	 *
 	 */
 	this.handelResponse= function(response){
		CursoUtils.addRowTableDefault(this.targetNode,response);
 	 };
 	/*
 	 *
 	 */
 	this.waiting=function(){
	
 	};
	/*
	 * 
	 */
	this.disableWaiting=function(){
		
	};
	/*
	 * 
	 */
    this.isSync =function(){
		return this.sync;
	};
	/*
	 * 
	 */
	this.isValide =function(){
		var validation = true;
		this.myform = document.forms[this.myform];
		var myAry = CursoUtils.getNameValueAsHash(this.myform);
		//validate tripper 1
		if( !CursoValidator.validateString(myAry['travlerUserName'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateString(myAry['travlerUserFirstname'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateString(myAry['nationality'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateDate(myAry['travlerUserBirthday'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}

		// validate user data
		if( !CursoValidator.validateString(myAry['bookingName'].getMyField(),"Feld ist erfordarlich")){
			validation = false;
		}
		if( !CursoValidator.validateString(myAry['bookingFirstname'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateString(myAry['bookingStreet'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateDate(myAry['bookingBirthday'].getMyField(),"Feld ist erforderlich")){
			validation = false;
			}
		if( !CursoValidator.validateString(myAry['bookingStreetNumber'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateNumber(myAry['bookingPlz'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateString(myAry['bookingCity'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateEmail(myAry['bookingEmail'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateString(myAry['bookingTelefon'].getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateCheckbox(myAry['agb'].getMyField(),"AGB Feld ist nicht aktiviert.")){
			validation = false;
		}
		return validation;
	};	
};
/**
 * 
 * @param {Object} obj
 */
function CalendarTab(){
	this.nameCal = "calendarShowTab";
	this.yearField= "yearValue";
	this.montField= "";
	this.performAction = function(response){
		elem =document.getElementById(this.nameCal);
		elem.innerHTML =response;
		elem.style.visibility='visible';
	}	
	this.removeCal= function(){
		elem =document.getElementById(this.nameCal);
		elem.removeChild(elem.firstChild);
		elem.style.visibility='hidden';
	}	
	this.setCalDate = function(){
		elem =document.getElementById(this.yearField);
		alert(elem.value);
		year = elem[0].getElementsByName(this.yearField);
		alert(year);
	}
};
/**
 * Buisness
 *
 *
 *
 *
 */
function Buisness(){
 	this.formName = "buisnessForm";
	this.Action =
	this.elementsFields = new Array("age");
	this.divErr = "age_err";
	this.divMsg = "age_msg";
	this.indexLoading="20xFF";
	this.targetNode = "contentPanel";
	//
 	this.sync=true;
 	//
	this.myWaitId;
 	/*
 	 *
 	 */
 	this.getPostForm = function(){
		var myform = document.getElementsByName(this.formName);
		var mybody =CursoUtils.getNameValueAsString(Form.getElements(myform[0]));
		return mybody;
 	};
 	/*
 	 *
 	 */
 	this.getDoAction= function(){
		return CursoWeb.createMappingAction("buisness.do");
 	};
 	/*
 	 * 
 	 */
 	this.performAction= function(){
 		var con = new AjaxConnector();
 		con.firePostRequest(this);
 	};
 	/*
 	 *
 	 */
 	this.handelResponse= function(response){
		CursoUtils.addRowTableDefault(this.targetNode,response);
 	 };
 	/*
 	 *
 	 */
 	this.waiting=function(){
		CursoUtils.showWaitingforLoad(this.targetNode,this.indexLoading);
 	};
	/*
	 * 
	 */
	this.disableWaiting=function(){
		
	};
	/*
	 * 
	 */
    this.isSync =function(){
		return this.sync;
	};
	/*
	 * 
	 */
	this.isValide =function(){
		var validation = true;
		var myform = document.getElementsByName(this.formName);
		var myAry = CursoUtils.getNameValueAsHash(myform[0]);
		var age = myAry['age'];
		if( !CursoValidator.validateNumber(age.getMyField(),"Feld ist erforderlich")){
			validation = false;
		}
		if( !CursoValidator.validateBorns(age.getMyField(),18,65,"Alter zwischen 18 und 65 Jahre")){
			validation = false;
		}
		return validation;
	};
};
/**
 * Kids
 *
 *
 *
 *
 */
function Pupils(){
 	this.formName = "pupilsForm";
	this.divErr = "age_err";
	this.divMsg = "age_msg";
	this.indexLoading="20xFF";
	this.sync=true;
	this.targetNode = "contentPanel";
	/*
 	 *
 	 */
 	this.getPostForm = function(){
		var myform = document.getElementsByName(this.formName);
		var mybody =CursoUtils.getNameValueAsString(Form.getElements(myform[0]));
		return mybody;
 	};
 	/*
 	 *
 	 */
 	this.getDoAction= function(){
		return CursoWeb.createMappingAction("pupils.do");
 	};
 	/*
 	 * 
 	 */
 	this.performAction= function(){
 		var con = new AjaxConnector();
 		con.firePostRequest(this);
 	};
 	/*
 	 *
 	 */
 	this.handelResponse= function(response){
		CursoUtils.addRowTableDefault(this.targetNode,response);
 	 };
 	/*
 	 *
 	 */
 	this.waiting=function(){
		CursoUtils.showWaitingforLoad(this.targetNode,this.indexLoading);
 	};
	/*
	 * 
	 */
	this.disableWaiting=function(){
		
	};
	/*
	 * 
	 */
    this.isSync =function(){
		return this.sync;
	};
	/*
	 * 
	 */
	this.isValide =function(){
		var validation = true;
		var myform = document.getElementsByName(this.formName);
		var myAry = CursoUtils.getNameValueAsHash(myform[0]);
		var age = myAry['age'];
		if( !CursoValidator.validateNumber(age.getMyField(),"Feld ist erforderlich")){
			validation = false;
			}
		if( !CursoValidator.validateBorns(age.getMyField(),14,19,"Alter zwischen 14 und 19 Jahre ")){
			validation = false;
		}
		return validation;
	};
};
/**
 * Contact
 *
 *
 *
 *
 */
function Contact(){
 	this.formName = "contactme";
	this.divErr = "age_err";
	this.divMsg = "age_msg";
	this.indexLoading="20xFF";
	this.sync= true;
	this.targetNode = "contentPanel";
	/*
 	 *
 	 */
 	this.getPostForm = function(){
		var myform = document.getElementsByName(this.formName);
		var mybody =CursoUtils.getNameValueAsString(Form.getElements(myform[0]));
		return mybody;
 	};
 	/*
 	 *
 	 */
 	this.getDoAction= function(){
		return CursoWeb.createMappingAction("contact-data.do");
 	};
 	/*
 	 * 
 	 */
 	this.performAction= function(){
 		var con = new AjaxConnector();
 		con.firePostRequest(this);
 	};
 	/*
 	 *
 	 */
 	this.handelResponse= function(response){
		CursoUtils.addRowTableDefault(this.targetNode,response);
 	 };
 	/*
 	 *
 	 */
 	this.waiting=function(){
		CursoUtils.showWaitingforLoad(this.targetNode,this.indexLoading);
 	};
	/*
	 * 
	 */
	this.disableWaiting=function(){
		
	};
	/*
	 * 
	 */
    this.isSync =function(){
		return this.sync;
	};
	/*
	 * 
	 */
	this.isValide =function(){
		var validation = true;
		this.myform = document.forms[this.formName];
		var myAry = CursoUtils.getNameValueAsHash(this.myform);

		if( !CursoValidator.validateString(myAry['name'].getMyField(),"Feld ist erfordarlich")){
			validation = false;
		}
		if( !CursoValidator.validateString(myAry['firstname'].getMyField(),"Feld ist erfordarlich")){
			validation = false;
		}
		if( !CursoValidator.validateString(myAry['telefon'].getMyField(),"Feld ist erfordarlich")){
			validation = false;
		}
		if( !CursoValidator.validateEmail(myAry['email'].getMyField(),"Feld ist erfordarlich")){
			validation = false;
		}

		return validation;
	};
};

/**
 * NewsletterRegistry
 *
 *
 *
 *
 */
function NewsletterRegistry(){
 	this.formName = "newsRegistry";
	this.divErr = "age_err";
	this.divMsg = "age_msg";
	this.indexLoading="20xFF";
	this.targetNode = "contentPanel";
	/*
 	 *
 	 */
 	this.getPostForm = function(){
		this.myform = document.forms[this.formName];
		var mybody =CursoUtils.getNameValueAsString(this.myform);
		return mybody;
 	};
 	/*
 	 *
 	 */
 	this.getDoAction= function(){
		return CursoWeb.createMappingAction("register-to.do");
 	};
 	/*
 	 * 
 	 */
 	this.performAction= function(){
 		var con = new AjaxConnector();
 		con.firePostRequest(this);
 	};
 	/*
 	 *
 	 */
 	this.handelResponse= function(response){
		CursoUtils.addRowTableDefault(this.targetNode,response);
 	 };
 	/*
 	 *
 	 */
 	this.waiting=function(){
		CursoUtils.showWaitingforLoad(this.targetNode,this.indexLoading);
 	};
	/*
	 * 
	 */
	this.disableWaiting=function(){
		
	};
	/*
	 * 
	 */
    this.isSync =function(){
		return this.sync;
	};
	/*
	 * 
	 */
	this.isValide =function(){
		var validation = true;
		this.myform = document.forms[this.formName];
		var myAry = CursoUtils.getNameValueAsHash(this.myform);
		if( !CursoValidator.validateEmail(myAry['email'].getMyField(),"Feld ist erfordarlich")){
			validation = false;
		}
		return validation;
	};
};
/**
 * Activity
 *
 *
 *
 *
 */
function Certificate(){
 	this.formName = "certificate";
	this.divErr = "age_err";
	this.divMsg = "age_msg";
	this.indexLoading="20xFF";
	this.targetNode = "contentPanel";
	/*
 	 *
 	 */
 	this.getPostForm = function(){
		var myform = document.getElementsByName(this.formName);
		var mybody =CursoUtils.getNameValueAsString(Form.getElements(myform[0]));
		return mybody;
 	};
 	/*
 	 *
 	 */
 	this.getDoAction= function(){
		return CursoWeb.createMappingAction("certificate.do");
 	};
 	/*
 	 * 
 	 */
 	this.performAction= function(){
 		var con = new AjaxConnector();
 		con.firePostRequest(this);
 	};
 	/*
 	 *
 	 */
 	this.handelResponse= function(response){
		CursoUtils.addRowTableDefault(this.targetNode,response);
 	 };
 	/*
 	 *
 	 */
 	this.waiting=function(){
		CursoUtils.showWaitingforLoad(this.targetNode,this.indexLoading);
 	};
	/*
	 * 
	 */
	this.disableWaiting=function(){
		
	};
	/*
	 * 
	 */
    this.isSync =function(){
		return this.sync;
	};
	/*
	 * 
	 */
	this.isValide =function(){
		var validation = true;
		var myform = document.getElementsByName(this.formName);
		var myAry = CursoUtils.getNameValueAsHash(myform[0]);
		var age = myAry['age'];
		if( !CursoValidator.validateNumber(age.getMyField(),"Feld ist erfordarlich")){
			validation = false;
		}
		return validation;
	};
};
/**
 * Activity
 *
 *
 *
 *
 */
function Activity(){
 	this.formName = "activity";
	this.divErr = "age_err";
	this.divMsg = "age_msg";
	this.indexLoading="20xFF";
	this.targetNode = "contentPanel";
	/*
 	 *
 	 */
 	this.getPostForm = function(){
		var myform = document.getElementsByName(this.formName);
		var mybody =CursoUtils.getNameValueAsString(Form.getElements(myform[0]));
		return mybody;
 	};
 	/*
 	 *
 	 */
 	this.getDoAction= function(){
		return CursoWeb.createMappingAction("activity.do");
 	};
 	/*
 	 * 
 	 */
 	this.performAction= function(){
 		var con = new AjaxConnector();
 		con.firePostRequest(this);
 	};
 	/*
 	 *
 	 */
 	this.handelResponse= function(response){
		CursoUtils.addRowTableDefault(this.targetNode,response);
 	 };
 	/*
 	 *
 	 */
 	this.waiting=function(){
		CursoUtils.showWaitingforLoad(this.targetNode,this.indexLoading);
 	};
	/*
	 * 
	 */
	this.disableWaiting=function(){
		
	};
	/*
	 * 
	 */
    this.isSync =function(){
		return this.sync;
	};
	/*
	 * 
	 */
	this.isValide =function(){
		var validation = true;
		var myform = document.getElementsByName(this.formName);
		var myAry = CursoUtils.getNameValueAsHash(myform[0]);
		var age = myAry['age'];
		if( !CursoValidator.validateNumber(age.getMyField(),"Feld ist erfordarlich")){
			validation = false;
		}
		return validation;
	};
};
/**
 * 
 * @param {Object} formData
 */
function BuyPackage( formData){
	this.indexLoading="20xFF";
	this.targetNode = "contentPanel";
	
	/*
 	 *
 	 */
 	this.getPostForm = function(){
		return formData;
 	};
 	/*
 	 *
 	 */
 	this.getDoAction= function(){
		return CursoWeb.createHTTPSRequest("buy.do?"+formData);
 	};
 	/*
 	 * 
 	 */
 	this.performAction= function(){
		var url = this.getDoAction();
		window.location.href= url;
 	};
 	/*
 	 *
 	 */
 	this.handelResponse= function(response){
		CursoUtils.addRowTableDefault(this.targetNode,response);
 	 };
 	/*
 	 *
 	 */
 	this.waiting=function(){
		CursoUtils.showWaitingforLoad(this.targetNode,this.indexLoading);
 	};
	/*
	 * 
	 */
	this.disableWaiting=function(){
		
	};
	/*
	 * 
	 */
    this.isSync =function(){
		return true;
	};
	/*
	 * 
	 */
	this.isValide =function(){
		return true;
	}
};
function BuyPackage2(cid){
	this.indexLoading="20xFF";
	this.targetNode = "contentPanel";
	this.myform ="formBooking"+cid;
	/*
 	 *
 	 */
 	this.getPostForm = function(){
	  	var formTo = document.forms[this.myform];
		var mybody =CursoUtils.getNameValueAsString(formTo);
		return mybody;
	};
 	/*
 	 *
 	 */
 	this.getDoAction= function(){
		return CursoWeb.createHTTPSRequest("bcourse.do?"+this.getPostForm());
 	};
 	/*
 	 * 
 	 */
 	this.performAction= function(){
		var url = this.getDoAction();
		window.location.href= url;
 	};
 	/*
 	 *
 	 */
 	this.handelResponse= function(response){
		CursoUtils.addRowTableDefault(this.targetNode,response);
 	 };
 	/*
 	 *
 	 */
 	this.waiting=function(){
		CursoUtils.showWaitingforLoad(this.targetNode,this.indexLoading);
 	};
	/*
	 * 
	 */
	this.disableWaiting=function(){
		
	};
	/*
	 * 
	 */
    this.isSync =function(){
		return true;
	};
	/*
	 * 
	 */
	this.isValide =function(){
		return true;
	};
};
function Confirm( ){
	this.indexLoading="20xFF";
	this.targetNode = "contentPanel";
	this.myform="bookingconfirm";
	
	/*
 	 *
 	 */
 	this.getPostForm = function(){
		this.myform = document.forms[this.myform];
		var mybody =CursoUtils.getNameValueAsString(this.myform);
		return mybody;
 	};
 	/*
 	 *
 	 */
 	this.getDoAction= function(){
		return CursoWeb.createHTTPSRequest("confirmbooking.do");
 	};
 	/*
 	 * 
 	 */
 	this.performAction= function(){
		var con = new AjaxConnector();
 		con.firePostRequest(this);
 	};
 	/*
 	 *
 	 */
 	this.handelResponse= function(response){
		CursoUtils.addRowTableDefault(this.targetNode,response);
 	 };
 	/*
 	 *
 	 */
 	this.waiting=function(){
		CursoUtils.showWaitingforLoad(this.targetNode,this.indexLoading);
 	};
	/*
	 * 
	 */
	this.disableWaiting=function(){
		
	};
	/*
	 * 
	 */
    this.isSync =function(){
		return true;
	};
	/*
	 * 
	 */
	this.isValide =function(){
		return true;
	};
};
/**
 * CalculatorOne
 *
 *
 *
 *
 */
function CaculatorAdult(){
	this.formName = "adultForm";
	this.divErr = "age_err";
	this.divMsg = "age_msg";
	this.indexLoading="20xFF";
	this.targetNode = "contentPanel";
	/*
 	 *
 	 */
 	this.getPostForm = function(){
		var myform = document.getElementsByName(this.formName);
		var mybody =CursoUtils.getNameValueAsString(Form.getElements(myform[0]));
		return mybody;
 	};
 	/*
 	 *
 	 */
 	this.getDoAction= function(){
		return CursoWeb.createMappingAction("calculateAdult.do");
 	};
 	/*
 	 * 
 	 */
 	this.performAction= function(){
 		var con = new AjaxConnector();
 		con.firePostRequest(this);
 	};
 	/*
 	 *
 	 */
 	this.handelResponse= function(response){
		CursoUtils.addRowTableDefault(this.targetNode,response);
 	 };
 	/*
 	 *
 	 */
 	this.waiting=function(){
		CursoUtils.showWaitingforLoad(this.targetNode,this.indexLoading);
 	};
	/*
	 * 
	 */
	this.disableWaiting=function(){
		
	};
	/*
	 * 
	 */
    this.isSync =function(){
		return true;
	};
	/*
	 * 
	 */
	this.isValide =function(){
		var validation = true;
		var myform = document.getElementsByName(this.formName);
		var myAry = CursoUtils.getNameValueAsHash(myform[0]);
		var age = myAry['age'];
		if( !CursoValidator.validateNumber(age.getMyField(),"Feld ist erfordarlich")){
			validation = false;
		}
		if( !CursoValidator.validateBorns(age.getMyField(),18,65,"Alter zwischen 18 und 65 Jahre")){
			validation = false;
		}
		return validation;
	};
};
/*
 * tabs registery
 */
Calculators.prototype.tabsRegistery;
Calculators.prototype.URLs;
Calculators.prototype.GET="GET";
Calculators.prototype.POST="POST";
Calculators.prototype.req;
Calculators.prototype.pointer;
Calculators.prototype.ReqTYPE;
Calculators.prototype.URLs = [];
Calculators.prototype.indexE;
Calculators.prototype.tab;
/*
 * 
 */
function Calculators(){
	Calculators.prototype.tabsRegistery = new Array();
	Calculators.prototype.addActions();
};
/**
 * 
 */
Calculators.prototype.handelResponse= function(response){
	indexE = Calculators.prototype.indexE;
	tab =Calculators.prototype.tab;
	Calculators.prototype.tabsRegistery[indexE]=response;
	Calculators.prototype.replace(indexE,tab);
	
};
Calculators.prototype.getDoAction= function(){
	var indexE =Calculators.prototype.indexE
	return Calculators.prototype.URLs[indexE];
};
Calculators.prototype.waiting=function(){
		
 };
Calculators.prototype.isSync=function(){
	return true;	
 };
/**
 *
 */
Calculators.prototype.addActions = function(){
	Calculators.prototype.URLs.push(CursoWeb.createMappingAction("calcView.do?tab=0"));
	Calculators.prototype.URLs.push(CursoWeb.createMappingAction("calcView.do?tab=1"));
	Calculators.prototype.URLs.push(CursoWeb.createMappingAction("calcView.do?tab=2"));
	Calculators.prototype.URLs.push(CursoWeb.createMappingAction("calcView.do?tab=3"));
	Calculators.prototype.URLs.push(CursoWeb.createMappingAction("calcView.do?tab=4"));
};
/**
 * 
 */
Calculators.prototype.performAction= function(){
	
};
/**
 * 
 */
Calculators.prototype.replace = function(index, tab){
	elem =document.getElementById(tab);
	parentTab = elem.offsetParent;
	Effect.Shrink(tab);
	//parentTab.removeChild(parentTab.childNodes[0]);
	parentTab.innerHTML = Calculators.prototype.tabsRegistery[index];
	Effect.Grow("tab"+index);
};
/**
 * 
 */
Calculators.prototype.showNewTab= function(indexE,tab)
{
	Calculators.prototype.indexE =indexE;
    Calculators.prototype.tab=tab;
	if( Calculators.prototype.tabsRegistery[indexE]){
		Calculators.prototype.replace(indexE,tab);
		return;
	}
	var con = new AjaxConnector();
 	con.fireRequest(this);
 };

/**
 * 
 * 
 */
Calculators.prototype.addTab= function(index,tab){
	Calculators.prototype.tabsRegistery[index] = tab;
};
/**
 * 
 */
TripperRegistery ={
	tripperCounter : 1,
	addTripper :function(){
		TripperRegistery.tripperCounter++;	
	},
	resetTripper : function(){
		TripperRegistery.tripperCounter=1;
	}
};
/**
 * CursoUtils
 *
 *
 *
 *
 *
 */
var CursoUtils = 
{
   /**
    *
    *
    */ 
    defaultCell : 1,
   /**
    * 
    * @param {Object} targetRow
    * @param {Object} newRowContent
    * @param {Object} colSpan
    */
    openDocumentInWindow: function(documentContent){
 	  var formToOpen = window.open(" ", "Zweitfenster", "scrollbars=1,width=400,height=300,left=100,top=200");
	  formToOpen.document.innerHTML = documentContent;
    },	
   /**
    *
    *
    */ 
    addRowTable : function(targetRow, newRowContent, colSpan){
      var trElm = document.getElementById(targetRow);
      trElm.innerHTML = newRowContent;
    },
   /**
  	* 
  	*/
 	addContentToDiv : function(targetDiv, htmlContent){
 	   var trElm = document.getElementById(targetDiv);
	   trElm.innerHTML = htmlContent;
	   Effect.SlideDown(targetDiv);
 	},
	/*
	 *
	 */
	MSDA : "Microsoft.XMLHTTP",
	/*
	 * 
	 */
	HTTPMethodGET : 'GET',
	/*
	 * 
	 */
	HTTPMethodPOST : 'POST',
	/*
	 * 
	 */
	getURLPatter : function(doAction){
		return APPLICATIONCONTEXT+doAction;
	},
 	/**
 	 *
 	 *
  	 */ 	
	 addRowTableDefault : function(targetRow, newRowContent){
       CursoUtils.addRowTable(targetRow, newRowContent, CursoUtils.defaultCell);
 	},

 	/**
	 * 
	 * @param {Object} obj
	 */
	getNameValueAsString : function (obj) {
		var body  = CursoUtils.getNameValuePairHelp(obj);
		return body; 
	},
	/**
	 * 
	 * @param {Object} obj
	 */
	getNameValueAsHash :function(nodes){
		var myHashAry = new Array();
		// get child of this form
	  	myHashAry= CursoUtils.getNameValueHashHelp(nodes, myHashAry);
		return myHashAry; 
	},
	/**
	 * 
	 * @param {Object} myHashAry
	 */
	getNameValueHashHelp : function( nodes, myHashAry){
		// body content collector
	  var parameters="";
	  // for each element in this form parse name value
	  for (var i=0; i<nodes.length; i++) {
	  	 // check if is input element
         if (nodes[i].tagName == "INPUT") {
         	// text element
            if (nodes[i].type == "text") {
               myHashAry[nodes[i].name]= new MyBean(nodes[i].name,nodes[i],nodes[i].value);
		    }
            // checkbox.
            if (nodes[i].type == "checkbox") {
               if (nodes[i].checked) {
                  myHashAry[nodes[i].name]=new MyBean(nodes[i].name,nodes[i],nodes[i].value);
               } else {
                  myHashAry[nodes[i].name]=new MyBean(nodes[i].name,nodes[i],'');
               }
		    }
            // radio
            if (nodes[i].type == "radio") {
               if (nodes[i].checked) {
                  myHashAry[nodes[i].name]=new MyBean(nodes[i].name,nodes[i],nodes[i].value);
               }
		    }
			if (nodes[i].type == "hidden") {
            	  myHashAry[nodes[i].name]=new MyBean(nodes[i].name,nodes[i],nodes[i].value);
         	}
         }  
         // check if it s select element. 
         if (nodes[i].tagName == "SELECT") {
            var sel = nodes[i];
			myHashAry[sel.name] =new MyBean(nodes[i].name,nodes[i],sel.options[sel.selectedIndex].value);
         }
         if (nodes[i].tagName == "TEXTAREA") {
        	myHashAry[nodes[i].name]=new MyBean(nodes[i].name,nodes[i],nodes[i].value);		 
         }
      }
	  return myHashAry;
   },
   /**
 	* get namevaluepair from the the given form element 
 	* @param {form} the node element form
    */
	getNameValuePairHelp : function (nodes) {
	  // body content collector
	  var parameters="";
	  // for each element in this form parse name value
	  for (var i=0; i<nodes.length; i++) {
	  	 // check if is input element
         if (nodes[i].tagName == "INPUT") {
         	// text element
            if (nodes[i].type == "text") {
               parameters += nodes[i].name + "=" + nodes[i].value + "&";
		    }
            // checkbox.
            if (nodes[i].type == "checkbox") {
               if (nodes[i].checked) {
                  parameters += nodes[i].name + "=" + nodes[i].value + "&";
               } else {
                  parameters += nodes[i].name + "=&";
               }
		    }
            // radio
            if (nodes[i].type == "radio") {
               if (nodes[i].checked) {
                  parameters += nodes[i].name + "=" + nodes[i].value + "&";
               }
		    }
			if (nodes[i].type == "hidden") {
            	var hiddenItem = nodes[i];
                parameters += hiddenItem.name + "=" + hiddenItem.value + "&";
         	}
         }  
         // check if it s select element. 
         if (nodes[i].tagName == "SELECT") {
            var sel = nodes[i];
            parameters += sel.name + "=" + sel.options[sel.selectedIndex].value + "&";
         }
         if (nodes[i].tagName == "TEXTAREA") {
        	parameters += nodes[i].name + "=" + nodes[i].value + "&";		 
         }
      }
	  return parameters;
  },
 /**
  *
  *
  *
  *
  */
 disableOrEnableElem : function(actPerformer, listener, styleDis, styleEn,myform)
 {
 	var elem = document.forms[myform].elements[listener];
	if(actPerformer.checked){
		elem.disabled=false;
		elem.className=styleEn;
	}else{
		elem.disabled=true;
		elem.className=styleDis;
	}
 },
 /**
  * 
  * @param {Object} actPerformer
  * @param {Object} listener
  * @param {Object} styleDis
  * @param {Object} styleEn
  */
 disableOrEnableText : function(actPerformer, listener, styleDis, styleEn)
 {
 	var elem = document.getElementById(listener);
	if(actPerformer.checked){
		elem.className=styleEn;
	}else{
		elem.className=styleDis;
	}
 },
 /**
  *
  *
  *
  *
  */
  createTable : function()
  {
  var tableCode ='<table width="100%" cellspacing="0" cellpadding="0" class="cLoadTable">';
  tableCode+='<tr>';
  tableCode+=' <td  class="cloadingSpace">&nbsp;</td>';
  tableCode+=' <td></td>';
  tableCode+=' <td>&nbsp;</td>';
  tableCode+='</tr>';
  tableCode+='<tr>';
  tableCode+=' <td>&nbsp;</td>';
  tableCode+=' <td class="cloadingText">Loading ....</td>';
  tableCode+=' <td>&nbsp;</td>';
  tableCode+='</tr>';
  tableCode+='<tr>';
  tableCode+=' <td >&nbsp;</td>';
  tableCode+=' <td class="cloading">&nbsp;</td>';
  tableCode+=' <td>&nbsp;</td>';
  tableCode+='</tr>';
  tableCode+='<tr>';
  tableCode+=' <td  class="cloadingSpace">&nbsp;</td>';
  tableCode+=' <td></td>';
  tableCode+=' <td>&nbsp;</td>';
  tableCode+='</tr>';
  tableCode+='</table>';
  return tableCode
 },
 /**
 * 
 * @param {Object} targetNode
 * @param {Object} indexLoad
 */
 showWaitingforLoad : function(targetNode)
 {
  CursoUtils.addRowTableDefault(targetNode,CursoUtils.createTable());
 },
 /**
  * 
  * @param {Object} targetNode
  */
 buildWaitingDiv : function(targetNode){
 	var divId = "result"+targetNode;
 	var divElem = document.getElementById(divId);
	divElem.innerHTML = CursoUtils.createTable();
 }
 ,
 /**
  * 
  * @param {Object} elem
  * @param {Object} parentElem
  */	
 addElement : function(elem, parentElem){
  	var __root__ = document.getElementById(parentElem);
	__root__.appendChild(elem);
 },
 /**
  * 
  */
 TYPE : {
     STRING : "String",
	 BOOLEAN :"boolean",
	 INT :"int",
	 DATE :"date",
	 GROUPBOOLEAN : "GBoolean"
 },
 /**
  * 
  * @param {Object} toColaps
  * @param {Object} but
  */
 collapsThis : function(toColaps, but){
	var elem = document.getElementById(toColaps);
	elem.style.visibility='visible';
	but.style.visibility='hidden';
 },
 buildAction : function(myaction,pattern,num,post){
 	return (myaction+num+"."+pattern+"?"+post);
 }
};

/**
 * CursoWeb
 *
 *
 *
 *
 *
 */
var CursoWeb=
{
 //
 URLPattern : "/",
// URLPattern : "/ct/",
 URLHttps : "https://",
 HOSPIP : "www.curso24.de",
 //HOSPIP : "www.curso.de",
 //HOSPIP : "192.168.178.29",
 URLHttp : "http://",
  /**
   * 
   * @param {Object} params
   */	
  createMappingAction : function( params ){
 	return  CursoWeb.URLPattern+params;
  },
  /**
   * 
   * @param {Object} params
   */	
  createHTTPSRequest :function(params){
  	var https = CursoWeb.URLHttps +CursoWeb.HOSPIP+ CursoWeb.URLPattern;
	return (https+params);
  },
  createAbsolutMappingAction : function( params ){
 	return  this.URLHttp+this.HOSPIP+this.URLPattern+params;
  }		
};
var CursoValidator = {
	
 /**
  * 
  * @param {Object} ThisForm
  * @param {Object} this.FormElem
  */		
 validateForm : function(ThisForm, elems){
 	var validation = false;
 	if( !ThisForm || !elems )
		return false;
	var formElem = document.getElementsByName(ThisForm);
	if( !formElem )
		return validation;	
	for( key in elems ) {
		var _item_ = formElem[0].elements[key];
		var _value_ = elems[key];
		switch( _value_) {
            case CursoUtils.TYPE.STRING:
				validation=CursoValidator.validateString(_item_, "");
                break;
            case CursoUtils.TYPE.DATE:
				validation=CursoValidator.validateDate(_item_);
                break;
			case CursoUtils.TYPE.INT:
			    validation=CursoValidator.validateNumber(_item_);
                break;
			case CursoUtils.TYPE.GROUPBOOLEAN:
			    validation= CursoValidator.validateGroupBool(_item_); 
                break;
			
        }
	}
	return validation;;
 },	
/**
 * validate string lenght of the given field.
 * 
 * @param field to validate
 * @param msg message to show if validate faild.
 * @param min the minimum lenght
 * @param max the maximum lenght
 * 
 * @return false validation isn t ok
 *         true ok.
 */
  validateString : function(field, msg, min, max) 
  {
	if (!min) { min = 1; }
	if (!max) { max = 65535; }
	if (!field.value || 
		field.value.length < min ||  
		field.value.max > max) 
	{
		field.style.backgroundColor ="#FFC4C4";
		return false;
	}
	return true;
 },
 /**
  * 
  * @param {Object} itemToVal
  * @param {Object} fields
  * @param {Object} messageTo
  */
 validateStrings : function(itemToVal, fields, messageTo){
 	var validation = true;
 	elem = document.getElementById(itemToVal);
	
	for(var i = 0; i<fields.length;i++){
	//	 field = elem.children.[fields[i]];
		 validation = CursoValidator.validateString(field,messageTo,null,null);
	}
	return validation;
 }, 
/**
 * validate email adress.
 * 
 * @param email the value to validate
 * @param msg the message to show if this validation faild.
 * @param optional true field required.
 *                 false field not required.
 * 
 * @return true validation is ok.
 *         false validation faild.
 */
  validateEmail : function(email, msg, optional) 
  {
	if (!email.value && optional) {
		return true;
	}
	var re_mail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z])+$/;
	if (!re_mail.test(email.value)) 
	{
		email.style.backgroundColor="#FFC4C4";
		return false;
	}
	return true;
  },
  validateBorns : function(DAT, XX,YY, msg){
	if (!DAT.value || 
		(DAT.value < XX ||  
		DAT.value > YY)) 
	{
		DAT.style.backgroundColor ="#FFC4C4";
		 alert( msg);
		return false;
	}
	return true;   
  },
  /**
   * 
   * @param {Object} checkboxV
   */
   validateCheckbox : function(checkboxV, msg) 
  {
	if( checkboxV.checked )
		return true;
    alert( msg);
	return false;
  },
/**
 * validate the given number 
 * 
 * @param field the number value to validate
 * @param msg the message to show if validation faild.
 * @param min the minimum born that should this number have.
 * @param max the maximum born that should this number have.
 * 
 * @return false validation isn t ok
 *         true validation ok
 */
  validateNumber : function(field, msg, min, max) 
  {
  	if (!min) { min = 0; }
	if (!max) { max = 255; }
	if ( (parseInt(field.value) != field.value) ||  
       field.value.length < min || 
       field.value.length > max) 
    {
		field.style.backgroundColor="#FFC4C4";
		return false;
	}
	return true
  },
  /**
   * 
   * @param {Object} field
   */
  validateGroupBool : function( field ){
  	 return true;
   },
  /**
   * 
   * @param {Object} _date_
   */
  validateDate : function( field){
  	if(!field.value){
		field.style.backgroundColor="#FFC4C4";
		return false;
	}
  	return true;
  }
};

/**
 * AjaxConnection constructor, does initialize to ajax connector; 
 */
function AjaxConnector(){
   /**
	* create xml http request. 
	*/
	this.getRequest = function(){
		//
		if (window.XMLHttpRequest) {
        	return new XMLHttpRequest();
    	} 
    	//
    	else if (window.ActiveXObject) {
        	return new ActiveXObject(MSDA);
    	}
    }

	/**
	 * 
	 * @param {Object} HTTP_METHOD
	 * @param {Object} URL
	 */
    this.fireRequest = function(obj)
    {
		obj.waiting();
		
        var httpRequest = this.getRequest();
   		httpRequest.onreadystatechange = function()
  		{
		 	// Wenn Fortschritt = 0, dann wurde der Request noch nicht abgeschickt,
    	 	// ansonsten: Upload / Download wurde noch nicht bet?tigt
    	 	if(httpRequest.readyState == 0){
      	 	// In einer Statusanzeige k?nnte jetzt "uninitialized" stehen,
      	 	// es k?nnte jetzt ein Statusbild angezeigt werden oder ?hnliches
      	 	// Wenn Fortschritt = 1, Request wird gestartet, wurde aber noch nicht abgeschickt
   		 	}else if(httpRequest.readyState == 1){
      	 	// In einer Statusanzeige k?nnte jetzt "loading process" stehen
      	 	// Wenn Fortschritt = 2, Request wurde ausgef?hrt,
      	 	// es wird auf Server-Antwort gewartet
   		 	}else if(httpRequest.readyState == 2){
     	 	// In einer Statusanzeige k?nnte jetzt "process loaded" stehen
     	 	// Wobei der Prozess noch nicht beendet ist, da auf eine
     	 	// Antwort des Servers gewartet wird
     	 	// Wenn Fortschritt = 3, Request ausgef?hrt und Teile der
     	 	// Antwort des Servers sind schon im Puffer
   	     	}else if(httpRequest.readyState == 3){
     	 	// In einer Statusanzeige k?nnte jetzt "reading/sending data" stehen
     	 	// Wenn Fortschritt = 4, Request ausgef?hrt und Antwort des
     	 	// Servers erhalten, Up-/Download abgeschlossen
         	}else if(httpRequest.readyState == 4){
         		//alert(httpRequest.status);
     	 		// In einer Statusanzeige k?nnte jetzt "process completed" stehen
         		// Wenn Statuscode = 200 oder "OK", Anfrage erhalten und Daten sind in Serverantwort
     	 		if(httpRequest.status == 200 || httpRequest.statusText == 'OK'){
       				obj.handelResponse(httpRequest.responseText);
   				}else{
       				alert("ERROR: "+httpRequest.statusText);
					alert(httpRequest.responseText);
    			}
   		 	}
   		 }
   	   httpRequest.open(CursoUtils.HTTPMethodGET, obj.getDoAction(), obj.isSync());	 
	   httpRequest.send(null);
	}	
	/**
	 * 
	 * @param {Object} HTTP_METHOD
	 * @param {Object} URL
	 * @param {Object} PARAMS
	 * @param {Object} formToPost
	 */
	this.firePostRequest = function(obj){
		var myform = obj.getPostForm();
		obj.waiting();
		httpRequest = this.getRequest();
		httpRequest.open(CursoUtils.HTTPMethodPOST,obj.getDoAction(), obj.isSync());
		httpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      	httpRequest.setRequestHeader("Content-length", myform.length);
		httpRequest.onreadystatechange = function() 
		{
			
		 	// Wenn Fortschritt = 0, dann wurde der Request noch nicht abgeschickt,
    	 	// ansonsten: Upload / Download wurde noch nicht bet?tigt
    	 	if(httpRequest.readyState == 0){
				
      	 	// In einer Statusanzeige k?nnte jetzt "uninitialized" stehen,
      	 	// es k?nnte jetzt ein Statusbild angezeigt werden oder ?hnliches
      	 	// Wenn Fortschritt = 1, Request wird gestartet, wurde aber noch nicht abgeschickt
			}else if(httpRequest.readyState == 1){
      	 	// In einer Statusanzeige k?nnte jetzt "loading process" stehen
      	 	// Wenn Fortschritt = 2, Request wurde ausgef?hrt,
      	 	// es wird auf Server-Antwort gewartet
		
			   
   		 	}else if(httpRequest.readyState == 2){
     	 	// In einer Statusanzeige k?nnte jetzt "process loaded" stehen
     	 	// Wobei der Prozess noch nicht beendet ist, da auf eine
     	 	// Antwort des Servers gewartet wird
     	 	// Wenn Fortschritt = 3, Request ausgef?hrt und Teile der
     	 	// Antwort des Servers sind schon im Puffer
			 
   	     	}else if(httpRequest.readyState == 3){
     	 		// In einer Statusanzeige k?nnte jetzt "reading/sending data" stehen
     	 		// Wenn Fortschritt = 4, Request ausgef?hrt und Antwort des
     	 		// Servers erhalten, Up-/Download abgeschlossen
			}else if(httpRequest.readyState == 4){
     	 		// In einer Statusanzeige k?nnte jetzt "process completed" stehen
         		// Wenn Statuscode = 200 oder "OK", Anfrage erhalten und Daten sind in Serverantwort
         		if(httpRequest.status == 200 || httpRequest.status == 'OK'){
       				// Datei wird als alert() ausgegeben
				   obj.handelResponse(httpRequest.responseText);
					
					// Wenn nichts zutrifft
     			}else{
       				alert("ERROR: "+httpRequest.statusText);
					alert(httpRequest.responseText);
    			}
   		 	}
		}
		httpRequest.send(myform);	
	}
 };
 /**
  * 
  * @param {Object} myname
  * @param {Object} myfield
  * @param {Object} myvalue
  */
 function MyBean(myname, myfield, myvalue){
	this.myname=myname;
	this.myfield=myfield;
	this.myvalue=myvalue;
	this.getMyName= function(){
		return this.myname;
	}
	this.getMyField= function(){
		return this.myfield;
	}
	this.getMyValue= function(){
		return this.myvalue;
	}
};

