/****************** dropdown menus ***************************/
var timeout    = 500;
var closetimer = 0;
var ddmenuitem = 0;

function jsddm_open()
{  jsddm_canceltimer();
   jsddm_close();
   ddmenuitem = $(this).find('ul');
   $(ddmenuitem).show();
}

function jsddm_close()
{  if(ddmenuitem) $(ddmenuitem).hide();}

function jsddm_timer()
{  closetimer = window.setTimeout(jsddm_close, timeout);}

function jsddm_canceltimer()
{  if(closetimer)
   {  window.clearTimeout(closetimer);
      closetimer = null;}}

$(document).ready(function()
{  $('#jsddm > li').bind('mouseover', jsddm_open)
   $('#jsddm > li').bind('mouseout',  jsddm_timer)});

document.onclick = jsddm_close;
/********************************************************************/

$.fn.scrollView = function () {
    return this.each(function () {
        $('html, body').animate({
            scrollTop: $(this).offset().top
        }, 700);
    });
}



function init_header() {
	
	$(document).ready(function() {
	
		$("#findus-button").click(
			function() { $("#findus-wrap").slideToggle('fast'); return false; }
		);
		
		$("#map").hover(
			function(){	$("#map-overlay").fadeIn('fast'); }, 
			function() { $("#map-overlay").fadeOut('fast'); }
		);
		
		$("#map-view").hover(
			function(){	$(this).stop().animate({top:"35px"},{queue:false,duration:200}); }, 
			function() { $(this).stop().animate({top:"45px"},{queue:false,duration:200}); }
		);
		
		$("#map-print").hover(
			function(){	$(this).stop().animate({top:"35px"},{queue:false,duration:200}); }, 
			function() { $(this).stop().animate({top:"45px"},{queue:false,duration:200}); }
		);
		
		$(".movable").hover(
			function(){	$(this).stop().animate({paddingBottom:"5px"},{queue:false,duration:200}); }, 
			function() { $(this).stop().animate({paddingBottom:"0px"},{queue:false,duration:200}); }
		);
		
		$(".movable-s").hover(
			function(){	$(this).stop().animate({marginBottom:"6px"},{queue:false,duration:200}); }, 
			function() { $(this).stop().animate({marginBottom:"1px"},{queue:false,duration:200}); }
		);
		
		$("a[rel=map]").fancybox({
			'transitionIn'	:	'elastic',
			'transitionOut'	:	'elastic',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	true
		});
		
		$("a[rel=ss]").fancybox({
			'transitionIn'	:	'elastic',
			'transitionOut'	:	'elastic',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	true
		});

		
	   
		$('a[href=#top]').click(function(){
			$('html, body').animate({scrollTop:0}, 'slow');
			return false;
		});
		
		
		Cufon.replace('h1')('h2')('.aller');

});
	
}

function checkContact() {
    var inputs = $("#contact_div :input").validator();
    result = inputs.data("validator").checkValidity();
	return result;
}

