var chatwindow=null;
var world_id =2679;
var naviFolders = new Array("homeLi","districtLi","yachtfinderLi","werftenLi","serviceLi","specialsLi","motorbootLi","bewertungLi");//,"luxusLi"
var revierFolders = new Array("euroatlantik","indischer","mittelmeer","suedsee");
var marinaFolders = new Array("Allgemeines","Ausstattung","Plan","Seewetter","Yachten","Meinung","Videos");
var cityFolders = new Array("Allgemeines","Images","Videos");
var searchFolders = new Array("districtSearch","marinaSearch","citySearch","yachtSearch","vendorSearch","yachtmodelleSearch","yachttestSearch","sonstigesSearch");
var votingFolders = new Array("yachtVoting","yachtdetailVoting","marinaVoting","districtVoting","providerVoting","serviceVoting");
function submitQuickSearch(){
	var value = AJAXgetTextParameter(document.getElementById("QuickSearchInput"));
	window.location.href=absolutePath+"?"+value;
}
function submitFullTextSearch(){
	var value = AJAXgetTextParameter(document.getElementById("FullTextSearchInput"));
	window.location.href=absolutePath+"?"+value;
}
function loadDistricts(district_oid,target,level,event){
	if(!district_oid)district_oid=world_id;
	var select = document.getElementById("district1Div").getElementsByTagName("select")[0];
	select.style.backgroundColor="#ffffff";
	var url = absolutePath+"AJAXYachtRequest.jsp"+sessionid;
	url +="?action=1&District="+district_oid+"&level="+level;
	var nextLevel= document.getElementById(target+(level+1)+"Div");
	if(nextLevel){
		nextLevel.innerHTML="<select class='select1' ></select>";
	}
	AJAXloadHTMLinTarget(url,target+level+"Div",null,event);
}
function loadDistrictsExpressFinder(target){
	var url = absolutePath+"AJAXYachtRequest.jsp"+sessionid+"?action=22";
	AJAXloadHTMLinTarget(url,target,null,null);
}
function searchDistrict1(){
	loadDistricts(document.getElementById("district1").value,"district",2,null);
}
function searchDistrict2(){
	loadDistricts(document.getElementById("district2").value,"district",3,null);
}
function searchDistrict3(){}

function searchDistrict1Detail(){
	var district_oid=document.getElementById("district1").value;
	var url = absolutePath+"AJAXYachtRequest.jsp"+sessionid;
	url +="?action=1&District="+district_oid+"&level=2Detail";
	//hideDiv("addMarinaButton");
	AJAXloadHTMLinTarget(url,"district2Div",null,null);
}
function searchDistrict2Detail(){
	var district_oid=document.getElementById("district2Detail").value;
	/*if(district_oid>-1){
		showDiv("addMarinaButton");
	}else{
		hideDiv("addMarinaButton");
	}*/
}
function showDistrict3Detail(){
	var district_oid=document.getElementById("district2Detail").value;
	var url = absolutePath+"AJAXYachtRequest.jsp"+sessionid;
	url +="?action=12&District="+district_oid+"&level=2Detail";
	AJAXsendRequest(url,"processReqDistrictCheck(\""+district_oid+"\")",null,null);
}
function processReqDistrictCheck(district_oid){
	if(document.getElementById("district"+district_oid))return;
	document.getElementById("district3Div").innerHTML += req.responseText;
}
function searchMini(){
	if(!document.getElementById("district1") || document.getElementById("district1").value=='-1'){
		var select = document.getElementById("district1Div").getElementsByTagName("select")[0];
		select.style.backgroundColor="#ff7070";
		return;
	}
	document.forms["miniSucheForm"].submit();
}

