
if(typeof(window.opera)!='undefined'){var console={};console.log=window.opera.postError;}
function komsys_load(content_id,content_type,h){window.komsys_time=new Date().getTime();komsys_loadComments(content_id,content_type,h);}
function komsys_loadComments(content_id,content_type,h){try{var req=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP");}catch(e){return;}
var container=wfv4_gebi('comments_box');if(container==null)return;container.oInnerHTML=container.innerHTML;container.innerHTML='<span class="menu">Lade Kommentare, bitte warten...</span>';req.open('GET','/comments/show/'+content_type+'/'+content_id+'/'+h,true);req.onreadystatechange=function(){if(req.readyState<4)return;var container=wfv4_gebi('comments_box');if(req.status!=200){container.innerHTML=container.oInnerHTML;return;}
container.innerHTML=req.responseText;komsys_init(content_type,content_id);}
req.send(null);}
function komsys_init(content_type,content_id){komsys_addEditLinks();if(typeof(komsys_addAdminButtons)=='function')komsys_addAdminButtons(content_id,content_type);if(window.location.hash.match(/^[#]?[0-9]+$/)!=null){window.setTimeout('window.location.hash = window.location.hash;',1);}
komsys_foldComments();}
function komsys_addEditLinks(){var container=wfv4_gebi('comments_box');var user=GetCookie('wfv4login');if(user==null)return;user=user.toLowerCase();var user_comments=wfv4_gebc('komsys_userlink','a',container);if(user_comments==null)return;var user_comment=null;for(var k in user_comments){user_comment=user_comments[k];if(user_comment.title.toLowerCase()=='mywinfuture profil von '+user){var own_kom_id=user_comment.id.match(/komsys_userlink_([0-9]*)/)[1];wfv4_gebi('comment_'+own_kom_id).className=wfv4_gebi('comment_'+own_kom_id).className+' komsys_hl';var re=(wfv4_gebi('comment_'+own_kom_id).className.match(/komsys_re/)!=null)?1:0;var own_div=document.getElementById('own_'+own_kom_id);own_div.innerHTML='<a class="r komsys_btn_e" title="Bearbeiten" href="javascript:komsys_openOwnEdit( '+own_kom_id+', '+re+' );"> </a>';own_div.style.width = '17px';}}}
function komsys_foldComments(){var container=wfv4_gebi('comments_box');var comments=wfv4_gebc('komsys_fold','div',container);var comment_id=0,comment=null,replies=null,s=null,t=null,o=null,a=null;for(var k in comments){comment=comments[k];comment_id=comment.id.match(/comment_([0-9]*)/)[1];comment.className=comment.className+' komsys_folded';o=wfv4_gebi('own_'+comment_id);s=document.createElement('span');s.innerHTML='<a title="Aufklappen" class="r komsys_btn_unfold" onclick="komsys_unfoldComment( '+comment_id+' );"> </a>';o.parentNode.insertBefore(s,o);a=wfv4_gebc('menu','a',comment)[0];a.href_=a.href;a.removeAttribute('href');a.title_=a.title;a.removeAttribute('title');comment.onclick=function(){try{wfv4_gebc('komsys_btn_unfold','a',this)[0].onclick();}catch(e){}
this.onclick=function(){};this.style.cursor='';return false;}
comment.style.cursor='pointer';comment.title='Aufklappen';thread=wfv4_gebi('comment_thread_'+comment_id);if(thread!=null){replies=wfv4_gebc('komsys_re','div',thread);for(var l in replies){replies[l].className=replies[l].className+' komsys_auto_folded';}}}}
function komsys_unfoldComment(comment_id){var comment=wfv4_gebi('comment_'+comment_id);if(comment==null){return;}
comment.className=comment.className.replace(/komsys_folded/,'');comment.removeAttribute('title');var a=wfv4_gebc('menu','a',comment)[0];a.href=a.href_;a.title=a.title_;thread=wfv4_gebi('comment_thread_'+comment_id);if(thread==null){return;}
replies=wfv4_gebc('komsys_re','div',thread);for(var k in replies){replies[k].className=replies[k].className.replace(/komsys_(auto_)?folded/g,'');}}
function komsys_openReply(content_id,kom_id,default_text,re_id,content_type){if(GetCookie('wfv4login')==null){alert('Bitte einloggen, um einen Kommentar abzugeben.');return;}
default_text=(default_text==null?'':'@'+default_text+': ');var re=(re_id>0?true:false);var textDiv=wfv4_gebi('comment_text_'+kom_id);var oldEditBox=wfv4_gebi('komsys_editBox');if(oldEditBox){oldEditBox.parentNode.removeChild(oldEditBox);if(oldEditBox.className==kom_id)return;}
var editBox=document.createElement('div');editBox.id='komsys_editBox';editBox.className=kom_id;editBox.style.width=(re?39:43)+'4px';editBox.style.marginTop='10px';editBox.innerHTML='<div style="margin-bottom:4px;">'+'<span class="menu" style="float:left">Auf Kommentar antworten</span>'+'<a href="/netiquette.html" class="menu" style="float:right; text-decoration:underline;" title="Netiquette beachten!">Netiquette beachten!</a>'+'</div><div style="height:4px;overflow:hidden;clear:both;">&nbsp;</div>'+'<div style="position:relative;">'+'<form style="margin:0;padding:0;" method="post" action="'+(window.location+'').split('#')[0]+'" onsubmit="wfv4_gebi(\'js_post_comment\').disabled=true;if(wfv4_count_chars(trim(wfv4_gebi(\'kommentartext\').value))<2){alert(\'Unzureichende Textlänge!\');wfv4_gebi(\'js_post_comment\').disabled=false;return false;}">'+'<textarea style="width:'+(re?39:43)+'4px;" class="inputbox" rows="8" cols="82" name="comments_text" id="kommentartext">'+default_text+'</textarea>'+'<div style="margin: 6px 3px 0 '+(re?29:33)+'2px;">'+'<input type="image" src="http://img.winfuture.de/button_abschicken.gif" id="js_post_comment" alt="Abschicken" value="Go" name="post">'+'</div>'+'<input name="reply_to_id" value="'+kom_id+'" type="hidden">'+'</form>'+'</div>'+'<div style="clear:both;display:block;height:1px;overflow:hidden;visibility:hidden;"> </div>';textDiv.parentNode.appendChild(editBox);}
function komsys_openOwnEdit(kom_id,re){re=re>0?true:false;var comment_text_element=wfv4_gebi('comment_text_'+kom_id);if(comment_text_element==null)return;var open_edit_id=wfv4_gebi('comment_edit_id');open_edit_id=open_edit_id==null?false:open_edit_id.value;var edit_text='';var edited_div=null;if(open_edit_id!=false){var open_edit_element=wfv4_gebi('comment_text_'+open_edit_id);if(typeof(open_edit_element.textContent)!='undefined'){open_edit_element.textContent=wfv4_gebi('comment_edit_original_text').value;}else if(typeof(open_edit_element.innerText)!='undefined'){open_edit_element.innerText=wfv4_gebi('comment_edit_original_text').value;}
edited_div=wfv4_gebc('komsys_edit','div',wfv4_gebi('comment_'+open_edit_id));if(edited_div.length>0){edited_div[0].style.display='block';}}
if(open_edit_id==kom_id){return;}
edited_div=wfv4_gebc('komsys_edit','div',wfv4_gebi('comment_'+kom_id));if(edited_div.length>0){edited_div[0].style.display='none';}
var original_text=typeof(comment_text_element.textContent)!='undefined'?comment_text_element.textContent:typeof(comment_text_element.innerText)!='undefined'?comment_text_element.innerText:'';comment_text_element.innerHTML=comment_text_element.innerHTML.split(isIE()?'&shy;':'\u00ad').join('');edit_text=typeof(comment_text_element.textContent)!='undefined'?comment_text_element.textContent:typeof(comment_text_element.innerText)!='undefined'?comment_text_element.innerText:'';comment_text_element.innerHTML='<form style="margin:0;padding:0;" method="post" action="'+(window.location+'').split('#')[0]+'" '
+'onsubmit="wfv4_gebi(\'comment_edit_submit\').disabled=true;if(wfv4_count_chars(trim(wfv4_gebi(\'comment_edit_text\').value))<2){alert(\'Unzureichende Textlänge!\');wfv4_gebi(\'comment_edit_submit\').disabled=false;return false;}">'
+'<input type="hidden" name="comment_edit_id" id="comment_edit_id" value="'+kom_id+'">'
+'<textarea id="comment_edit_text" name="comment_edit_text" style="width:'+(re?38:42)+'6px;" class="inputbox" rows="8" cols="82"></textarea>'
+'<div style="margin: 6px 3px 0 '+(re?28:32)+'2px;">'
+'<input type="image" src="http://img.winfuture.de/button_abschicken.gif" id="comment_edit_submit" alt="Abschicken">'
+'</div>'
+'</form>'
+'<input type="hidden" name="comment_edit_original_text" id="comment_edit_original_text">'
+'<div style="clear:both;display:block;height:1px;overflow:hidden;visibility:hidden;"> </div>';wfv4_gebi('comment_edit_original_text').value=original_text;wfv4_gebi('comment_edit_text').value=edit_text;}
function komsys_vote(kom_id,h,b){if(GetCookie('wfv4login')==null){alert('Sie müssen angemeldet sein, um einen Kommentar bewerten zu können.');return;}
var now=new Date().getTime();if(now-4000<window.komsys_time){alert('Bitte warten Sie einige Sekunden,\nbevor Sie die nächste Bewertung abgeben.');window.komsys_time=now;return;}
window.komsys_time=now;try{var req=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP");}catch(e){return;}
req.open('GET','/vote/comment/ajax/'+kom_id+'/'+b+'/'+h,false);req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');req.send(null);var vote_plus=wfv4_gebi('komsys_vote_plus_'+kom_id);var vote_minus=wfv4_gebi('komsys_vote_minus_'+kom_id);if(req.responseText==''){var votingSpan=wfv4_gebi('comment_vote_'+kom_id);var voting=votingSpan.innerHTML;var match=voting.match(/^\(<b[^>]*>([+-][0-9]+)<\/b>\)/i);voting=0;if(match!=null){match=match[1];voting=match.substring(0,1)=='-'?match:match.substr(1);}
if(b==1){vote_minus.style.backgroundPosition='0 -82px';vote_plus.style.visibility='hidden';voting--;}else{vote_plus.style.backgroundPosition='0 -69px';vote_minus.style.visibility='hidden';voting++;}
var className='';switch(voting){case 5:className='p4';break;case 4:className='p3';break;case 3:className='p2';break;case 2:className='p1';break;case-2:className='n1';break;case-3:case-4:className='n2';break;case-5:className='n3';break;case-6:className='n4';break;}
if(voting>5)className='p4';if(voting<-6)className='n4';if(voting>2||voting<-2){wfv4_gebi('comment_'+kom_id).className+=' komsys_'+className;}
var html='(<b>';if(voting>0)html+='+';html+=voting+'</b>)&nbsp;';votingSpan.innerHTML=html;}else{alert(req.responseText);}
vote_plus.onclick=function(){return false;};vote_plus.removeAttribute('href');vote_minus.onclick=function(){return false;};vote_minus.removeAttribute('href');}