﻿$(document).ready(function() {
	
	equalHeight($(".homePage"));
	
	$('#ProjectSlideShow').after('<div id="project-nav">')
		.cycle({
			fx:      'scrollLeft',
			speed:    500,
			timeout:  6000,
			pager:  '#project-nav'
		});
	$('#pauseButton').click(function() {
		
		$("#pauseButton").toggleClass('pause');
		
		if( $("#pauseButton").is('.pause') ) {
			$('#ProjectSlideShow').cycle('pause');
		}
		else {
			$('#ProjectSlideShow').cycle('resume');
		}
	});
	
	$("a.switch_thumb").toggle(function(){
	  $(this).addClass("swap"); 
	  $("ul.display").fadeOut("fast", function() {
		$(this).fadeIn("fast").addClass("thumb_view"); 
		 });
	  }, function () {
	  $(this).removeClass("swap");
	  $("ul.display").fadeOut("fast", function() {
		$(this).fadeIn("fast").removeClass("thumb_view");
		});
	});
	
	$("ul.box li a.visible").each(
		function() {
			$(this).hover(
				function() { $(this).fadeTo(320, 0) },
				function() { $(this).fadeTo(320, 1) }
			);
		}
	);
	$("A[rel='external']").attr('target','_blank');
});

function MenuAccord(item_toggle){
	item_toggle = '#'+ item_toggle;
	$(item_toggle).slideToggle();
}

var url = "http://www.spacesheep.net"; 
var title = "Spacesheep - Tasarım ve yazılım stüdyosu"; 
var userLang = (navigator.userLanguage ) ? navigator.userLanguage : navigator.language;
//alert ("The language is: " + userLang);

function addToFavorites() { 
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
} 
function equalHeight(group) {
	tallest = 0;
	group.each(function() {
		thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
}

