/*-------------------------------------------------------------------------*/
$(function () {
	
	var preload = function () {};
	
	/* button hover states */
	$('input[type=image]').each(function () {
		var id = $(this).attr('id');
		preload[id + '-over'] = new Image();
		preload[id + '-over'].src = '/img/' + id + '-over.gif';
		preload[id] = new Image();
		preload[id].src = '/img/' + id + '.gif';
		
		
		$(this).mouseover(function () {
			$(this).attr('src', '/img/' + id + '-over.gif');
		});
		$(this).mouseout(function () {
			$(this).attr('src', '/img/' + id + '.gif');
		});
		
	});
	
	/* external links */
	$('a[rel=external]').each(function () {
		$(this).attr('target', '_blank');
	});
	
});

/*-------------------------------------------------------------------------*/
var font = {
 src: '/inc/flash/sifr.swf'
 };

 sIFR.useStyleCheck = true;
 sIFR.activate(font);

 sIFR.replace(font, {
 selector: '#main .col h1'
 ,css: [
 '.sIFR-root { color: #015588; font-weight: normal; }'
 ],wmode: 'transparent'
 });
 
 sIFR.replace(font, {
 selector: '#main .col h2'
 ,css: [
 '.sIFR-root { color: #015588; font-weight: bold; }'
 ],wmode: 'transparent'
 });
 
 sIFR.replace(font, {
 selector: '#left h3'
 ,css: [
 '.sIFR-root { color: #ffffff; font-weight: normal; }'
 ],wmode: 'transparent'
 });
 
 sIFR.replace(font, {
 selector: '#main h1'
 ,css: [
 '.sIFR-root { color: #ffffff; font-weight: normal; }'
 ],wmode: 'transparent'
 });
 
 sIFR.replace(font, {
 selector: '#main h2'
 ,css: [
 '.sIFR-root { color: #015588; font-weight: bold; }'
 ],wmode: 'transparent'
 });
/*-------------------------------------------------------------------------*/ 
function calculateDate(dt, el)
{
	var days = $('#'+el).val();
	var checkin = new Date();
	var date = $('#'+dt).val().split("/");
	
	checkin.setYear(date[2]);
	checkin.setMonth(date[1]-1);
	checkin.setDate(date[0]);
	
	checkin.setDate(checkin.getDate() + parseInt(days));
	
	var coDay = (parseInt(checkin.getDate()) < 10 ? "0" : "" ) + checkin.getDate();
	var coMon = (parseInt(checkin.getMonth()) < 9 ? "0" : "" ) + (checkin.getMonth()+1);

	var formattedDate = ' ' + coDay + '/' + coMon + '/' + checkin.getFullYear();
	$('#departureDateDisplay').text(formattedDate);
};

