//Overlib Bubbles

var bubble_msg = new Array();
bubble_msg[0] =js_overlib_homepage;
bubble_msg[1] =js_overlib_informieren;
bubble_msg[2] =js_overlib_news;
bubble_msg[3] =js_overlib_community;
bubble_msg[4] =js_overlib_forum;

var allowToHideBubble = false;
var timeout_runs = false;

function showMenuBubble(msg,type){
	//Bubble Typen finden
	var myCssClass="bubble_start";
	if(type==0){
		myCssClass="bubble_start";
	}
	if(type==1){
		myCssClass="bubble_ratgeber";
	}
	if(type==2){
		myCssClass="bubble_news";
	}
	if(type==3){
		myCssClass="bubble_community";
	}
	if(type==4){
		myCssClass="bubble_forum";
	}
	
	Element.removeClassName('bubble',Element.classNames('bubble'))
    Element.addClassName('bubble',myCssClass);

	$('bubble').update(msg)
	Element.show('bubble');
}  	 

function hideBubble(){
    if(allowToHideBubble == true){
        Element.hide('bubble');
        allowToHideBubble = false; 
    }else{
    	if(timeout_runs == false){
        	allowHideBubbleAfter(myBubbleTimeout)
    	}  
    }
}

function allowHideBubbleAfter(time){
    allowToHideBubble = false;
    timeout_runs = true;
    window.setTimeout("allowToHideBubble=true;hideBubble();timeout_runs=false;",time);
}

//Overlib Bubbles Ende

//Script welches spaeter die optimale Groesse des mittleren Bereiches ermittelt
function getSize(){
	var Column1_size = 0;
	var Column3_size = 0;
	for(var d=0;d<js_PortletsColumn1.length;d++){
		Column1_size += Element.getDimensions(js_PortletsColumn1[d]).height +16;//wir habens ja
	}
	for(var d=0;d<js_PortletsColumn3.length;d++){
		Column3_size += Element.getDimensions(js_PortletsColumn3[d]).height +16;//wir habens ja
	}
	if (Column1_size > Column3_size) {
		var my_size = Column1_size;
	}
	else {
		var my_size = Column3_size;
	} 
	
	middle_height = Element.getDimensions('column2-content').height;
	
	if(document.getElementById('divRatgeberResult')){
		middle_height=Element.getDimensions('divRatgeberResult').height;
	}
	if(document.getElementById('divNewsResult')){
		if(middle_height < Element.getDimensions('divNewsResult').height){
			middle_height=Element.getDimensions('divNewsResult').height;
		}
	}
	if(document.getElementById('divForumResult')){
		if(middle_height < Element.getDimensions('divForumResult').height){
			middle_height=Element.getDimensions('divForumResult').height;
		}
	}
	
	if(document.getElementById('divRatgeberResult')){
    	$('column2-content').style.height = parseFloat(middle_height)+parseFloat(170)+"px";
    }
	if(document.getElementById('divNewsResult')){
    	$('column2-content').style.height = parseFloat(middle_height)+parseFloat(170)+"px";
    }
    if(document.getElementById('divForumResult')){
    	$('column2-content').style.height = parseFloat(middle_height)+parseFloat(170)+"px";
    }
	if(middle_height < my_size){
		$('column2-content').style.height = my_size+"px";
    }
    
}

function showHideChars(myFocus,myLayer){
	if(myFocus==1){
		Effect.BlindDown(myLayer, {duration:0.3});	
	}else{
		Effect.BlindUp(myLayer, {duration:0.3});	
	}
}

function countTextChars(myMaxChars,myTextfield,myRestSpan){
	max = myMaxChars;
	wert = max-document.getElementsByName(myTextfield)[0].value.length;
	if (wert <= 0) {
		//alert("Dieser Text darf nur "+ max +" Zeichen lang sein.");
		document.getElementById(myRestSpan).style.color="red";
		document.getElementsByName(myTextfield)[0].value = document.getElementsByName(myTextfield)[0].value.substring(0,max);
		wert = max-document.getElementsByName(myTextfield)[0].value.length;
		document.getElementById(myRestSpan).innerHTML = wert; 
	} else {
		document.getElementById(myRestSpan).style.color="green";
		document.getElementById(myRestSpan).innerHTML = max - document.getElementsByName(myTextfield)[0].value.length;
	}
}


//Hinzufuegen und Entfernen von Produktmerkmalen
var myMaxFeatureId=1;
function newFeature(){
    myMaxFeatureId++;
    new Ajax.Request(myBasePath+'/inc/ratgeber/inc_new_feature.cfm?aIdFeature='+myMaxFeatureId, {asynchronous:true, onComplete:addNewFeature});
    getSize(); 
}

function removeFeature(myIdPrefix,myFeatureId){
 	if(myIdPrefix == "idProductFeatureContainer"){//nur bestehende Links in aLinkToDelete eintragen
        document.getElementsByName('aFeatureToDelete')[0].value=document.getElementsByName('aFeatureToDelete')[0].value +","+myFeatureId;
    }else{
    	//Bei neuen Features muss der Titel und Beschreibung entfernt werden entfernt werden damit nix gepeichert wird
    	document.getElementsByName('aNewFeatureTitle'+myFeatureId)[0].value='';
    	document.getElementsByName('aNewProductFeature'+myFeatureId)[0].value='';
    	tinyMCE.getInstanceById('idNewProductFeature'+myFeatureId).getDoc().body.innerHTML='';
	 }
    //Element.remove(myIdPrefix+myFeatureId);
    document.getElementById(myIdPrefix+myFeatureId).style.display='none';
    getSize();
}

function addNewFeature(req){
    new Insertion.Bottom($('divProductFeatures'), req.responseText);
    getSize(); 
}

//Hinzufuegen und Entfernen eines eines externen Links
var myMaxLinkId=1;
function newLink(myNewLinkDefaultDescr,myDeleteLinkDefaultDescr){
	 myMaxLinkId++;
	 myNewListElement='<li class="greyDecoratedList_li" id="idNewExternalLink'+myMaxLinkId+'"><input type="hidden" name="idNewExternalLink" value="'+myMaxLinkId+'"/><input type="text" class="textfield190" name="aNewExternalLink'+myMaxLinkId+'" value="http://" onfocus="emptyTextfield(1,\'http://\',\'aNewExternalLink'+myMaxLinkId+'\');" onblur="emptyTextfield(0,\'http://\',\'aNewExternalLink'+myMaxLinkId+'\');" /><input type="text"  class="textfield190" name="aNewExternalLinkDescr'+myMaxLinkId+'" value="'+myNewLinkDefaultDescr+'" onfocus="emptyTextfield(1,\''+myNewLinkDefaultDescr+'\',\'aNewExternalLinkDescr'+myMaxLinkId+'\');" onblur="emptyTextfield(0,\''+myNewLinkDefaultDescr+'\',\'aNewExternalLinkDescr'+myMaxLinkId+'\');" /><a onmouseover="this.style.cursor=\'pointer\';" onmouseout="this.style.cursor=\'default\';" onclick="if(confirm(js_bearbeiten_delete_link)){removeLink(\'idNewExternalLink\','+myMaxLinkId+');};"><img src="'+myBasePath+'/pics/icons/delete.gif" border="0" alt="'+myDeleteLinkDefaultDescr+'" title="'+myDeleteLinkDefaultDescr+'" /></a><\/li>';
	 new Insertion.Bottom($('ulExternalLinks'),myNewListElement);
}

