
Cufon.set('forceHitArea', 'true');
Cufon.replace('#header .nav-main .text A', { fontFamily: 'Eurostile', fontWeight: 500, hover: true });
Cufon.replace('#header .section-lower .title', { fontFamily: 'Eurostile', fontWeight: 600 });
Cufon.replace('#sidebar .nav-sub > LI > A', { fontFamily: 'Myriad Pro', hover: true });
Cufon.replace('H1, H2', { fontFamily: 'Myriad Pro' });

jQuery.noConflict();

(function($) {
$(function() {

	var IS_OLD_MOBILE_WEBKIT = (function() {
		var agent = navigator.userAgent;
		return /Series60|SymbianOS/i.test(agent) && /WebKit\/[0-4]\d\d /i.test(agent);
	})();

	$(".text").focus(function() {
		if (this.value == this.defaultValue) {
			this.value = "";
		}
	}).blur(function() {
		if (! this.value.length) {
			this.value = this.defaultValue;
		}
	});

	if (IS_OLD_MOBILE_WEBKIT) return;

	/**
	 * Support for custom size fonts, saved into cookie
	 */
	
	var ResizeableFont = function(selector) {
		this.COOKIE_FONTSIZE = 'fontsize';
		this.selector = selector;
		this.default_size = parseInt($(this.selector).css('fontSize')) + ($.browser.msie ? 3 : 0);
		this.delta = parseInt($.cookie(this.COOKIE_FONTSIZE)) || 0;
		this.update();
	}
	
	ResizeableFont.prototype.update = function() {
		var new_size = parseInt(this.default_size + this.delta) + 'px';
		$(this.selector).css('fontSize', new_size);
		Cufon.refresh();
		$.cookie(this.COOKIE_FONTSIZE, this.delta, { expires: 180, path: '/' });	
	}
	
	ResizeableFont.prototype.adjust = function(delta) {
		this.delta += delta;
		this.update();
	}

	if ($.browser.msie && $.browser.version < 7) {
		$('LI:first-child').addClass('first-child');
		$('.section:first-child').addClass('section-first-child');
	}

	var resizeable_font = new ResizeableFont('#document');
	
	$('A.new-window').each(function() { $(this).attr('target', '_blank') });

	$('#footer A.print').click(function(e) {
		e.preventDefault();
		print();
	});
	
	$('#footer A.bigger').click(function(e) {
		e.preventDefault();
		resizeable_font.adjust(+1);
	});

	$('#footer A.smaller').click(function(e) {
		e.preventDefault();
		resizeable_font.adjust(-1);
	});
	

	$('#footer A.print_rss').click(function(e) {
		e.preventDefault();
		print();
	});
	
	$('#footer A.bigger_rss').click(function(e) {
		e.preventDefault();
		resizeable_font.adjust(+1);
	});

	$('#footer A.smaller_rss').click(function(e) {
		e.preventDefault();
		resizeable_font.adjust(-1);
	});


	/* Frontpage map icon & label hilite */

	$('.front #airports LI').each(function() {
		var m = this.className.match(/coords-([0-9]+)-([0-9]+)/);
		if (m && m.length > 2) {
			this.location_icon = $('<div class="location" />')
				.css('left', m[1] + 'px')
				.css('top', m[2] + 'px')
				.appendTo('#content .section-upper').get(0);
			this.location_icon.location_label = this;
		}
	}).hover(function() {
		$(this.location_icon).addClass('location-current');
	}, function() {
		$(this.location_icon).removeClass('location-current');	
	});
	
	$('.front #content .section-upper .location').each(function() {
		$(this).attr('title', $(this.location_label).text());
	}).hover(function() {
		$('A', this.location_label).addClass('hover');
		$(this).addClass('location-current');
	}, function() {
		$('A', this.location_label).removeClass('hover');
		$(this).removeClass('location-current');	
	}).click(function() {
		window.location.href = $('A', this.location_label).attr('href');
	});


        $('.sunrise-menu').find('strong').live('click', function(event) {
                var target = event.target || event.srcElement || event.originalTarget;
                if(target.nodeName.toLowerCase() != 'a') {
		var parent = $(this).parents('.sunrise-menu');
		if(parent.hasClass('active')) {
			parent.removeClass('active');
		} else {
		    $('.sunrise-menu').removeClass('active');
			parent.addClass('active');
		}
                }
	});
	$('#sunrise-table tr:last-child').addClass('last');
	
});
})(jQuery);


/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */
jQuery.cookie=function(a,b,c){if(typeof b!='undefined'){c=c||{};if(b===null){b='';c.expires=-1}var d='';if(c.expires&&(typeof c.expires=='number'||c.expires.toUTCString)){var e;if(typeof c.expires=='number'){e=new Date();e.setTime(e.getTime()+(c.expires*24*60*60*1000))}else{e=c.expires}d='; expires='+e.toUTCString()}var f=c.path?'; path='+(c.path):'';var g=c.domain?'; domain='+(c.domain):'';var h=c.secure?'; secure':'';document.cookie=[a,'=',encodeURIComponent(b),d,f,g,h].join('')}else{var j=null;if(document.cookie&&document.cookie!=''){var k=document.cookie.split(';');for(var i=0;i<k.length;i++){var l=jQuery.trim(k[i]);if(l.substring(0,a.length+1)==(a+'=')){j=decodeURIComponent(l.substring(a.length+1));break}}}return j}};

