/* ********** (C) TAXI2AIRPORT 2009 ********** */

/* ********** ****** ********* ********** */
/* ********** JQUERY FUNCTIONS ********** */
/* ********** ****** ********* ********** */

$(document).ready(function() {
	$("area").mouseover(function() {
		var country = this.className; 
		$("#map").attr("src", "gfx/eu-" + country + ".png"); // 
    });
	
	$("area").mouseout(function() {
		$("#map").attr("src", "/taxi2airport/ontwerpen/taxi2airport.com/gfx/eu.png"); // 
    });
	
	$("table.countries tr").click(function() {
		var id = this.id;
		var url = $("#" + id + " td:first a").attr("href");
		window.location = url;
	});
	
	$("div.list div div").click(function() {
		var id = this.id;
		var url = $("#" + id + " a").attr("href");
		window.location = url;
	});
	
	$("#logo").click(function() {
		$("div#en").slideToggle(); 
    });
	
	$("#title1").click(function() {
		$("#content1").slideToggle(600); 
		$("#comment1").slideToggle(150); 
    });
	
	$("#title2").click(function() {
		$("#content2").slideToggle(400); 
		$("#comment2").slideToggle(150); 
    });
	
	var showmap = true;
	$("#closemap").click(function() {
		showmap = !showmap;
		$("div.flashobject").toggle(); 
		if (showmap)
		{
			$("#showhide").attr("src", "/taxi2airport/ontwerpen/taxi2airport.com/gfx/show-c.png");
		}
		else
		{
			$("#showhide").attr("src", "/taxi2airport/ontwerpen/taxi2airport.com/gfx/hidden-c.png");
		}
    });
	
	$("div.collapse").css('cursor', 'pointer');
	$("table.countries tr").css('cursor', 'pointer');
	$("div.list div div").css('cursor', 'pointer');
	$("div.countryinfo span.button").css('cursor', 'pointer');


	/* QUOTE countryinfo */
	// see http://henrik.nyh.se/examples/truncator/
	$(function()
	{
		$('div.countryinfo').truncate({max_length: 500});
    });

	$("#foottip a").tooltip({ 
	    bodyHandler: function() { 
	        return $($(this).attr("href")).html(); 
	    }, 
	    showURL: false 
	});
	
	$("div.airports li").tooltip({ 
		bodyHandler: function() { 
	        return $('ap'+$(this).attr("ap")).html(); 
	    }, 
	    showURL: false 
	});

	/* If return trip is selected, expand row */
	if ( $("#offerte-retour").val() == 't' )
	{
		$(".retour").show();
		$("#offerte-retourdatum").hide();
	}
	else
	{
		$(".retour").hide();
	}
	
	/* QUOTE collapse return trip */
	$("#offerte-retour").change(function(){ 
		$(".retour").toggle();
	});
	
	/* MODULE LAYOUT FIX */
	$('div#module6 > table').attr('style', 'width: 630px; ');
	$('div#module6 select').attr('style', 'width: 180px; ');
	$('select[name=aantalvolwassenen]').attr('style', 'width: 50px; ');
	$('select[name=heenreis_dag]').attr('style', 'width: 50px; ');
	$('select[name=heenreis_maand]').attr('style', 'width: 100px; ');
	$('select[name=heenreis_jaar]').attr('style', 'width: 50px; ');
	$('select[name=heenreis_uur]').attr('style', 'width: 50px; ');
	$('select[name=heenreis_min]').attr('style', 'width: 50px; ');
	$('select[name=boeking-tellc]').attr('style', 'width: 50px; ');
	
	
	
	$("form#countryform select#country").change(function(){ 
		$("form#countryform").submit();
	});
    $("form#countryform input.button").hide();

    $('#land-naar').change(function() {
    	setTimeout ("layoutFix()", 500);
    });
    $('#land-van').change(function() {
    	setTimeout ("layoutFix()", 500);
    });
});


/* ********** ********** ********* ********** */
/* ********** JAVASCRIPT FUNCTIONS ********** */
/* ********** ********** ********* ********** */

function layoutFix()
{
	$('span#txtplaatsen-naar select').attr('style', 'width: 180px; ');
	$('span#txtplaatsen-van select').attr('style', 'width: 180px; ');
}

/*

*/