function removeLink(myIdPrefix,myLinkId){
 	if(myIdPrefix == "idExternalLink"){//nur bestehende Links in aLinkToDelete eintragen
        document.getElementsByName('aLinkToDelete')[0].value=document.getElementsByName('aLinkToDelete')[0].value + "," + myIdPrefix+myLinkId;
    }
    Element.remove(myIdPrefix+myLinkId);
    getSize();
}


//Die PreviewButtons im Ratgeberbereich
	//1.ProduktBeschreibung
	function showProductDescrPreview(myPreviewOrEdit){//1=Preview, 0=Edit
		if(myPreviewOrEdit==1){
			document.getElementById('spanProductTitle').innerHTML=document.getElementsByName('aProductTitle')[0].value;
			document.getElementById('spanProductDescription').innerHTML=document.getElementsByName('aProductDescription')[0].value.replace(/\n/g, "<br>");
			Effect.Fade('divProductDescriptionEdit', {duration:0.1});
			Effect.Appear('divProductDescriptionPreview', {duration:0.1});
		}else{
			Effect.Fade('divProductDescriptionPreview', {duration:0.1});
			Effect.Appear('divProductDescriptionEdit', {duration:0.1});
		}
	}
	
	//2.ProduktMerkmale
	function showProductFeaturePreview(myIsNew,myFeatureId,myPreviewOrEdit){//1=Preview, 0=Edit
		if(myIsNew==1){
			if(myPreviewOrEdit==1){
				var myFeatureContent=tinyMCE.getInstanceById('idNewProductFeature'+myFeatureId).getDoc().body.innerHTML;
				document.getElementById('spanNewProductFeature'+myFeatureId).innerHTML=document.getElementsByName('aNewFeatureTitle'+myFeatureId)[0].value;
				document.getElementById('spanNewProductFeatureDescription'+myFeatureId).innerHTML=myFeatureContent;
				Effect.Fade('divNewProductFeatureEdit'+myFeatureId, {duration:0.1});
				Effect.Appear('divNewProductFeaturePreview'+myFeatureId, {duration:0.1});
			}else{
				Effect.Appear('divNewProductFeatureEdit'+myFeatureId, {duration:0.1});
				Effect.Fade('divNewProductFeaturePreview'+myFeatureId, {duration:0.1});
			}
		}else{
			if(myPreviewOrEdit==1){
				var myFeatureContent=tinyMCE.getInstanceById('idProductFeature'+myFeatureId).getDoc().body.innerHTML;
				document.getElementById('spanProductFeature'+myFeatureId).innerHTML=document.getElementsByName('aFeatureTitle'+myFeatureId)[0].value;
				document.getElementById('spanProductFeatureDescription'+myFeatureId).innerHTML=myFeatureContent;
				Effect.Fade('divProductFeatureEdit'+myFeatureId, {duration:0.1});
				Effect.Appear('divProductFeaturePreview'+myFeatureId, {duration:0.1});
			}else{
				Effect.Appear('divProductFeatureEdit'+myFeatureId, {duration:0.1});
				Effect.Fade('divProductFeaturePreview'+myFeatureId, {duration:0.1});
			}
		}
	}
	
//Leeren eines Textfeldes beim Focus und auffuellen wenn der Inhalt leer ist
function emptyTextfield(myFocusOrBlur,myDefaultValue,myTextFieldName){//1=Focus,0=Blur
	if(myFocusOrBlur==1){
		if(document.getElementsByName(myTextFieldName)[0].value==myDefaultValue){
			document.getElementsByName(myTextFieldName)[0].value='';
		}
	}else{
		if(document.getElementsByName(myTextFieldName)[0].value.length==0){
			document.getElementsByName(myTextFieldName)[0].value=myDefaultValue;
		}
	}
}

function removeImage(myImageId,myImageDefaultTitle,myImageDefaultDescr,myImageDefaultSource){
	document.getElementsByName('aIdImageToRemove')[0].value=myImageId;
	document.getElementById('divCurrentImage').style.display='none';
	document.getElementById('divNewImage').style.display='';
	
	document.getElementsByName('aImageTitle')[0].value=myImageDefaultTitle;
	document.getElementsByName('aImageDescription')[0].value=myImageDefaultDescr;
	document.getElementsByName('aImageSourceString')[0].value=myImageDefaultSource;
}


