$(document).ready(function() {	
$(window).load(function() {							
$('#home').animate({ height: "224px"}, 600, function(){
		$('#home-inner2').fadeIn('slow'); 
});  
$('#home-images').crossSlide({
  sleep: 2,
  fade: 2
		    }, [
		      { src: 'images/about.jpg'},
			  { src: 'images/home-2.jpg'},
			  { src: 'images/clients.jpg'},
	      	  { src: 'images/listings.jpg'}
		    ]);

$('#navbar li').click(function() {	
	$('#anim-text-back').css('display','none');	
	$('#anim-text').css('display','none');							   
	var currentImg = $(this).attr("title");	
	var currentBox = $(this).attr("class");	
if ($('#home').hasClass('homepage')) {
	$('#home-inner1').hide( 0);		
if(currentBox != 'development') {
	$('#head-image-frame').show( 0, function(){
        $('#head-image-frame').animate({ height: "117px"}, 600); 											 
		$('#home').animate({ height: "117px"}, 600, function(){
		$('#head-image').css('background-image','url(images/' + currentImg + '.jpg)'); 													 
		$('#head-image-frame-inner').fadeIn('slow', function(){
			$('#'+currentBox).addClass('showthis'); 												 
			$('#'+currentBox).show( 0); 												 
			$('#main').slideDown('slow'); 												 
});  
});   
});
}
else {
	$('#head-image-frame').show( 0, function(){
        $('#head-image-frame').animate({ height: "0px"}, 600); 											 
		$('#home').animate({ height: "0px"}, 600, function(){												 
			$('#'+currentBox).addClass('showthis'); 												 
			$('#'+currentBox).show( 0); 												 
			$('#main').slideDown('slow', function(){ 
if(!FlashDetect.installed) {
    $('#anim-2').fadeOut(2000, function(){
	$('#dev-text-inner ').fadeIn(400, function(){	
	$('#anim-text-back').css('display','block');	
	$('#anim-text').css('display','block');										   
	$('#anim-text-back').animate({left: '458'}, 400);	
	$('#anim-text').animate({left: '458'}, 400);
});  
});  
}	
else {
		$('#anim-2').flash(
        { src: 'images/develop.swf',
          width: 698,
          height: 348,
		  wmode: 'transparent',
		  expressInstall: false,
		  update: false });
    $('#anim-2').delay(6800).fadeOut(2000, function(){
	$('#dev-text-inner ').fadeIn(400, function(){	
	$('#anim-text-back').css('display','block');	
	$('#anim-text').css('display','block');										   
	$('#anim-text-back').animate({left: '458'}, 400);	
	$('#anim-text').animate({left: '458'}, 400);
});  
});  
};
});   			
});   
});
};
	$('#home').removeClass('homepage');
}	
else { 

	if(currentBox != 'development') {
    $('#head-image-frame-inner').stop(true, true).fadeOut('slow', function(){
	$('#head-image-frame').animate({ height: "117px"}, 600); 
	$('#home').animate({ height: "117px"}, 600, function(){
	$('#head-image').css('background-image','url(images/' + currentImg + '.jpg)'); 	
	$('#head-image-frame-inner').fadeIn('slow'); 
}); 
}); 
	$('.content').stop(true, true).fadeTo('slow', 0, function(){											
	$('#main').slideUp('slow', function(){
	$('.showthis').hide();										  
	$('.showthis').removeClass('showthis');									
	$('#'+currentBox).addClass('showthis');
	$('#'+currentBox).show( 0); 
	$('#main').slideDown('slow', function(){  
	$('.showthis .content').fadeTo('slow', 1); 
}); 
}); 	
}); 		
}
else {
	
    $('#head-image-frame-inner').stop(true, true).fadeOut('slow', function(){
	$('#head-image-frame').animate({ height: "0px"}, 600); 	
	$('#home').animate({ height: "0px"}, 600);
}); 	
	$('.content').stop(true, true).fadeTo('slow', 0, function(){											
	$('#main').slideUp('slow', function(){
	$('.showthis').hide();										  
	$('.showthis').removeClass('showthis');									
	$('#'+currentBox).addClass('showthis');
	$('#'+currentBox).show( 0); 
	$('#main').slideDown('slow', function(){  
	$('.showthis .content').fadeTo(0, 1); 
if(!FlashDetect.installed) {
    $('#anim-2').fadeOut(2000, function(){
	$('#dev-text-inner ').fadeIn(400, function(){	
	$('#anim-text-back').css('display','block');	
	$('#anim-text').css('display','block');										   
	$('#anim-text-back').animate({left: '458'}, 400);	
	$('#anim-text').animate({left: '458'}, 400);
});  
});  
	}	
	else {
		$('#anim-2').flash(
        { src: 'images/develop.swf',
          width: 698,
          height: 348,
		  wmode: 'transparent',
		  expressInstall: false,
		  update: false });
    $('#anim-2').delay(6800).fadeOut(2000, function(){
	$('#dev-text-inner ').fadeIn(400, function(){	
	$('#anim-text-back').css('display','block');	
	$('#anim-text').css('display','block');										   
	$('#anim-text-back').animate({left: '458'}, 400);	
	$('#anim-text').animate({left: '458'}, 400);
});  
});  
}  	
}); 
}); 	
}); 	
};	
};
});  
}); 
$('#listings .left ul li').click(function() {	
	$('#listings .left ul li').removeClass('active');
	$(this).addClass('active');
	var currentFrame = $(this).attr("title");
	$('#listings .right').fadeTo(400, 0, function(){	
	$('#listings .right .active').removeClass('active');												  
	$('#listings .right .' + currentFrame).addClass('active');
	$('#listings .right .' + currentFrame + '.image img').fadeTo(0, 1);
	$(this).fadeTo(400, 1);
}); 							   
}); 
$('#listings .right .top ul li').mouseover(function() {	
	var currentImg1 = $(this).attr("title");	
	$('.active .image').fadeTo(200, 0, function(){						   
	$(this).css('background-image', 'url('+currentImg1+')');
	$(this).delay(1).fadeTo(200, 1);
}); 							   
}); 
}); 
