$(document).ready(function(){

$(function() {
	$("div#makeMeScrollable").smoothDivScroll({scrollingSpeed: 12, mouseDownSpeedBooster: 3, autoScroll: "", autoScrollDirection: "", autoScrollSpeed: 1, visibleHotSpots: "always", hotSpotsVisibleTime: 9});		
});


$('.clientArea').hover(
		function() {
		this.tip = $(this).children('.clientAreaTitle').text();
		$(this).append(
			'<div class="toolTipWrapper">'
				+'<div class="toolTipTop"></div>'
				+'<div class="toolTipMid">'
					+this.tip
				+'</div>'
				+'<div class="toolTipBtm"></div>'
			+'</div>'
		);
		this.title = "";
		$('.toolTipWrapper').fadeIn(300);
	},
	function() {
		$('.toolTipWrapper').fadeOut(100);
		$(this).children('.toolTipWrapper').remove();
			this.title = this.tip;
		}
	);



var jumpLeft = $(window).width()-800

    $("#projectInfoArea").css("left", jumpLeft/2 + "px");
    $("#contactFormDiv").css("left", jumpLeft/2 + "px");

$(".clientHome .clientArea").bind("click", function(e){
$.scrollTo('847', 1000);
});

$('a.callAjax').ajaxify({
tagToload:{
                '#projectInfo':'#projectInfoArea'
                },
loadHash: 'attr:title',
onStart:function(options){
                      $("#overlay").css({"top":"0","opacity":"0"}).fadeTo("slow", 0.9);
$("#projectInfoArea").animate({"top":"0"},1200);

                        },
onSuccess:function(options){
$("#closeArea").click(function () { 
$("#projectInfoArea").animate({"top":"-3000"},1200).empty();
  $("#overlay").fadeTo("fast", 0).animate({"top":"-1200"}, 100);
});

}

});

$('#item51').bind('click',function(){

$("#overlay").css({"top":"0","opacity":"0"}).fadeTo("slow", 0.9);
$("#contactFormDiv").animate({"top":"-40"},1200);
$("#closeRight").animate({"top":"75"},1200);


$("#closeRight").click(function () { 
$("#contactFormDiv").animate({"top":"-3000"},1200);
$("#closeRight").animate({"top":"-3000"},1200);
$("#overlay").fadeTo("fast", 0).animate({"top":"-1200"}, 100);
});

 $('#EmailForm').ajaxForm(function() { 
$('#contactFormDiv').html("<p>We do appreciate your feedback. Your comments have been submitted to our office and hopefully someone will bother to actually read it.&nbsp;</p><p>Please be assured that we will do our best not to ignore you, but if today's a Monday please try again in a few days.</p>")

            });  // end Contact Ajax


}); // end Contact Ajax


$('a.execs').ajaxify({
tagToload:{
                'h1.teamTitle':'#teamTitle',
                'h2.teamType':'#teamType',
                'p':'#teamContent',
                '#theTeam':'#subLeft'

                },
loadHash: 'attr:title',
onStart:function(options){
 $("#overlay").stop();
$("#overlay").css({"top":"0","opacity":"0"}).fadeTo("slow", 0.9);

 $("#sectionTalk").stop();
$("#sectionTalk").animate({"top":"0"},1200);

$("#subLeft").stop();
$("#subLeft").animate({"top":"0"},1200);

$("#closeRight").stop();
$("#closeRight").animate({"top":"75"},1200);

                        },
onSuccess:function(options){

$("#subLeft ul li a").bind("mouseenter", function(e){ 
$(this).stop();
$(this).animate({ 
        fontSize: "28px"
      }, 300 );
});

$("#subLeft ul li a").bind("mouseleave", function(e){ 
$(this).stop();
$(this).animate({ 
        fontSize: "20px"
      }, 300 );
});

$('#subLeft ul li a').ajaxify({
tagToload:{
                'h1.teamTitle':'#teamTitle',
                'h2.teamType':'#teamType',
                'p':'#teamContent'
                },
loadHash: 'attr:title'
}); //end AJax within an Ajax


$("#closeRight").click(function () { 
$("#sectionTalk").animate({"top":"-3000"},1200);
$("#teamType").empty();
$("#teamContent").empty();
$("#teamTitle").empty();

$("#subLeft").animate({"top":"-3000"},1200).empty();
$("#closeRight").animate({"top":"-3000"},1200);

  $("#overlay").fadeTo("fast", 0).animate({"top":"-1200"}, 100);
});

}

}); // end Execs ajax  

$('a.type1').ajaxify({
tagToload:{
                'h1.teamTitle':'#teamTitle',
                'h2.teamType':'#teamType',
                'p':'#teamContent',
                '#wwd':'#subLeft'

                },
loadHash: 'attr:title',
onStart:function(options){
 $("#overlay").stop();
$("#overlay").css({"top":"0","opacity":"0"}).fadeTo("slow", 0.9);

 $("#sectionTalk").stop();
$("#sectionTalk").animate({"top":"0"},1200);

$("#subLeft").stop();
$("#subLeft").animate({"top":"0"},1200);

$("#closeRight").stop();
$("#closeRight").animate({"top":"75"},1200);

                        },
onSuccess:function(options){

$("#subLeft ul li a").bind("mouseenter", function(e){ 
$(this).stop();
$(this).animate({ 
        fontSize: "1.6em"
      }, 300 );
});

$("#subLeft ul li a").bind("mouseleave", function(e){ 
$(this).stop();
$(this).animate({ 
        fontSize: "1.2em"
      }, 300 );
});

$('#subLeft ul li a').ajaxify({
tagToload:{
                'h1.teamTitle':'#teamTitle',
                'h2.teamType':'#teamType',
                'p':'#teamContent'
                },
loadHash: 'attr:title'
}); //end AJax within an Ajax


$("#closeRight").click(function () { 
$("#sectionTalk").animate({"top":"-3000"},1200);
$("#teamType").empty();
$("#teamContent").empty();
$("#teamTitle").empty();

$("#subLeft").animate({"top":"-3000"},1200).empty();
$("#closeRight").animate({"top":"-3000"},1200);

  $("#overlay").fadeTo("fast", 0).animate({"top":"-1200"}, 100);
});

}

}); // end WWD ajax  

$(".currentProj").bind("mouseenter", function(e){ 
$(this).children('.currentInfo').stop();

$(this).children('.currentInfo').animate({ 
        top: "0"
      }, 500 );
$(this).find('.imageBackground').animate({ 
        opacity: "1"
      }, 500 );

});

$(".currentProj").bind("mouseleave", function(e){
$(this).children('.currentInfo').stop();

$(this).children('.currentInfo').animate({ 
        top: "250px"
      }, 500 );

$(this).find('.imageBackground').animate({ 
        opacity: "0.3"
      }, 500 );

});

var middleHeight = $('.middleSec3').height()
$('.middleSec3').height(middleHeight);

$("#type54").bind("mouseenter", function(e){
$("#type54").toggleClass('powerOn').toggleClass('powerOff');
$(".type54").stop();

$(".type54").animate({ 
        backgroundColor: "#ffffff"
},400);

$(this).delay(1550,function(){
var middleInnerHeight = $('.middleSec3Inner').height()
$('.middleSec3').animate({
                                        height: middleInnerHeight
                                        });
             });//Delay
});


var middleHeight = $('.middleSec3').height()
$('.middleSec3').height(middleHeight);

$("#type54").bind("mouseleave", function(e){
$("#type54").toggleClass('powerOn').toggleClass('powerOff');
$(".type54").stop();

$(".type54").animate({ 
        backgroundColor: "#b1b1b1"
},400);

$(this).delay(1550,function(){
var middleInnerHeight = $('.middleSec3Inner').height()
$('.middleSec3').animate({
                                        height: middleInnerHeight
                                        });
             });//Delay
});




$("#type95").bind("mouseenter", function(e){
$("#type95").toggleClass('powerOn').toggleClass('powerOff');
$(".type95").stop();
$(".type95").animate({ 
        backgroundColor: "#ffffff"
},400);
$(this).delay(1551,function(){
var middleInnerHeight = $('.middleSec3Inner').height()
$('.middleSec3').animate({
                                        height: middleInnerHeight
                                        });
             });//Delay

});


$("#type95").bind("mouseleave", function(e){
$("#type95").toggleClass('powerOn').toggleClass('powerOff');
$(".type95").stop();
$(".type95").animate({ 
        backgroundColor: "#b1b1b1"
},400);
$(this).delay(1551,function(){
var middleInnerHeight = $('.middleSec3Inner').height()
$('.middleSec3').animate({
                                        height: middleInnerHeight
                                        });
             });//Delay

});




var fadeToVal = 0.1


$("#community").bind("mouseenter", function(e){
$('.community').stop();
$(".community").animate({ 
        opacity: "1"
},500);
});
$("#community").bind("mouseleave", function(e){
$('.community').stop();
$(".community").animate({ 
        opacity: fadeToVal
},500);
});

$("#Design").bind("mouseenter", function(e){
$('.Design').stop();
$(".Design").animate({ 
        opacity: "1"
},500);
});
$("#Design").bind("mouseleave", function(e){
$('.Design').stop();
$(".Design").animate({ 
        opacity: fadeToVal
},500);
});

$("#Desktop").bind("mouseenter", function(e){
$('.Desktop').stop();
$(".Desktop").animate({ 
        opacity: "1"
},500);
});
$("#Desktop").bind("mouseleave", function(e){
$('.Desktop').stop();
$(".Desktop").animate({ 
        opacity: fadeToVal
},500);
});

$("#Curriculum").bind("mouseenter", function(e){
$('.curriculum').stop();
$(".curriculum").animate({ 
        opacity: "1"
},500);
});
$("#Curriculum").bind("mouseleave", function(e){
$('.curriculum').stop();

$(".curriculum").animate({ 
        opacity: fadeToVal
},500);
});

$("#games").bind("mouseenter", function(e){
$('.games').stop();
$(".games").animate({ 
        opacity: "1"
},500);
});
$("#games").bind("mouseleave", function(e){
$('.games').stop();

$(".games").animate({ 
        opacity: fadeToVal
},500);
});


$("#mobile").bind("mouseenter", function(e){
$('.mobile').stop();

$(".mobile").animate({ 
        opacity: "1"
},500);
});
$("#mobile").bind("mouseleave", function(e){
$('.mobile').stop();

$(".mobile").animate({ 
        opacity: fadeToVal
},500);
});


$("#online").bind("mouseenter", function(e){
$('.online').stop();

$(".online").animate({ 
        opacity: "1"
},500);
});
$("#online").bind("mouseleave", function(e){
$('.online').stop();

$(".online").animate({ 
        opacity: fadeToVal
},500);
});

$("#Print").bind("mouseenter", function(e){
$('.Print').stop();

$(".Print").animate({ 
        opacity: "1"
},500);
});
$("#Print").bind("mouseleave", function(e){
$('.Print').stop();

$(".Print").animate({ 
        opacity: fadeToVal
},500);
});

$("#tv").bind("mouseenter", function(e){
$('.tv').stop();

$(".tv").animate({ 
        opacity: "1"
},500);
});
$("#tv").bind("mouseleave", function(e){
$('.tv').stop();

$(".tv").animate({ 
        opacity: fadeToVal
},500);
});

$(".callAjax").bind("mouseenter", function(e){
$(this).stop();
$(this).animate({ 
        opacity: "1"
},400);
});
$(".callAjax").bind("mouseleave", function(e){
$(this).stop();
$(this).animate({ 
        opacity: fadeToVal
},400);
});

$("#item51").bind("mouseenter", function(e){
$(this).stop();
});
$("#item51").bind("mouseleave", function(e){
$(this).stop();
});

$("#loginClick").bind("click", function(e){
$('#loginForm').animate({opacity: 1})

$('#loginClick').animate({opacity:0}).css({display : 'none'})



});


});