

$(document).ready(function(){
	$('#menu>li').hover(function(){
		$(this).addClass('over');
	}, function(){
		$(this).removeClass('over');
	});
	$('#news').cycle({ 
		fx:    'scrollUp', 
		timeout: 10000,
		delay: -1000
	});
	
	$('#bannerContainer, .imagecontainer').cycle();
	$('#slides').cycle({
		/*before: onBefore*/
	});
	
	$('.imagecontainer a, .fancy').fancybox({
		'cyclic': true,
		onStart: function(){$('.youtubemovs').hide();},
		onClosed: function(){$('.youtubemovs').show();}
	});
	//$('.fancy').
	$(document).pngFix();
	$('img.captify').captify({opacity: '1.0'});
	
	$('a[rel=external]').each(function(){
		$(this).attr('target','_blank');
	})
	
	$('.mailrep').each(function(){
		var newHref = $(this).attr('href').replace('[(ad)]','@').replace('[(dot)]','.');
		var newHtml = $(this).html().replace('[(ad)]','@').replace('[(dot)]','.');
		$(this).attr('href',newHref).html(newHtml);
	});
    
    
});

function embedYT(mov, w, h){
	var ifr = '<iframe width="'+w+'" height="'+h+'" frameborder="0" src="http://www.youtube.com/embed/'+mov+'" title="" class="youtube"></iframe>'
	document.write(ifr);
}

function onBefore(curr, next, opts) {
	var n = opts.nextSlide;
	var temp = $('#slides a:eq('+opts.nextSlide+')').css('height'); 
	var tempCurr = $('#slides a:eq('+opts.currSlide+')').css('height');;
	if(temp == "0px"){
		var temp = 700;
	} else if(parseFloat(tempCurr)<=parseFloat(temp)){
			$('#slides').css('height',temp);
	}
	
}

