(function(a){if(typeof a.fn.rte==="undefined"){var b={media_url:"assets/templates/buehne-0910/js/rte/",content_css_url:"assets/templates/buehne-0910/js/rte/rte.css",dot_net_button_class:null,max_height:350};a.fn.rte=function(c){a.fn.rte.html=function(e){return e.contentWindow.document.getElementsByTagName("body")[0].innerHTML};var d=a.extend(b,c);return this.each(function(){var o=a(this);var i;var f=o.attr("id");var e=false;var h=false;function j(){var r=o.val();if(a.trim(r)==""){r="<br />"}if(i){o.hide();a(i).contents().find("body").html(r);a(i).show();a("#toolbar-"+f).remove();o.before(m());return true}i=document.createElement("iframe");i.frameBorder=0;i.frameMargin=0;i.framePadding=0;i.height=200;if(o.attr("class")){i.className=o.attr("class")}if(o.attr("id")){i.id=f}if(o.attr("name")){i.title=o.attr("name")}o.after(i);var q="";if(d.content_css_url){q="<link type='text/css' rel='stylesheet' href='"+d.content_css_url+"' />"}var s="<html><head>"+q+"</head><body class='frameBody'>"+r+"</body></html>";n(s,function(){a("#toolbar-"+f).remove();o.before(m());o.hide()})}function n(r,s){if(!i){return false}try{i.contentWindow.document.open();i.contentWindow.document.write(r);i.contentWindow.document.close()}catch(q){}if(document.contentEditable){i.contentWindow.document.designMode="On";s();return true}else{if(document.designMode!=null){try{i.contentWindow.document.designMode="on";s();return true}catch(q){}}}setTimeout(function(){n(r,s)},500);return false}function l(s){var r=a(i).contents().find("body").html();if(a(i).is(":visible")){e=a(i).width();h=a(i).height();o.val(r)}if(s!==true){o.show();if(e!==false){o.width(e)}if(h!==false){o.height(h)}a(i).hide()}else{r=o.val();var q=new RegExp("<br[^>]*><br[^>]*>","g");r=r.replace(q,"<br>");q=new RegExp("<br[^>]*>","g");r=r.replace(q,"<p></p>");o.val("<p>"+r)}}function m(){var r=a("<div class='rte-toolbar' id='toolbar-"+f+"'><div>                <p>                    <a href='#' class='bold'><img src='"+d.media_url+"bold.gif' alt='bold' /></a>                    <a href='#' class='italic'><img src='"+d.media_url+"italic.gif' alt='italic' /></a>                </p>                <p>                    <a href='#' class='unorderedlist'><img src='"+d.media_url+"unordered.gif' alt='unordered list' /></a>                    <a href='#' class='link'><img src='"+d.media_url+"link.png' alt='link' /></a>                    <a href='#' class='image'><img src='"+d.media_url+"image.png' alt='image' /></a>                    <a href='#' class='disable'><img src='"+d.media_url+"close.gif' alt='close rte' /></a>                </p></div><div style='clear:both'></div></div>");a(".bold",r).click(function(){k("bold");return false});a(".italic",r).click(function(){k("italic");return false});a(".unorderedlist",r).click(function(){k("insertunorderedlist");return false});a(".link",r).click(function(){var u=prompt("URL:");if(u){k("CreateLink",u)}return false});a(".image",r).click(function(){var u=prompt("image URL:");if(u){k("InsertImage",u)}return false});a(".disable",r).click(function(){l();var u=a('<a class="rte-edm" href="#">Enable design mode</a>');r.empty().append(u);u.click(function(v){v.preventDefault();j();a(this).remove()});return false});if(d.dot_net_button_class){var s=a(i).parents("form").find(d.dot_net_button_class);s.click(function(){l(true)})}else{a(i).parents("form").submit(function(){l(true)})}var t=a(i.contentWindow.document);var q=a("select",r)[0];t.mouseup(function(){p(g(),q);return true});t.keyup(function(){p(g(),q);var u=a("body",t);if(u.scrollTop()>0){var v=parseInt(i.style.height);if(isNaN(v)){v=0}var w=Math.min(d.max_height,v+u.scrollTop())+"px";i.style.height=w}return true});return r}function k(s,q){i.contentWindow.focus();try{i.contentWindow.document.execCommand(s,false,q)}catch(r){}i.contentWindow.focus()}function p(r,q){return true}function g(){if(i.contentWindow.document.selection){selection=i.contentWindow.document.selection;range=selection.createRange();try{node=range.parentElement()}catch(q){return false}}else{try{selection=i.contentWindow.getSelection();range=selection.getRangeAt(0)}catch(q){return false}node=range.commonAncestorContainer}return node}j()})}}})(jQuery);$(document).ready(function(){var a=$(".rte-zone").rte("","images url");if($("html").hasClass("ie6")){$("#navigation ul li").hover(function(){$(this).addClass("over")},function(){$(this).removeClass("over")})}if($("html").hasClass("ie6")){$("#navigation ul li ul.submenu li").hover(function(){$(this).addClass("over")},function(){$(this).removeClass("over")})}});