﻿/*
 *	Client: Mert Gutav Portfolio
 *	Client Site: www.mertgutav.com
 *******************************************************************************************	
 *	Author/Developer: Oğuzcan Şahin
 *	Author/Developer web site: www.oguzcan.org
 *	Javascript Framework: jQuery 1.3.2
 *	Generated: 08.08.2009
 *******************************************************************************************
 */
  
   $(document).ready(function(){
   
      /*.easyslider
      $("div.portfoyImg").easySlider({
         prevId: "prevBtn",
         nextId: "nextBtn",	
         speed:       800,
         auto:        false,
         pause:	      2000,
         continuous:  true
      });/*.easyslider*/
      	var controller = ".projectBottom .controller a"
 		$(controller).bind("click",function(){
			var _index = $(this).parents(".project").find(controller).index(this);
			$(this).parent().children("A").removeClass("active");
			$(this).addClass("active");
			//alert($(this).attr("role"))
			if($(this).attr("role")){
				$(this).parent().parent().find(".prRole").text($(this).attr("role"))
			}
			if($(this).attr("agency")){
				$(this).parent().parent().find(".prAgency").text($(this).attr("agency"))
			}
			$(this).parents(".project").find(".portfoyImg img").each(function(){
				if($(this).attr("longdesc")){
					$(this).attr("src",$(this).attr("longdesc"));
					$(this).removeAttr("longdesc");
				}				
			})
			
			$(this).parents(".projectBottom").prev().children().children(".portfoyImg").stop().animate({
				marginLeft:"-"+parseInt(_index * 944)+"px"															 
			},1000);
			return false;
		})
      $(".projectBottom").each(function(){
      	//alert($(this).find(".controller a").length)
      	if($(this).find(".controller a").length < 2){
      		$(this).children(".controller").hide();
      	}
      })
      /*scroll*/
      $(function(){
         var isResizing;
         var setContainerHeight = function()
      {
         if (!isResizing) { 
         isResizing = true;
         $w = $(window);
         $c = $("#outDiv");
         var p = (parseInt($c.css('paddingLeft')) || 0) + (parseInt($c.css('paddingRight')) || 0);
         $("body>.jScrollPaneContainer").css({"height": $w.height() + "px", "width": $w.width() + "px"});
         $c.css({"height": ($w.height()-p) + "px", "width": ($w.width() - p) + "px", "overflow":"auto"});
         $c.jScrollPane({scrollbarWidth:25, animateTo:true});
         isResizing = false;	
      }
         }
         setContainerHeight();
         setContainerHeight();
         $(window).load( function(){
            setContainerHeight();
            setContainerHeight();
         });
         $(window).resize( function(){
            setContainerHeight();
            setContainerHeight();
         });
      });
      
      /*top page*/
      $(".top").click(function(){
         $('#outDiv')[0].scrollTo(0);
         return false;
      });

   }); /*document.ready*/
