// --------------------------------------------------------------
// UNOBTRISUVE INITIALIZATION
// Author: Stefan Rausch
// Company: Skygate GmbH
// Created: 2009-05-12
// --------------------------------------------------------------

$(document).ready(function() {
  initAdjustSearchToggle();
  initHelp();
  initUmkreissucheEnableToggle();
});

// --------------------------------------------------------------
// FUNCTIONS
// --------------------------------------------------------------
function initAdjustSearchToggle()
{
  $("a#adjustSearch").click(function(){	
    $("#sc1").toggle("slow");
    return false;
  });
}

function initHelp()
{
  $("a.InfoText").each(function() {
  	
  	$(this).wTooltip({
	    content: true,
	    callBefore: function(tooltip, helpContent) {
	        $(tooltip).html($(helpContent).html());
    	},
    	fadeIn: 400,
     	fadeOut: "fast",
     	style: {
			    border: "1px solid #8EC104",
			    background: "#EEF5CF",
			    color: "#000",
			    padding: "10px",
			    zIndex: "1000",
			    textAlign: "left",
			    width: "500px",
			    fontSize: "75%"
		}
	});
  
  });
}

function testUmkreissucheEnable(eventObject)
{
	if($("input#plz").val().length==5 || $("input#ort").val().length>=3){
		$("select#umkreis").removeAttr('disabled');
	}else{
		$("select#umkreis").attr('disabled','disabled');
	}
}

function initUmkreissucheEnableToggle()
{
  testUmkreissucheEnable();
	
  $("input#plz").keyup(function (e){
	  testUmkreissucheEnable();
  });
  $("input#ort").keyup(function (e){
	  testUmkreissucheEnable();
  });
}



function showAllToggleDivs(){
	$(".togglecontent").css('display','block');
}

function hideAllToggleDivs(){
	$(".togglecontent").css('display','none');
}