//Validierung der Form Bearbeiten
function checkBearbeitenForm(myListName){
	Effect.BlindUp('divErrorMessages', {duration:0.2});
	var everythingOK=1;
	var NewFeatureCounter=myMaxFeatureId+1;
	var myFeatureContent="";
	//Einmal die Liste leermachen und dann wird geprueft.
	document.getElementById('ulWarnings').innerHTML='';
	if(document.getElementsByName('aProductTitle')[0].value.length<2 || document.getElementsByName('aProductTitle')[0].value==js_bearbeiten_default_advisor_title){
		 myNewListElement='<li>'+js_bearbeiten_error_titel+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.getElementsByName('aProductDescription')[0].value.length<20 || document.getElementsByName('aProductDescription')[0].value==js_bearbeiten_default_advisor_descr){
		 myNewListElement='<li>'+js_bearbeiten_error_advisor_descr+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	for(i=1;i<NewFeatureCounter;i++){
		if(document.getElementsByName('aNewFeatureTitle'+i)[0]){
			myFeatureContent=tinyMCE.getInstanceById('idNewProductFeature'+i).getDoc().body.innerHTML;
			myFeatureContent=myFeatureContent.replace(myTinyMceDefaultCode,'');
			myFeatureContent=myFeatureContent.replace(myTinyMceDefaultCode2,'');
			if((document.getElementsByName('aNewFeatureTitle'+i)[0].value.length==0 || document.getElementsByName('aNewFeatureTitle'+i)[0].value==js_bearbeiten_default_feature_title) && myFeatureContent.length>1){
				myNewListElement='<li>'+js_bearbeiten_error_feature_title+'<\/li>';
				new Insertion.Bottom($(myListName),myNewListElement);
				everythingOK=0;
			}
			if(document.getElementsByName('aNewFeatureTitle'+i)[0].value.length>1 && document.getElementsByName('aNewFeatureTitle'+i)[0].value!=js_bearbeiten_default_feature_title && myFeatureContent.length<10){
				myNewListElement='<li>'+js_bearbeiten_error_feature_descr+' ('+document.getElementsByName('aNewFeatureTitle'+i)[0].value+')<\/li>';
				new Insertion.Bottom($(myListName),myNewListElement);
				everythingOK=0;
			}
		}
	}
	
	if(document.getElementsByName('aAGB')[0]){
		if(document.getElementsByName('aAGB')[0].checked==false){
			myNewListElement='<li>'+js_bearbeiten_error_agb+'<\/li>';
		 	new Insertion.Bottom($(myListName),myNewListElement);
		 	everythingOK=0;
		}
		if(document.getElementsByName('aDatenschutz')[0].checked==false){
			myNewListElement='<li>'+js_bearbeiten_error_privacy+'<\/li>';
		 	new Insertion.Bottom($(myListName),myNewListElement);
		 	everythingOK=0;
		}
	}
	if(document.getElementsByName('aImage')[0]){
		if(document.getElementsByName('aImage')[0].value.length>0 && document.getElementsByName('aImageSource')[0].checked==true && (document.getElementsByName('aImageSourceString')[0].value.length==0 || document.getElementsByName('aImageSourceString')[0].value==js_bearbeiten_default_image_source)){
			myNewListElement='<li>'+js_bearbeiten_error_missing_source+'<\/li>';
			new Insertion.Bottom($(myListName),myNewListElement);
			everythingOK=0;
		}
	}
	if(document.getElementById('divRatgeberTItleError').style.display==''){
		myNewListElement='<li>'+js_bearbeiten_error_product_title_exists+'<\/li>';
		new Insertion.Bottom($(myListName),myNewListElement);
		everythingOK=0;
	}
	if(document.getElementsByName('aComment')[0].value.length<2 || document.getElementsByName('aComment')[0].value==js_bearbeiten_comment_text){
		 myNewListElement='<li>'+js_bearbeiten_comment_text_alert+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(everythingOK==0){
		setTimeout('Effect.BlindDown(\'divErrorMessages\', {duration:0.2})',400);
		scroll(0,0);
	}else{
		showSearchAlert();
		document.fKonsumoForm.submit();
	}
	
}

//Funktion die prueft ob ein Ratgeber bereits exisitert. Wenn ja, dann darf der zu bearbeitende Ratgeber nicht so heissen
function checkRatgeberTitle(myRatgeberTitle,myIdRatgeber){
	var myRatgeberIsOk=1;
	if(myRatgeberTitle.length>0){
		new Ajax.Updater('ajaxUpdates','/inc/ratgeber/iCheckRatgeberName.cfm?aIdRatgeber='+myIdRatgeber+'&aRatgeberTitle='+myRatgeberTitle, { method: 'get', evalScripts:true });
	}
	
}

//Entfernen von Alternativen Titeln und Tags
function removeAlternate(myAlternate){
	document.getElementsByName('aAlternateToDelete')[0].value=document.getElementsByName('aAlternateToDelete')[0].value + "," + myAlternate;
	Element.remove('liAlternateTitle'+myAlternate);
}
function removeTag(myTag){
	document.getElementsByName('aTagToDelete')[0].value=document.getElementsByName('aTagToDelete')[0].value + "," + myTag;
	Element.remove('liTag'+myTag);
}


//Hoveeffekt fuer die Vote Buttons
function positiveOrNegative(myInOrOut,myFeatureId,myInnerString){
	if(myInOrOut==1){
		document.getElementById('divVoteResult'+myFeatureId).style.color='#666';
		document.getElementById('divVoteResult'+myFeatureId).innerHTML=myInnerString;
	}else{
		document.getElementById('divVoteResult'+myFeatureId).style.color='#6d6d6d';
		document.getElementById('divVoteResult'+myFeatureId).innerHTML=myInnerString;
	}
}

function doVote(myRatgeberId,myFeatureId,PositiveOrNegative){
	if(myFeatureId>0 && myRatgeberId>0){
		new Ajax.Updater('divVotes'+myFeatureId,'/actions/ratgeber/ratgeber_vote.cfm?aIdRatgeber='+myRatgeberId+'&aIdFeature='+myFeatureId+'&aPositiveOrNegative='+PositiveOrNegative, { method: 'get', evalScripts:true });
	}
}



//Validierung der Form Kommentar
function checkComment(myListName){
	Effect.BlindUp('divErrorMessages', {duration:0.2});
	var everythingOK=1;
	//Einmal die Liste leermachen und dann wird geprueft.
	document.getElementById('ulWarnings').innerHTML='';
	if(document.getElementsByName('aCommentName')[0].value.length<2){
		 myNewListElement='<li>'+js_comment_name+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.formComment.aCommenteMail.value.match(/([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4})/gi)==null){
		 myNewListElement='<li>'+js_comment_mail+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.getElementsByName('aCommentText')[0].value.length<5){
		 myNewListElement='<li>'+js_comment_text+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	
	
	if(everythingOK==0){
		setTimeout('Effect.BlindDown(\'divErrorMessages\', {duration:0.2})',400);
	}else{
		document.formComment.submit();
	}
}


//Funktion die die History Leiste einblendet und ausblendet
function showHistoryChanges(){
 	if(document.getElementById('divHistoryListFull').style.display=='none'){
 		$('divHistoryListShort').style.display='none';
 		$('divHistoryListFull').style.display='';
 	}else{
 		$('divHistoryListShort').style.display='';
 		$('divHistoryListFull').style.display='none';
 	}
 }

//Funktion beim Versionsvergleich prueft ob wirklich nur 2 checkboxen angeklickt sind
function checkVersionBoxes(isChecked,myRevisionId){
	if(isChecked==true){
		var Counter=0;
		for(i=0;i<document.getElementsByName('aCompareVersion').length;i++){
			if(document.getElementsByName('aCompareVersion')[i].checked==true){
				Counter++;
			}
		}
		if(Counter>2){
			alert(js_only_two_revisions);
			for(i=0;i<document.getElementsByName('aCompareVersion').length;i++){
				if(document.getElementsByName('aCompareVersion')[i].checked==true){
					if(document.getElementsByName('aCompareVersion')[i].value==myRevisionId){
						document.getElementsByName('aCompareVersion')[i].checked=false;
					}
				}
			}
		}
	}
}


//Funktion welche den Versionsvergleich ausloesen wird. Sie prueft vorher ob auch wirklich 2 Revisionen angeklickt wurden
function showComparison(myRatgeberName,myRatgeberId){
	var Counter=0;
	var myParam='';
	for(i=0;i<document.getElementsByName('aCompareVersion').length;i++){
		if(document.getElementsByName('aCompareVersion')[i].checked==true){
			Counter++;
			myParam=myParam+'/'+document.getElementsByName('aCompareVersion')[i].value;
		}
	}
	if(Counter==2){
		document.location.href='/'+myUrlRatgeberVersionen+'/'+myRatgeberId+'/'+myRatgeberName+myParam;
	}else{
		alert(js_minimum_two_revisions);
	}
}


//Validierung der Benutzerregistrierung
function checkRegisterForm(myListName){
	Effect.BlindUp('divErrorMessages', {duration:0.2});
	var everythingOK=1;
	//Einmal die Liste leermachen und dann wird geprueft.
	document.getElementById('divErrorMessages').innerHTML='<ul id="'+myListName+'" class="ulWarnings marginPaddingLef20 paddingBottom15"><\/ul>';
	if(document.getElementsByName('aFirstName')[0].value.length<2){
		 myNewListElement='<li>'+js_register_first_name+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.getElementsByName('aLastName')[0].value.length<2){
		 myNewListElement='<li>'+js_register_last_name+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.fKonsumoForm.aMail.value.match(/([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4})/gi)==null){
		 myNewListElement='<li>'+js_register_mail+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.getElementsByName('aUserName')[0].value.length<2){
		 myNewListElement='<li>'+js_register_username+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.getElementsByName('aCheck')[0].value=='1'){
		 myNewListElement='<li>'+js_register_username_already_exist+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.getElementsByName('aPassword')[0].value.length<2){
		 myNewListElement='<li>'+js_register_password+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.getElementsByName('aPasswordConfirm')[0].value.length<2){
		 myNewListElement='<li>'+js_register_password_conf+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.getElementsByName('aPassword')[0].value!=document.getElementsByName('aPasswordConfirm')[0].value){
		 myNewListElement='<li>'+js_register_password_conf_mismatch+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.getElementsByName('aAcceptTerms')[0].checked==false){
		myNewListElement='<li>'+js_register_terms+'<\/li>';
		new Insertion.Bottom($(myListName),myNewListElement);
		everythingOK=0;
	}
	if(document.getElementsByName('aAcceptPrivacyPolicy')[0].checked==false){
		myNewListElement='<li>'+js_register_privacy+'<\/li>';
		new Insertion.Bottom($(myListName),myNewListElement);
		everythingOK=0;
	}
	if(everythingOK==0){
		setTimeout('Effect.BlindDown(\'divErrorMessages\', {duration:0.2})',400);
		scroll(0,0);
	}else{
		document.fKonsumoForm.submit();
	}
	
}

function checkUsername(myUsername){
   new Ajax.Updater('ajaxUpdates','/inc/ratgeber/iCheckUserName.cfm?aNickName=' + myUsername, { method: 'get', evalScripts:true });
}

function editData(fadeInLayer){
	if(document.getElementById(fadeInLayer).style.display=='none'){
		document.getElementById(fadeInLayer).style.display='';
		document.getElementById(fadeInLayer+'Edit').style.display='none';
		document.getElementById(fadeInLayer+'Span').innerHTML=js_profil_edit_profile;
	}else{
		document.getElementById(fadeInLayer).style.display='none';
		document.getElementById(fadeInLayer+'Edit').style.display='';
		document.getElementById(fadeInLayer+'Span').innerHTML=js_profil_show_profile;
	}
}

function editContactData(fadeInLayer){
	if(document.getElementById(fadeInLayer).style.display=='none'){
		document.getElementById(fadeInLayer).style.display='';
		document.getElementById(fadeInLayer+'Edit').style.display='none';
		document.getElementById(fadeInLayer+'Span').innerHTML=js_profil_edit_contact_data;
	}else{
		document.getElementById(fadeInLayer).style.display='none';
		document.getElementById(fadeInLayer+'Edit').style.display='';
		document.getElementById(fadeInLayer+'Span').innerHTML=js_profil_show_contact_data;
	}
}
function editActivityData(fadeInLayer){
	if(document.getElementById(fadeInLayer).style.display=='none'){
		document.getElementById(fadeInLayer).style.display='';
		document.getElementById(fadeInLayer+'Edit').style.display='none';
		document.getElementById(fadeInLayer+'Span').innerHTML=js_profil_edit_activity;
	}else{
		document.getElementById(fadeInLayer).style.display='none';
		document.getElementById(fadeInLayer+'Edit').style.display='';
		document.getElementById(fadeInLayer+'Span').innerHTML=js_profil_show_activity;
	}
}
function editContactListStatusData(fadeInLayer){
	if(document.getElementById(fadeInLayer).style.display=='none'){
		document.getElementById(fadeInLayer).style.display='';
		document.getElementById(fadeInLayer+'Edit').style.display='none';
		document.getElementById(fadeInLayer+'Span').innerHTML=js_profil_edit_contact_data;
	}else{
		document.getElementById(fadeInLayer).style.display='none';
		document.getElementById(fadeInLayer+'Edit').style.display='';
		document.getElementById(fadeInLayer+'Span').innerHTML=js_profil_show_contact_data;
	}
}


function showCrop(){
	if(document.getElementById('divShowCrop').style.display=='none'){
		Effect.BlindDown('divShowCrop', {duration:0.2});
	}else{
		Effect.BlindUp('divShowCrop', {duration:0.2});
	}
}

function onEndCrop( coords, dimensions ) {
	$( 'x1' ).value = coords.x1;
	$( 'y1' ).value = coords.y1;
	$( 'x2' ).value = coords.x2;
	$( 'y2' ).value = coords.y2;
	$( 'width' ).value = dimensions.width;
	$( 'height' ).value = dimensions.height;
}

var CropIsInitialized=0;
function doShowCrop(){
	if(CropIsInitialized==0){
		new Cropper.ImgWithPreview( 
			'konsumoAvatar',
			{ 
				minWidth: avatarImageSize, 
				minHeight: avatarImageSize,
				ratioDim: { x: avatarImageSize, y: avatarImageSize },
				displayOnInit: true, 
				onEndCrop: onEndCrop,
				previewWrap: 'previewArea' 
			} 
		) 
		CropIsInitialized=1;
	}
}

function sendBuddyMessage(myBuddyId,myBuddyNickName){
	if(document.getElementById('divUserAlert')){
		document.getElementById('divUserAlert').style.display='none';
	}
	if(document.getElementById('divBuddyMessage')){
		document.getElementById('divBuddyMessage').style.display='none';
	}
	if (document.all){
 		myHeightValue=parseFloat(document.documentElement.scrollTop)+50;
 	}else{
 		myHeightValue=parseFloat(window.pageYOffset)+50;
 	}
 	document.getElementById('divBuddyMailMessage').style.top=myHeightValue+'px';
	document.getElementsByName('aIdSendMessageFriend')[0].value=myBuddyId;
	document.getElementsByName('aSendMessageFriendNickName')[0].value=myBuddyNickName;
	document.getElementById('spanFriendName').innerHTML=myBuddyNickName;
	if($('divBuddyMailMessage').style.display=='none'){
		Effect.Appear('divBuddyMailMessage', {duration:0.5});
	}
}


function addContact(){
	if(document.getElementById('divUserAlert')){
		document.getElementById('divUserAlert').style.display='none';
	}
	if(document.getElementById('divBuddyMailMessage')){
		document.getElementById('divBuddyMailMessage').style.display='none';
	}
	if($('divBuddyMessage').style.display=='none'){
		Effect.Appear('divBuddyMessage', {duration:0.5});
	}
}
function alertUser(){
	if(document.getElementById('divBuddyMessage')){
		document.getElementById('divBuddyMessage').style.display='none';
	}
	if(document.getElementById('divBuddyMailMessage')){
		document.getElementById('divBuddyMailMessage').style.display='none';
	}
	if($('divUserAlert').style.display=='none'){
		Effect.Appear('divUserAlert', {duration:0.5});
	}
}

function alertRatgeber(){
	document.getElementById('divRatgeberEmpfehlen').style.display='none';
	if($('divRatgeberMissbrauch').style.display=='none'){
		Effect.Appear('divRatgeberMissbrauch', {duration:0.5});
	}
}
function empfehlenRatgeber(){
	document.getElementById('divRatgeberMissbrauch').style.display='none';
	if($('divRatgeberEmpfehlen').style.display=='none'){
		Effect.Appear('divRatgeberEmpfehlen', {duration:0.5});
	}
}

function empfehlenNews(){
	document.getElementById('divNewsLeserbrief').style.display='none';
	if($('divNewsEmpfehlen').style.display=='none'){
		Effect.Appear('divNewsEmpfehlen', {duration:0.5});
	}
}
function leserBriefNews(){
	document.getElementById('divNewsEmpfehlen').style.display='none';
	if($('divNewsLeserbrief').style.display=='none'){
		Effect.Appear('divNewsLeserbrief', {duration:0.5});
	}
}

function alertForum(){
	if (document.all){
 		myHeightValue=parseFloat(document.documentElement.scrollTop)+50;
 	}else{
 		myHeightValue=parseFloat(window.pageYOffset)+50;
 	}
 	document.getElementById('divForumEmpfehlen').style.display='none';
	if($('divForumMissbrauch').style.display=='none'){
		Effect.Appear('divForumMissbrauch', {duration:0.5});
	}
	document.getElementById('divForumMissbrauch').style.top=parseFloat(myHeightValue)+400+'px';
	
}
function empfehlenForum(){
	document.getElementById('divForumMissbrauch').style.display='none';
	if($('divForumEmpfehlen').style.display=='none'){
		Effect.Appear('divForumEmpfehlen', {duration:0.5});
	}
}

function checkEmpfehlen(myListName){
	Effect.BlindUp('divEmpfehlenErrorMessages', {duration:0.2});
	var everythingOK=1;
		//Einmal die Liste leermachen und dann wird geprueft.
	document.getElementById('divEmpfehlenErrorMessages').innerHTML='<ul id="'+myListName+'" class="ulWarnings marginPaddingLef20 paddingBottom15"><\/ul>';
	if(document.getElementsByName('aYourName')[0].value.length<2){
		 myNewListElement='<li>'+js_register_your_first_name+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.formEmpfehlenRatgeber.aYourMail.value.match(/([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4})/gi)==null){
		 myNewListElement='<li>'+js_register_your_mail+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.getElementsByName('aBuddyName')[0].value.length<2){
		 myNewListElement='<li>'+js_register_buddy_first_name+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.formEmpfehlenRatgeber.aBuddyMail.value.match(/([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4})/gi)==null){
		 myNewListElement='<li>'+js_register_buddy_mail+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(everythingOK==0){
		setTimeout('Effect.BlindDown(\'divEmpfehlenErrorMessages\', {duration:0.2})',400);
		scroll(0,0);
	}else{
		document.formEmpfehlenRatgeber.submit();
	}
}

function checkEmpfehlenNews(myListName){
	Effect.BlindUp('divNewsEmpfehlenErrorMessages', {duration:0.2});
	var everythingOK=1;
		//Einmal die Liste leermachen und dann wird geprueft.
	document.getElementById('divNewsEmpfehlenErrorMessages').innerHTML='<ul id="'+myListName+'" class="ulWarnings marginPaddingLef20 paddingBottom15"><\/ul>';
	if(document.getElementsByName('aYourNewsName')[0].value.length<2){
		 myNewListElement='<li>'+js_register_your_first_name+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.formEmpfehlenNews.aYourNewsMail.value.match(/([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4})/gi)==null){
		 myNewListElement='<li>'+js_register_your_mail+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.getElementsByName('aBuddyNewsName')[0].value.length<2){
		 myNewListElement='<li>'+js_register_buddy_first_name+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.formEmpfehlenNews.aBuddyNewsMail.value.match(/([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4})/gi)==null){
		 myNewListElement='<li>'+js_register_buddy_mail+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(everythingOK==0){
		setTimeout('Effect.BlindDown(\'divNewsEmpfehlenErrorMessages\', {duration:0.2})',400);
		scroll(0,0);
	}else{
		document.formEmpfehlenNews.submit();
	}
}

function checkEmpfehlenForum(myListName){
	Effect.BlindUp('divEmpfehlenErrorMessages', {duration:0.2});
	var everythingOK=1;
	//Einmal die Liste leermachen und dann wird geprueft.
	document.getElementById('divEmpfehlenErrorMessages').innerHTML='<ul id="'+myListName+'" class="ulWarnings marginPaddingLef20 paddingBottom15"><\/ul>';
	if(document.getElementsByName('aYourName')[0].value.length<2){
		 myNewListElement='<li>'+js_register_your_first_name+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.formEmpfehlenForum.aYourMail.value.match(/([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4})/gi)==null){
		 myNewListElement='<li>'+js_register_your_mail+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.getElementsByName('aBuddyName')[0].value.length<2){
		 myNewListElement='<li>'+js_register_buddy_first_name+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.formEmpfehlenForum.aBuddyMail.value.match(/([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4})/gi)==null){
		 myNewListElement='<li>'+js_register_buddy_mail+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(everythingOK==0){
		setTimeout('Effect.BlindDown(\'divEmpfehlenErrorMessages\', {duration:0.2})',400);
		scroll(0,0);
	}else{
		document.formEmpfehlenForum.submit();
	}
}

function checkLeserbriefNews(myListName){
	Effect.BlindUp('divNewsLeserbriefErrorMessages', {duration:0.2});
	var everythingOK=1;
		//Einmal die Liste leermachen und dann wird geprueft.
	document.getElementById('divNewsLeserbriefErrorMessages').innerHTML='<ul id="'+myListName+'" class="ulWarnings marginPaddingLef20 paddingBottom15"><\/ul>';
	if(document.getElementsByName('aYourLeserbriefNewsName')[0].value.length<2){
		 myNewListElement='<li>'+js_register_your_first_name+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.formLeserbriefNews.aYourLeserbriefNewsMail.value.match(/([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4})/gi)==null){
		 myNewListElement='<li>'+js_register_your_mail+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(everythingOK==0){
		setTimeout('Effect.BlindDown(\'divNewsLeserbriefErrorMessages\', {duration:0.2})',400);
		scroll(0,0);
	}else{
		document.formLeserbriefNews.submit();
	}
}

function aboThemeTag(){
    new Ajax.Autocompleter(
    	'aThemeTag',
    	'autoCompleteThemeTag',
    	myBasePath+'/inc/ratgeber/iSearchTags.cfm'
    );
}

function ratgeberTags(){
    new Ajax.Autocompleter(
    	'aNewProductTags',
    	'autoCompleteRatgeberTag',
    	myBasePath+'/inc/ratgeber/iSearchTags.cfm',
    	{
    		minChars:1,
    		tokens: ' '
    	}
    );
}
function newsTags(){
    new Ajax.Autocompleter(
    	'aNewTags',
    	'autoCompleteNewsTag',
    	myBasePath+'/inc/ratgeber/iSearchTags.cfm',
    	{
    		minChars:1,
    		tokens: ' '
    	}
    );
}
function profileTags(){
    new Ajax.Autocompleter(
    	'aProductScopes',
    	'autoCompleteProfileTag',
    	myBasePath+'/inc/ratgeber/iSearchTags.cfm',
    	{
    		minChars:1,
    		tokens: ' '
    	}
    );
}

function checkAboRegister(myListName){
	Effect.BlindUp('divErrorMessages', {duration:0.2});
	var everythingOK=1;
	//Einmal die Liste leermachen und dann wird geprueft.
	document.getElementById('divErrorMessages').innerHTML='<ul id="'+myListName+'" class="ulWarnings marginPaddingLef20 paddingBottom15"><\/ul>';
	
	if(document.fKonsumoAbo.aIdUser.value==-1){
		if(document.getElementsByName('aFirstName')[0].value.length<2){
			 myNewListElement='<li>'+js_register_first_name+'<\/li>';
			 new Insertion.Bottom($(myListName),myNewListElement);
			 everythingOK=0;
		}
		if(document.getElementsByName('aLastName')[0].value.length<2){
			 myNewListElement='<li>'+js_register_last_name+'<\/li>';
			 new Insertion.Bottom($(myListName),myNewListElement);
			 everythingOK=0;
		}
		if(document.fKonsumoAbo.aMail.value.match(/([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4})/gi)==null){
			 myNewListElement='<li>'+js_register_mail+'<\/li>';
			 new Insertion.Bottom($(myListName),myNewListElement);
			 everythingOK=0;
		}
		if(document.fKonsumoAbo.aMail.value!=document.fKonsumoAbo.aMailConfirm.value){
			myNewListElement='<li>'+js_mail_confirmation_not_valid+'<\/li>';
			 new Insertion.Bottom($(myListName),myNewListElement);
			 everythingOK=0;
		}
		if(document.fKonsumoAbo.aAcceptTerms.checked==false){
			myNewListElement='<li>'+js_register_terms+'<\/li>';
			 new Insertion.Bottom($(myListName),myNewListElement);
			 everythingOK=0;
		}
		if(document.fKonsumoAbo.aAcceptPrivacyPolicy.checked==false){
			myNewListElement='<li>'+js_register_privacy+'<\/li>';
			 new Insertion.Bottom($(myListName),myNewListElement);
			 everythingOK=0;
		}
	}
	if(everythingOK==0){
		setTimeout('Effect.BlindDown(\'divErrorMessages\', {duration:0.2})',400);
		scroll(0,0);
	}else{
		document.fKonsumoAbo.submit();
	}
}

function createMailAbo(myIdAbo,myitemId,myTag,myAboType){
	new Ajax.Updater('ajaxUpdates','/actions/community/abo_create_mail.cfm?aIdAbo='+myIdAbo+'&aIdItem='+myitemId+'&aTag='+myTag+'&aAboType='+myAboType, { method: 'get', evalScripts:true });
}

function removeMailAbo(myMailAbo,myAbo,myIdItem){
	new Ajax.Updater('ajaxUpdates','/actions/community/abo_beenden_mail.cfm?aIdMailAbo='+myMailAbo+'&aIdAbo='+myAbo+'&aIdItem='+myIdItem, { method: 'get', evalScripts:true });
}

function checkPost(myListName,myUserId){
	var everythingOK=1;
	//Einmal die Liste leermachen und dann wird geprueft.
	document.getElementById('divErrorMessages').innerHTML='<ul id="'+myListName+'" class="ulWarnings marginPaddingLef20 paddingBottom15"><\/ul>';
	
	if(myUserId=='-1'){
		if(document.fKonsumoForm.aMailAdress.value.match(/([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4})/gi)==null){
			 myNewListElement='<li>'+js_comment_mail+'<\/li>';
			 new Insertion.Bottom($(myListName),myNewListElement);
			 everythingOK=0;
		}
	}
	
	var myPostContent=tinyMCE.getInstanceById('idPostContent').getDoc().body.innerHTML;
	if(myPostContent.length<2 || myPostContent=='<p><br mce_bogus="1"></p>' || myPostContent=='<P><BR mce_bogus="1"></P>'){
		myNewListElement='<li>'+js_forum_insert_content+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	
	
	if(everythingOK==0){
		setTimeout('Effect.BlindDown(\'divErrorMessages\', {duration:0.2})',400);
		scroll(0,0);
	}else{
		document.fKonsumoForm.submit();
	}

}


function checkPostingForm(myListName){
	var everythingOK=1;
	//Einmal die Liste leermachen und dann wird geprueft.
	document.getElementById('divErrorMessages').innerHTML='<ul id="'+myListName+'" class="ulWarnings marginPaddingLef20 paddingBottom15"><\/ul>';
	if(document.getElementsByName('aIdForum')[0].value.length<1){
		 myNewListElement='<li>'+js_forum_select_forum+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.getElementsByName('aThreadTitle')[0].value.length<2){
		 myNewListElement='<li>'+js_forum_insert_title+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	var myThreadContent=tinyMCE.getInstanceById('idThreadContent').getDoc().body.innerHTML;
	if(myThreadContent.length<2 || myThreadContent=='<p><br mce_bogus="1"></p>' || myThreadContent=='<P><BR mce_bogus="1"></P>'){
		myNewListElement='<li>'+js_forum_insert_content+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	
	if(document.getElementsByName('aForumCreateThreadUserId')[0].value=='-1'){
		if(document.fKonsumoForm.aGuestMail.value.match(/([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4})/gi)==null || document.getElementsByName('aGuestMail')[0].value==js_porlet_forum_your_email){
			 myNewListElement='<li>'+js_comment_mail+'<\/li>';
			 new Insertion.Bottom($(myListName),myNewListElement);
			 everythingOK=0;
		}
		if(document.getElementsByName('aAcceptQuestionTerms')[0].checked==false){
			myNewListElement='<li>'+js_bearbeiten_error_agb+'<\/li>';
		 	new Insertion.Bottom($(myListName),myNewListElement);
			everythingOK=0;
		}
		if(document.getElementsByName('aAcceptQuestionPrivacy')[0].checked==false){
			myNewListElement='<li>'+js_bearbeiten_error_privacy+'<\/li>';
		 	new Insertion.Bottom($(myListName),myNewListElement);
			everythingOK=0;
		}
	}
	if(everythingOK==0){
		setTimeout('Effect.BlindDown(\'divErrorMessages\', {duration:0.2})',400);
		scroll(0,0);
	}else{
		document.fKonsumoForm.submit();
	}

}

function voteashelpful(myVoteType,myIdItem){
	new Ajax.Updater('contentBottomRight'+myVoteType+myIdItem,'/actions/forum/forum_vote.cfm?aIdItem='+myIdItem+'&myVoteType='+myVoteType, { method: 'get', evalScripts:true });
}


function questionRegistered(){
	if(document.getElementById('divQuestionGuest').style.display=='none'){
		document.getElementById('divQuestionRegistered').style.display='none';
		document.getElementById('divQuestionGuest').style.display='';
		document.getElementsByName('aRegisteredForm')[0].value='gast';
	}else{
		document.getElementById('divQuestionRegistered').style.display='';
		document.getElementById('divQuestionGuest').style.display='none';
		document.getElementsByName('aRegisteredForm')[0].value='user';
	}
}

function openRatgeberQuestion(){
	if(document.getElementById('divQuestionDetail').style.display=='none'){
		Effect.BlindDown('divQuestionDetail', {duration:1.2});
	}
}
function questionInRatgeber(){
	if(document.getElementById('divQuestionDetail').style.display=='none'){
		Effect.BlindDown('divQuestionDetail', {duration:1.2});
	}else{
		checkQuestion('ulWarnings');
	}
}

function checkQuestion(myListName){
	if(document.getElementById('divQuestionDetail').style.display=='none'){
		questionInRatgeber();
	}else{
		Effect.BlindUp('divErrorMessages', {duration:0.2});
		var everythingOK=1;
		//Einmal die Liste leermachen und dann wird geprueft.
		document.getElementById('divErrorMessages').innerHTML='<ul id="'+myListName+'" class="ulWhiteWarnings marginPaddingLef20 paddingBottom15"><\/ul>';
		if(document.getElementsByName('aQuestion')[0].value.length<2){
			 myNewListElement='<li>'+js_ratgeberquestion_insert_question+'<\/li>';
			 new Insertion.Bottom($(myListName),myNewListElement);
			 everythingOK=0;
		}
		if(document.getElementsByName('aQuestionDescription')[0].value.length<5){
			 myNewListElement='<li>'+js_ratgeberquestion_insert_question_descr+'<\/li>';
			 new Insertion.Bottom($(myListName),myNewListElement);
			 everythingOK=0;
		}
		if(document.getElementsByName('aQuestionUserId')[0].value=='-1'){
			if(document.getElementsByName('aRegisteredForm')[0].value=='gast'){
				if(document.fKonsumoQuestion.aQuestionMailAddress.value.match(/([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4})/gi)==null || document.getElementsByName('aQuestionMailAddress')[0].value==js_porlet_forum_your_email){
					 myNewListElement='<li>'+js_register_mail+'<\/li>';
					 new Insertion.Bottom($(myListName),myNewListElement);
					 everythingOK=0;
				}
				if(document.getElementsByName('aAcceptQuestionTerms')[0].checked==false){
					 myNewListElement='<li>'+js_question_register_terms+'<\/li>';
					 new Insertion.Bottom($(myListName),myNewListElement);
					 everythingOK=0;
				}
			}
			if(document.getElementsByName('aRegisteredForm')[0].value=='user'){
				if(document.getElementsByName('aQuestionUserName')[0].value.length<1){
					 myNewListElement='<li>'+js_register_username+'<\/li>';
					 new Insertion.Bottom($(myListName),myNewListElement);
					 everythingOK=0;
				}
				if(document.getElementsByName('aQuestionUserPassword')[0].value.length<1){
					 myNewListElement='<li>'+js_register_password+'<\/li>';
					 new Insertion.Bottom($(myListName),myNewListElement);
					 everythingOK=0;
				}
			}
		}
		if(everythingOK==0){
			setTimeout('Effect.BlindDown(\'divErrorMessages\', {duration:0.2})',400);
		}else{
			document.fKonsumoQuestion.submit();
		}
	}
}

function checkKontaktForm(myListName){
	Effect.BlindUp('divErrorMessages', {duration:0.2});
	var everythingOK=1;
	//Einmal die Liste leermachen und dann wird geprueft.
	document.getElementById('divErrorMessages').innerHTML='<ul id="'+myListName+'" class="ulWarnings marginPaddingLef20 paddingBottom15"><\/ul>';
	if(document.getElementsByName('aVornmae')[0].value.length<2){
		 myNewListElement='<li>'+js_register_first_name+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.getElementsByName('aNachname')[0].value.length<2){
		 myNewListElement='<li>'+js_register_last_name+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.fKontaktForm.aMail.value.match(/([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4})/gi)==null){
		 myNewListElement='<li>'+js_register_mail+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.getElementsByName('aMessage')[0].checked==false){
		 myNewListElement='<li>'+js_kontakt_insert_text+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(everythingOK==0){
		setTimeout('Effect.BlindDown(\'divErrorMessages\', {duration:0.2})',400);
	}else{
		document.fKontaktForm.submit();
	}
}

function checkMail(myListName){
	Effect.BlindUp('divErrorMessages', {duration:0.2});
	var everythingOK=1;
	//Einmal die Liste leermachen und dann wird geprueft.
	document.getElementById('divErrorMessages').innerHTML='<ul id="'+myListName+'" class="ulWarnings marginPaddingLef20 paddingBottom15"><\/ul>';
	if(document.getElementsByName('aUsername')[0].value.length<2){
		 myNewListElement='<li>'+js_register_username+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.fKonsumoPasswordReminder.aMailadress.value.match(/([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4})/gi)==null){
		 myNewListElement='<li>'+js_register_mail+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(everythingOK==0){
		setTimeout('Effect.BlindDown(\'divErrorMessages\', {duration:0.2})',400);
	}else{
		document.fKonsumoPasswordReminder.submit();
	}
}

function checkPassword(myListName){
	Effect.BlindUp('divErrorMessages', {duration:0.2});
	var everythingOK=1;
	//Einmal die Liste leermachen und dann wird geprueft.
	document.getElementById('divErrorMessages').innerHTML='<ul id="'+myListName+'" class="ulWarnings marginPaddingLef20 paddingBottom15"><\/ul>';
	if(document.getElementsByName('aNewPassword')[0].value.length>0 && document.getElementsByName('aConfirmNewPassword')[0].value.length<1){
		 myNewListElement='<li>'+js_usersettings_password+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(document.getElementsByName('aNewPassword')[0].value != document.getElementsByName('aConfirmNewPassword')[0].value){
		 myNewListElement='<li>'+js_usersettings_password_no_match+'<\/li>';
		 new Insertion.Bottom($(myListName),myNewListElement);
		 everythingOK=0;
	}
	if(everythingOK==0){
		setTimeout('Effect.BlindDown(\'divErrorMessages\', {duration:0.2})',400);
	}else{
		document.fKonsumoPasswordChange.submit();
	}
}

function checkQuickSearch(){
	if(document.getElementsByName('aQuickSearch')[0].value.length>0){
		showSearchAlert();
		document.formQuickSearch.submit();
		return true;
	}else{
		alert(js_quicksearch_no_searchtext);
		return false;
	}
}

function switchResult(myHeadline,myValue,myRowFrom,myRowTo,myRowCount){
	document.getElementById('divRatgeberResult').style.display='none';
	document.getElementById('divNewsResult').style.display='none';
	document.getElementById('divForumResult').style.display='none';
	
	document.getElementById('spanRowFrom').innerHTML=myRowFrom;
	document.getElementById('spanRowTo').innerHTML=myRowTo;
	
	if(mySearchItemsPerPage <= myRowCount){
		document.getElementById('spanRowCount').innerHTML=myRowCount;
		document.getElementById('spanFromWord').style.display='';
	}else{
		document.getElementById('spanRowCount').innerHTML='';
		document.getElementById('spanFromWord').style.display='none';
		document.getElementById('spanRowTo').innerHTML=myRowCount;
	}
	if(myRowCount==0){
		document.getElementById('spanRowFrom').innerHTML='0';
	}
	
	document.getElementById(myValue).style.display='';
	document.getElementById('h1SearchHeadline').innerHTML=myHeadline;
	
	if(myValue=='divRatgeberResult'){
		document.getElementById('divResultTabs').style.backgroundImage='url('+myBasePath+'/pics/search_tab1.gif)';
	}
	if(myValue=='divNewsResult'){
		document.getElementById('divResultTabs').style.backgroundImage='url('+myBasePath+'/pics/search_tab2.gif)';
	}
	if(myValue=='divForumResult'){
		document.getElementById('divResultTabs').style.backgroundImage='url('+myBasePath+'/pics/search_tab3.gif)';
	}
}


function checkSuchart(mySearchType){
	document.getElementById('divSearchContent').style.display='none';
	document.getElementById('divSearchUser').style.display='none';
	
	document.getElementById(mySearchType).style.display='';
	
	if(mySearchType=='divSearchContent'){
		document.formExtendedSearch.action='/suchergebnis';
	}else{
		document.formExtendedSearch.action='/mitglieder-suchergebnis';
	}
}

function checkExtendedSearch(){
	var allowSearch=1;
	if(document.getElementById('divSearchContent').style.display==''){
		if(document.formExtendedSearch.aSearchInTitle.value.length<1 && document.formExtendedSearch.aSearchInTag.value.length<1 && document.formExtendedSearch.aSearchInText.value.length<1){
			alert(js_search_missing_criteria);
			var allowSearch=0;
		}
	}else{
		if(document.formExtendedSearch.aUsername.value.length<1 && document.formExtendedSearch.aName.value.length<1 && document.formExtendedSearch.aCity.value.length<1){
			alert(js_search_missing_criteria);
			var allowSearch=0;
		}
	}
	if(allowSearch==1){
		showSearchAlert();
		document.formExtendedSearch.submit();
	}
}

function extendedSearch(myActivePart){
	document.getElementsByName('aSearchInTitle')[0].value='';
	document.getElementsByName('aSearchInTitle')[0].disabled=true;
	document.getElementsByName('aSearchInTitle')[0].style.backgroundColor='#efefef';
	
	document.getElementsByName('aSearchInTag')[0].value='';
	document.getElementsByName('aSearchInTag')[0].disabled=true;
	document.getElementsByName('aSearchInTag')[0].style.backgroundColor='#efefef';
	
	document.getElementsByName('aSearchInText')[0].value='';
	document.getElementsByName('aSearchInText')[0].disabled=true;
	document.getElementsByName('aSearchInText')[0].style.backgroundColor='#efefef';
	
	if(myActivePart=='title'){
		document.getElementsByName('aSearchInTitle')[0].disabled=false;
		document.getElementsByName('aSearchInTitle')[0].style.backgroundColor='#ffffff';
	}
	if(myActivePart=='tag'){
		document.getElementsByName('aSearchInTag')[0].disabled=false;
		document.getElementsByName('aSearchInTag')[0].style.backgroundColor='#ffffff';
	}
	if(myActivePart=='text'){
		document.getElementsByName('aSearchInText')[0].disabled=false;
		document.getElementsByName('aSearchInText')[0].style.backgroundColor='#ffffff';
	}
}


function showNewsPreview(){
	if(document.getElementById('divNewsPreviewArea').style.display=='none'){
		//Hier geht die Arbeit los
		document.getElementById('h1NewsPreviewTitle').innerHTML=document.getElementsByName('aNewsTitle')[0].value;
		document.getElementById('h2NewsPreviewSubTitle').innerHTML=document.getElementsByName('aNewsTitle2')[0].value;
		document.getElementById('h3NewsPreviewTeaser').innerHTML=document.getElementsByName('aNewsTeaser')[0].value.replace(/\n/g, "<br>");
		var myNewsContent=tinyMCE.getInstanceById('idNewsContentText').getDoc().body.innerHTML;
		document.getElementById('divNewsPreviewContent').innerHTML=myNewsContent;
		
		document.getElementById('divNewsPreviewArea').style.display='';
		document.getElementById('divNewsEditArea').style.display='none';
		
	}else{
		//Hier nur die Preview ausblenden und die Bearbeiten Maske einblenden
		document.getElementById('divNewsPreviewArea').style.display='none';
		document.getElementById('divNewsEditArea').style.display='';
	}
}

function showSearchAlert(){
	if (document.all){
 		myHeightValue=parseFloat(document.documentElement.scrollTop)+140;
 	}else{
 		myHeightValue=parseFloat(window.pageYOffset)+140;
 	}
 	document.getElementById('divSearchMaskContent').style.top=myHeightValue+'px';
	Effect.Appear('divSearchMask', {duration:0.5});
	Effect.Appear('divSearchMaskContent', {duration:0.2});
}

function editThread(myIdThread,myIdForum){
	if(document.getElementById('divForumEditThread').style.display=='none'){
		if(document.getElementById('divForumEditThread').innerHTML==''){
			new Ajax.Updater('divForumEditThread','/inc/forum/inc_thread_edit.cfm?aIdThread='+myIdThread+'&aIdForum='+myIdForum, { method: 'get', evalScripts:true });
		}
		Effect.BlindDown('divForumEditThread', {duration:0.6});
	}else{
		Effect.BlindUp('divForumEditThread', {duration:0.6});
	}
}

function editPost(myIdThread,myIdForum,myIdPost){
	if(document.getElementById('divForumEditPost'+myIdPost).style.display=='none'){
		if(document.getElementById('divForumEditPost'+myIdPost).innerHTML==''){
			new Ajax.Updater('divForumEditPost'+myIdPost,'/inc/forum/inc_post_edit.cfm?aIdThread='+myIdThread+'&aIdForum='+myIdForum+'&aIdPost='+myIdPost, { method: 'get', evalScripts:true });
		}
		Effect.BlindDown('divForumEditPost'+myIdPost, {duration:0.6});
	}else{
		Effect.BlindUp('divForumEditPost'+myIdPost, {duration:0.6});
	}
}


