
// little event helpers for IE6
function show(element){
	element.className += "hover";
}
function hide(element){
	element.className = element.className = "";
}


$(document).ready(function(){ 
	
	//$(document).pngFix();
	
	$("area").tooltip({
		bodyHandler: function(){
			return $("#" + $(this).attr("class")).html();
		},
		showURL: false,
		track: true,
		fade: 150,
		top: 13,
		left: 15
	});
	
	$("#heightHelper").css({'height': ($(document).height()) });
	
    $("area").mouseover(
      function () {
        $("#" + $(this).attr('class') + "_image").removeClass("hidden");
		$("#imageMap_default").addClass("hidden");
      });
	  

	$("area").mouseout(
      function () {
		$("#" + $(this).attr('class') + "_image").addClass("hidden");
		$("#imageMap_default").removeClass("hidden");
      }
    );

    
    
    $("#searchInput").click(function() {
      $("#searchInput").attr("value", "");
    })

	
	$('a.toTop').click(function() {	
		$.scrollTo(0, 600 );	
	})	
	
}); 


/**
 * Downloads
 */
function checkOrder() {    
	if ($("input:checked").length > 0)
	{
		return true;
	}
	else {
		$(".orderText").html("<strong>Sie müssen mindestens eine Printausgabe ausgewählt haben!</strong>");
		return false;
	}
}


/**
 *  displays the click2call popup
 */
function click2callPopup(){

    //set the height of the black background layer again.. measurements may have changed
    $("#overlay").css({
        height: $(document).height(),
        opacity: 0.92
    });

    $("select").hide();
    
	$("#overlay").fadeIn(350, function() {

		/*$("#click2call").css({
	        top: ($(document).scrollTop() + 200)
	    });*/
	
		$("#click2call").fadeIn(400);
		
	});
	    
    //bind the click event on the overlay div
    $("#overlay, #click2call, #freecallCloseButton").click(function(){
		$("#click2call").fadeOut(250, function () {
	        $("#overlay").fadeOut(280);
		});
		return false;
    });
	
	$("#freecallBox").click(function() {
		return false;
	});
	
	$("#freecallBox input[type=submit]").click(function() {
		c2c_submit();
	});

    return false;
}



function c2c_submit(){

    var c2cLink = $('#c2cF').attr('action') + '?GesamtNummer=' + $('input[name=c2cGn]').val() + '&PartnerID=' + $('input[name=c2cPid]').val() + '&Land=' + $('input[name=c2cL]').val();
    
    $('body').append('<iframe width="0" height="0" frameborder="0" src="' + c2cLink + '" scrolling="no" style="display:none;"></iframe>');
    
	$("#freecallForm").fadeOut("fast", function() {
	    $("#freecallForm").html("In ein paar Sekunden erhalten Sie einen Anruf und werden kostenfrei mit unserer Zentrale verbunden.");
	});
	$("#freecallBox .top .bottom").animate({
		 height: "51px"
	}, 600);
	$("#freecallForm").fadeIn("fast");
	
    return false;
    
}

