$(document).ready(function(){

  $('#premium_head a').cluetip({
    dropShadow: false,
    width: 456,
    positionBy: 'mouse'
  });

  $('#menu_bottom a:eq(3)').cluetip({
    dropShadow: false,
    width: 207,
    positionBy: 'bottomTop',
    topOffset: 12,
    leftOffset: 0});

  /* Karte vor Ort */
  /*$('.ansprechpartner a').cluetip({
    dropShadow: false,
    width: 187,
    positionBy: 'fixed',
    topOffset: -50,
    leftOffset: 150});*/

		$('.ibhamburg a').cluetip({
    dropShadow: false,
    width: 187,
    positionBy: 'fixed',
    activation: 'click',
    topOffset: -85,
    leftOffset: 187});
    
    $('.ibduesseldorf a').cluetip({
    dropShadow: false,
    width: 187,
    positionBy: 'fixed',
    activation: 'click',
    topOffset: -125,
    leftOffset: 155});
    
    $('.ibfrankfurt a').cluetip({
    dropShadow: false,
    width: 187,
    positionBy: 'fixed',
    activation: 'click',
    topOffset: -260,
    leftOffset: 234});
    
    $('.ibmuenchen a').cluetip({
    dropShadow: false,
    width: 187,
    positionBy: 'fixed',
    activation: 'click',
    topOffset: -367,
    leftOffset: 132});
    
    $('.ibwien a').cluetip({
    dropShadow: false,
    width: 187,
    positionBy: 'fixed',
    activation: 'click',
    topOffset: -375,
    leftOffset: 6});

  $('#searchTerm').attr('value','Suchbegriff').css('color', '#000000').click(function(){
      $('#searchTerm').attr('value','').css('color', '#000000');   //.unclick().unfocus()
  }).focus(function(){
    $('#searchTerm').attr('value','').css('color', '#000000');  //.unfocus().unclick()
  });
  $('#search label').hide();
  $(".lightbox").lightbox();

  $('#printpreview a:eq(0)').click(function(){
    var loc = window.location.href;
    var noParams = loc.indexOf("?") == -1;
    var lastChar = loc.charAt(loc.length-1);
    if(lastChar == "#") loc = loc.substring(0,loc.length-1);
    window.open(loc+(noParams ? "?" : "&")+"printpreview=on", "Druckvorschau", "width=800,height=500,left=50,top=50,scrollbars=yes");
  });

  $('#print a:eq(0)').click(function(){
    window.print();
  });


  /* This script is used to display thy Tabpanel for the in and outbox */
  $("#tabpanel > ul").tabs();
  $("#fondsTable").tablesorter({
      headers: {
           1: { sorter: false  },
           3: { sorter: false  },
           4: { sorter: false  }
      }
    });
    $("#fondsTable").tablesorterPager({container: $("#fondsPager")});
    $("#searchHits").tablesorter({
      headers: {
           0: { sorter: false  }
      }
    });
    $("#searchHits").tablesorterPager({container: $("#searchPager")});
    $('#uploadAttachment').MultiFile({
        accept:'jpeg|jpg|pdf|doc|txt|png|gif|htm|html|ppt|xls|bmp|odt|rtf|zip',
        max: 6,
        list: '#uploadInfoList',
        STRING: {
            file: '<em title="Datei wird beim Abschicken angeh&auml;ngt">$file</em>',
            remove: '<img src="/Images/Layout/delete.gif" height="16" width="16" alt="Anhang entfernen"/>',
            selected:'Zum Upload bereit: $file',
            denied:'Die Dateiendung $ext ist nicht erlaubt!',
            duplicate:'Diese Datei ($file) liegt schon zum Upload bereit!'
        },
        onFileAppend: function(element, value, master_element){
            document.getElementById('uploadInfoLabel').innerHTML="Dateianh&auml;nge:";
        }
    });

});



function setMenuFontSize8() {
  $('body').css('font-size', '0.8em');
  $('#font_size a.small .pic').css('background', 'url(/Images/Layout/akleinaktiv.gif) no-repeat scroll 0 5px');
  $('#menue a').css('font-size', '10px');
}

function setMenuFontSize9() {
  $('body').css('font-size', '0.9em');
  $('#font_size a.medium .pic').css('background', 'url(/Images/Layout/amittelaktiv.gif) no-repeat scroll 0 5px');
  $('#menue a').css('font-size', '10px');
}

function setMenuFontSize98() {
  $('body').css('font-size', '0.98em');
  $('#font_size a.large .pic').css('background', 'url(/Images/Layout/agrossaktiv.gif) no-repeat scroll 0 5px');
  $('#menue a').css('font-size', '10px');
}

/* 'decode' a double uri-encoded link */
function downloadDisclaimer(thePath){
    var theLink = unescape(thePath);
    theLink = unescape(theLink);
    $("#dialog").css({ display:"block"});
      $("#dialog").dialog({
        resizable: false,
        height: 170,
        width:  300,
        modal: true,
        persist: true,
          overlay: {
              opacity: 0.5,
              background: "black"
          },
        buttons: {
              "Gelesen": function() {
                 window.open(theLink, "", "");
                 $("#dialog").dialog("destroy");
            },
              "Abbrechen": function() {
                $("#dialog").dialog("destroy");
            }
        }
    });
    $("#dialog").dialog("open");
}

