// simple jQuery code for Proudfoot pages, just to handle menu buttons
// proudfoot01js.js		12 Mar 10	from nobrow02js.js 3feb10 
// proudfoot02js.js     25 Mar 10   simplified (no hometitle or footer positioning)
//									     (see oldversions/10mar24 for previous version)
// proudfootjs.js		10 Apr 10	modified for Wordpress
//						11 Jan 12	new orange buttons

// global variables


// *************** to handle menu buttons **********************************

$(document).ready(function() {
		
		// Preload all rollovers
		$("#menudiv img").each(function() {
			// Set the original src
			rollsrc = $(this).attr("src");
			rollON = rollsrc.replace('_up', '_over');
			newImg = new Image(); // create new image obj
			$(newImg).attr("src", rollON); // set new obj's src, ie cache it
			rollDown = rollsrc.replace('_up', '_down');
			downImg = new Image(); // create new image obj
			$(downImg).attr("src", rollDown); // set new obj's src, ie cache it
		});

		
		// Navigation rollovers
		$("#menudiv a").mouseover(function(){
			imgsrc = $(this).children("img").attr("src");
			if (typeof(imgsrc) != 'undefined') {
				imgsrcOVER = imgsrc.replace('_up', '_over');
				$(this).children("img").attr("src", imgsrcOVER);
			}
		});
		
		// on mouse down
		$("#menudiv a").mousedown(function(){
			if (typeof(imgsrc) != 'undefined') {
				imgsrcDOWN = imgsrc.replace('_up', '_down');
				$(this).children("img").attr("src", imgsrcDOWN);
			}
		});
		
		
		// Handle mouseout
		$("#menudiv a").mouseout(function(){
			if (typeof(imgsrc) != 'undefined') {
				$(this).children("img").attr("src", imgsrc);
			}
		});
		
});

// *************** on home page : film rollover actions **********************************
// 				reduce opacity to 90% ( and get film title for this row/col - no, removed 24mar10)
// using index inside <table class="hometable">...
$(document).ready(function() {

		$(".hometable td").hover(function(){
				// reduce opacity of img by 10% (opacity for FF, filter for IE)
				$(this).css('opacity', 0.8);
				// get row and col of hovered item.	not reqd  24 mar 10				   
				//var col = $(this).parent().children().index($(this));
				//var row = $(this).parent().parent().children().index($(this).parent());
				//var myTitle = homelist[ row * 3 + col];
				//$('.home2title').text(myTitle);
			}, function() {
				$(this).css('opacity', 1.0);
				//$('.home2title').text(" ");
		});
		
});



// *************** to ensure grey container extends to bottom of page on short pages **********************************
// .container (which is the inner grey bkgd) does not extend with size of text etc (because next inner is absiolute?)
// so - fix size in css (to ensure default bkgd colour)
// 		and then extend size here to cover content (outerdiv)
//		also extend to bottom of screen if container is shorter (design reqmt)
// have to do it on 'load' not 'ready' so that eg. text on film page etc is fully loaded (ie ht known)

// and on blog page, make bkgd white (No, 11may10, do it in css (.containerblog) because jquery is too slow)

$(window).load( function() {						   
		
		var windowHt = 0;
		var outerdivHt = 0;
		
		windowHt = $(window).height() ;
		outerdivHt = $('#outerdiv').height() ;
		if (windowHt > $('#outerdiv').height() ) {
			outerdivHt = windowHt;
		}
		//$('.container').height(outerdivHt + 50);
		// on normal pages the div is .container, on blog page it's .containerblog
		if (isNaN(parseInt($('#blogdiv').css('top')))) {
			$('.container').height(outerdivHt + 50);
		} else {
			$('.containerblog').height(outerdivHt + 50);
			//$('.container').css("background-color", "white"); // 11may10,no need cos containerblog is white
		}
});

// *********************** to stripe the Things we know, on blog page ********************
$(document).ready(function() {
	$('.blogsidestriped li:odd').addClass('stripe');						   					  
});





