$(document).ready(function(){
	$('#footer_process_list ul').hide();
	var numRand = Math.floor(Math.random()*5);
	$('#footer_process_list .ph'+numRand).addClass('active');
	$('#footer_process_list .ph'+numRand+' ul').fadeIn(200);

	$('#footer_process_list li.header').hover(function(){
		if ($(this).is('.active')){
		}
		else{
			$('#footer_process_list ul').fadeOut(200);
			$('#footer_process_list li').removeClass('active');
		}

		$(this).addClass('active');
		$(this).find('ul:next').fadeIn(200);
		
	},
	function(){
	});

	$('input[type="text"]').clearField();

	$('ul#nav_global li').hover(function(){
		$(this).find('a:first').addClass('active');
	},
	function(){
		$(this).find('a:first').removeClass('active');
	});

	$("#nav_global").superfish({
		delay:0,
		speed:'fast',
		autoArrows:false,
		dropShadows:false
	});

	$('#main #filter button').hide();
	$("#main #filter select#type").change(function(){
		$val = $(this).val();
		window.location = '/project-portfolio/?type='+$val;
	});
	$("#main #filter select#standard").change(function(){
		$val = $(this).val();
		window.location = '/project-portfolio/?standard='+$val;
	});
	$("#main #filter select#region").change(function(){
		$val = $(this).val();
		window.location = '/project-portfolio/?region='+$val;
	});

	$('a.lightbox').lightBox();
});

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

var frutiger = {
	src: '/interface/flash/frutiger.swf'
	,ratios: [7, 1.32, 11, 1.31, 13, 1.24, 14, 1.25, 19, 1.23, 27, 1.2, 34, 1.19, 42, 1.18, 47, 1.17, 48, 1.18, 69, 1.17, 74, 1.16, 75, 1.17, 1.16]
};

sIFR.activate(frutiger);

sIFR.replace(frutiger,{
	selector: '#home h1'
	,wmode: 'transparent'
	,css: [
	'.sIFR-root {color:#F3F4F4;letter-spacing:-1;leading:-2;}'
	]
});
sIFR.replace(frutiger,{
	selector: 'h1'
	,wmode: 'transparent'
	,css: [
	'.sIFR-root {color:#189A56;letter-spacing:-1;leading:-2;},a{color:#000000;text-decoration:none;},a:hover{color:#000000;}'
	]
});
/*
sIFR.replace(frutiger,{
	selector: '#home .callout h2'
	,wmode: 'transparent'
	,css: [
	'.sIFR-root {color:#394742;letter-spacing:-1;leading:-2;}'
	]
});
sIFR.replace(frutiger,{
	selector: '#home #footer h2'
	,wmode: 'transparent'
	,css: [
	'.sIFR-root {color:#394742;letter-spacing:-1;leading:-12;}'
	]
});
*/