$(document).ready(function(){
	// popup window
	$('.pop').popupWindow({ 
		centerScreen:1 
	});
 
 
 var speed = 300;
	// search drop
	$('#head-search .img1').click(function(){
		$('.secondary, .secondary2').slideUp(speed);
		$('.img1').show();
		$('.img2').hide();
		$('img.arrow').hide();
		$('img.arrow2').hide();
		$('.img1.over').hide();
		$('.img2.over').show();
		
		$('#head-search .img1').hide();
		$('#head-search .img2').show();
		$('#search').stop(true, true).slideDown(speed);
	});
	
	// tenants drop
	$('#head-tenants .img1').click(function(){
		$('.secondary, .secondary2').slideUp(speed);
		$('.img1').show();
		$('.img2').hide();
		$('img.arrow').hide();
		$('img.arrow2').hide();
		$('.img1.over').hide();
		$('.img2.over').show();
		
		$('#head-tenants .img1').hide();
		$('#head-tenants .img2').show();
		$('#tenants img.arrow').show();
		$('#tenants').stop(true, true).slideDown(speed);
	});	
	
	$('#head-tenants2 .img2.over').click(function(){
		$('.secondary, .secondary2').slideUp(speed);
		$('.img1').show();
		$('.img2').hide();
		$('img.arrow').hide();
		$('img.arrow2').hide();
		$('.img1.over').hide();
		$('.img2.over').show();
		
		$('#head-tenants2 .img2.over').hide();
		$('#head-tenants2 .img1.over').show();
		$('#tenants img.arrow2').show();
		$('#tenants').stop(true, true).slideDown(speed);
	});	

	
	
	// associations drop
	$('#head-associations .img1').click(function(){
		$('.secondary, .secondary2').slideUp(speed);
		$('.img1').show();
		$('.img2').hide();
		$('img.arrow').hide();
		$('img.arrow2').hide();
		$('.img1.over').hide();
		$('.img2.over').show();
		
		$('#head-associations .img1').hide();
		$('#head-associations .img2').show();
		$('#associations img.arrow').show();
		$('#associations').stop(true, true).slideDown(speed);
	});	
	
	$('#head-associations2 .img2.over').click(function(){
		$('.secondary, .secondary2').slideUp(speed);
		$('.img1').show();
		$('.img2').hide();
		$('img.arrow').hide();
		$('img.arrow2').hide();
		$('.img1.over').hide();
		$('.img2.over').show();
		
		$('#head-associations2 .img2').hide();
		$('#head-associations2 .img1').show();
		$('#associations img.arrow2').show();
		$('#associations').stop(true, true).slideDown(speed);
	});	
	
	// property drop
	$('#head-property .img1').click(function(){
		$('.secondary, .secondary2').slideUp(speed);
		$('.img1').show();
		$('.img2').hide();
		$('img.arrow').hide();
		$('img.arrow2').hide();
		$('.img1.over').hide();
		$('.img2.over').show();
		
		$('#head-property .img1').hide();
		$('#head-property .img2').show();
		$('#property img.arrow').show();
		$('#property').stop(true, true).slideDown(speed);
	});
	
	$('#head-property2 .img2.over').click(function(){
		$('.secondary, .secondary2').slideUp(speed);
		$('.img1').show();
		$('.img2').hide();
		$('img.arrow').hide();
		$('img.arrow2').hide();
		$('.img1.over').hide();
		$('.img2.over').show();
		
		$('#head-property2 .img2.over').hide();
		$('#head-property2 .img1.over').show();
		$('#property img.arrow2').show();
		$('#property').stop(true, true).slideDown(speed);
	});	
	
	
	
	
		
	// manage drop
	$('#head-manage .img1').click(function(){
		$('.secondary, .secondary2').slideUp(speed);
		$('.img1').show();
		$('.img2').hide();
		$('img.arrow').hide();
		$('img.arrow2').hide();
		$('.img1.over').hide();
		$('.img2.over').show();
		
		$('#head-manage .img1').hide();
		$('#head-manage .img2').show();
		$('#manage img.arrow').show();
		$('#manage').stop(true, true).slideDown(speed);
	});
	
	$('#head-manage2 .img2.over').click(function(){
		$('.secondary, .secondary2').slideUp(speed);
		$('.img1').show();
		$('.img2').hide();
		$('img.arrow').hide();
		$('img.arrow2').hide();
		$('.img1.over').hide();
		$('.img2.over').show();
		
		$('#head-manage2 .img2.over').hide();
		$('#head-manage2 .img1.over').show();
		$('#manage img.arrow2').show();
		$('#manage').stop(true, true).slideDown(speed);
	});	
	
	
	
	
	// about drop
	$('#head-about .img1').click(function(){
		$('.secondary, .secondary2').slideUp(speed);
		$('.img1').show();
		$('.img2').hide();
		$('img.arrow').hide();
		$('img.arrow2').hide();
		$('.img1.over').hide();
		$('.img2.over').show();
		
		$('#head-about .img1').hide();
		$('#head-about .img2').show();
		$('#about img.arrow').show();
		$('#about').stop(true, true).slideDown(speed);
	});	
	
	$('#head-about2 .img2.over').click(function(){
		$('.secondary, .secondary2').slideUp(speed);
		$('.img1').show();
		$('.img2').hide();
		$('img.arrow').hide();
		$('img.arrow2').hide();
		$('.img1.over').hide();
		$('.img2.over').show();
		
		$('#head-about2 .img2.over').hide();
		$('#head-about2 .img1.over').show();
		$('#about img.arrow2').show();
		$('#about').stop(true, true).slideDown(speed);
	});	
	
	
	
	
		// news drop
	$('#head-news .img1').click(function(){
		$('.secondary, .secondary2').slideUp(speed);
		$('.img1').show();
		$('.img2').hide();
		$('img.arrow').hide();
		$('img.arrow2').hide();
		$('.img1.over').hide();
		$('.img2.over').show();
		
		$('#head-news .img1').hide();
		$('#head-news .img2').show();
		$('#news img.arrow').show();
		$('#news').stop(true, true).slideDown(speed);
	});	
	
	$('#head-news2 .img2.over').click(function(){
		$('.secondary, .secondary2').slideUp(speed);
		$('.img1').show();
		$('.img2').hide();
		$('img.arrow').hide();
		$('img.arrow2').hide();
		$('.img1.over').hide();
		$('.img2.over').show();
		
		$('#head-news2 .img2.over').hide();
		$('#head-news2 .img1.over').show();
		$('#news img.arrow2').show();
		$('#news').stop(true, true).slideDown(speed);
	});	
	
	
	
	// inner circles
	$('#associations-circle').mouseover(function(){
		$('#associations-inner').stop(true, true).show();
		$(this).mouseout(function(){ $('#associations-inner').hide(); });
	});
	
	$('#tenants-circle').mouseover(function(){
		$('#tenants-inner').stop(true, true).show();
		$(this).mouseout(function(){ $('#tenants-inner').hide(); });
	});
	
	$('#property-circle').mouseover(function(){
		$('#property-inner').stop(true, true).show();
		$(this).mouseout(function(){ $('#property-inner').hide(); });
	});
	
	$('#about-circle').mouseover(function(){
		$('#about-inner').stop(true, true).show();
		$(this).mouseout(function(){ $('#about-inner').hide(); });
	});	

	// apartments box
	$('a.launch').click(function(){
		var box = $(this).attr('title');
		$('.'+box).fadeIn(300);
	});
	
	var leftMargin = (($('#container').width() / 2) - ($('.item').width() / 2));
	var topMargin = (($(window).height() / 2) - ($('.item').height() / 2));
		
		$('.item').css({
			'margin-left': leftMargin - 25,
			'margin-top': 25 //topMargin
		});
	
	IE6 = navigator.appVersion.indexOf("MSIE 6.") == -1 ? false : $('.item').css({
			'margin-left': -125,
			'margin-top': 25 //topMargin
		});
	IE7 = navigator.appVersion.indexOf("MSIE 7.") == -1 ? false : $('.item').css({
			'margin-left': -125,
			'margin-top': 25 //topMargin
		});
	
	$('.close').click(function(){
		var closeBox = $(this).attr('alt');
		$('.'+closeBox).fadeOut(300);
	}); 
	
	// Form Notifications
	$('#trasaction-failed').delay(2000).fadeOut(1500);
	$('#trasaction-success').delay(2000).fadeOut(1500);
	
	// Client Insider Archive
	$('#archive-button').toggle(function(){
		$('#archive-area').show(500);
	}, function(){
		$('#archive-area').hide(500);
	});
	
	// Our Team Effects
	$('#executive_team h3').click(function(){
		if( $('#executive_team .slide').hasClass('open') ){
			$('#executive_team .slide').slideUp(500);
			$('#executive_team .slide').removeClass('open');
		} else {
			$('.slide').slideUp(500);
			$('.slide').removeClass('open');
			$('#executive_team .slide').addClass('open');
			$('#executive_team .slide').slideDown(500);
		}
	});
	
	$('#management_team h3').click(function(){
		if( $('#management_team .slide').hasClass('open') ){
			$('#management_team .slide').slideUp(500);
			$('#management_team .slide').removeClass('open');
		} else {
			$('.slide').slideUp(500);
			$('.slide').removeClass('open');
			$('#management_team .slide').addClass('open');
			$('#management_team .slide').slideDown(500);
		}
	});
	
	$('#administrative_team h3').click(function(){
		if( $('#administrative_team .slide').hasClass('open') ){
			$('#administrative_team .slide').slideUp(500);
			$('#administrative_team .slide').removeClass('open');
		} else {
			$('.slide').slideUp(500);
			$('.slide').removeClass('open');
			$('#administrative_team .slide').addClass('open');
			$('#administrative_team .slide').slideDown(500);
		}
	});
	
	$('#accounting_team h3').click(function(){
		if( $('#accounting_team .slide').hasClass('open') ){
			$('#accounting_team .slide').slideUp(500);
			$('#accounting_team .slide').removeClass('open');
		} else {
			$('.slide').slideUp(500);
			$('.slide').removeClass('open');
			$('#accounting_team .slide').addClass('open');
			$('#accounting_team .slide').slideDown(500);
		}
	});
	
	$('#other_services h3').click(function(){
		if( $('#other_services .slide').hasClass('open') ){
			$('#other_services .slide').slideUp(500);
			$('#other_services .slide').removeClass('open');
		} else {
			$('.slide').slideUp(500);
			$('.slide').removeClass('open');
			$('#other_services .slide').addClass('open');
			$('#other_services .slide').slideDown(500);
		}
	});
	
	$('.read').toggle(function(){
		$(this).next().css('display', 'block');
	}, function(){
		$(this).next().css('display', 'none');
	});
 
 });