function searchAndResetYachtDetail(event){
	var yfForm = document.getElementById("YachtFinderForm");
	yfForm.elements["length_slider_max"].value=0;
	yfForm.elements["length_slider_min"].value=0;
	yfForm.elements["bunk_slider_max"].value=0;
	yfForm.elements["bunk_slider_min"].value=0;
	yfForm.elements["price_slider_max"].value=0;
	yfForm.elements["price_slider_min"].value=0;
	resetSlider();
	searchYacht(event);
}
function searchAndResetYacht(event){
	var yfForm = document.getElementById("YachtFinderForm");
	yfForm.elements["length_slider_max"].value=0;
	yfForm.elements["length_slider_min"].value=0;
	yfForm.elements["bunk_slider_max"].value=0;
	yfForm.elements["bunk_slider_min"].value=0;
	yfForm.elements["price_slider_max"].value=0;
	yfForm.elements["price_slider_min"].value=0;
	resetSlider();
	searchYacht(event);
}
function searchDistrictYacht(){
	var elements = document.getElementById("YachtFinderForm").elements;
	var disSelected=false;
	for(var i=0;i<elements.length;i++){
		var id= elements[i].id;
		if(id.indexOf("ip")!=0)continue;
		if(elements[i].value){
			disSelected=true;
			break;
		}
	}
	if(!disSelected)return;
	searchAndResetYachtDetail(null);
	showFolder2('suchergebniss');
}
function resetSlider(){
	document.getElementById("sliders").innerHTML="";
}
function searchYacht(event){
	var url = AJAXgetForm("YachtFinderForm");
	AJAXloadHTMLinTarget(url,"YachtListDiv","showSlider();",event);
}
function yachtFinder(){
	window.location.href=AJAXgetForm("YachtFinderForm");
}
function showSlider(){
	if(document.getElementById("sliders").innerHTML.length==0){
		AJAXloadHTMLinTarget(absolutePath+"AJAXSlider.jsp"+sessionid,"sliders",null,null);
	}
}
function sortOfferList(sortOrder){
	var url = AJAXgetForm("YachtFinderForm");
	url +="&order="+sortOrder;
	AJAXloadHTMLinTarget(url,"YachtListDiv",null,null);
}
function posOfferList(pos){
	var url = AJAXgetForm("YachtFinderForm");
	url +="&limit="+pos;
	AJAXloadHTMLinTarget(url,"YachtListDiv",null,null);
}
function setOfferListPosCount(){
	var url = AJAXgetForm("YachtFinderForm");
	url +="&poscount="+document.getElementById("posCount").value;
	AJAXloadHTMLinTarget(url,"YachtListDiv",null,null);
}
function show_value(x){
	document.getElementById(x).style.display="block";
}
function hide_value(x){
	document.getElementById(x).style.display="none";
}
function showWeeks(year){
	showDiv("weeks"+year);
//	hideDiv("moreWeeksBtn");
}
function loadAval(yacht_oid,event){
	var url = absolutePath+"AJAXYachtRequest.jsp"+sessionid;
	url +="?action=3&yacht_oid="+yacht_oid+"&duration="+document.getElementById("DurationSelect").value;
	AJAXloadHTMLinTarget(url,"WeekSelectDiv","loadPrice(null)",event);
}
function openPrintView(yacht_oid,event){
	var url = absolutePath+"PrintView.jsp"+sessionid;
	url +="?yacht_oid="+yacht_oid;
	PrintView = window.open(url,"PrintView"+yacht_oid,"height=650,width=1050,scrollbars=yes");
	PrintView.focus();
}
function addToCart(yachtweek_oid,duration,event){
	var url = absolutePath+"AJAXYachtRequest.jsp"+sessionid;
	url +="?action=7&yachtweek_oid="+yachtweek_oid+"&duration="+duration;
	AJAXloadHTMLinTarget(url,"CartDiv",null,event);
}
function loadCart(){
	var url = absolutePath+"AJAXYachtRequest.jsp"+sessionid;
	url +="?action=7";
	AJAXloadHTMLinTarget(url,"CartDiv",null,null);
}
function openImagesPopup(event){
	var YachtImagesPopupContainer = document.getElementById('YachtImagesPopupContainer');
	var LightWindow = document.getElementById('LightWindow');
	LightWindow.innerHTML=YachtImagesPopupContainer.innerHTML;
	showLightWindow(100,0,712,452);
	showDiv('ImagesPopup');
	slider = new UI.Carousel('ImagesPopup',{direction:'vertical'});
}
function submitCompare(){
	var url = AJAXgetForm("CompareForm");
	AJAXloadHTMLinTarget(url,"LightWindow",null,null);
}
function openCompare(event){
	var url = absolutePath+"Compare.jsp"+sessionid+"?";
	var elements = document.forms["CartForm"].elements;
	var hit=0;
	for(var i=0;i<elements.length;i++){
		if(elements[i].name!="yacht" || !elements[i].checked)continue;
		url +="&yacht="+elements[i].value;
		hit++;
	}
	if(hit<2){
		showMessage("Bitte wählen Sie mindestens zwei Yachten aus.");
		return;
	}else if(hit>5){
		showMessage("Bitte wählen Sie maximal 4 Yachten aus.");
		return;
	}
	showLightWindow(50,0,920,0);
	AJAXloadHTMLinTarget(url,"LightWindow",null,event);
}
function loadAJAXWindow(url,curWindow){
	curWindow.setAjaxContent(url, {
			evalJS:'force',method: 'get',evalJSON:false,
		    onCreate: function() {this.setContent('<div class="message">Please wait...</div><div class="spinner"></div>'); }
		  });
}
function openAJAXWindow(width,height,top,left,curWindow){
	if(!curWindow){
		curWindow = new UI.Window({theme:"mac_os_x",shadow: true, width:width,height: height});
	}
	if(top==-1){
		curWindow.center();
	}else{
		curWindow.setPosition(top,left);
	}
	curWindow.show();
	curWindow.activate();
	curWindow.bringToFront();
	return curWindow;
}
var windowOrderForm2;
function openOrderForm2(yw,duration,event){
	var url = absolutePath+"AJAXYachtRequest.jsp"+sessionid;
	url +="?action=18&week="+yw+"&duration="+duration;
	showLightWindow(50,0,920,0);
	AJAXloadHTMLinTarget(url,"LightWindow",null,event);
}
function openCartSaveForm(event){
	showLightWindow(0,0,500,0);
	var url = absolutePath+"AJAXYachtRequest.jsp"+sessionid+"?action=9";
	AJAXloadHTMLinTarget(url,"LightWindow",null,event);
}
function saveCart(){
	var url = AJAXgetForm("CartSaveOffer");
	url +="&action2=save";
	var offerDiv = document.getElementById("LightWindow");
	AJAXloadHTMLinTarget(url,"LightWindow",null,null);
}
function openOrderForm(yw,duration,event){
	showLightWindowYF(100,0,560,670);
	var url = absolutePath+"AJAXYachtRequest.jsp"+sessionid;
	url +="?action=5&week="+yw+"&duration="+duration+"&set_special=true";
	var elements = document.forms["SpecialForm"].elements;
	for(var i=0;i<elements.length;i++){
		if(!elements[i].value)continue;
		if(elements[i].value!="checked")continue;
		url +="&"+elements[i].name+"="+elements[i].value;
	}
	AJAXloadHTMLinTarget(url,"LightWindow",null,event);
}
function openVotingPopup(id_name,object_oid){
	showLightWindowYF(10,0,560,670);
	var url = absolutePath+"AJAXYachtRequest.jsp"+sessionid;
	url +="?action=14&"+id_name+"="+object_oid;
	AJAXloadHTMLinTarget(url,"LightWindow",null,null);
}
function openNewsletter(){
	showLightWindowYF(100,0,500,300);
	var url = absolutePath+"AJAXYachtRequest.jsp"+sessionid;
	url +="?action=19";
	AJAXloadHTMLinTarget(url,"LightWindow",null,null);
}
function getCookie(name){
	var cookies = document.cookie.split(";");
	for(var i=0;i<cookies.length;i++){
		if(cookies[i].indexOf(name)>-1){
			return cookies[i].substring(cookies[i].indexOf("=")+1);
		}
	}
	return null;
}
function openAutoNewsletter(){
	var cookie = getCookie("ycf_newsltter_reg");
	if(cookie)return;
	showLightWindowYF(0,0,500,300);
	var url = absolutePath+"AJAXYachtRequest.jsp"+sessionid;
	url +="?action=19";
	AJAXloadHTMLinTarget(url,"LightWindow",null,null);
}
function submitNLForm(){
	var url = AJAXgetForm("NewsLetterForm");
	AJAXloadHTMLinTarget(url,"LightWindow",null,null);
}
function disableNLNotify(){
	url = absolutePath+"AJAXYachtRequest.jsp"+sessionid+"?action=105";
	AJAXloadHTMLinTarget(url,"LightWindow","hideLightWindow();",null);
}
function loadOrderForm(yacht_oid,week_oid,event){
	var url = absolutePath+"AJAXYachtRequest.jsp"+sessionid+"?action=4&yacht="+yacht_oid;
	if(document.getElementById("WeekSelect")){
		var week = document.getElementById("WeekSelect").value;
		var duration = document.getElementById("DurationSelect").value;
		url +="&duration="+duration+"&week="+week;
	}else if(week_oid){
		url +="&duration=1&week="+week_oid;
	}
	AJAXloadHTMLinTarget(url,"OrderFormDiv",null,event);
}
function openInquiryForm(yacht_oid,event){
	showLightWindow(100,0,560,450);
	var url = absolutePath+"AJAXYachtRequest.jsp"+sessionid+"?action=10&yacht="+yacht_oid;
	AJAXloadHTMLinTarget(url,"LightWindow",null,event);
}
function sendInquiry(){
	var url = AJAXgetForm("YachtOffer");
	AJAXloadHTMLinTarget(url,"LightWindow",null,null);
}
function setVotingImg2(value,id){
	document.getElementById("voting_value_"+id).value=value;
}
function showVotingImg2(value,id){
	var img = document.getElementById("VotingImg_"+id);
	if(value==0){
		value = document.getElementById("voting_value_"+id).value;
		//alert(value);
		img.src="http://www.yachtcharterfinder.com/images/Voting2_"+value+".jpg";
	}else{
		img.src="http://www.yachtcharterfinder.com/images/Voting2_"+value+".jpg";
	}
}

