/* ISTC.be, all rights reserved */

// head images rotator
function rotate(){
	$('#headimg li:last, #heading li:last img').fadeOut(1000, function(){
		$('#headimg li:last').prependTo('#headimg ul').show();
	});
}

// check Cruises form
function checkCruisesForm(){
	if ($('input[name=name]').val() == ''){
		alert('Please fill in your name.');
		return false;
	}

	if ($('input[name=city]').val() == ''){
		alert('Please fill in your city.');
		return false;
	}

	if ($('input[name=phone]').val() == ''){
		alert('Please fill in your phone number.');
		return false;
	}

	if (!emailValid($('input[name=email]').val())){
		alert('Please fill in your e-mail address.');
		return false;
	}

	return true;
}

// check Deluxe Holidays form
function checkDeluxeHolidaysForm(){
	if ($('input[name=name]').val() == ''){
		alert('Please fill in your name.');
		return false;
	}

	if ($('input[name=city]').val() == ''){
		alert('Please fill in your city.');
		return false;
	}

	if ($('input[name=phone]').val() == ''){
		alert('Please fill in your phone number.');
		return false;
	}

	if (!emailValid($('input[name=email]').val())){
		alert('Please fill in your e-mail address.');
		return false;
	}

	return true;
}

// check City Trips form
function checkCityTripsForm(){
	if ($('input[name=name]').val() == ''){
		alert('Please fill in your name.');
		return false;
	}

	if ($('input[name=city]').val() == ''){
		alert('Please fill in your city.');
		return false;
	}

	if ($('input[name=phone]').val() == ''){
		alert('Please fill in your phone number.');
		return false;
	}

	if (!emailValid($('input[name=email]').val())){
		alert('Please fill in your e-mail address.');
		return false;
	}

	return true;
}

// check Around the world form
function checkAroundTheWorldForm(){
	if ($('input[name=name]').val() == ''){
		alert('Please fill in your name.');
		return false;
	}

	if ($('input[name=country]').val() == ''){
		alert('Please fill in your country.');
		return false;
	}

	if ($('input[name=phone]').val() == ''){
		alert('Please fill in your phone number.');
		return false;
	}

	if (!emailValid($('input[name=email]').val())){
		alert('Please fill in your e-mail address.');
		return false;
	}

	return true;
}

// check Tours form
function checkToursForm(){
	if ($('input[name=name]').val() == ''){
		alert('Please fill in your name.');
		return false;
	}

	if ($('input[name=city]').val() == ''){
		alert('Please fill in your city.');
		return false;
	}

	if ($('input[name=country]').val() == ''){
		alert('Please fill in your country.');
		return false;
	}

	if ($('input[name=phone]').val() == ''){
		alert('Please fill in your phone number.');
		return false;
	}

	if (!emailValid($('input[name=email]').val())){
		alert('Please fill in your e-mail address.');
		return false;
	}

	return true;
}

function emailValid(email){
	var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
	return emailPattern.test(email);
}


// document ready
$(document).ready(function(){
	$('#headimg ul').removeClass('hide');
	setInterval('rotate()', 5000);

	// fancybox
	$("a[rel=iframe]").fancybox({
		'type':'iframe',
		'scrolling':'yes',
		'showNavArrows':false,
		'width':930,
		'height':650
	});


});





