// js functions for the sochi project /home/

// wait for the DOM to be loaded 
$(document).ready(function() {
	
	if($('#login-error').html() != null){

		$('#sign-in-form-container').toggle();

		if($('#fp-projectinfo').hasClass('fp-projectinfo-nonshifted')){
			$('#fp-projectinfo').removeClass('fp-projectinfo-nonshifted').addClass('fp-projectinfo-shifted');
		} else {
			$('#fp-projectinfo').addClass('fp-projectinfo-nonshifted').removeClass('fp-projectinfo-shifted');
		}	
	}
	
					
			$('.imagecontainer_h').mouseover(function(){$(this).addClass("imagecontainer_v");$(this).removeClass('imagecontainer_h');}).mouseout(function(){
			$(this).addClass('imagecontainer_h');
			$(this).removeClass('imagecontainer_v');
			});
			
			$('.textitem_heading_h').mouseover(function(){
			$(this).addClass("textitem_heading_v");
			$(this).removeClass('textitem_heading_h');
			$}).mouseout(function(){
			$(this).addClass('textitem_heading_h');
			$(this).removeClass('textitem_heading_v');});
			
			
			$('.headerfoldin').mouseover(function(){
				$(this).addClass('headerfoldout');
				$(this).removeClass('headerfoldin');
				}
			).mouseout(function(){
				$(this).addClass('headerfoldin');
				$(this).removeClass('headerfoldout');
				}
			);


			$('#smallmap').click(function(){$('#sochimap').show();});
			$('#sochimap').click(function(){$(this).hide();});

			$('#fp-smallmap').click(function(){$('#fp-sochimap').show();});
			$('#fp-sochimap').click(function(){$(this).hide();});
			
			$('#fp-projectinfo-agenda-header').bind('click',function(){
				
				if($('#fp-projectinfo-agenda-content').is(":visible")){
					$('#fp-projectinfo-agenda-content').hide();
					$('#fp-projectinfo-agenda-arrow-open').hide();
					$('#fp-projectinfo-agenda-arrow-closed').show();

				} else {
					$('#fp-projectinfo-agenda-content').show();
					$('#fp-projectinfo-agenda-arrow-closed').hide();
					$('#fp-projectinfo-agenda-arrow-open').show();				
				}
				
				
				
				
				
			});
			
			
			$('#fp-twitter-content').load('twitter_feed.php',function(){});
			
			
			
			
			$('.biolink1').mouseover(function(){$('#biography1').toggle()}).mouseout(function(){$('#biography1').toggle()});
			$('.biolink2').mouseover(function(){$('#biography2').toggle()}).mouseout(function(){$('#biography2').toggle()});
			$('#sign_in').click(function(){$('#sign_in_form').toggle();});
			
			$('#sign-in-link').click(function(){
				$('#sign-in-form-container').toggle();
				if($('#fp-projectinfo').hasClass('fp-projectinfo-nonshifted')){
					$('#fp-projectinfo').removeClass('fp-projectinfo-nonshifted').addClass('fp-projectinfo-shifted');
				} else {
					$('#fp-projectinfo').addClass('fp-projectinfo-nonshifted').removeClass('fp-projectinfo-shifted');
				}
			});
			
			$('#fp-projectinfo-form-arrow').bind('click',function(){$('#sign-in-form').submit();});
			
			
			
			
			// wissel footer class
			$('#tac').toggle(
				function(){
					$('#contact_text').hide();
					$('#tac_text').show();
					$('#footer').css({height:"auto"});
				},
				function(){
					$('#tac_text').hide();
					$('#footer').height(21);
				}
			);
			
			
			// wissel footer class
			$('#contactlink').toggle(
				function(){
					$('#tac_text').hide();
					$('#contact_text').show();
					$('#footer').css({height:"auto"});
				},
				function(){
					$('#contact_text').hide();
					$('#footer').height(21);
				}
			);
			
			
			    $('#login').focus(function () {
         			curval = $(this).val();
         
		         	if(curval == "Login"){
		         		$(this).val('');
		         	}
         
    			});


			    $('#password').focus(function () {
         			curval = $(this).val();
         
		         	if(curval == "Password"){
		         		$(this).val('');
		         	}
         
    			});
    			
			
});
