
function handleTextField(tfield, op, deftext){
            switch(op){
		    case 'show' : if(tfield.value == '')
                                tfield.value=deftext;
		    break;
		    
                    case 'hide' : if(tfield.value == deftext)
				tfield.value='';
		    break;
	    }
        return true;
}

$(document).ready(function(){
            $('#txbQuery').focus(function(){
		handleTextField(this,'hide', 'keresés');
	})
	
	$('#txbQuery').blur(function(){
		handleTextField(this,'show', 'keresés');
	})

/*Thx to - http://www.learningjquery.com/2007/09/animated-scrolling-with-jquery-12*/
$('a[href=#newsletterform]').click(function() {
   if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
     var $target = $(this.hash);
     $target = $target.length && $target
     || $('[name=' + this.hash.slice(1) +']');
     if ($target.length) {
       var targetOffset = $target.offset().top;
       $('html,body').animate({scrollTop: targetOffset}, 500);
       setTimeout("$('input#email').focus()",400);/*késleltetés hogy a focus ne zavarjon bele az animációba*/
      return false;
     }
   }
  });

/*IE hover menu patch*/
if(document.all&&document.getElementById){
    $('li.hasSub').hover(
			function() { $('ul', this).attr('style', 'left: 0;');},
			function() { $('ul', this).attr('style', 'left:-990em;'); });        
}
var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;

	$('#newsletterform').submit(function(e){
		if(!$('#email').val().match(emailExp)){
			e.preventDefault();
			$('#warning').fadeIn(250);
		}
		else{
			$('#warning').fadeOut(250);
			return true;
		}
	})

})

