/*Content display change*/
$(document).ready(function() {

	// Escape from frame
	if (top.location != location) {
		top.location.href = document.location.href;
	}

	$('ul.nav li').has('ul.sub-nav').addClass('has-sub');

	$('#navigation ul.nav li ul li').hover( function() {
		$(this).next().children("a").addClass("nobg");
	}, function () {
		$(this).next().children("a").removeClass("nobg");
	});

	$('ul.nav li').hover( function() {
		$('ul:first',this).show();
	}, function () {
		$('ul:first',this).hide();
	});

/*	now = new Date();
	startDate = new Date();
	startDate.setDate(now.getDate()+2);
	startDate = startDate.asString();*/
	$('.date-pick').datePicker({clickInput:true });
	$('.date-in-pop').datePicker({clickInput:true });

	$('a.fb-icon').hover( function() {
		$('.tooltip-fb').fadeIn('fast');
	}, function () {
		$('.tooltip-fb').fadeOut('fast');
	});
	$('a.tw-icon').hover( function() {
		$('.tooltip-tw').fadeIn('fast');
	}, function () {
		$('.tooltip-tw').fadeOut('fast');
	});
	$('a.fav-icon').hover( function() {
		$('.tooltip-fav').fadeIn('fast');
	}, function () {
		$('.tooltip-fav').fadeOut('fast');
	});


	$("ul.news-multi > li").click(function(){
		$(this).colorbox();
	});

	$("#right .promotion .cont").each(function() {
		$(this).colorbox({ iframe: true, innerWidth:605, innerHeight:500, title: false, href: $(this).find('a').attr('href')});
	});

	jQuery.fn.swapWith = function(to) {
		return this.each(function() {
			var copy_to = $(to).clone(true);
			var copy_from = $(this).clone(true);
			$(to).replaceWith(copy_from);
			$(this).replaceWith(copy_to);
		});
	};

	$('.subv .v-item').click(function () {
		if ($(this).parent().hasClass('vsub')) {
			$(this).swapWith('.vclick > .v-item');
		}
	});

	$('.sub .w-item').click(function () {
		if ($(this).parent().hasClass('sub')) {
			$(this).swapWith('.click > .w-item');
		}
	});


	$('.date').css('visibility','hidden');
	$('.sub-nav').hide();
	$('.sub').hide();
	$('.vsub').hide();
	$('.search-pop').hide();

	$('button').hover(function () {
		$(this).hide();
	});

	$('#foot-nav ul li').hover( function() {
		$(this).addClass("dropselected");
		$('ul:first',this).show();
	}, function () {
		$(this).removeClass("dropselected");
		$('ul:first',this).hide();
	});

	$('.tooltip').tipsy({live: true, gravity: 'w', fade: true, html: true});

	$("a[rel='gallery']").colorbox({maxWidth: 800, maxHeight: 800});

	/* Popup Calls */
	$(".request-trigger").colorbox({ iframe: true, innerWidth:605, innerHeight:500, title: false}); // FL
	/* Popup Calls End */

	$('input[type="text"]').example(function() {
		return $(this).attr('title');
	});

	$('#phone-slide').innerfade({
		animationtype: 'fade',
		speed: 'slow',
		timeout: 3000, /* set "pause time" for phone slider */
		type: 'sequence',
		containerheight: '94px'
	});


	$('.hotels').bind('click',function () {
		$(this).toggleClass('reqactive');
		$('.request').toggleClass('reqactive');
		$('.sendrequest').toggleClass('sendrequestactive');
		$('.epower-bottom').slideToggle('normal');
		$('.epower, .epower-hotels, .epower-cars').slideToggle('normal');
		return false;
	});

	$('.request-hotels').bind('click',function () {
		$(this).toggleClass('reqactive');
		$('.hotels').toggleClass('reqactive');
		$('.sendrequest').toggleClass('sendrequestactive');
		$('.epower-bottom').slideToggle('normal');
		$('.epower, .epower-hotels, .epower-cars').slideToggle('normal');
		return false;
	});

	$('.request').bind('click',function () {
		$(this).toggleClass('reqactive');
		$('.avio').toggleClass('reqactive');
		$('.sendrequest').toggleClass('sendrequestactive');
		$('.epower-bottom').slideToggle('normal');
		$('.epower, .epower-hotels').slideToggle('normal');
		return false;
	});

	$('.avio').bind('click',function () {
		$(this).toggleClass('reqactive');
		$('.request').toggleClass('reqactive');
		$('.sendrequest').toggleClass('sendrequestactive');
		$('.epower-bottom').slideToggle('normal');
		$('.epower, .epower-hotels').slideToggle('normal');
		return false;
	});



	/* Search box eff */
	$(".search-pop").click(function(event){
		event.stopPropagation();
	});

	$('.search-pop span a').click(function () {
		$('.search-pop').fadeOut('fast');
		$('.small').slideDown('normal');
	});

	$('.small').click(function () {
		$(this).hide();
		$('.search-pop').toggle('slide');

	});

	$('.blue-button-small input').click(function() {
		$('.blue-button-small').removeClass('blue-button-small').addClass('btnclicked');
	});

	/* Body click handler */
	$(document).click(function() {
		$('.search-pop').fadeOut('fast');
		$('.small').slideDown('normal');
	});
	$('.small').click(function(e) {
		e.stopPropagation();
	});

	/* End serach box */

	/* Social icons hover text */
	$('.social-icons a').hover(
		function() {
			$('.social-icons span').css('color','#00536e');
		},
		function () {
			$('.social-icons span').css('color','#0091c0');
		}
	);

	$('.request').hover(
		function() {
			$('.slide').css('background-position','bottom right');
		},
		function () {
			$('.slide').css('background-position','top right');
		}
	);

	/* End social icons*/

	/*Hover tooltip end*/


	$('.cont').hover(
		function() {
			$(this).css({'background':'#a3d6e9' , 'border-top':'1px solid #7db5cd' , 'margin-top':'-1px' });
			$(this).children('.price, .value').css('color','#fb1d6d');
		},
		function () {
			$(this).css({'background':'none','border-top':'1px solid #a3d7ec !important'});
			$('.datea, .price').css('color','#00aeef !important');
			$('.value').css('color','#0091c0 ');
		}
	);

	/*Hover news*/
	$('.news-multi li').hover(
		function() {
			$(this).children('.date').css('visibility','visible');
			$(this).children('p').css({'color':'#333333','border-bottom':'1px solid #eee'});
			$(this).children('img').css('border','1px solid #bf201d !important');
		},
		function () {
			$(this).children('.date').css('visibility','hidden');
			$(this).children('p').css({'color':'#666666','border-bottom':'none'});
			$(this).children('img').css('border','1px solid #eeeeee !important');
		}
	);
	/*End hover news*/

	/*Scrool styling*/
	//$('.scroll-pane').jScrollPane();
	$('.scroll-pane').css('overflow', 'hidden');
        
        if($('#scroll-first-minute li').length > 2) {
            $('#scroll-first-minute').vTicker({ 
                    speed: 500,
                    pause: 4000,
                    mousePause: true,
                    showItems: 2
            });
        } else {
            $('#scroll-first-minute').css('height', 'auto');
        }
        if($('#scroll-last-minute li').length > 2) {
            $('#scroll-last-minute').vTicker({ 
                    speed: 500,
                    pause: 4000,
                    mousePause: true,
                    showItems: 2
            });
        } else {
            $('#scroll-last-minute').css('height', 'auto');
        }
        if($('#scroll-other-minute li').length > 2) {
            $('#scroll-other-minute').vTicker({ 
                    speed: 500,
                    pause: 4000,
                    mousePause: true,
                    showItems: 2
            });
        } else {
            $('#scroll-other-minute').css('height', 'auto');
        }
        
	$('.scroll-pane2').jScrollPane();
	/*Scrool styling end*/


/* Footer wheather and value drop nav */
	var vals = {
		'whe': false,
		'val': false
	};
	$('.whe-list').bind('click', function() {
		if(vals['whe']) {
			$('.sub', $(this)).slideUp('fast', function() {
				vals['whe'] = false;
			});
			$(this).removeClass('footeractive');
		} else {
			$('.val-list .vsub').slideUp('fast', function() {
				vals['val'] = false;
				$('.val-list').removeClass('footeractiveleft');
			});
			$('.sub').slideDown('fast', function() {
				vals['whe'] = true;
			});
			$(this).addClass('footeractive');
		}
	});
	$('.val-list').bind('click', function() {
		if(vals['val']) {
			$('.vsub', $(this)).slideUp('fast', function() {
				vals['val'] = false;
			});
			$(this).removeClass('footeractiveleft');
		} else {
			$('.whe-list .sub').slideUp('fast', function() {
				vals['whe'] = false;
				$('.whe-list').removeClass('footeractive');
			});
			$('.vsub').slideDown('fast', function() {
				vals['val'] = true;
			});
			$(this).addClass('footeractiveleft');
		}
	});
	$(document).bind('click', function() {
		if(vals['whe']) {
			$('.sub').slideUp('fast');
			$('.whe-list').removeClass('footeractive');
			vals['whe'] = false;
		}

		if(vals['val']) {
			$('.vsub').slideUp('fast');
			$('.val-list').removeClass('footeractiveleft');
			vals['val'] = false;
		}
	});
	/* end footer nav */

	$('.head a').toggle(function () {
		$('.head a').addClass('multi-view');
			$('ul.news-multi').fadeOut('fast', function() {
			$(this).fadeIn("slow").addClass("news-single");
		});
	}, function () {
		$('.head a').removeClass('multi-view');
			$("ul.news-single").fadeOut("fast", function() {
			$(this).fadeIn("fast").removeClass("news-single");
		});
	});

	// News click
	$("ul.news-multi > li").click(function(){
		window.location=$(this).find("a").attr("href");
		return false;
	});

	jQuery.fn.swapWith = function(to) {
		return this.each(function() {
			var copy_to = $(to).clone(true);
			var copy_from = $(this).clone(true);
			$(to).replaceWith(copy_from);
			$(this).replaceWith(copy_to);
		});
	};

	$("div.promotion .jspPane").each(function() {
		if ( $(this).children("span.cont").length < 2 ) {
			$(this).parents('.jspContainer').attr('style', 'width: 247px; height: 73px;');
			$(this).parents('.scroll-pane').attr('style', 'height: 73px;');
		}
	});

});
/*Content display change - end*/

