$(document).ready(function(){ 
	//Sitespecific javascript here
	//Searchbox clear and fill
	function input_values()
	{	
		var inputBox = $('#newsletter input, #search input');
	
		
		inputBox.focus(function(){
			if ($(this).val() != "") {
				
				var theValue = $(this).val();
				$(this).attr('temp', theValue)
				$(this).val('');
			};
		
		});
		inputBox.blur(function(){
			if ($(this).val() == "") {
				var theValue = $(this).attr('temp');
				$(this).val(theValue);
			};
			
		});
	}
	input_values();
	
	//Even and odd rows in tables
	/* if Environment is NOT Editor */
		$("table tr").mouseover(function() {
			$(this).addClass("over");}).mouseout(function() {$(this).removeClass("over");
		});
		$("table tr:nth-child(even), table tr td:nth-child(even)").addClass("even");
		$("table tr:nth-child(odd), table tr td:nth-child(odd)").addClass("odd");
		$("table tr:first-child").removeClass('even').addClass("th");
		$('table tr td:first-child, ul li:first-child').addClass('first');
		$('table tr td:last-child, ul li:last-child').addClass('last');

	/*fake dropdown*/
	$('#header form ul').click(function(event){
		event.stopPropagation();
		//$('ul#language').css('overflow','visible');
		$('#header form ul.dropdown').removeClass('dropdown');
		$(this).addClass('dropdown');
		$tempText = $(this).children('li.first').attr('temp'); //take the temp attribute value
		$('#header form ul.dropdown li.first strong').text($tempText); //set the tempvalue as the main text in the first list item
	});
	
	$('ul#language a').click(function(){
		$theFirst = $('ul#language li.first strong').text(); //grab the language text in the first list item 
		$theLang = $(this).text(); //get the language name from list item
		$theLink = $(this).attr('href'); //get the url from the link
		$('ul#language li.first').attr('temp',$theFirst); // move the language name into temp attribute
		$('ul#language li.first strong').text($theLang); //Set the first one to the selected language
		$('ul.dropdown').removeClass('dropdown'); //hide the dropdown
		if ($('#select-site').length) { //Check if this is on the form on the intro page
			$('input#uri').val($theLink); //set input uri to the link
			return false; //don't follow the link
		};
		//note: For all other pages than intro pages, we should simply follow the link, and there is no input to add the value to
	});
	$('ul#accessibility a').click(function(){
		$theFirst = $('ul#accessibility li.first strong').text(); //grab the language text in the first list item 
		$theLang = $(this).text(); //get the language name from list item
		$theLink = $(this).attr('href'); //get the url from the link
		$('ul#accessibility li.first').attr('temp',$theFirst); // move the language name into temp attribute
		$('ul#accessibility li.first strong').text($theLang); //Set the first one to the selected language
		$('ul.dropdown').removeClass('dropdown'); //hide the dropdown
		$('input#adjust').val($theLink); //set input adjust value to the link
		
		$('form#access').submit(); //submit the form
		return false; //don't follow the link
	});
	
	$('#container').click(function(){
		if ($('#header form ul').hasClass('dropdown')) {
			$('ul.dropdown').removeClass('dropdown'); //hide the dropdown
		};
		
	});




});