$(document).ready(function(){
	$('.scroll-pane').jScrollPane();
	Cufon.replace(".calibri, .menuContainer li a, .pageContent h2", {hover:true});
	
	$("#contactform").submit(function(){
		elems = new Array('isim', 'email', 'message', 'subject');
		error = false;
		for(i=0; i< elems.length; i++){
			if($("#contactform .input"+elems[i]).val().length < 2){
				$("#contactform .input"+elems[i]).addClass("errorInput");
				$(".formError").slideDown();
				error = true;
			}else{
				$("#contactform .input"+elems[i]).removeClass("errorInput");
			}
		}
		if(error)
			return false;
		else
			return true;
	});
	
	if($("#newsList  li").length > 4){
		$("#viewer").imageScroller({
			next:"newsPrev",
			prev:"newsNext",
			frame:"newsList",
			width: 840,
			child:"li",
			auto:false
		});
	}
	
	$("#newsList li a").click(function(){
		$("div.newsDetailsBox").hide();
		parentElem = $("div.newsDetailsBox");
		parentElem.load($(this).attr("href"));
		parentElem.show();
		scroller();
		return false;
	});
	
	$(".closePopup").live("click",function(){
		$(".newsDetailsBox").hide();
		return false;
	});
	
	$(".personLink").click(function(){
		$(".contentImage").load($(this).attr("href"));
		$(".personPhoto").hide();
		$(this).find(".personPhoto").css("display","block");
		$(".showPhoto").removeClass("showPhoto");
		$(this).addClass("showPhoto");
		
		return false;
	});
	

	
	$(".personLink").click(
		function(){
			$(this).find(".personPhoto").css({display: "block", zIndex:"10"});
		}
	);
	
	
	$(".teamMemberLink").click(function(){
		$(".teamMemberDetails").load($(this).attr("href"));
		
		return false;
	});
	
	$(".slideShow li:first").fadeIn("slow", function() {
		$(this).addClass("activeElem");
	});
	
	$(".showLevel2").click(function(){
		$(".level2").hide();
		$($(this).attr("href")).show();
	});
	
	$(".projectList li a.projectLink").click(function(){
		$(".projectList div").hide();
		$(this).parent().find("div").show().css({'z-index': 999});
		return false;
    });
	$('.projectGalleryContainer a').colorbox();
	if($('.projectGalleryContainer a').length != 0) {
		$('.contentImage .imageContainer img').attr('src', $('.projectGalleryContainer a:first').attr('href'));
	}
    
    
    $('*:not(.projectList *)').click(function() {
    	$(".projectList div").hide();
    });
});

function slaytShow(){
	return true;
}


function scroller(){
	$('.scroll-pane').jScrollPane();
} 



  $('.slideShow').cycle({
		fx: 'fade'
	});











