/* custom javascript added by Behnam kashani */

//START DOCUMENT READY
 $(document).ready(function() {
 // For Animating top Menu  
 $("#top-menu").animate({ 
    marginTop: "-47px"
  }, 1000 );
	$("#top-menu a").delay(1000).fadeIn(500);
	$("#top-menu").delay(500).queue(function(next){
    $(this).addClass("top-menu-zindex");
    next();
});	
// for tabular wedget 	
	$(".Main-tab-container:first").show();

// For hover in projects 
$(function() {
	$('.project-holder a').hover(
		function() {
			$(this).stop().animate({ marginTop: "-5px", opacity: 1 });
		},
		function() {
			$(this).stop().animate({ marginTop: "0px", opacity: 0.8 });
		}
	);
	});

// For hover in Home Object
$(function() {
	$('.wooden-shild a').hover(
		function() {
			$(this).stop().delay(300).animate({opacity: 0.8 });
		},
		function() {
			$(this).stop().delay(300).animate({opacity: 1 });
		}
	);
});

 // for coffe steam 

/*  $(function() {
  var timer = setInterval( showDiv, 1000);
 var counter = 0;
  function showDiv() {
  if (counter ==0) { counter++; return; }  
   $('div','#steam-holder')
     .stop()
     .fadeOut()
	 .css({bottom:'27px'})
     .filter( function() { return this.id.match('div' + counter); })
	  .animate({ bottom: '37px'},2000)
	  .fadeIn(800);
    counter == 2? counter = 0 : counter++; 
  }
 });
 */ 
// For clock animate
  setInterval( function() {
  var seconds = new Date().getSeconds();
  var sdegree = seconds * 6;
  var srotate = "rotate(" + sdegree + "deg)";
  
  $("#sec").css({"-moz-transform" : srotate, "-webkit-transform" : srotate});
	  
  }, 1000 );
  
  setInterval( function() {
  var hours = new Date().getHours();
  var mins = new Date().getMinutes();
  var hdegree = hours * 30 + (mins / 2);
  var hrotate = "rotate(" + hdegree + "deg)";
  
  $("#hour").css({"-moz-transform" : hrotate, "-webkit-transform" : hrotate});
	  
  }, 1000 );

  setInterval( function() {
  var mins = new Date().getMinutes();
  var mdegree = mins * 6;
  var mrotate = "rotate(" + mdegree + "deg)";
  
  $("#min").css({"-moz-transform" : mrotate, "-webkit-transform" : mrotate});
	  
  }, 1000 );
// for custom right click 
	$('#menu').click(function() {
		$('#menu').hide();
	});
	$(document).click(function() {
		$('#menu').hide();
	});
 
// function for tabular wedget 	
$("#top-menu a:first").click(function() {
	$(".Main-tab-container").hide();
	$(".Main-tab-container:first").fadeIn(1000);
});
$("#top-menu a:eq(1), .wooden-shild .cup").click(function() {
	$(".Main-tab-container").hide();
	$(".Main-tab-container:eq(1)").fadeIn(1000);
});
$("#top-menu a:eq(2), .wooden-shild .plant").click(function() {
	$(".Main-tab-container").hide();
	$(".Main-tab-container:eq(2)").slideDown(1500);
});
$("#top-menu a:eq(3), .wooden-shild .phone").click(function() {
	$(".Main-tab-container").hide();
	$(".Main-tab-container:eq(3)").show(1000);
});

$("#top-menu a").click(function() {
	$("#top-menu a").removeClass("active");
	$(this).addClass("active");
});

// For set home object page 
$(".wooden-shild .plant").click(function() {
	$("#top-menu a").removeClass("active");
	$("#top-menu a:eq(2)").addClass("active");
});
$(".wooden-shild .cup").click(function() {
	$("#top-menu a").removeClass("active");
	$("#top-menu a:eq(1)").addClass("active");
});
$(".wooden-shild .phone").click(function() {
	$("#top-menu a").removeClass("active");
	$("#top-menu a:eq(3)").addClass("active");
});

});////////////Document ready

// for set tooltip on object
$(function(){
    $(".wooden-shild a.cup, .wooden-shild a.phone").tipTip({edgeOffset: 10});
});
$(function(){
    $(".wooden-shild a.plant").tipTip({edgeOffset: 0, defaultPosition: "left"});
});