function showVotingImg3(value,id){
	var img = document.getElementById("VotingImg_"+id);
	if(value==0){
		value = document.getElementById("voting_value_"+id).value;
		//alert(value);
		img.src="http://www.yachtcharterfinder.com/images/Voting3_"+value+".jpg";
	}else{
		img.src="http://www.yachtcharterfinder.com/images/Voting3_"+value+".jpg";
	}
}
function submitTripVoting(){
	/*var elements = document.getElementById("TripVotingForm").elements;
	for(var i=0;i<elements.length;i++){
		if(elements[i].name.indexOf("text")!=0)continue;
		if(!elements[i].activated)elements[i].value="";
	}*/
	document.getElementById("TripVotingAction").value='submit';
	document.getElementById("TripVotingForm").submit();
}
function saveTripVoting(){
	/*var elements = document.getElementById("TripVotingForm").elements;
	for(var i=0;i<elements.length;i++){
		if(elements[i].name.indexOf("text")!=0)continue;
		if(!elements[i].activated)elements[i].value="";
	}*/
	document.getElementById("TripVotingAction").value='save';
	document.getElementById("TripVotingForm").submit();
}

function setVotingImg(value){
	document.forms["VotingForm"].elements["voting_value"].value=value;
}
function showVotingImg(value){
	var img = document.getElementById("VotingImg");
	if(value==0){
		value = document.forms["VotingForm"].elements["voting_value"].value;
		//alert(value);
		img.src="http://www.yachtcharterfinder.com/images/Voting"+value+".jpg";
	}else{
		img.src="http://www.yachtcharterfinder.com/images/Voting"+value+".jpg";
	}
}
function showVoting(voting_oid){
	//alert(document.getElementById("VotingDiv"+voting_oid).style.height);
	document.getElementById("VotingDiv"+voting_oid).style.height="auto";
}
function saveVotingForm(){
	var url = AJAXgetForm("VotingForm");
	AJAXloadHTMLinTarget(url,"LightWindow",null,null);
}
function saveCommitCardForm(){
	var url = AJAXgetForm("CommitCardForm");
	AJAXloadHTMLinTarget(url,"CommitFormDiv",null,null);
}
function continueBooking(action){
	var url = AJAXgetForm("YachtOffer");
	if(action!=null){
		url += "&action2="+action;
	}
	AJAXloadHTMLinTarget(url,"LightWindow",null,null);
}
function setBgBlack(divName){
	var bodyhight=document.getElementsByTagName('body')[0].scrollHeight;
	var bodywidth=document.getElementsByTagName('body')[0].scrollWidth;
	document.getElementById(divName).style.width=bodywidth+'px';
	document.getElementById(divName).style.height=bodyhight+'px';
	showDiv(divName);
}
function loadDistrictChooser(district1_oid,district2_oid,event){
	var url = absolutePath+"AJAXYachtRequest.jsp"+sessionid;
	url +="?action=1&District="+world_id+"&level=1";
	AJAXloadHTMLinTarget(url,"district1Div","setSelect('district1',"+district1_oid+")",event);

	url = absolutePath+"AJAXYachtRequest.jsp"+sessionid;
	url +="?action=1&District="+district1_oid+"&level=2";
	AJAXloadHTMLinTarget(url,"district2Div","setSelect('district2',"+district2_oid+")",event);
}
function setSelect(district,district_oid){
	var select = document.getElementById(district);
	for(var i=0;i<select.options.length;i++){
		if(!select.options[i].value)continue;
		if(select.options[i].value==district_oid){
			select.selectedIndex=i;
			break;
		}
	}
}
function openDistrict(selectName,event){
	//var name = document.getElementById(selectName).options[document.getElementById(selectName).selectedIndex].text;encodeURIComponent(name)
	window.location.href=absolutePath+"Charter-Revier/"+document.getElementById(selectName).value+".html";
}
function charterAngebote(selectName,event){
	window.location.href=absolutePath+"Charter-Yacht-finden//district2/"+document.getElementById(selectName).value+".html";
}
function hideLightWindow(){
	hideDiv("LightWindow");
	//hideDiv("BlackBackground");
}
function loadYachtDetailSelect( event){
	url = absolutePath+"AJAXYachtRequest.jsp"+sessionid;
	url +="?action=11&vendor_oid_fk="+document.getElementById("vendor_oid_fk").value;
	AJAXloadHTMLinTarget(url,"yachtmodellDiv",null,event);
}
function showDistrictCheck3(){
	var url = absolutePath+"AJAXYachtRequest.jsp"+sessionid;
	url +="?action=12&District="+district_oid+"&level="+level;
	AJAXloadHTMLinTarget(url,target+"3Div",null,event);
}
function setYachtImage(imageUrl,name,aspekt){
	var image = new Image();
	image.src = imageUrl;
	var html = "<img src='"+imageUrl+"' ";
	if(aspekt>1){
		html +=" width='355' ";
		var height = 355/parseFloat(aspekt);
		height = 280-height;
		height /=2;
		html +=" style='margin-top:"+height+"px;' ";
	}else{
		html +=" height='280' ";
	}
	html +=" />";
	document.getElementById("PopupTopImage"+name).innerHTML=html;
}
function setImagesCity(imageUrl,name){
	document.getElementById("PopupTopImage").style.background="url("+imageUrl+") center no-repeat";
	document.getElementById("CityImageName").innerHTML = name;
}
function setImagesPopup(imageUrl,name){
	if(name){
		document.getElementById("PopupTopImage"+name).style.background="url("+imageUrl+") center no-repeat";
	}else{
		document.getElementById("PopupTopImage").style.background="url("+imageUrl+") center no-repeat";
	}
}
function showFolder2(folderName){
	for(var i=0;i<folders.length;i++){
		var li = document.getElementById("li-"+folders[i]);
		if(folders[i].indexOf(folderName)<0){
			hideDiv(folders[i]);
			li.className ='';
		}else{
			showDiv(folders[i]);
			li.className ='active';
		}
	}

}

