// JavaScript Document
/*
-----------------------------------------------
/ Equalize height of the Graphic Teasers on the same line
-----------------------------------------------
*/ 

jQuery.noConflict();


jQuery(document).ready(function(){



jQuery(".btnSendToFriend").click(function(){
										  

										
	var iframeLink = jQuery(".btnSendToFriend").attr("href");	  
	jQuery("body").prepend(' <div class="tellAFriendTransparentBk2"><div class="tellAFriendTransparentBk">  </div> </div> <div class="tellAFriendWrapperIframe"> <iframe width="380" height="518" src="#" style="border: medium none;" frameborder="0"> test</iframe> </div>')
	jQuery(".tellAFriendCloseWindow").show();
	
	
	jQuery(".tellAFriendWrapperIframe iframe").attr("src",iframeLink);	
	return false;
});


jQuery(".tellAFriendCloseWindow").click(function(){
	jQuery(".tellAFriendTransparentBk2, .tellAFriendWrapperIframe").remove();
	jQuery(".tellAFriendCloseWindow").hide();
});

/*
jQuery("#date1").datepicker({showOn: 'button', firstDay: 1, dateFormat: 'dd-mm-yy', buttonImage: '/images/icon_calendar.gif', buttonImageOnly: true});
jQuery("#date2").datepicker({showOn: 'button', firstDay: 1,  dateFormat: 'dd-mm-yy', buttonImage: '/images/icon_calendar.gif', buttonImageOnly: true});
*/

/*jQuery('#date1').datePicker();
jQuery('#date2').datePicker();*/
jQuery('#fc').css('z-index', '2000');


jQuery(function(){jQuery('.teaserWideImage, .teaserImagePriceNumber, .teaserMediumMagazinePhoto, .teaserWideImageTextMedia, .teaserGraphicMedia, .tellAFriendTransparentBk2, .tellAFriendWrapperIframe, .searchFieldsWrap, #mainMenu div').pngFix();});


jQuery("#mainMenu").hover(function(){
		jQuery("#mainMenu > div").stop().animate({ height: "290px"}, 500 );
	},function(){
		jQuery("#mainMenu > div").stop().animate({ height: "44px"}, 500 );
										   
})




jQuery("#mainMenu, #mainMenu li").hover(function(){
		jQuery(this).addClass("hover");		
	},function(){
		jQuery(this).removeClass("hover");			   
										   
})


if (jQuery.browser.msie && jQuery.browser.version <= 6 ) {
	
		jQuery("#mainMenu li:first").hover(function(){
				jQuery(this).addClass("hoverFirstChild");		
			},function(){
				jQuery(this).removeClass("hoverFirstChild");  
		})
		
		if (jQuery("#mainMenu li:first").hasClass("activePage")){
				jQuery("#mainMenu li:first").addClass("activePageFirstChild");
		}

}
/*
-----------------------------------------------
ONLINE BOOKING FORM PAGE
-----------------------------------------------
*/ 

jQuery(".onlineBookingFormRooms").hide();

jQuery("#oneWaytripType").click(function(){
									
	if (jQuery("#oneWaytripType:checked").length == 1) {
		jQuery(".onlineBookingFormRetur").hide();
		jQuery("#onlineBookingFormFlyMed").hide();
	}else{
		jQuery(".onlineBookingFormRetur").show();
		jQuery("#onlineBookingFormFlyMed").show();
	}

});

jQuery("#ReturntripType").click(function(){
									
	if (jQuery("#ReturntripType:checked").length == 1) {
		jQuery(".onlineBookingFormRetur").show();
		jQuery("#onlineBookingFormFlyMed").show();
	}else{
		jQuery(".onlineBookingFormRetur").hide();
		jQuery("#onlineBookingFormFlyMed").hide();
	}

});

jQuery("#bookhotel").click(function(){
									
	if (jQuery("#bookhotel:checked").length == 1) {
		jQuery(".onlineBookingFormRooms").show();
	}else{
		jQuery(".onlineBookingFormRooms").hide();
	}

});


for (i=1;i<=8;i++){
	jQuery(".onlineBookingFormChildAge:first").clone(true).insertAfter(jQuery(".onlineBookingFormChildAge:last")).children("select").attr("id", "age" + i + "DropDown").attr("name", "age" + i + "DropDown");

}
jQuery(".onlineBookingFormChildAge").hide();



jQuery("#childDropDown").change(function(){
	var nrChildren = Number(jQuery("#childDropDown option:selected").val());
	jQuery(".onlineBookingFormChildAge").hide();
	for (var i = 0; i < nrChildren; i++ ){
		jQuery(".onlineBookingFormChildAge").eq(i+1).show();
	}
	
});

/*
-----------------------------------------------
/ ONLINE BOOKING FORM PAGE
-----------------------------------------------
*/ 



/*
-----------------------------------------------
teaserGraphic ANIMATION
-----------------------------------------------
*/ 


var teaserGraphicNr = jQuery(".teaserGraphicAnimList .teaserGraphic").length;


jQuery(".teaserGraphicAnimList .teaserGraphic").append('<ul class="teaserGraphicNavigation"></ul>')
for (var i = 0; i < teaserGraphicNr; i++){
		jQuery(".teaserGraphic .teaserGraphicNavigation").append("<li>&nbsp;</li>")
}


var timeOutDelay;
var teaserGraphicCurentPos = 0;
var teaserGraphicCurentX = 0;
var teaserGraphicWidth = 236;

jQuery(".teaserGraphicNavigation li").click(function(){													 
	teaserGraphicCurentPos = jQuery(".teaserGraphicNavigation li").index(this) % teaserGraphicNr;
	teaserGraphicAnimation();		
	intervalTrigger(); 	
})
			
jQuery(".teaserGraphicNavigation").each(function (i) {		// add green bullet for the active li
	jQuery(this).children("li:first").addClass("activeTeaser");		
});


function teaserGraphicAnimation( ){

	 jQuery(".teaserGraphicNavigation").each(function (i) {		// add green bullet for the active li
		jQuery(this).children("li").removeClass("activeTeaser").eq(teaserGraphicCurentPos).addClass("activeTeaser");		
	});
	 

	jQuery(".teaserGraphicAnimList").animate({ 
				left:  teaserGraphicCurentPos * (-teaserGraphicWidth)+"px"
		}, 1000,function(){
	});
	
	if (teaserGraphicCurentPos < teaserGraphicNr - 1 ){
			teaserGraphicCurentPos ++;
			teaserGraphicCurentX = teaserGraphicCurentPos * (-teaserGraphicWidth);	
		}else{
			teaserGraphicCurentPos = 0;
			teaserGraphicCurentX = 0;
	}
}




function intervalTrigger( ) {									   
	clearInterval(timeOutDelay);
	timeOutDelay = setInterval( teaserGraphicAnimation, 4000 );
};

intervalTrigger(); 

jQuery(".teaserGraphicAnimList .teaserGraphic").hover(function(){													   
			clearInterval(timeOutDelay);
		},function(){
			intervalTrigger(); 																
})

	/*
	
setInterval ( teaserGraphicAnimation(), 2000 );
	
	
jQuery(".teaserGraphicAnimList").animate({ 
			marginLeft:  teaserGraphicCurentX+"px"
    }, 1000, "linear", function(){alert("all done");} );

	
	*/
	
	
/*
	jQuery(".teaserGraphicAnimList").animate({ 
			marginLeft:  teaserGraphicCurentX+"px"
		},1100 ).animate({ 
			opacity: 1
	}, 1000, function(){
		
		if (teaserGraphicCurentPos < teaserGraphicNr){
			teaserGraphicCurentPos ++;		
			teaserGraphicCurentX = teaserGraphicCurentX - 236;

		}else{
			teaserGraphicCurentPos = 1;
			teaserGraphicCurentX = 0;
		}
		
		teaserGraphicAnimation()
	});
*/






/*
-----------------------------------------------
/ teaserGraphic ANIMATION
-----------------------------------------------
*/ 




});






