
// onload action

$(document).ready(function() {

var agent=navigator.userAgent.toLowerCase();
var is_iphone = (agent.indexOf('iphone')!=-1);

   
if (is_iphone) { 
	function rescaleForIphone(){
		
		viewport = document.querySelector("meta[name=viewport]");
		
		if(window.orientation ==90 || window.orientation ==-90){
		
			viewport.setAttribute('content', 'width=240px; user-scalable=no;');
		
		} else if(window.orientation ==0 || window.orientation ==180){
			
			viewport.setAttribute('content', 'width=240px;maximum-scale=1.33; user-scalable=no;');	
		}
		replaceIfProject();
	}
	// wait in the beginning
	setTimeout(function () {
		replaceIfProject();
	}, 1000);
	
	function replaceIfProject(){
		if(window.projectPage === "true"){
			if(window.orientation ==90 || window.orientation ==-90){
				window.scrollTo(0, 175);
				//$("#home").css("display","inline");
			} else{
			window.scrollTo(0, 150);
			}
		} else{
			window.scrollTo(0, 1);
		}
	}
	//alert( "iphone version");
	$('head').append('<meta name="viewport" id="metatag" />');
	var previousOrientation = 0;

	var checkOrientation = function(){
    if(window.orientation !== previousOrientation){
        previousOrientation = window.orientation;
        // orientation changed, do your magic here
        rescaleForIphone();
        }
	};
	rescaleForIphone();
	
	window.addEventListener("resize", checkOrientation, false);
	window.addEventListener("orientationchange", checkOrientation, false);
}
	
	function isdefined( variable)
{
    return (typeof(window[variable]) == "undefined")?  false: true;
}
	// grab a search stream
	 $.getJSON('http://search.twitter.com/search.json?q=from%3Adecaix&include_entities=true&callback=?', function(json) {
		// iterate results 
		URLLink ="";
		$.each(json.results, function(i,tweet) {
			// buid slide and add to slideshow
			var checkUrl= "";
			var checkUrlParent= tweet.entities.urls[0];
			
			if( checkUrlParent != undefined){
				//alert(i+"  checkUrlParent exist");
				if( checkUrlParent.expanded_url == undefined){
				//	alert(" checkUrlParent.expanded_url inexexist");
				} else{
				//	alert(i+" "+checkUrlParent.expanded_url);
					checkUrl =checkUrlParent.expanded_url;
				}

			} else{
								
				//checkUrl = checkUrl.expanded_url;
			}
			
			if( checkUrl == ""){
					$("#slideshowTwitter").append('<p class="slide">— ' + tweet.text+ '</p>');
			} 
			else{
					//alert("exist : this.entities.urls: "+this.entities.urls.length);
					$("#slideshowTwitter").append('<a href="'+checkUrl+'" class="slide">— ' + tweet.text+ '</a>');
					//$twitterContent ='<span class="tweet">— ' + this.text+ '</span>';
			}
			
			// iterate results 
			
				//$('<div class="slide">').append($twitterContent)
				//$('<div class="slide">').appendTo('#slideshowTwitter');
		}); 

		// after all slides are added, start cycle
		$('#slideshowTwitter').cycle({
			fx: 'scrollDown',
			timeout: 5000,
			pause: true
		});
	});

	// The DOM (document object model) is constructed
	// case searchResult missing
	if($('#searchResult').length == 0){
	//alert("nor results")
	$('#caseResults').html("");
	$('<div id="searchResult" class="grid_4 naviElt lineBottom"><h5>no results</h5></div><div id="searchResult" class="grid_4 naviElt lineBottom"><h5>enter new search</h5></div><div id="searchResult" class="grid_4 naviElt lineBottom"> <h5>&mdash; </h5></div></div><!-- End SEARCH HEADLINES EXTENDED --><!-- SEARCH EXTENDED CONTENT--><div id="searchContents_extended" class="container_16"><div id="" class="grid_16 news alpha omega"><div id="mansonry_search" class="wrap"> </div></div></div>').appendTo('#caseResults');
	}



	// check Browser
	
	$browserTypeWebkit = false;
	if ($.browser.webkit) {
	    //alert("this is webkit!");
	    $browserTypeWebkit = true;
	    // init css modification
	    $(".moreButton").css("padding","0 0 3px 20px");
	    $(".arrowTopElt").css("margin","6px 0 0 0");
	    $(".filter").css("padding","0 0 4px 0");
	    $(".feedsTab").css("padding","5px 0 9px 0");
	    $(".searchTab").css("padding","5px 0 9px 0");
	    $(".link").css("padding","4px 11px 5px 9px");
		// example:  $('#feeds').removeClass('naviElt').addClass('naviEltWebKit');
	}

	if(navigator.platform === "Win32"){
		if ($.browser.webkit) {
			$(".moreButton").css("padding","0 0 1px 20px");
	           //alert("hello :"+moveWebKitUp);
		}
		else if ($.browser.msie) {
			$("a.link:link, a.link:visited").css("padding-right","9px");
			//alert("hello :"+$.browser.msie);
		} else{
		$("a.link:link, a.link:visited").css("padding-right","9px");
		}
		
		
	}


	$("a .thumbnail").each(function(){
		
	
	var images_URL =  $(this).attr("src");
	var image_height = $(this).height();
    var image_width = $(this).width();
	$(this).parent().css('background-image','url('+images_URL+')');
	$(this).parent().css('background-repeat','none');
	$(this).parent().css('width',image_width);
	$(this).parent().css('height',image_height);
	$(this).parent().css('display','block');
	$(this).hide();
		//alert("images_URL : "+images_URL);
	});
	

	
	$(".thumbnailLinkElt").hover(
		function(){
			//alert("hover");
        	var image_width = $(this).find('img').width();
        	$(this).css('backgroundPosition',-(image_width));
        	$(this).fadeOut(200);
        	$(this).fadeIn(100);
			//$(this).animate( {backgroundPosition:-(image_width)} , 500 );
		},
  		function () {
  		$(this).css('backgroundPosition',0);

	});
		/*
		function(){	
			$(this).animate( {backgroundPosition: -100px } , 1000 );
			$(this).parent().children('img').hide();
			$(this).hide();
		}*/
	
	
	// We will initialize and run our plugin here
	//
	/*
	if (window.projectPage === undefined){
		//alert("window.projectPage is undefined/undeclared"); 
	} 
	*/
	// turm on validation in form
	$("#contactForm").validate({
	
	errorLabelContainer: ".infoForm",
	showErrors: function(errorMap, errorList) {
		$(".infoForm").html("&rarr; " + this.numberOfInvalids() + " errors. ");
		this.defaultShowErrors();
	},
   rules: {
     // simple rules
     name: {
       required: true,
       minlength: 2
     },
     from: {
       required: true
     },
     comment1: {
       required: true
     },
     // compound rule
     email: {
       required: true,
       email: true
     }
    }
})
  /* Config */
    xOffset = 20;
    yOffset = -14;


$("#slideshow").hover(function(e){
       	if (!is_iphone)$("body").append("<p id='imageTooltip'>roll out to continue</p>");
        $("#imageTooltip")
            .css("top", (e.pageY + yOffset) + "px")
            .css("left",(e.pageX + xOffset) + "px")
            .css("z-index", "99")
            .fadeIn("fast");        
    }, function(){
    $("#imageTooltip").remove();
    });
    $("#slideshow").mousemove(function(e){
        $("#imageTooltip")
            .css("top",(e.pageY + yOffset) + "px")
            .css("left",(e.pageX + xOffset) + "px");
    });

		$("#contactForm").submit(function(){
	
	// 'this' refers to the current submitted form
	var str = $(this).serialize();
	
	   $.ajax({
	   type: "POST",
	   url: "assets/contactForm/contact.php",
	   data: str,
	   success: function(msg){
		
	$(".infoForm").ajaxComplete(function(event, request, settings){
	
	$(".infoForm").css("display","inline");
	if(msg == 'OK') // Message Sent? Show the 'Thank You' message and hide the form
	{
		
	result = '<div class="notification_ok" style ="display:inline">&rarr;  Your message has been sent. Thank you!</div>';
	$(".sendElt").hide();
	$("form .expendedElt").css("background-image","none");
	}
	else
	{
	result = msg;
	}
		
	$(this).html(result);
	
	});
	
	}
	
	 });
	
	return false;
	
	});

	// form tuning
	$('.service input[type="text"]').addClass("idleField");
	    $('.service input[type="text"]').focus(function() {
	    	
	    	$(this).removeClass("idleField").addClass("focusField");
	        
	        
	        if (this.value == this.defaultValue){
	        	this.value = '';
	    	}
	    	
	        if(this.value != this.defaultValue){
	        	this.select();
	        }
	       
	        
	    });
	    $('.service input[type="text"]').blur(function() {
	    	if(this.value != this.defaultValue){
	    		$(this).removeClass("focusField").addClass("filledField");
	        } else{
	        $(this).removeClass("focusField").addClass("idleField");
	        }
	    	/*
	        if ($.trim(this.value == '')){
	        	this.value = (this.defaultValue ? this.defaultValue : '');
	    	}
	    	*/
	    	
	    	
	    });
	  
	$('.service textarea').addClass("idleField");
	    $('.service textarea').focus(function() {
	    	$(this).removeClass("idleField").addClass("focusField");
	    	
	        if (this.value == this.defaultValue){
	        	this.value = '';
	    	}
	    	
	        if(this.value != this.defaultValue){
	        	this.select();
	        }
	        
	        
	    });
	    $('.service textarea').blur(function() {
	    	if(this.value != this.defaultValue){
	    		$(this).removeClass("focusField").addClass("filledField");
	        } else{
	        $(this).removeClass("focusField").addClass("idleField");
	        }
	    	
	        if ($.trim(this.value == '')){
	        	this.value = (this.defaultValue ? this.defaultValue : '');
	    	}
	    	
	    });
	

	// search form tuning
	//

	$.extend({
	  getUrlVars: function(){
	    var vars = [], hash;
	    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
	    for(var i = 0; i < hashes.length; i++)
	    {
	      hash = hashes[i].split('=');
	      vars.push(hash[0]);
	      vars[hash[0]] = hash[1];
	    }
	    return vars;
	  },
	  getUrlVar: function(name){
	    return $.getUrlVars()[name];
	  }
	});
	// Get object of URL parameters
	var allVars = $.getUrlVars();
	
	// Getting URL var by its nam
	var bySearch = $.getUrlVar('search');

	// search expender
	$heightSearch =$(".searchExpendedElt").height();
	
	var caseSearchHandler ="close";

	if (bySearch){
		caseSearchHandler= "open";
		//alert("....starting with: "+allVars+"::::"+bySearch);
		// starting with searching
		$(".searchExpendedElt").height($heightSearch);
		$(".searchExpendedElt").css('display','block');
		$(".searchExpendedElt").css('visibility','visible');
		
		$('#search a').removeClass('moreButton').addClass('closeButton');
		$('#search a').html("close search");
		
		
				
	} else{
		caseSearchHandler ="close";
		//alert("....starting with: "+allVars+"::::"+bySearch);
		// starting with no searching
		$(".searchExpendedElt").height(1); 
		$(".searchExpendedElt").css('display','none');
		$(".searchExpendedElt").css('visibility','hidden');

	
		$('#search a').removeClass('closeButton').addClass('moreButton');
		$('#search a').html("search");
		
	}

	
	$('.searchReset').click(function(){

 		$(':text', '#searchform').val('');  

	});

    
    	$('.searchReset').click(function(){
		$('.searchInput').val('');
	});
	
	
	$('#search a').click(function(){	
		//alert("search click");
		if(caseConnectHandler == "open"){
			//alert("search  close connect");
			$('#connect a').click();
		};
		if(caseSearchHandler == "close"){
			//alert("search open $heightSearch"+$heightSearch);
			caseSearchHandler= "open";
			$(".searchExpendedElt").css('display','block');
			$(".searchExpendedElt").css('visibility','visible');
			
			$(".searchExpendedElt").stop().animate({
				height: $heightSearch,duration: 'slow'
				});
			
			$(this).removeClass('moreButton').addClass('closeButton');
			$(this).html("close search");	

		} else {
			//alert("search close");
			caseSearchHandler ="close";
			
			$(".searchExpendedElt").stop().animate({
			height: '1px',duration: 'slow',
				},function(){
				$(this).css('display','none');
				$(this).css('visibility','hidden');
				
				$('#search a').removeClass('closeButton').addClass('moreButton');
				$('#search a').html("search");
				
				});
		}
	});
	// connect expender
	var caseConnectHandler ="close";
	$heightConnect =$(".connectExpendedElt").height();
	
	$(".connectExpendedElt").height(1); 
	
	$('#connect a').click(function(){
	//alert("connect  click ");
		if(caseSearchHandler == "open"){
		//alert("connect  close search");
			$('#search a').click();
		};
	
		if(caseConnectHandler == "close"){
			//alert("connect  open ");
			
			caseConnectHandler= "open";
			$(".connectExpendedElt").css('display','block');
			$(".connectExpendedElt").css('visibility','visible');
			
			$(".connectExpendedElt").stop().animate({
				height: $heightConnect,duration: 'slow'
				});
			
			$(this).removeClass('moreButton').addClass('closeButton');
			$(this).html("close connect");	
			

		} else {
			//alert("connect closing");
			caseConnectHandler ="close";
			
			$(".connectExpendedElt").stop().animate({
			height: '1px',duration: 'slow',
				},function(){
				$(this).css('display','none');
				$(this).css('visibility','hidden');
				
				$('#connect a').removeClass('closeButton').addClass('moreButton');
				$('#connect a').html("connect");
				
				});
		}
	});	
	//contentInfo Handler
	
	$('#profile a').click(function(){
		contentInfoHandler("profile");
	});
	$('#service a').click(function(){	
		contentInfoHandler("service");
	});
	$('#contact a').click(function(){	
		contentInfoHandler("contact");
	});
	$('#imprint a').click(function(){	
		contentInfoHandler("contact");
	});
	$('.contactTwoto').click(function(){	
		contentInfoHandler("service");
	});
	
	
	var caseHandler ="close";
	var selected="";;
	var $lastSelected="";
	
	var pos_profile="237px";
	var pos_service="477px";
	var pos_contact="717px";

	function MoveItArrow(selected){
	
	
		if(selected=="profile"){
			$(".arrowTopElt").css("opacity", "0");
			$(".arrowTopElt").stop().animate({
			 	"left": pos_profile,
			 	opacity: 1,
				duration: 'slow'
			});
			$(".arrowTopElt").css("background-position", "0px 0px");
			}
		else if(selected=="service"){
			$(".arrowTopElt").css("opacity", "0");
			$(".arrowTopElt").stop().animate({
			 	"left": pos_service,
			 	opacity: 1,
				duration: 'slow'
			});
			$(".arrowTopElt").css("background-position", "-20px 0px");
			}
		else if(selected=="contact"){
			$(".arrowTopElt").css("opacity", "0");
			$(".arrowTopElt").stop().animate({
			 	"left": pos_contact,
			 	opacity: 1,
				duration: 'slow'
			});
			$(".arrowTopElt").css("background-position", "-40px 0px");
			
			}
		else if(selected="CLOSE"){
			$(".arrowTopElt").css("opacity", "0");
			$(".arrowTopElt").css("left", pos_profile);
			$(".arrowTopElt").css('visibility','hidden');
			}
			
		
		}
	function contentInfoHandler(selected){

		if ($(".contentInfo").is('.close')) {
			caseHandler= "close";
		} else{
			caseHandler ="open";
		}
		
		if (caseHandler == "close" && selected != $lastSelected) {
		
			if(window.projectPage === "true" || window.newsPage === "true"){
			 closeProject(selected);
			// alert("here we are");
			} else{
			 //alert("alternative we are");
			// start case
			$lastSelected = selected;
			$(".contentInfo").removeClass('close').addClass('open');
			$("#"+selected+" a").removeClass('moreButton').addClass('closeButton');
			$("#"+selected+" a").html("close");	
			
			$(".contentInfo").css('visibility','visible');
			$(".contentInfo").css('display','block');
			$(".contentInfo").css("margin-bottom","20px");
			$(".contentInfo").stop().animate({
			 height: "225",duration: 'slow'
			},function(){
			 $(".arrowTopElt").css('display','block');
			 $(".arrowTopElt").css('visibility','visible');
			 
			MoveItArrow(selected);
			});
			$(".stageIntro").data("originalHeight",$(".stageIntro").height());
			$stageHeight = $(".stageIntro").data("originalHeight");
			$(".stageIntro").stop().animate({
			 height: "1",
			 opacity: "0"},function(){
			 $(".stageIntro").css('visibility','hidden');
			$(".stageIntro").css('display','none');
			});
			
			$(".contentInfo .service").hide();	
			$(".contentInfo .profile").hide();
			$(".contentInfo .contact").hide();
			
			$(".contentInfo "+"."+selected).stop().slideToggle('slow');
			// end case
			}
			$("#menu").stop().animate({
			 opacity: "0.2"}
			);
			$("#contents").stop().animate({
			 opacity: "0.2"}
			);
			$("#connect_extended").stop().animate({
			 opacity: "0.2"}
			);
			$("#search_extended").stop().animate({
			 opacity: "0.2"}
			);	
		
		 } else if (caseHandler == "open"  && selected == $lastSelected) {
		 		
		 		
				$(".contentInfo").removeClass('open').addClass('close');
				$("#"+$lastSelected+" a").removeClass('closeButton').addClass('moreButton');
				$("#"+$lastSelected+" a").html("more");		 
				 MoveItArrow("CLOSE");
				 
				 						
				$(".stageIntro").css('visibility','visible');
				$(".stageIntro").css('display','block');
				if(window.projectPage === "true" || window.newsPage === "true"){
					$("#menu").css("margin-top","80px");
				};
				 
		$(".stageIntro").stop().animate({
			 height: $stageHeight,
			 opacity: "1"
			});
			  	$(".contentInfo").stop().animate({
						height: "0",duration: 'slow'
					
					},function(){
						$(".contentInfo").css('visibility','hidden');
						$(".contentInfo").css('display','none');

						
						if(window.projectPage === "true" || window.newsPage === "true"){
							$("#menu").css("margin-top","0px");
			 				openProject();
						};		
		
					});
					
			
				$lastSelected = "";
				    
				$(".contentInfo .service").hide();	
			 	$(".contentInfo .profile").hide();
				$(".contentInfo .contact").hide();
				
			$("#menu").stop().animate({
			 opacity: "1"}
			);
			$("#contents").stop().animate({
			 opacity: "1"}
			);
			$("#connect_extended").stop().animate({
			 opacity: "1"}
			);
			$("#search_extended").stop().animate({
			 opacity: "1"}
			);	
				
			}	
		 	else if (caseHandler == "open"  && selected != $lastSelected) {
		 	
		 		$("#"+$lastSelected+" a").removeClass('closeButton').addClass('moreButton');
		 		$("#"+$lastSelected+" a").html("more");		
		 		$("#"+selected+" a").removeClass('moreButton').addClass('closeButton');
		 		$("#"+selected+" a").html("close");
		 	
		 		$lastSelected = selected;
		 		$(".contentInfo .service").hide();	
				$(".contentInfo .profile").hide();
				$(".contentInfo .contact").hide();
				$(".contentInfo "+"."+selected).stop().slideToggle('slow');	
				$(".arrowTopElt").css('opacity','1');
				MoveItArrow(selected);
		 	}
		}
	// project
	
	function closeProject(selected){
			
			$("#menu").css("margin-top","80px");

			$('#slideshow').cycle('pause');
			
			$(".stageProject").stop().animate({
					height: "1",duration: 'slow'				
					},function(){		
						// end action
			
			$(".stageProject").css('visibility','hidden');
			$(".stageProject").css('display','none');

	
				// start case
			//alert("selected we are: "+selected);
			
			$lastSelected = selected;
			$(".contentInfo").removeClass('close').addClass('open');
			$("#"+selected+" a").removeClass('moreButton').addClass('closeButton');
			$("#"+selected+" a").html("close");	
			
			$(".contentInfo").css('visibility','visible');
			$(".contentInfo").css('display','block');
			$(".contentInfo").stop().animate({
			 height: "225",duration: 'slow'
			},function(){
			 $(".arrowTopElt").css('display','block');
			 $(".arrowTopElt").css('visibility','visible');
			 			$("#menu").css("margin-top","0px");
			MoveItArrow(selected);
			});
			$(".stageProject").data("originalHeight",$(".stageProject").height());
			$stageHeight = $(".stageProject").data("originalHeight");

			
			$(".contentInfo .service").hide();	
			$(".contentInfo .profile").hide();
			$(".contentInfo .contact").hide();
			
			$(".contentInfo "+"."+selected).stop().slideToggle('slow');
			
			// end case
			
										
			});
			$projectInfoHeight = $(".projectInfo").height();
			
			$(".logoProject").css('visibility','hidden');
			$(".projectInfo").css('visibility','hidden');
			$(".projectInfo").css('display','none');
			$(".projectInfo").css('height','0');
			$(".contentInfo").css("margin-bottom","20px");
			

			
	};


	function openProject(){

			$(".stageProject").css("margin-top","100px");	
			$(".stageProject").css('visibility','visible');
			$(".stageProject").css('display','block');
			$(".logoProject").css('visibility','visible');
						
			$(".stageProject").stop().animate({
					height: "420px",
					opacity:"1",
					duration: 'slow'	
					},function(){
						// end action
					$(".projectInfo").css('visibility','visible');
					$('#slideshow').cycle('resume');
					});
			

			$(".projectInfo").css('display','block');
			$(".projectInfo").css('height',$projectInfoHeight);
			$(".contentInfo").css("margin-bottom","0px");
	
	
	};
	function introProject(){
	
			//$(".stageProject").css('height','1px');
			$(".stageProject").css('visibility','visible');
			$(".stageProject").css('display','block');
			//$(".projectInfo").css('visibility','hidden');
			$(".projectInfo").css('visibility','visible');	

				/*		
			$(".stageProject").stop().animate({
					height: "420px",duration: 'fast'	
					},function(){
						// end action
						$(".projectInfo").css('visibility','visible');
					});
				*/	
			$(".logoProject").css('visibility','visible');
			$(".projectInfo").css('display','block');
			$(".contentInfo").css("margin-bottom","0px");
	
	};

	// mansonry
	
	var speed = 1000,  // animation speed
    $wall = $('#mansonry');

	$('#mansonry').masonry({
		 singleMode: true, 
	    // only apply masonry layout to visible elements
	    itemSelector: '.box:not(.invis)',
	    animate: true,
	    animationOptions: {
	        duration: speed,
	        queue: false
	    }
	});

	$('#filterNavigation a').click(function(){
		
	    var colorClass = '.' + $(this).attr('class');
	    
	    $actualSelected = $('#filterNavigation').find('.selected_filter');
	    $actualSelected.css('color',$basicColor);
	    $actualSelected.removeClass('selected_filter');
	    $actualSelected.css('color',$basicColor);
	   $(this).parent().addClass('selected_filter');
	    var $selected  = $(".selected_filter");
	    
	    $magicBox
	    .width($selected.width())
	    .css("left", $selected.find("a").position().left)
	    .data("origLeft", $selected.find("a").position().left)
	    .data("origWidth", $magicBox.width())
	    .data("origColor", $basicColor);
	    

	     
	    
	    $selected.find("a").stop().animate({color:hightLightColor});
        $magicBox.stop().animate({
            left: $magicBox.data("origLeft"),
            width: $magicBox.data("origWidth"),
            
        });    
	    
	    if(colorClass=='.all') {
	        // show all hidden boxes
	        $wall.children('.invis')
	            .toggleClass('invis').fadeIn(speed);
	    } else {    
	        // hide visible boxes 
	        $wall.children().not(colorClass).not('.invis')
	            .toggleClass('invis').fadeOut(speed);
	        // show hidden boxes
	        $wall.children(colorClass+'.invis')
	            .toggleClass('invis').fadeIn(speed);
	    }
	    $wall.masonry();

	    return false;
	});
	
	// menu Effects: magicBox,rollOver,rollOut
	
    var $el, leftPos, newWidth;
    var $mainNav = $("#filterNavigation");

    	
    $mainNav.append("<li id='magicBox'></li>");
    var $magicBox = $("#magicBox");
    var $selected = $(".selected_filter");
    
    var basicColor =$('#filterNavigation li').css('color');
    var hightLightColor=$('.selected_filter a').css('color');

    var $basicColor =$(basicColor);
    var $hightLightColor =$(hightLightColor);
    
    $magicBox
    .width($selected.width())
    .css("left", $selected.find("a").position().left)
    .data("origLeft", $selected.find("a").position().left)
    .data("origWidth", $magicBox.width())
    .data("origColor", $basicColor);
    
    
    // fix for webkit
    if ($browserTypeWebkit == true) {
    	if(navigator.platform === "Win32"){
    		var moveWebKitUp = parseInt($magicBox.css("margin-top"));
        }else{
        	var moveWebKitUp = parseInt($magicBox.css("margin-top"))-1;

		}   
	 	$magicBox.css("margin-top",moveWebKitUp);   
    }
                
    $("#filterNavigation li").find("a").hover(function() {
        $el = $(this);
        
        leftPos = $el.position().left;
        newWidth = $el.parent().width();
        
        $el.stop().animate({color:hightLightColor}); 
        // rollOn
        if( $el.parent().hasClass("selected_filter")){
        	$(".selected_filter").find("a").css('color',$hightLightColor)
        } else{
        	$(".selected_filter").find("a").stop().animate({color:basicColor}); 
        }
       
        $magicBox.stop().animate({
            left: leftPos,
            width: newWidth
        })
        
    }, function() {
    	// rollOut
    	$el.stop().animate({color:basicColor}); 
    	$(".selected_filter").find("a").stop().animate({color:hightLightColor});
        $magicBox.stop().animate({
            left: $magicBox.data("origLeft"),
            width: $magicBox.data("origWidth"),
            
        });    
    });
    
    if(window.projectPage === "true" || window.newsPage === "true"){
		introProject();
	};
	if ($.browser.msie) {
  		//alert(parseInt(jQuery.browser.version));
 		$("#filtering").removeClass('filter').addClass('naviElt');
		$("#filtering").html("<h5>IE only partially supported</h5>");
	};	
});
