$colors=new Array('#d25467','#33333', '#7dcbc7');
$numCurrent=100;
$changeColor=true;
 $("#home").mousemove(function(e){
    moveAnimation()
});
function moveAnimation(){
	  $numRandom = Math.floor(Math.random()*3)	 
	 if($changeColor==true && $numCurrent!=$numRandom){		
		$changeColor=false
		$('#color-fade').stop().animate({		
			backgroundColor: $colors[$numRandom]
		}, 400, function() {
			$numCurrent=$numRandom;
			$changeColor=true;
		});
		}

$changeColor=true;
}

jQuery(function( $ ){
	$.easing.elasout =  function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	};	
	$.easing.easeInOutBounce= function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	}


});


/*
$('.section').click(function(){	
	$(this).find('image').fadeIn(1000);
});
*/

/* pop up 
$('.active-ar .show-btn.first').live('click', function(){
	$(this).parent().find('section.first').fadeIn(1000);
	$(this).parent().find('section.second').fadeOut(1000);
	loadShowImg('.first',$(this))
	
	
	//alert('jo')
	return false;
})

$('.active-ar .boxcontent1').live('click', function(){
	$('.port1').fadeIn(1000);
	loadShowImg('.port1',$(this))
	
	
	//alert('jo')
	return false;
})

//****************************************************
$('.active-ar .boxcontent2').live('click', function(){
	$('.port2').fadeIn(1000);
	loadShowImg('.port2',$(this))
	
	
	//alert('jo')
	return false;
})

//****************************************************
$('.active-ar .boxcontent3').live('click', function(){
	$('.port3').fadeIn(1000);
	loadShowImg('.port3',$(this))
	
	
	//alert('jo')
	return false;
})

//****************************************************
$('.active-ar .boxcontent4').live('click', function(){
	$('.port4').fadeIn(1000);
	loadShowImg('.port4',$(this))
	
	
	//alert('jo')
	return false;
})

//****************************************************
$('.active-ar .boxcontent5').live('click', function(){
	$('.port5').fadeIn(1000);
	loadShowImg('.port5',$(this))
	
	
	//alert('jo')
	return false;
})

//****************************************************
$('.active-ar .boxcontent6').live('click', function(){
	$('.port6').fadeIn(1000);
	loadShowImg('.port6',$(this))
	
	
	//alert('jo')
	return false;
})

//****************************************************
$('.active-ar .boxcontent7').live('click', function(){
	$('.port7').fadeIn(1000);
	loadShowImg('.port7',$(this))
	
	
	//alert('jo')
	return false;
})

//****************************************************
$('.active-ar .boxcontent8').live('click', function(){
	$('.port8').fadeIn(1000);
	loadShowImg('.port8',$(this))
	
	
	//alert('jo')
	return false;
})

//****************************************************
$('.active-ar .boxcontent9').live('click', function(){
	$('.port9').fadeIn(1000);
	loadShowImg('.port9',$(this))
	
	
	//alert('jo')
	return false;
})

//****************************************************

$('.active-ar .boxcontent10').live('click', function(){
	$('.port10').fadeIn(1000);
	loadShowImg('.port10',$(this))
	
	
	//alert('jo')
	return false;
})

//****************************************************

$('.active-ar .boxcontent11').live('click', function(){
	$('.port11').fadeIn(1000);
	loadShowImg('.port11',$(this))
	
	
	//alert('jo')
	return false;
})

//****************************************************


$('.active-ar .boxcontent12').live('click', function(){
	$('.port12').fadeIn(1000);
	loadShowImg('.port12',$(this))
	
	
	//alert('jo')
	return false;
})

//****************************************************
$('.active-ar .boxcontent13').live('click', function(){
	$('.port13').fadeIn(1000);
	loadShowImg('.port13',$(this))
	
	
	//alert('jo')
	return false;
})

//****************************************************
$('.active-ar .boxcontent14').live('click', function(){
	$('.port14').fadeIn(1000);
	loadShowImg('.port14',$(this))
	
	
	//alert('jo')
	return false;
})

//****************************************************

$('.active-ar .boxcontent15').live('click', function(){
	$('.port15').fadeIn(1000);
	loadShowImg('.port15',$(this))
	
	
	//alert('jo')
	return false;
})

//****************************************************

$('.active-ar .boxcontent16').live('click', function(){
	$('.port16').fadeIn(1000);
	loadShowImg('.port16',$(this))
	
	
	//alert('jo')
	return false;
})

//****************************************************

$('.active-ar .boxcontent17').live('click', function(){
	$('.port17').fadeIn(1000);
	loadShowImg('.port17',$(this))
	
	
	//alert('jo')
	return false;
})

//****************************************************

$('.active-ar .boxcontent18').live('click', function(){
	$('.port18').fadeIn(1000);
	loadShowImg('.port18',$(this))
	
	
	//alert('jo')
	return false;
})

//****************************************************

$('.active-ar .boxcontent19').live('click', function(){
	$('.port19').fadeIn(1000);
	loadShowImg('.port19',$(this))
	
	
	//alert('jo')
	return false;
})

//****************************************************

$('.active-ar .boxcontent20').live('click', function(){
	$('.port20').fadeIn(1000);
	loadShowImg('.port20',$(this))
	
	
	//alert('jo')
	return false;
})

//****************************************************

$('.active-ar .boxcontent21').live('click', function(){
	$('.port21').fadeIn(1000);
	loadShowImg('.port21',$(this))
	
	
	//alert('jo')
	return false;
})

//****************************************************


$('.active-ar .hire').live('click', function(){
	$('.port22').fadeIn(1000);
	loadShowImg('.port22',$(this))
	
	
	//alert('jo')
	return false;
})

//****************************************************


$('.active-ar .show-btn.second').live('click', function(){
	$(this).parent().find('section.second').fadeIn(1000);
	$(this).parent().find('section.first').fadeOut(1000);
	loadShowImg('.second',$(this))
	//alert('jo')
	return false;
})




$('.active-ar .next-show-btn').live('click', function(){	
	$('.active-ar .show-btn.second').click()
	return false
});

$('.active-ar .prev-show-btn').live('click', function(){	
	$('.active-ar .show-btn.first').click()
	return false
});

 */

