// On Pageload

$(document).ready(function(){
	
	// Hero slideshow
	
	$("#hero").cycle({
		fx:			"fade",
		speed:		"slow",
		timeout:	"6000"
	});
	
	// Navigation Dropdown
	
	$("#navigation li").hover(
		function () {
		$(this).children("ul").show();
	}, 
		function () {
		$(this).children("ul").hide();
		}
	);
		
		$("#navigation li.products").hover(
			function () {
			$(this).addClass("hoveringProducts");
		}, 
			function () {
			$(this).removeClass("hoveringProducts");
			}
		);
		
		$("#navigation li.company").hover(
			function () {
			$(this).addClass("hoveringCompany");
		}, 
			function () {
			$(this).removeClass("hoveringCompany");
			}
		);
		
		$("#navigation li.support").hover(
			function () {
			$(this).addClass("hoveringSupport");
		}, 
			function () {
			$(this).removeClass("hoveringSupport");
			}
		);
		
		$("#navigation li.clients").hover(
			function () {
			$(this).addClass("hoveringClients");
		}, 
			function () {
			$(this).removeClass("hoveringClients");
			}
		);
		
		$("#navigation li.resources").hover(
			function () {
			$(this).addClass("hoveringResources");
		}, 
			function () {
			$(this).removeClass("hoveringResources");
			}
		);
		
		
		$("ul.screenshots").each(function(){
		  var rell = "dd"+Math.floor(Math.random()*9999);
		  var fancyboxes = $(this).find("a.fancybox");
		  fancyboxes.attr("rel",rell).fancybox();
		  if(fancyboxes.size()>1){
		      var text = "View full-size screenshots";
		  }
		  else{
		      var text = "View full-size screenshot";
		  }
		  
    		  $('<div class="screenshotsMore"><a href="#">'+text+'</a></div>').insertAfter($(this)).find("a").click(function(){
    		      fancyboxes.eq(0).click();
    		      return false;
    		  });
		});
		
		//$("a.fancybox").fancybox();
		
		$('<div id="handheldshim"></div>').appendTo($("body"));
		
		if($("#handheldshim").width()==50){
		  $("link[rel='stylesheet']").remove();
		}
	
});



