function showLightWindowYF(top,left,width,height){
	var scrollPos = document.body.scrollTop;
	if(scrollPos==0)scrollPos=document.documentElement.scrollTop;
	var offerDiv = document.getElementById("LightWindow");
	if(top>0){
		scrollPos +=top;
	}else{
		scrollPos+=100;
	}
	offerDiv.style.top=scrollPos+"px";
	if(left<=0){
		if(window.innerWidth)left = ((window.innerWidth-width)/2);
		else left = ((document.body.clientWidth -width)/2);
	}
	offerDiv.style.left=left+"px";
	offerDiv.style.width=width+"px";
	if(height>0)offerDiv.style.height=height+"px";
	showDiv('LightWindow');
}

function changeStyle(className,styleName,styleValue){
	for(var j=0;j<document.styleSheets.length;j++){
		var rules = document.styleSheets[j].cssRules;
		if(!rules)rules = document.styleSheets[j].rules ;
		for(var i=0;i<rules.length;i++){
			if(rules[i].selectorText==className){
				rules[i].style[styleName]=styleValue;
				return;
			}
		}
	}
}

function hideDistrictNavi(){
	hideDiv("districtNavi");
}
function showFolder(folderName,folderArray){
	for(var i=0;i<folderArray.length;i++){
		var li = document.getElementById(folderArray[i]);
		if(li==null){
			alert("folder nicht gefunden:"+folderArray[i]);
			return;
		}
		if(folderArray[i].indexOf(folderName)<0){
			li.className ='';
		}else{
			li.className ='active';
		}
	}
}
function hideEmptyFolders(folders,foldersCount,pre){
	for(var i=0;i<folders.length;i++){

		if(foldersCount[i]==0)hideDiv(pre+folders[i]);
	}
}
function showFolderDiv(folderName,folderArray){
	for(var i=0;i<folderArray.length;i++){
		var li = document.getElementById("Li"+folderArray[i]);
		var div = document.getElementById("Div"+folderArray[i]);
		if(li==null){
			alert("Li nicht gefunden:Li"+folderArray[i]);
			return;
		}
		if(div==null){
			alert("div nicht gefunden:Div"+folderArray[i]);
			return;
		}
		if(folderArray[i].indexOf(folderName)<0){
			li.className ='';
			hideDiv(div.id);
		}else{
			li.className ='active';
			showDiv(div.id);
		}
	}
}
function showDistrictNavi(link){
	//hideDiv('serviceNavi');
	hideDiv('specialsNavi');
	showDiv('districtNavi');
	showFolder("districtLi",naviFolders);
	changeStyle(".holder-main","padding","99px 15px 0");
	var folders = document.getElementById("districtNavi").getElementsByTagName("a");
	for(var i=0;i<folders.length;i++){
		if(folders[i].href.indexOf(link)>-1){
			 folders[i].parentNode.className ='active';
			 folders[i].parentNode.parentNode.className ='active';
			 folders[i].parentNode.parentNode.parentNode.className ='active';
			 folders[i].parentNode.parentNode.parentNode.parentNode.className ='active';
			break;
		}
	}
}
function showSpecialNavi(link){
	if(link=="Motorboote"){
		showFolder("motorbootLi",naviFolders);
	}else if(link=="bewertung"){
		showFolder("bewertungLi",naviFolders);
	}else if(link=="luxusLi"){
		showFolder("luxusLi",naviFolders);
	}else{
		showDiv('specialsNavi');
		showFolder("specialsLi",naviFolders);
	}
	hideDiv('districtNavi');
	//hideDiv('serviceNavi');
	changeStyle(".holder-main","padding","99px 15px 0");
}
function showServiceNavi(){
	hideDiv('districtNavi');
	hideDiv('specialsNavi');
	showDiv('serviceNavi');
	showFolder("serivceLi",naviFolders);
	changeStyle(".holder-main","padding","99px 15px 0");
}
function showRevier(folderName){
	for(var i=0;i<revierFolders.length;i++){
		if(revierFolders[i].indexOf(folderName)<0){
			document.getElementById(revierFolders[i]+'Li').className ='';
		}else{
			document.getElementById(revierFolders[i]+'Li').className ='active';
		}
	}
}
function selectAllDistricts(){
	if(allDistricts==1){
		allDistricts=0;
	 	document.getElementById("cbAll").style.backgroundPosition="bottom";
	 }else{
	 	allDistricts=1;
	 	document.getElementById("cbAll").style.backgroundPosition="top";
	 }

	var elements = document.getElementById("YachtFinderForm").elements;
	for(var i=0;i<elements.length;i++){
		var id= elements[i].id;
		if(id.indexOf("ip")!=0)continue;
		if(allDistricts==1){
			setCheckBoxActive(id.substring(2,id.length));
		}else {
			setCheckBoxInActive(id.substring(2,id.length));
		}
	}
}
var allDistricts=1;
function setCheckBoxActive(id){
	var input = document.getElementById("ip"+id);
	var checkbox = document.getElementById("cb"+id);
	input.value=""+id;
	checkbox.style.backgroundPosition="top";
}
function setCheckBoxInActive(id){
	var input = document.getElementById("ip"+id);
	var checkbox = document.getElementById("cb"+id);
	input.value="";
	checkbox.style.backgroundPosition="bottom";
}
function setCheckBox(id){
	var input = document.getElementById("ip"+id);
	var checkbox = document.getElementById("cb"+id);
	if(input.value==id){
		input.value="";
		checkbox.style.backgroundPosition="bottom";
	}else{
		input.value=""+id;
		checkbox.style.backgroundPosition="top";
	}
}
function setCheckBox2(id){
	var input = document.getElementById("ip"+id);
	var checkbox = document.getElementById("cb"+id);
	if(input.value=="checked"){
		input.value="";
		checkbox.style.backgroundPosition="bottom";
	}else{
		input.value="checked";
		checkbox.style.backgroundPosition="top";
	}
}
var articlesListHTML=null;
function showArticle(article_oid){
	var url = absolutePath+"AJAXYachtRequest.jsp"+sessionid;
	url +="?action=17&article_oid="+article_oid;
	articlesListHTML = document.getElementById("revier-info").innerHTML;
	AJAXloadHTMLinTarget(url,"revier-info",null,null);
}
function showArticleList(){
	if(articlesListHTML!=null){
		document.getElementById("revier-info").innerHTML=articlesListHTML;
	}else {
		window.location.reload();
	}
}
var marinaListHTML=null;
function showMarina(marina_oid){
	var url = absolutePath+"AJAXYachtRequest.jsp"+sessionid;
	url +="?action=16&marina_oid="+marina_oid;
	marinaListHTML = document.getElementById("marinas").innerHTML;
	AJAXloadHTMLinTarget(url,"marinas",null,null);
}
function showMarinaList(){
	if(marinaListHTML!=null){
		document.getElementById("marinas").innerHTML=marinaListHTML;
	}else {
		window.location.reload();
	}
}
var GoogleMapsMarinaActive=false;
function activateGoogleMapsMarina(){
	document.getElementById("GoogleMapsMarinaAdressInput").value='';
	GoogleMapsMarinaActive=true;
}
function submitGoogleMapsMarina(){
	if(!GoogleMapsMarinaActive){
		document.getElementById("GoogleMapsMarinaAdressInput").style.backgroundColor="#ffa0a0";
		document.getElementById("GoogleMapsMarinaAdressInput").style.border="1px solid #f00000";
	}else{
		document.getElementById("GoogleMapsMarinaForm").submit();
	}
}
function submitOfferForm(Filter,event){
	var form = document.getElementById("OfferForm");
	var url =AJAXgetForm("OfferForm")+"&Filter="+Filter;
	AJAXloadHTMLinTarget(url,"OffersDiv","",event);
}
function showOrderForm2(event){
	hideDiv("OrderForm1Div");
	showDiv("OrderForm2Div");
}
function showOrderForm1(event){
	hideDiv("OrderForm2Div");
	showDiv("OrderForm1Div");
}
function addHelpCount(value,ov_oid,event){
	var url =absolutePath+"AJAXYachtRequest.jsp"+sessionid+"?action=20&ov_oid="+ov_oid+"&voting="+value;
	AJAXloadHTMLinTarget(url,"DivNull","",event);
}
function loadAction(div,action,parameter){
	var url =absolutePath+"AJAXYachtRequest.jsp"+sessionid+"?action="+action;
	if(parameter)url+="&"+parameter;
	AJAXloadHTMLinTarget(url,div,"",null);
}
function openContact(){
	var bodywidth=document.getElementsByTagName('body')[0].scrollWidth;
	document.getElementById("ContactWindow").style.left=(parseInt(bodywidth)/2+200)+"px";
	showDiv("ContactWindow");
}
function openChat(){
	showAJAXWindow("LightWindow2",100,0,712,452);
	var url =absolutePath+"AJAXYachtRequest.jsp"+sessionid+"?action=23";
	AJAXloadHTMLinTarget(url,"LightWindow2","",null);
}
function startChat(){
	var url =absolutePath+"AJAXYachtRequest.jsp"+sessionid+"?action=23&action2=start";
	AJAXloadHTMLinTarget(url,"LightWindow2","",null);
}
function runChat(){
	var url =absolutePath+"AJAXYachtRequest.jsp"+sessionid+"?action=24";
	AJAXloadHTMLinTarget(url,"LightWindow2","",null);
}
function submitChat(){
	var url = AJAXgetForm("ChatUserForm");
	AJAXloadHTMLinTarget(url,"LightWindow2","",null);
}
function closeChat(){
	var url = AJAXgetForm("ChatUserForm");
	url +="&close=close";
	AJAXloadHTMLinTarget(url,"LightWindow2","",null);
}
function reloadChatWindow(){
	var tempWindow =document.getElementById("chatwindow");
	if(!tempWindow || tempWindow==null)return;

	var jetzt = new Date();
	tempWindow.src=absolutePath+"chat.jsp"+sessionid+"?time="+jetzt.getTime()+"#unten";
}
function showMessage(text){
	var html ="<div class='m-popup' ><div class='popup-top' ></div>";
	html +="<div class='popup-content' style='width:304px;' >"+text+"</div>";
	html +="<div class='popup-footer' ></div>";
	html +="</div>";
	var div = document.getElementById("LightWindow2");
	div.innerHTML=html;
	var Y = lastMouseY;
	if(Y==0)Y=300;
	showAJAXWindow("LightWindow2",Y-100,lastMouseX-200,350,150);
	window.setTimeout("hideDiv('LightWindow2');",4000);
}
function activateComment(id){
	var field = document.getElementById(id);
	if(field.activated)return;
	field.value="";
	field.style.color='#707070';
	field.activated=true;
}
function preActivatedComment(id){
	var field = document.getElementById(id);
	field.style.color='#707070';
	field.activated=true;
}
function genUploadForm(name,id,event){
	if(!event)event = window.event;
	var html ="<div class='m-popup' ><div class='popup-top' onclick='hideDiv(\"LightWindow\")' ></div>";
	html += "<div class='popup-content' style='width:304px;' >";
	html += "<form method='post'  action='"+absolutePath+"AJAXYachtRequest.jsp"+sessionid+"' name='UploadForm' id='UploadForm' "+
		" enctype='multipart/form-data' target='UpLoadIframe'  >"+
			"<input type='file' name='uploadImage' id='uploadImage' />"+
			"<input type='hidden' name='action' value='150' />"+
			"<input type='hidden' name='"+name+"' value='"+id+"' />"+
			"<div onclick='submitUploadForm(\"UploadForm\")' style='float:right;' class='button btn-orange' ><span class='button-main'>Absenden</span><span class='button-right'>&nbsp;</span></div>"+
		"</form><iframe id='UpLoadIframe' name='UpLoadIframe' class='hidden' ></iframe>";
	html += "</div>";
	html += "<div class='popup-footer' ></div>";
	html += "</div>";
	document.getElementById("LightWindow").innerHTML=html;
	showAJAXWindow("LightWindow",300,500,350,150);
}
function submitUploadForm(formName){
	document.getElementById(formName).submit();
	var html ="<div class='m-popup' ><div class='popup-top' ></div>";
	html +="<div class='popup-content' style='width:304px;' >bitte warten bis der Upload fertig ist ...</div>";
	html +="<div class='popup-footer' ></div>";
	html +="</div>";
	var div = document.getElementById("LightWindow2");
	div.innerHTML=html;
	hideDiv("LightWindow");
	showAJAXWindow("LightWindow2",300,500,350,150);
}
function deleteUserImage(image_id,image_name,object_oid){
	loadAction('FileUpload'+object_oid+'Div','151','remove_oid='+image_id+'&object_oid='+object_oid);
}
var special_price = new Object();
function setSpecialPrice(){
	var price =0;
	for (var Eigenschaft in special_price){
		var checkBox = document.getElementById("ip"+Eigenschaft);
		if(checkBox && checkBox.value=="checked"){
			price +=special_price[Eigenschaft];
		}
	}
	var ObligatoryPrice = parseInt(document.getElementById("ObligatoryPrice").innerHTML);
	var EndPrice = document.getElementById("EndPrice");
	EndPrice.innerHTML = (price+ObligatoryPrice)+".00&euro;";

}
function showBookingForm(){
	showDiv("booking");
	hideDiv("voting");
	document.getElementById("booking-li").className="active";
	document.getElementById("voting-li").className="";
}
function showVotingForm(){
	showDiv("voting");
	hideDiv("booking");
	document.getElementById("booking-li").className="";
	document.getElementById("voting-li").className="active";
}
function showCatalog(oid){
	for(var i=0;i<catalogs.length;i++){
	//	if(!document.getElementById("li-cat"+catalogs[i]))continue;
		hideDiv("aval"+catalogs[i]);
		hideDiv("prices"+catalogs[i]);
		hideDiv("discount"+catalogs[i]);
		document.getElementById("li-cat"+catalogs[i]).className="";
	}	
	showDiv("aval"+oid);
	showDiv("prices"+oid);
	showDiv("discount"+oid);
	document.getElementById("li-cat"+oid).className="active";
}
function loadVoting(limit,class_index,target){
	var url =absolutePath+"AJAXYachtRequest.jsp"+sessionid+"?action=31&limit="+limit+"&class_index="+class_index+"";
	AJAXloadHTMLinTarget(url,"Div"+target+"Voting","",null);
}
function openInquiryForm(yacht_oid,event){	
	showLightWindow(100,0,560,450);
	var url = absolutePath+"AJAXYachtRequest.jsp"+sessionid+"?action=10&yacht="+yacht_oid;
	AJAXloadHTMLinTarget(url,"LightWindow",null,event);	
}
function openDistrictInquiryForm(district_oid,event){	
	showLightWindow(280,0,560,450);
	var url = absolutePath+"AJAXYachtRequest.jsp"+sessionid+"?action=32&district1="+district_oid;
	AJAXloadHTMLinTarget(url,"LightWindow",null,event);	
}
function showSuperYachtGal(){
	var images = document.getElementById("SuperYachtImages").getElementsByTagName("img");
	var html="";
	for(var i=0;i<images.length;i++){
		if(images[i].src.indexOf(".jpg")==-1)continue;
		html +="<li><a href='#'><img src='"+images[i].src;
		html +="' width='205' height='119' alt='"+images[i].alt+"' /></a></li>";
	}
	document.getElementById("SuperYachtImagesList").innerHTML=html;
}
function setMerkListDefaultText(pre_subject,pre_text){
	var MLSubject = document.getElementById("MLSubject");
	var MLText = document.getElementById("MLText");
	if(MLSubject.value=="")MLSubject.value=pre_subject;
	if(MLText.value=="")MLText.value=pre_text;
}
//window.setInterval("reloadChatWindow()",5000);
