// JavaScript Document

//jQuery start
$(document).ready(function(){
	
	// HOME
	if ((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod') != -1) || (navigator.userAgent.indexOf('iPad') != -1) || (navigator.userAgent.indexOf('Andriod') != -1))  {			
	
		// Posters
		(function() {
			var err;
			try{
				$.slideshowBoxEmbedCanvas.init({appendToID:"postersGallery",imagesXmlPath:"xml_ssb_postergallery.php?ProjectID=8",width:620, height:327, autoHideControls:"false",autoSlideShow:"true",backgroundVisible:"true",loadOriginalImages:"false",slideShowSpeed:"6",backgroundColor:"#1C1C1C",backgroundImage:"",scaleBackground:"false",controlBarAlpha:"0.8",controlBarPrimaryColor:"#333333",controlBarSecondaryColor:"#FFFFFF",navigationControls:"true",slideShowControls:"false",fullScreenButton:"false",controlsHideSpeed:"2",showImageInfos:"false",showImageIndex:"true",scaleMode:"scaleCrop"});
			}catch(err){}
		})();		
		
		// thumbs
		$(".thumbsScrollable").scrollable({circular: true, mousewheel: true, speed: 600}).autoscroll({interval: 6000});		
	
	} else {				
			
		// posters
		$("#postersGallery").flashembed("http://www.actproductions.co.uk/flash/home-wide5.swf");
		
		//thumbs
		$("#thumbsGallery").flashembed("http://www.actproductions.co.uk/flash/thumbs-wide.swf");			

	};	
				

	// Projects
	//$(".scrollable").scrollable({circular: true, mousewheel: true}).navigator().autoscroll({ interval: 6000	});
	
    $("a#archiveToggle").click(function () {
      $("#theArchive").animate({
                height: "toggle",
                opacity:"toggle"
              }, 400); 
	  $("#up").toggle(400);
	  $("#down").toggle(400);	  
    });
	
	$("a[rel]").overlay({
							 
	// some mask tweaks suitable for modal dialogs
	mask: {
		color: '#fff',
		loadSpeed: 100,
		opacity: 0.3
	}
	
	});
	
	// News	
	$("a[title]").click( function(){							 
		
		$target = $(this).attr("title");
		$("#newsBody", $target).slideToggle(300);
		$("#newsReadMore", $target).toggle(300);	
		$("#newsReadLess", $target).toggle(300);				
		
	});	
	
	$("img[rel]").click( function(){							 
		
		$target = $(this).attr("rel");		
		$("#newsBody", $target).slideToggle(300);
		$("#newsReadMore", $target).toggle(300);	
		$("#newsReadLess", $target).toggle(300);				
		
	});	
	
	/* Form styling
	/* ------------------------------------------------------------------*/		
    $('input[type="text"]').addClass("idleField");
	$('input[type="text"]').focus(function() {
		$(this).removeClass("idleField").addClass("focusField");
    });
    $('input[type="text"]').blur(function() {
    	$(this).removeClass("focusField").addClass("idleField");
    });
	
    $('textarea').addClass("idleField");
	$('textarea').focus(function() {
		$(this).removeClass("idleField").addClass("focusField");
    });
    $('textarea').blur(function() {
    	$(this).removeClass("focusField").addClass("idleField");
    });			
	
    $('input[type="password"]').addClass("idleField");
	$('input[type="password"]').focus(function() {
		$(this).removeClass("idleField").addClass("focusField");
    });
    $('input[type="password"]').blur(function() {
    	$(this).removeClass("focusField").addClass("idleField");
    });		
				

// End jQuery
});