$('.active-ar .hide-btn').live('click', function(){
	if($('#grey').hasClass('active-ar')==true){
		$(this).parent().fadeOut(1000);
	}else{
		$(this).parent().parent().fadeOut(1000);
   }
	//alert('jo')
	return false;
})
 /* end popup */

 
/* Keyboard nav scroll*/
$(document).keyup(function(e) {
 
if (e.keyCode == 27) { $('.active-ar section').hide(); }   // esc
else if(e.keyCode == 37) { $('.active-ar .prev-show-btn').click(); }   // esc
else if (e.keyCode == 39) { $('.active-ar .next-show-btn').click(); }   // esc
else if(e.keyCode == 38) { $('#prev-btn').click(); return false}   // esc
else if (e.keyCode == 40) { $('#next-btn').click(); return false}   // esc
  
});




/* buttons nav scroll */
$(window).scroll(function () { 
         $sh=$(window).height()
         $st=$(window).scrollTop()+$(window).height()	
         $ws=$sh*2-($sh/2)
         $ys=$sh*3-($sh/2)
         $gs=$sh*4-($sh/2)
         $rs=$sh*5-($sh/2)
         $bs=$sh*6-($sh/2)
         $os=$sh*7-($sh/2)
         $grs=$sh*8-($sh/2)
	
	if($ws>$st){		
		if(!($("#prev-btn").hasClass('disabled-btn'))){
			$('#prev-btn').addClass('disabled-btn');
		}
		$('#pink').addClass('active-ar');
		$('#cream').removeClass('active-ar');
		
	}else if ($ys>$st){
		$('#prev-btn, #next-btn').removeClass('disabled-btn');
		$('#cream').addClass('active-ar');
		$('#pink').removeClass('active-ar');	
	}else if ($gs>$st){
		$('#cream').removeClass('active-ar');
	}else if ($os>$st){
		$('#prev-btn, #next-btn').removeClass('disabled-btn');
		$('#grey').removeClass('active-ar');		
	}else if ($grs>$st){		
		$('#grey').addClass('active-ar');
		$('#next-btn').addClass('disabled-btn');
	}
});

$totallArticles=3
$('#next-btn').live('click', function(){	
	$currentArticleNo=$('.active-ar').index('article')	
	if($currentArticleNo<$totallArticles){		
		$nextArticle=$('.active-ar').next()
		$currentArticle=$('.active-ar');	
		$.scrollTo( $nextArticle, 1500, {axis:'y', easing:'elasout' }); 	
		$('.active-ar').next().addClass('active-ar');
	 	$currentArticle.removeClass('active-ar');
	 }else{
		$('#next-btn').addClass('disabled-btn');		 
	 }	
	  $('#prev-btn').removeClass('disabled-btn');	 
 	return false;
});
$('#prev-btn').live('click', function(){	
	$currentArticle=$('.active-ar')
	$prevArticle=$('.active-ar').prev()
	$.scrollTo($prevArticle, 1500, {axis:'y', easing:'elasout' });
	$('.active-ar').prev().addClass('active-ar');
	 $currentArticle.removeClass('active-ar');	
 	return false;
});







function scaleImages(){
	$marginPercent=10
	$margin=Math.round($marginPercent/100*$(window).height())
	$marginBottom=$margin/2
	$marginTop=$margin/2
	
	$containerHeight=$(window).height()-$margin
  
	
	if($largeImg=='large'){
		$imgWidth=720;
		$imgHeight=1080;
	}else{
		$imgWidth=960;
		$imgHeight=1440;
	}
	$marginPercentScaleH=Math.round(($containerHeight/$imgHeight)*100);
	
	$scaleImgHeight=Math.round(($marginPercentScaleH/100*$imgHeight))
	$scaleImgWidth=Math.round(($marginPercentScaleH/100*$imgWidth))
	

	$descWidth=Math.round(55/100*$scaleImgWidth)
	$containerWidth=$scaleImgWidth*2 +$descWidth
		
	if($(window).width()<1024){
		
		$descWidth=Math.round(45/100*$scaleImgWidth)
		$containerWidth=$scaleImgWidth*2 +$descWidth

	}	
	$('article section').css({'height': $scaleImgHeight,'width': $containerWidth, 'marginLeft':-($containerWidth/2)})
}



$('a[href^="http://"]').addClass("external").attr({ target: "_blank" });








