function startMenu() {
	$('ul.topnav > li').hover(
			function() {$('ul:first', this).show();},
			function() { $('ul:first', this).hide();}
	);
	$('ul.topnav li li').hover(function() {
		$('ul:first', this).each(function() {
			$(this).css('top', $(this).parent().position().top );
			$(this).css('left', $(this).parent().position().left + $(this).parent().width() );
			$(this).show();
		});},
		function() {$('ul:first', this).hide();});
	}

function topBannerSlideShow(){ $('#topbanner').innerfade({ speed: 800, timeout: 5000, type: 'sequence', containerheight: '220px' });}
function toggleDiv(itemID){ $('#'+itemID).slideToggle('normal');}           

var headline_count;
var headline_interval;
var old_headline = 0;
var current_headline=0;

function startNewsScroll(){
  headline_count = $("div.headline").size();
  $("div.headline:eq("+current_headline+")").css('top','5px');
  
  headline_interval = setInterval(headline_rotate,4000); 
  $('#scrollup').hover(function() {
    clearInterval(headline_interval);
  }, function() {
    headline_interval = setInterval(headline_rotate,4000); 
    headline_rotate();
  });
};

function headline_rotate() {
  current_headline = (old_headline + 1) % headline_count;
  $("div.headline:eq(" + old_headline + ")").animate({top: -205},"slow", function() {
    $(this).css('top','210px');
    });
  $("div.headline:eq(" + current_headline + ")").show().animate({top: 5},"slow");  
  old_headline = current_headline;
}

function validateRequire(){
	var nev = $('#nev');
	var ceg = $('#ceg');
	var cim = $('#cim');
	var tel = $('#telefon');
	var email = $('#email');
	var marka = $('#marka');
	var tipus = $('#tipus');
	
	reg = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/ ;
	var bool = true;
	if( tipus.val() == '' ){ bool = false; tipus.css('border','1px solid #FF0000'); }else{ tipus.css('border','1px solid #858585'); }
	if( marka.val() == '' ){ bool = false; marka.css('border','1px solid #FF0000'); }else{ marka.css('border','1px solid #858585'); }
	if( !reg.test(email.val()) ){ bool = false; email.css('border','1px solid #FF0000'); }else{ email.css('border','1px solid #858585'); }
	if( tel.val() == '' ){ bool = false; tel.css('border','1px solid #FF0000'); }else{ tel.css('border','1px solid #858585'); }
	if( cim.val() == '' ){ bool = false; cim.css('border','1px solid #FF0000'); }else{ cim.css('border','1px solid #858585'); }	
	if( ceg.val() == '' ){ bool = false; ceg.css('border','1px solid #FF0000'); }else{ ceg.css('border','1px solid #858585'); }
	if( nev.val() == '' ){ bool = false; nev.css('border','1px solid #FF0000'); }else{ nev.css('border','1px solid #858585'); }
	return bool;
	}
