		
		
		var page = 1;
		var countOfWorks;
		var l2;
		var winWidth;
		var l3;
		var curId;
		var curPrev, curNext;
		var intV = "";
		var flag = 0;
		var musteriIndex = 0;
		var tarayici = "";
		var mapFlag = 0;
		
		$.fn.timeout = function(t,f){
		 this.each(function(){setTimeout(f,t); }); 
		 return this; };
		 
		$(function(){
				
    	   	var $window = $(window);
    	   	winHeight = $window.height();
    	   	winWidth = $window.width();
    	   	k = (winHeight-605);

		 	$("#wrapperFrame").height(winHeight);
		 	$("#worksFrame").width(winWidth);
		 	if(k>0){
		 		$("#mainCon").css("margin-top",k +"px");
		 	}
			
			///////bu iki satır gereksiz olabilir
			var r = parseInt($("#mainCon").css("height"),10) - 150;
		 	$("#musteriler ul").height(r);
			

			$("img.opened").hide();
    	  	$("img.opened",this).imagesLoaded(arrangeWorks);//cached image problem solved.

			curId = Number($("#works .work:nth-child(2)").attr("id").substring(1));
			countOfWorks = $("#works .work").length;

			$(window).resize(function(){
	    		winHeight = $window.height();
	    	   	winWidth = $window.width(); 
				k = (winHeight-605);
				wh = Math.max(winHeight, 560);
				$("#wrapperFrame").height(wh);
				
				if (wh < 605){
					$("#header").css("height", 143 - (605 - wh) + "px");
					$("#header #logo").css("top", 49 - ((605 - wh) / 2) + "px");
					$("#leftCon").css("top", 145 - (605 - wh) + "px");
					$("#rightCon").css("top", 145 - (605 - wh) + "px");
					//$("#mainCon").css("margin-top",k +"px");
					if (page != 1){
						$('#wrapper').css('top', - $("#wrapperFrame").height() + 46 + "px");
					}
				}
				
				if(page == 1){//örnek işler			
					if(k>0){
						$("#mainCon").css("margin-top",k +"px");
						$("#header").css("height",143 + "px");
					}
					
				}
				else if(page == 5){//müşteriler
					$("#mainCon").height(winHeight-4);
					var r = parseInt($("#mainCon").css("height"),10) - 180;
					if(r%16 > 0){ r = r - (r%16);}
		 			$("#musteriler ul").height(r);

					$("#isler .is:nth-child("+(musteriIndex+1)+")").height(r-30);///gereksiz?
					upDownControl("musteri");
					upDownControl("isler");
				}
				else{
					if(winHeight-4 > 588){
						$("#mainCon").height(winHeight-4);
					}
					else{
						$("#mainCon").height(588);
					}
				}

				$("#worksFrame").width(winWidth);
				arrangeWorks();
           });

			$(window).resize();
    	});

		function resetSubImages(id){////////////////////???????????????????????
			if($("#i"+id).children("img").length > 1){
				$("#w"+id+" .imgNos .subNoArrow").css("marginLeft","10px");
				$("#w"+id+" .imgNos a.selected").removeClass("selected");
				$("#w"+id+" .imgNos a:last-child").addClass("selected");
				$("#i"+id+" img.selected").attr("style","opacity:0").removeClass("selected");
				$("#i"+id+" img:first-child").attr("style","opacity:1").addClass("selected");
			}
		}
		function upDownControl(pTitle){
			if(pTitle == "musteri"){
				var t = parseInt($("#musteriler ul li:last-child").css("top"),10);
				var n = parseInt($("#musteriler ul li:first-child").css("top"),10);
				var r = parseInt($("#musteriler ul").css("height"),10);
				if(n < 0){
					if(tarayici == "ie"){
						$("#musteriler #topButM").css("display","block");
					}
					else{
						$("#musteriler #topButM").fadeIn(150);//.css("display","block");
					}
				}
				else{
					if(tarayici == "ie"){
						$("#musteriler #topButM").css("display","none");
					}
					else{
						$("#musteriler #topButM").fadeOut(150);//.css("display","none");
					}
				}
				if(t > r){
					if(tarayici == "ie"){
						$("#musteriler #botButM").css("display","block");
					}
					else{
						$("#musteriler #botButM").fadeIn(150);//.css("display","block");
					}
				}
				else{
					if(tarayici == "ie"){
						$("#musteriler #botButM").css("display","none");
					}
					else{
						$("#musteriler #botButM").fadeOut(150);//.css("display","none");
					}
				}
				if($("#musteriler").css("display") == "block"){
					$("#isler").css("display","none");
				}
			}
			if(pTitle == "isler"){
				$("#mainCon").height(winHeight-4);
				var r = parseInt($("#mainCon").css("height"),10) - 170;
				if(r%16 > 0){ r = r - (r%16);}
				$("#cw"+musteriIndex).height(r);

				var offsetBottom = $("#cw"+musteriIndex+" ul li:last-child").offset();
				var t = offsetBottom.top-16;
				var n = parseInt($("#cw"+musteriIndex+" ul").css("top"));
				
				var r = $("#cw"+musteriIndex).css("height");
				r = parseInt(r,10);
				//alert("t: " + t + " n: " + n + " r: " + r);

				if(n < 0){
					if(tarayici == "ie"){
						$("#isler #topButI").css("display","block");
					}
					else{
						$("#isler #topButI").fadeIn(150);
					}
				}
				else{
					if(tarayici == "ie"){
						$("#isler #topButI").css("display","none");
					}
					else{
						$("#isler #topButI").fadeOut(150);//.css("display","none");
					}
					
				}
				if(t > r){
					if(tarayici == "ie"){
						$("#isler #botButI").css("display","block");
					}
					else{
						$("#isler #botButI").fadeIn(150);//
					}
					
				}
				else{
					if(tarayici == "ie"){
						$("#isler #botButI").css("display","none");
					}
					else{
						$("#isler #botButI").fadeOut(150);//.css("display","none");
					}
					
				}
				//alert("t:"+t+" r:"+r);
			}
		}

    	function arrangeWorks(){
			if($("#w"+curId).next().length > 0){
				curNext = Number($("#w"+curId).next().attr("id").substring(1));
			}
			else{
				curNext = Number($("#works .work:first-child").attr("id").substring(1));
			}
			if($("#w"+curId).prev().length > 0){
				curPrev = Number($("#w"+curId).prev().attr("id").substring(1));
			}
			else{
				curPrev = Number($("#works .work:last-child").attr("id").substring(1));
			}

			//$("img[id!=opened]").css("left","3000px");
				
			l = - ($("#w"+curPrev+" img.selected").width() - 50);
			//açılışta bu(l) değeri alamıyoruz??

			$("#w"+curPrev).css("left",l+"px");
			l2 = $("#menu").offset().left;
			$("#w"+curId).css("left",l2+"px");
			$("#w"+curId+" div.title").css("display","block");
			$("#logo").css("left",l2+"px");
			
			winWidth = $(window).width();
			l3 = winWidth - 50;
			$("#w"+curNext).css("left",l3+"px");
			$("#w"+curId+" img.selected, "+"#w"+curPrev+" img.selected,"+"#w"+curNext+" img.selected, "+"#logo").fadeIn();
		}
		
		function motAct(id, workId){//id ex: 0-9
			flag = 0;
			//$("#w"+id).prev().hide();
			if (workId == undefined){
				if ($("#w"+curId).children().eq(1).children("img").length > 1){
					$("#w"+curId+" .imgNos a:first").click();	
					$("#w"+curId+" .txt p:first").show();
					//changeSubImageByNo(1);
				}
			}
			//resetSubImages($("#w"+id).prev().attr('id').substr(1));
			if(flag%4 == 0 && id != curId){
				if($("#w"+id).next().length > 0){
					nextNext = Number($("#w"+id).next().attr("id").substring(1));
				}
				else{
					nextNext = Number($("#works .work:first-child").attr("id").substring(1));
				}
				if($("#w"+id).prev().length > 0){
					nextPrev = Number($("#w"+id).prev().attr("id").substring(1));
				}
				else{
					nextPrev = Number($("#works .work:last-child").attr("id").substring(1));
				}
				var lp = - Math.round(($("#w"+nextPrev).width() - 50));
				var lp2 = - Math.round(($("#w"+curId).width() - 50));
				
				if(curPrev == id){
					$("#w"+curNext).animate({
						left: '+=360'
					  }, 500, function() {
						$(this).css("left","-1000px").hide();
						
						flag++;
					});
					
					$(this).timeout(50,function(){
						$("#w"+curId+" div.title").fadeOut("slow");
						$("#w"+curId).animate({
							left: l3
						  }, 450, function() {
							flag++;
						});
					});

					$("#w"+id+" div.title").fadeIn("slow");
					$("#w"+id).animate({
						left: l2
					  }, 500, function() {
						flag++;
					});
					$(this).timeout(50,function(){     
						 $("#w"+nextPrev).css("left", Math.round((-2 * $("#w"+nextPrev).width()))+"px").show()
						.animate({
							left: lp
						  }, 450, function() {
							//addNextPrevImgHover();
							flag++; 
						});
					});
					$(this).timeout(100,function(){ 
						curId = id; 
						curPrev = nextPrev;
						curNext = nextNext;
					});
					if(workId != null){
						$(this).timeout(150,function(){ 
							$("#menu ul li:nth-child(2) a").click();
						});
					}					
				}
				else if(curNext == id){
					$("#w"+curPrev).animate({
						left: (-2 * Math.round($("#w"+curPrev).width()))
					  }, 500, function() {
						$(this).css("left","-1000px").hide();
						flag++;
					});
					
					$(this).timeout(50,function(){
						$("#w"+curId+" div.title").fadeOut("slow");
						$("#w"+curId).animate({
							left: lp2
						  }, 450, function() {
							flag++;
						});
					});

					$("#w"+id+" div.title").fadeIn("slow");
					$("#w"+id).animate({
						left: l2
					  }, 500, function() {
						flag++;
					});
					
					$(this).timeout(50,function(){     
						$("#w"+nextNext).css("left", (winWidth + Math.round((2 * $("#w"+nextNext).width())))+"px").show()
						.animate({
							left: l3
						  }, 450, function() {
							//addNextPrevImgHover();
							flag++;
						});
					});
					$(this).timeout(100,function(){ 
						curId = id; 
						curPrev = nextPrev;
						curNext = nextNext;
					});
					if(workId != null){
						$(this).timeout(150,function(){ 
							$("#menu ul li:nth-child(2) a").click();
						});
					}
				}
				else{
					$("#w"+curId+","+"#w"+curPrev+","+"#w"+curNext).hide();
					curId = id;
					arrangeWorks();
					$("#menu ul li:nth-child(2) a").click();
				}
				if(workId == null){ workId = 1; }
				else{
					$(this).timeout(150,function(){ 
						$("#w"+curId+","+"#w"+curPrev+","+"#w"+curNext).css("display","block");
						$(".work .imgNos a[id=w"+curId+"m"+workId+"]").click();
						arrangeWorks();
					});
				}
			}
			else if(curId == id && workId != null){
				$(this).timeout(150,function(){ 
					$("#w"+curId+","+"#w"+curPrev+","+"#w"+curNext).css("display","block");
					$(".work .imgNos a[id=w"+curId+"m"+workId+"]").click();
					arrangeWorks();
					$("#menu ul li:nth-child(2) a").click();
				});
			}
			else{}
		}

		function changeSubImageByNo(i){
			clrInterval(); 
			$("#i"+curId+" img.selected").removeAttr("class").animate({
				opacity:0 
				}, 750, function() {
			}); 
			$("#w"+curId).children(".title").eq(0).children(".txt").eq(0).children("p.selected").eq(0).fadeOut(function(){
					$(this).removeAttr("class");
					$("#w"+curId).children(".title").eq(0).children(".txt").eq(0).children("p").eq(i-1).fadeIn(function(){
						$(this).addClass("selected");
					});
			});
			$("#i"+curId+" img:nth-child("+i+")").attr("class","selected").animate({
				opacity:1
				}, 750, function() {
				$(this).addClass("selected");
			});
			
			wi = $("#i"+curId+" img:nth-child("+i+")").width();
			$("#w"+curId).children(".title").eq(0).children("h3").eq(0).animate({
				width:wi
				}, 500, function() {
				// Animation complete.
			});
			
			$("#w"+curId).children(".title").eq(0).children("h3").eq(0).children(".imgNos").eq(0).children(".subNoArrow").eq(0).animate({
				marginLeft: (10 + ((i-1)*24))
				}, 500, function() {
				stInterval();
			});
			

		}
		function resetPage2(){
			$("#topButPg2").css("display","none");
			$("#botButPg2").css("display","block");
			$("#pg2Image").animate({
				opacity:1,
				marginTop:0
				}, 50, function(){
					/////////
			});
			$("#pg2Text").animate({
				opacity:0
				}, 50, function(){
					/////////
			});
		}
		function arrangePages(pg){
			/*if(pg == 5 && page == 1){
				$("#closeBut").unbind("click");
				$("#closeBut").bind("click", function(){$("#menu ul li:nth-child(2) a").click();});
			}
			else{
				$("#closeBut").unbind("click");
				$("#closeBut").bind("click", closeButClick);
			}*/
			if(pg == 5){
				closeButControl();
				$("#content #pg5 #closeBut").click();
				musteriControl();
				islerControl();

				$("#mainCon").height(winHeight-4);
				var r = winHeight-184;
				if(r%16 > 0){ r = r - (r%16);}
				$("#musteriler ul").height(r);
				$("#cw"+musteriIndex).height(r-30);
				upDownControl("musteri");
				upDownControl("isler");
			}
			if(pg != 1){
				winHeight = $(window).height();
				if(winHeight-4 > 588){
					$("#mainCon").height(winHeight-4);
					var r = winHeight-174;
				}
				else{
					$("#mainCon").height(588);
					var r = 588-170;
				}	
				$("#footer").css("display","block");
			}
			else{
				$("#footer").css("display","none");
			}
			
			if(page == 1){				
				$("#content .pages").css("display","none");
				$("#content #pg"+pg).css("display","block");
				if(pg == 6 && mapFlag == 0){
					//alert(mapFlag);
					initialize();
					mapFlag = 1;
				}
				page = pg;
			}
			else{
				$("#content #pg"+page).fadeOut(function(){
					$("#content #pg"+pg).fadeIn(function(){
						if(pg == 6 && mapFlag == 0){
							initialize();
							mapFlag = 1;
						}
						page = pg;
					});
				});
			}
			if(pg == 2){
				resetPage2();
			}
			if(pg == 3){
				$("#tabletler").css("display","none");
				resetPage3();
			}
			
			
		}

		function resetSubPages(p){
			closeButControl();
			$("#closeBut").click();
		}

		function resetPage3(){
			$("#pg3 #closeTablet").click();
		}
		
		function closeTablet(){
			$("#forMusteriler").css("height","16px");
			$("#closeTablet").fadeOut(500);
			$("#tabletler").fadeOut(500,function(){
				$("#liste").fadeIn(500);				
			});
			listeControl();
		}
		
		function arrangeWorkText(element){
			var w = $(element).width();
			if($(element).parent().parent().children(".title").eq(0).children("h3").eq(0).children().eq(1).attr("class") != null){
				$(element).parent().parent().children(".title").eq(0).children("h3").eq(0).css("width",w+"px").css("display","block");
				$(element).parent().parent().children(".title").eq(0).children("h3").eq(0).children().eq(1).css("float","right");							
			}else{
				$(element).parent().parent().children(".title").eq(0).children(".txt").eq(0).animate({
					width:w
					}, 200, function() {
					// Animation complete.
				});
			}
		}

		$(document).ready(function(){
			jQuery.each(jQuery.browser, function(i, val) {
			   if(i=="mozilla" && $.client.os == "Mac"){
				 //$("#menu").attr("style","clear:both; letter-spacing:-1px; width:100%; height:42px;");
				 $("#harita").attr("style","width: 529px; height: 440px; position: relative;")
			   }
			   if($.browser.msie){
					tarayici = "ie";
			   }
			 });
			

			///////////////// bu bölüm ie 7 de rollOver'da siyah şerit problemi için eklendi.
			if ( parseInt($.browser.version, 10) == "7" ) {
				var zIndexNumber = 10000;
				$('div').each(function() {
					$(this).css('zIndex', zIndexNumber);
					zIndexNumber = zIndexNumber-10;
				});
				$("#content #isler ul li").css("clear","both");
				$("#content #isler ul li a").css("float","left");
				$("#content #isler ul .selectDot").css("margin-right","5px");
			}
			/////////////////


			$("#menu ul li a").click(function(){
				$("#menu ul li a").removeClass();
				$(this).addClass("selected");				
				winHeight = $(window).height();
				var index = $("#menu ul li a").index(this);
				if(index != 1){
					arrangePages(index);//
					tt = - $('#wrapperFrame').height() + 46;//Number(-winHeight+46);
					clrInterval();
				}	
				else{
					tt = 0;
					page = index;
					stInterval();					
				} 
				$("#wrapper").animate({
				    top: tt
				  }, 750, function() {
				 });
				
				//////////
				
				if(winHeight-605 > 0){
					$("#mainCon").animate({
				    marginTop: winHeight-605
				  }, 750, function() {
				 });
				}
				//////////
				var position = $(this).position(); 
				zz = position.left + ($(this).width() / 2) - 7; //7:arrow width
				$("#arrow").animate({
				    left: zz
				  }, 750, function() {
				});
			});
			
			$(".work .imgNos a").click(function(e){
				e.preventDefault();
				if($(this).attr("class") != "selected"){
					$(this).parent().children(".selected").removeClass("selected");
					$(this).addClass("selected");
					changeSubImageByNo($(this).parent().children().index(this));
				}
			});
			
			$("#menu ul li:nth-child(2) a").click(); //iş örneklerinden başlamak için onu tıklamışız gibin
			
			$(".work .image img.selected").each(function(){
				$($(this),this).imagesLoaded(arrangeWorkText);
			});
			
			/////////////////// left - right image functions
			
			$("#leftCon").hover(
				function(){
					if($("div:animated").length == 0){
					$("#w"+curPrev).animate({
					    left: '+=16'
					  }, 200, function() {
						  //alert($(this).offset().left + " : " + $(this).width());
					});
					}
				},
				function(){
					if($("div:animated").length == 0){
					$("#w"+curPrev).animate({
					    left: '-=16'
					  }, 200, function() {
					});
					}
				}
			);

			$("#rightCon").hover(
				function(){
					$("#w"+curNext).animate({
					    left: '-=16'
					  }, 200, function() {
					});
				},
				function(){
					$("#w"+curNext).animate({
					    left: '+=16'
					  }, 200, function() {
					});
				}
			);
			
			$("#leftCon").click(function(){
				$(this).css("display","none");
				$(this).css("display","block");		
				clrInterval();	
				motAct(curPrev);
				stInterval();
			});
			
			$("#rightCon").click(function(){
				$(this).css("display","none");
				$(this).css("display","block");		
				clrInterval();
				motAct(curNext);
				stInterval();
			});

			/////////////////////////////////////////////////////////
			///////////////iletişim

			$("#contact #mail").hover(
				function(){
					$(this).css("color","#fff");
					$(this).parent().children(".selectDot").addClass("over");
					$("#forMusteriler").offset({ top: $(this).offset().top });
					$("#forMusteriler").height($(this).height());
					$("#forMusteriler").show();
				},
				function(){
					$(this).css("color","#333333");
					$(this).parent().children(".selectDot").removeClass("over");
					$("#forMusteriler").hide();
				}			
			);
			
			//////////////////// iş örnekleri
			$(".title .client a").click(function(){
				if($(this).text() == "FONT ÇALIŞMALARI" || $(this).text() == "TİPOGRAFİ TABLETLERİ"){
					if($(this).text() == "FONT ÇALIŞMALARI"){
						$("#menu ul li:nth-child(3) a").click();
					}
					else{
						$("#menu ul li:nth-child(4) a").click();
					}
				}
				else{
					$("#menu ul li:nth-child(6) a").click();
					var clientIndex = parseInt($(this).parent().parent().parent().parent().attr("id").substring(1));
					musteriIndex = clientIndex;
					
					$("#closeBut").unbind("click");
					$("#closeBut").bind("click", function(){$("#menu ul li:nth-child(2) a").click(); closeButControl();});

					$("#musteriler ul li a[href=#"+clientIndex+"]").click();
				}
			});

			$(".title .client").hover(
				function(){
					$(this).parent().parent().parent().find('#down').css("top", "310px");
					$(this).parent().parent().parent().find('#down').animate({
					    top: 317,
					    opacity: 1
					  }, 200, function() {
					  	$(this).parent().parent().parent().find("img.o").css("display","none");
					 });
				},
				function(){
					$(this).parent().parent().parent().find('img.o').css("display","block");
					$(this).parent().parent().parent().find('#down').animate({
					    top: 310,
					    opacity: 0
					  }, 200, function() {					  	
					 });
				}
			);
			
			$("#works .work .image").click(function(){
				$(this).next().find("a").click();
			});
			//////////////////////////////////////////////////////////////


			///////////////////// Müşteriler

			$("#isler .is ul li a").click(function(){
				var clientId = $(this).parent().parent().parent().attr("id").substring(2);
				var workId = $(this).attr("href").substring(2);
				motAct(clientId, workId);
			});


			$("#musteriler #botButM").click(function(){
				$("#musteriler ul li").animate({
					    top: '-=16'
					  }, 100, function() {	
						upDownControl("musteri");  
				});
			});

			$("#musteriler #topButM").click(function(){
				$("#musteriler ul li").animate({
					    top: '+=16'
					  }, 100, function() {	
						upDownControl("musteri");  
				});
			});

			$("#isler #botButI").click(function(){
				var way;
				$("#cw"+musteriIndex+" ul li").each(function (ind) {
					var liTop = $(this).offset().top;
					var h4Top = $("#cw"+musteriIndex+" h4").offset().top + 34;	
					if ( h4Top < liTop ) {
						way = "-=" + (liTop-h4Top);
						return false;
					}
				});				
				//alert($("#isler .is:nth-child("+(musteriIndex+1)+") ul li").length);
				$("#cw"+musteriIndex+" ul").animate({
					    top: way
					  }, 100, function() {	
						upDownControl("isler");  
				});
			});


			$("#isler #topButI").click(function(){
				var way;
				$("#cw"+musteriIndex+" ul li").each(function (ind) {
					var liTop = $(this).offset().top;
					var h4Top = $("#cw"+musteriIndex+" h4").offset().top + 34;	
					if ( h4Top == liTop ) {
						var beLiTop = $("#cw"+musteriIndex+" ul li:nth-child("+ind+")").offset().top;
						way = "+=" + (liTop-beLiTop);
						return false;
					}
				});
				$("#cw"+musteriIndex+" ul").animate({
					    top: way
					  }, 100, function() {
						upDownControl("isler");  
				});
			});
			
			$("#topButPg2").click(function(){
				if(tarayici == "ie"){
					$(this).css("display","none");
				}
				else{
					$(this).fadeOut(450);
				}
				$("#pg2Image").animate({
					opacity:1,
					marginTop:0
					}, 450, function(){
						/////////
				});
				$("#pg2Text").animate({
					opacity:0
					}, 450, function(){
						/////////
				});
				if(tarayici == "ie"){
					$("#botButPg2").css("display","block");
				}
				else{
					$("#botButPg2").fadeIn(450);
				}

			});
						

			$("#botButPg2").click(function(){
				if(tarayici == "ie"){
					$(this).css("display","none");
				}
				else{
					$(this).fadeOut(450);
				}
				$("#pg2Image").animate({
					opacity:0,
					marginTop:-443
					}, 450, function(){
						/////////
				});
				$("#pg2Text").animate({
					opacity:1
					}, 450, function(){
						/////////
				});
				if(tarayici == "ie"){
					$("#topButPg2").css("display","block");
				}
				else{
					$("#topButPg2").fadeIn(450);
				}

			});

			$("#pg2Image").click(function(){
				$("#botButPg2").click();			
			});

			$("#closeBut, #closeTablet, #downPdf, #botButM, #topButM, #botButI, #topButI, #botButPg2, #topButPg2").hover(
				function(){
					$(this).addClass("over");
				},
				function(){
					$(this).removeClass("over");
				}
			);			
			$("#closeBut").bind('click', closeButClick);			
			$("#pg3 #closeTablet").bind('click', closeTablet);

			$("#musteriler ul li a").live('mouseover mouseout', function(event) {
				if($(this).attr("class") != "in"){
				  if (event.type == 'mouseover') {
						$(this).css("color","#fff");
						var tempZindex = Number($(this).parent().css("zIndex"));
						$("#forMusteriler").css("zIndex",tempZindex-5);
						$("#forMusteriler").offset({ top: $(this).offset().top });
						$("#forMusteriler").show();
				  } else {
						$(this).css("color","#333333");
						//$(this).parent().css("background-color","#F0F0F0");
						$("#forMusteriler").hide();
				  }
				}
			});

			$("#liste ul li a").live('mouseover mouseout', function(event) {
				if($(this).attr("class") != "din"){
				  if (event.type == 'mouseover') {
						$(this).css("color","#fff");
						var tempZindex = Number($(this).parent().css("zIndex"));
						$("#forMusteriler").css("zIndex",tempZindex-5);
						$("#forMusteriler").offset({ top: $(this).offset().top });
						$("#forMusteriler").show();
				  } else {
						$(this).css("color","#333333");
						//$(this).parent().css("background-color","#F0F0F0");
						$("#forMusteriler").hide();
				  }
				}
			});
			
			$("#liste ul li a").click(function(){
				$("#liste ul li a").addClass("din");
				var $m = $(this).parent();
				var topM = $(this).position().top;
				var index = $("#liste ul li a").index(this);
				$('#downPdf').unbind('click');
				$('#downPdf').click(function(){
					window.open("http://www.tipograf.com/imgs/tipografi-tabletleri-00"+(index+1)+".pdf");
					return false;
				});
				$("#liste ul li a[href!=" + $(this).attr("href") + "]").each(function(){
					if(parseInt($(this).attr("href").substring(1)) < index){
						var tarTop = '-=16';
					}
					else{
						var tarTop = '+=16';
					}
					$(this).parent().animate({
						top: tarTop
					  }, 300, function() {
					});
				});
				var kr = 0; //herbiri için tekrar çağrılmasın diye(fonksiyon yazmaktan çekindik)
				$("#liste ul li a[href!=" + $(this).attr("href") + "]").fadeOut(350,function(){
					if(kr < 1){
						$(this).timeout(50,function(){
							$m.fadeOut(400);
							$("#forMusteriler").animate({
								top: '+=8',
								height:0
								}, 400, function(){
								$(this).timeout(50,function(){
									$("#liste").css("display","none");
									musteriControl();
									$("#tabletler .tablet").css("display","none");
									$("#tabletler").css("display","block");
									$("#closeTablet").fadeIn(200);
									$("#tabletler .tablet:nth-child("+(index+1)+")").fadeIn(200,function(){
										$("#tabletler").css("display","block");
									});
								}); 								
							});
						});
						kr = 1;
					}
				});
			});
			

			$("#musteriler ul li a").click(function(){
				$("#topButI, #botButI").css("display","none");			
				$("#musteriler ul li a").addClass("in");
				var $m = $(this).parent();
				var index = Number($(this).attr("href").substring(1));
				musteriIndex = index;
				index += 1;
				var topM = $(this).position().top;
				$("#musteriler #topButM, #botButM").fadeOut();
				//////uzaklaşma...
				$("#musteriler ul li a[href!=" + $(this).attr("href") + "]").each(function(){
					if(parseInt($(this).attr("href").substring(1)) < (index-1)){
						var tarTop = '-=16';
					}
					else{
						var tarTop = '+=16';
					}
					$(this).parent().animate({
						top: tarTop
					  }, 300, function() {
					});
				});

				///////fadeOut...
				var kr = 0; //herbiri için tekrar çağrılmasın diye(fonksiyon yazmaktan çekindik)
				$("#musteriler ul li a[href!=" + $(this).attr("href") + "]").fadeOut(350,function(){
					if(kr < 1){
						$(this).timeout(50,function(){
							$m.fadeOut(400);
							$("#forMusteriler").animate({
								top: '+=8',
								height:0
								}, 400, function(){
								$(this).timeout(50,function(){
									$("#musteriler").css("display","none");
									musteriControl();
									$("#isler .is").css("display","none");
									$("#isler").css("display","block");
									$("#closeBut").fadeIn(200);
									$("#cw"+musteriIndex).fadeIn(200,function(){
										$("#isler").css("display","block");
										upDownControl("isler");
									});
								}); 								
							});
						});
						kr = 1;
					}
				});
			});

			$("#isler a").live('mouseover mouseout', function(event) {
				  if (event.type == 'mouseover') {
						$(this).css("color","#fff");
						$(this).parent().children(".selectDot").addClass("over");
						//$(this).parent().css("background-color","#000");
						//$("#forMusteriler").css("display","block");
						$("#forMusteriler").offset({ top: $(this).offset().top-2});
						$("#forMusteriler").height($(this).height()+6);
						$("#forMusteriler").show();

				  } else {
						$(this).css("color","#333333");
						$(this).parent().children(".selectDot").removeClass("over");
						//$(this).parent().css("background-color","#F0F0F0");
						$("#forMusteriler").hide();
				  }
			});

			

		});
		function closeButControl(){				
			$("#closeBut").unbind("click");
			$("#closeBut").bind("click", closeButClick);
		}

		function closeButClick(){
			$("#forMusteriler").css("height","16px");
			$("#closeBut").fadeOut(500);
			$("#isler").fadeOut(500,function(){
				//$("#isler .is").removeAttr("style");
				$("#musteriler").fadeIn(500);
				
			});
		}
		function musteriControl(){
			$("#musteriler ul li a").removeAttr("style");
			$("#musteriler ul li").css("display","block");
			$("#musteriler ul li a").each(function(index){
				var t = index*16;
				$(this).parent().css("top", t + "px");
				$(this).removeAttr("class");
			});
			upDownControl("musteri");///yukarda içerdeydi

			$("#forMusteriler").css("height","16px").css("display","none");	
		}

		function listeControl(){
			$("#liste ul li a").removeAttr("style");
			$("#liste ul li").css("display","block");
			$("#liste ul li a").each(function(index){
				var t = index*16;
				$(this).parent().css("top", t + "px");
				$(this).removeAttr("class");
			});
			$("#forMusteriler").css("height","16px").css("display","none");	
		}

		function islerControl(){
			
		}
		
		function initMusteri(ind){
			$("#musteri a").click(function(){
				$("#musteriler").fadeOut("slow", function(){
					$("#isler .is:nth-child("+ind+")").fadeIn("slow");
				});	
			});
			$("#musteri a").hover(
				function(){
					$("#forMusteriler").show();
				},
				function(){
					$("#forMusteriler").hide();
				}
			);
		}

		/////////////////////////////////////////////////////////
		//////////slide
	
		function clrInterval(){
			window.clearInterval(intV);
			intV = "";
		}
		function stInterval(){
			if(intV == ""){
				if(($("#i"+curId+" img").length > 1 && $("#i"+curId+" img:last-child").attr("class") != "selected") || ($("#w"+curId).next().children().eq(1).children("img").length > 1)){
					intV = window.setInterval( "araSlide()", 3500 );
				}
				else{
					intV = window.setInterval( "araSlide()", 10000 );
				}
			}
		}
		
		function araSlide(){
			if($("#i"+curId+" img").length > 1 && $("#i"+curId+" img:last-child").attr("class") != "selected"){
				//alert($("#i"+curId+" .imgNos a.selected") + " //// #i"+curId+" .imgNos a.selected" );
				var idToSolve = $("#w"+curId+" .imgNos a.selected").next().attr("id");
				wId = idToSolve.substring(String(curId).length + 2);
				motAct(curId, wId);
			}
			else{
				clrInterval();	
				stInterval();
				if($("#w"+curId).next().length > 0){
					tempNext = Number($("#w"+curId).next().attr("id").substring(1));
				}
				else{
					tempNext = Number($("#works .work:first-child").attr("id").substring(1));
				}
				motAct(tempNext);
			}			
		}
		//////////////////////////////////////////////////////////////
		

