jQuery(document).ready(function() {

	//Teaser Hover 
	$('a.more').css ({ "opacity": "0" });
	$('a.more').hover(function() {
		$(this).stop().animate ({ "opacity": "1.0" }, { "duration": "fast", "easing": "easeInOutElastic" });
		},
		 function () {
			$(this).stop().animate({ "opacity" : 0});
	});
	
	
	//Fancybox intitialisierens
	$(window).load(function() {
		$("a.fancybox").fancybox({
			'titleShow'     : false
		});
	});
	
	
	//Content FadeIn
	$('#news_feature, .tourdaten').css ({ "display": "none" });
	$('#news_feature, .tourdaten').delay(200).fadeIn(600);
	

}); //Close DocumentReady


	//Redirect Fancybox
	function shortFancy(infotext,redirectURL){
		$.fancybox(
				infotext,
				{
		        	'autoDimensions'	: false,
					'width'         	: 500,
					'height'        	: 'auto',
					'transitionIn'		: 'none',
					'transitionOut'		: 'none',
					'onClosed' 		: function() {
						if (redirectURL){
							$(location).attr('href',redirectURL);
						}
					}	
				});
	}
	function fancyPlayVideo(flvFile){
		infotext='<embed src="http://mdnplayer.intermedia-solutions.net/players/ims_player.swf" width="480" height="360" wmode="transparent" allowScriptAccess="always" allowFullScreen="true" flashvars="width=480&height=360&file=http://mdn.intermedia-solutions.net/fms;mobstis/27069;'+flvFile+';flv;xml&backcolor=0x7B7B7B&frontcolor=0xffffff&lightcolor=0x333333&resize_video=automatic&autostart=true&httpscode=false&repeat=false&showicons=true&showdigits=true&usefullscreen=true&showstop=false&smoothing=true">';
		shortFancy(infotext);
	}
	
	function fancyLeaveSite(externURL){
		infotext='<div class="attention-text"><div class="attentionIMG"><img src="'+picturePath+'attention.jpg" alt="" width="162" height="30"/></div><div class="leave_page_info_text">Du bist gerade dabei, die Webseite von Nintendo of Europe zu verlassen. Nintendo of Europe übernimmt keine Verantwortung für die Inhalte oder die Sicherheit der Seite, die Du zu besuchen beabsichtigst.</div><div class="left"><a class="leave_page" href="javascript:" onclick="$.fancybox.close();"></a></div><div class="left stay_on_page_div"><a class="stay_on_page" href="'+externURL+'" target="blank" onclick="$.fancybox.close();"></a></div></div><div class="clear" style="height: 1px;"></div></div>';
		shortFancy(infotext);
	}	
	
	//Gruppenfunktion mit Fancybox
	$(window).load(function() {
		for(i=0;i<15;i++){
			$(".pp_gal"+i).prettyPhoto({
				animation_speed: 'fast', /* fast/slow/normal */
				slideshow: 5000, /* false OR interval time in ms */
				autoplay_slideshow: false, /* true/false */
				opacity: 0.65, /* Value between 0 and 1 */
				show_title: false, /* true/false */
				allow_resize: true, /* Resize the photos bigger than viewport. true/false */
				default_width: 500,
				default_height: 344,
				counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
				theme: 'pp_default', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
				horizontal_padding: 20, /* The padding on each side of the picture */
				hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
				wmode: 'opaque', /* Set the flash wmode attribute */
				autoplay: true, /* Automatically start videos: True/False */
				modal: false, /* If set to true, only the close button will close the window */
				deeplinking: true, /* Allow prettyPhoto to update the url to enable deeplinking. */
				overlay_gallery: true, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
				keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */
				changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
				callback: function(){}, /* Called when prettyPhoto is closed */
				ie6_fallback: true,
				social_tools: false
			});
		}
	});
	
	
	//Gallerie Slider 
	function mycarousel_initCallback(carousel)
	{
			// Disable autoscrolling if the user clicks the prev or next button.
			carousel.buttonNext.bind('click', function() {
			carousel.startAuto(0);
			});
			
			carousel.buttonPrev.bind('click', function() {
			carousel.startAuto(0);
			});
			
			// Pause autoscrolling if the user moves with the cursor over the clip.
			carousel.clip.hover(function() {
			carousel.stopAuto();
			}, function() {
			carousel.startAuto(0);
			});
			};
			
			jQuery(document).ready(function() {
				jQuery('.mycarousel').jcarousel({
					auto: 10,
					wrap: 'last',
					initCallback: mycarousel_initCallback
			});
	}); 
			
	function getHomeNews(){
		$.ajax({
		  url: mainURL+"cmd/80-news",
		  type: 'POST',
		  data: 'homeinfonews=1',
		  context: document.body,
		  success: function(data){
				shortFancy(data, mainURL+'cmd/home');
		    return false;
		  }
		});
	}		
