function rsTextSelection()
{
        if (document.getSelection) // older Mozilla versions
        {
                var selectedString = document.getSelection();
        }
        else if (document.all) // MSIE 4+
        {
                var selectedString=document.selection.createRange().text;
        }
        else if (window.getSelection) // recent Mozilla versions
        {
                var selectedString=window.getSelection();
        }
        document.rs_form.selectedtext.value = selectedString;
        if (document.rs_form.url) {
                if (!document.rs_form.url.value) {
                        if (window.location.href)
                        {
                                document.rs_form.url.value=window.location.href;
                        }
                        else if (document.location.href)
                        {
                                document.rs_form.url.value=document.location.href;
                        }
                }
        }
}
function copyselected()
{
        setTimeout("rsTextSelection()",50);
        return true;
}
function openAndRead() {
        window.open('','rs','width=380,height=180,toolbar=0');
        setTimeout("document.rs_form.submit();",500);
}
document.onmouseup = copyselected;
document.onkeyup = copyselected;


/**
    *
    * Print Preview
    *
    */
    var truePrint = false;
    function PrintOrNot() {
          var myPrint = location.search;
          if (myPrint.indexOf("print=true") > -1) {
            truePrint = true;
          }
    }
    PrintOrNot();
    function printWindow(x,y) {
        window.open(x+"?print=true"+y,"_new","width=600px,height=600px,toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes");
    }
    if (truePrint == true) {
        document.write('<style type="text/css" media="screen">@import url(css/print.css);</style>');
    }

    /**
    *
    * Reads all a Elements within col2 and rewrites it in the footer div
    *
    */
    
    var oldBrowser = navigator.appVersion.indexOf("MSIE 5");
if (oldBrowser == -1) {
    if (truePrint == true) {
            jQuery(document).ready(function() {
    
            var links = new Array();
            var content = "";
            var dateAndTime = new Date();
            var day = dateAndTime.getDate();
            var month = dateAndTime.getMonth() + 1;
            var year = dateAndTime.getFullYear();
            var hours = dateAndTime.getHours();
            var minutes = dateAndTime.getMinutes();
            if (minutes < 10)    { 
                minutes = "0" + String(minutes);
            }
            var dateString = "<p>&nbsp;</p><p>Erzeugt am: "+day+"."+month+"."+year+" um " + hours + ":"+minutes+"</p>";
            jQuery("#footer").html(dateString);
//            links =  $("#col2:visible a[@href]").get();
            links =  jQuery("#col2:visible a.tbl").get();
            if (links.length > 0) {
                var content = "<h4>Verwendete Links:</h4>";
            }
            for (var i = 0; i < links.length; i++) {
                content += "<p style='margin:0;padding:0;'>" + links[i] + "</p>"; 
            } 
            content += dateString;
            jQuery("#footer").html(content);
            window.print();
         });
    }
    else {
        jQuery(document).ready(function() {
            var blendStatus = true; 
            jQuery("a.blend").click(function() { 
                if (blendStatus == true) {
                    jQuery("a.ausblenden").css({ background: "#551285", color: "#FFFFFF" });
                    jQuery("a.einblenden").css({ background: "#FFFFFF", color: "#005EC2" });
                    jQuery("ul.sitemap").find("ul:visible").slideUp("slow"); 
                    jQuery("a.blend").text("Dritte Ebene einblenden");
                    blendStatus = false;
                    return;
                }
                if (blendStatus == false) {
                    jQuery("a.blend").css({ background: "#551285", color: "#FFFFFF" });
                    jQuery("a.blend").css({ background: "#FFFFFF", color: "#005EC2" });
                    jQuery("ul.sitemap").find("ul:hidden").slideDown("slow");
                    jQuery("a.blend").text("Dritte Ebene ausblenden");
                    blendStatus = true;
                    return;
                }
            });
        
    
         });
    }
}
