$(document).ready(function() {
						   
	
mailto = []; 

$(".mailme").each(function(m){
	mailto[m] = $(this).html();
    $(this).html( '<a href="mailto:'+mailto[m]+'@vengit.com">'+mailto[m]+'@vengit.com</a>' );
});




/* input mezok default értékének cseréje.. default..üres.. */

swapValue = []; 

$(".swap-value").each(function(i){ 
   swapValue[i] = $(this).val(); 
   $(this).focus(function(){ 
      if ($(this).val() == swapValue[i]) { 
         $(this).val(""); 
      } 
      $(this).addClass("focus"); 
   }).blur(function(){ 
      if ($.trim($(this).val()) == "") { 
         $(this).val(swapValue[i]); 
	 $(this).removeClass("focus"); 
      } 
   }); 
}); 




/* scroll page */

$('.scrollPage').click(function() {
   var elementClicked = $(this).attr("href");
   var destination = $(elementClicked).offset().top;
   $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination-20}, 500 );
   return false;
});



var interval;
interval = setInterval(yourfunction, 5000);


$('.panel').mouseenter(function() {
	clearInterval(interval);
});

$('.panel').mouseleave(function() {
	interval = setInterval(yourfunction, 5000);
});



$('#slide-nav a').live('click' , function(c) {
	clearInterval(interval);
	var rel = $(this).attr('rel');
	var selector = '#' + rel;
	var t = $(this);
	$('.sld').stop().animate({
          opacity: 0
      }, 450 , function() {
      	$('.sld').hide();
       	$(selector).show().stop().animate({
          opacity: 1
      }, 600);

      });



	$('#slide-nav a').removeClass('active');
	$(t).addClass('active');
	
	
	return false;
	
});



$(".box").hover(
  function () {
	var obj = $(this).find('.info:first a');
	var html = $(obj).html();
	$(obj).attr('rel' , html);
	$(obj).html($(obj).attr('title'));
  }, 
  function () {
    var obj = $(this).find('.info:first a');
	var html = $(obj).html();
	$(obj).html($(obj).attr('rel'));
  }
);

$('.box').live('click' , function() {
	var obj = $(this).find('.info:first a');
	window.location.href = $(obj).attr('href');
});


$('ul.menu li a').live('click' , function () {

	$('ul.menu li a').removeClass('active');
	$(this).addClass('active');
   
	current = $(this);
	
	
	var h = $(this).attr('href');
	h = h.replace('?' , '#' );
	$('#contentSlider').scrollTo(h, 800);    
	var elm = $('.contentbox:visible');
	var height = $(h).outerHeight();
	height = height + 30;
	$('#contentSlider').animate({
		height: height
	});
	return false;
	 
});
	
	


var currentURL = window.location;
var hash = currentURL.search;
if ( hash != "" ) {
	var link = $("a[href='"+hash+"']");
	console.log(link);
	$(link).trigger('click');
} else {
	$('ul.menu a:first').trigger('click');
}
			





function yourfunction() { 

	if ( true ) { 
		var slide = $('.sld:visible');
		if ( $(slide).attr('id') == "slide1" ) {
			$("a[rel='slide2']").trigger('click');
		}
		if ( $(slide).attr('id') == "slide2" ) {
			$("a[rel='slide3']").trigger('click');
		}
		if ( $(slide).attr('id') == "slide3" ) {
			$("a[rel='slide1']").trigger('click');
		}
		
	}

}



});
