/* Facebook-Post für Sweetdoku */

function postonprofile(username, platz, zeit, difflevel) {
  var rand     = Math.random();
  var shareurl = 'http://www.schwartauer-werke.de/facebook/sweetdoku/sweetdoku_fb.php?username='+username+'&platz='+platz+'&zeit='+zeit+'&difflevel='+difflevel+'&randid='+rand;
  var sharetxt = 'Schwartau Sweetdoku';
  var openurl = 'http://www.facebook.com/sharer.php?u='+encodeURIComponent(shareurl)+'&t='+encodeURIComponent(sharetxt)+'&p=0';
  window.open(openurl,'_blank');
}

/*
$(function() {
    $('#allwrapper').css("width", function() {
      return $('body').width() + 1000 + "px";
    });
});
*/

/*
function anpass() {
  jQuery('#new-bg-div').css("width", function() {
      zz = jQuery('body').width() + 1000 + "px";
      console.log("width: " + zz);
      return ;
    });
  jQuery('#new-bg-div').css("left", function() {
      zz = - ((jQuery(this).width() - jQuery('body').width()) / 2);
      zz = Math.max(zz, -506) + "px"
      console.log("left: " + zz);
      return zz;
    });
}
*/

function anpass() {
  jQuery('body').css("backgroundPosition", function() {
    zz = Math.max(0, ((jQuery('body').width() - jQuery('#content-bg-wrapper').width()) / 2)) - 507;
    return zz+'px 77px';
  });
  jQuery('#main-menu-level-2').css("width", function() {
    zz = jQuery('body').width() - (Math.max(0, ((jQuery('body').width() - jQuery('#main-menu').width()) / 2)) + parseInt(jQuery('#main-menu-level-2').css("margin-left")));
    return zz;
  });
}

function suchFormValue(ref, act) {
  var ersetz = "Suche...";
  if (window.location.search != "") {
    var wls = window.location.search;
    var wls_erg = wls.search(/L=1/);
    if (wls_erg != -1)
      var ersetz = "Search...";
  }
  if (act == "focus" && ref.value == ersetz)
    ref.value = "";
  if (act == "blur" && ref.value == "")
    ref.value = ersetz;
}

function suchFormInitLang() {
  if (window.location.search != "") {
    var wls = window.location.search;
    var wls_erg = wls.search(/L=1/);
    if (wls_erg != -1) {
      document.getElementById("tx-indexedsearch-searchbox-sword").value = "Search...";
      document.getElementById("tx-indexedsearch-searchbox-lang").value = 1;
      document.tx_indexedsearch_top.action = "suche/?L=1";
      
      jQuery("#main-logo a").attr("href", "home/?L=1&na=1");
    } else {
      document.getElementById("tx-indexedsearch-searchbox-sword").value = "Suche...";
      document.getElementById("tx-indexedsearch-searchbox-lang").value = 0;
      document.tx_indexedsearch_top.action = "suche/";
      
      jQuery("#main-logo a").attr("href", "home/?na=1");
    }
  }
}

