	function sendRequest() {
	 	var firstname	= $('#q-first-name').val();
	 	var lastname	= $('#q-last-name').val();
	 	var email		= $('#q-email').val();
	 	var question	= $('#q-question').val();
	 	var optin = $('#q-opt-in').attr('checked')?1:0;

	 	$.post( "/wp-content/themes/woolworthshq/php/send.php", { firstname: firstname, lastname: lastname, email: email, question: question, optin: optin },
			function(html){
				showResponse(html);
		});
	}
	
	function showResponse(req) {
		$('#response-holder').html(req);

		if (req.indexOf('valid-response') != -1) {
			$('#q-first-name').value = '';
			$('#q-last-name').value = '';
			$('#q-email').value = '';
			$('#q-question').value = '';
		}
	}
	
	function getStatuses(){
		$.PeriodicalUpdater({
	      url : '/wp-content/themes/woolworthshq/php/status.php',
	      method : 'POST',
	      minTimeout : 30000
	   },
	   function(data){
	      $('#tweet').html(data);
	   });
	}
	
	function getStatusesIndex(){
		$.PeriodicalUpdater({
	      url : '/wp-content/themes/woolworthshq/php/status.php?from=index',
	      method : 'POST',
	      minTimeout : 30000
	   },
	   function(data){
	      $('#tweet').html(data);
	   });
	}
	
	function hideNode(classname, node) {
   		if(!node) node = document.getElementsByTagName("body")[0];
   		var a = [];
   		var re = new RegExp('\\b' + classname + '\\b');
   		var els = node.getElementsByTagName("*");
   
      	for(var i=0,j=els.length; i<j; i++)
   			if(re.test(els[i].className))els[i].style.display="none";	     		
  	 }
	 
	 function toggleQandA(id){
	 	answerNode = $('#'+id+'-a');
		questionNode = $('#'+id+'-q');
			
		answerNode.toggle();
		questionNode.toggleClass('exp');
   		questionNode.toggleClass('col');
	 }
	
	function flashWooliesClick(){
	 	pageTracker._trackPageview('/outbound/http://www.woolworths.co.uk');
	 	window.location = "http://www.woolworths.co.uk";
	 }
	 
	 function flashWooliesFavoritesClick(url){
	 	pageTracker._trackPageview('/outbound/http://www.woolworths.co.uk/favorites');
	 	window.location = url;
	 }
	 
	 
	 /* stu */
	$(function(){
	     $('.thumbnail').hover(
	     
	          function(){
	          	$('div#fade_in').show();
	               var $img = $(this);
	               		$img.fadeOut(600, function(){
	                    var src = $img.attr("src");
	                    $img.attr("src", src.replace('_OFF','_ON'));
	                   // $img.fadeIn('slow');
	                   //$('div#image_holder').hide();
	                   //$('div.fade_in').show();
	               })
	          }
	   );
	}); 
	
	//Slide Show script (this notice must stay intact)
	//For this and more scripts
	//visit java-scripts.net or http://wsabstract.com
	
	if (document.images) {
	     button1 = new Image
	     button2 = new Image
	
	     button1.src = 'img1.gif'
	     button2.src = 'img2.gif'
	 }
	
	var BrowserDetect = {
		init: function () {
			this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
			this.version = this.searchVersion(navigator.userAgent)
				|| this.searchVersion(navigator.appVersion)
				|| "an unknown version";
			this.OS = this.searchString(this.dataOS) || "an unknown OS";
		},
		searchString: function (data) {
			for (var i=0;i<data.length;i++)	{
				var dataString = data[i].string;
				var dataProp = data[i].prop;
				this.versionSearchString = data[i].versionSearch || data[i].identity;
				if (dataString) {
					if (dataString.indexOf(data[i].subString) != -1)
						return data[i].identity;
				}
				else if (dataProp)
					return data[i].identity;
			}
		},
		searchVersion: function (dataString) {
			var index = dataString.indexOf(this.versionSearchString);
			if (index == -1) return;
			return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
		},
		dataBrowser: [
			{
				string: navigator.userAgent,
				subString: "Chrome",
				identity: "Chrome"
			},
			{ 	string: navigator.userAgent,
				subString: "OmniWeb",
				versionSearch: "OmniWeb/",
				identity: "OmniWeb"
			},
			{
				string: navigator.vendor,
				subString: "Apple",
				identity: "Safari",
				versionSearch: "Version"
			},
			{
				prop: window.opera,
				identity: "Opera"
			},
			{
				string: navigator.vendor,
				subString: "iCab",
				identity: "iCab"
			},
			{
				string: navigator.vendor,
				subString: "KDE",
				identity: "Konqueror"
			},
			{
				string: navigator.userAgent,
				subString: "Firefox",
				identity: "Firefox"
			},
			{
				string: navigator.vendor,
				subString: "Camino",
				identity: "Camino"
			},
			{		// for newer Netscapes (6+)
				string: navigator.userAgent,
				subString: "Netscape",
				identity: "Netscape"
			},
			{
				string: navigator.userAgent,
				subString: "MSIE",
				identity: "Explorer",
				versionSearch: "MSIE"
			},
			{
				string: navigator.userAgent,
				subString: "Gecko",
				identity: "Mozilla",
				versionSearch: "rv"
			},
			{ 		// for older Netscapes (4-)
				string: navigator.userAgent,
				subString: "Mozilla",
				identity: "Netscape",
				versionSearch: "Mozilla"
			}
		],
		dataOS : [
			{
				string: navigator.platform,
				subString: "Win",
				identity: "Windows"
			},
			{
				string: navigator.platform,
				subString: "Mac",
				identity: "Mac"
			},
			{
				   string: navigator.userAgent,
				   subString: "iPhone",
				   identity: "iPhone/iPod"
		    },
			{
				string: navigator.platform,
				subString: "Linux",
				identity: "Linux"
			}
		]
	
	};
	BrowserDetect.init();
 
	 function reviewFilm(){
	 	//grab the values of our form
	 	var id			= $('#id').val();
	 	var reaction 	= $('input[name=reaction]:checked').val(); 
	 	var shop 		= $('input[name=shop]:checked').val();
	 	var tell 		= $('input[name=tell]:checked').val();
	 	
	 	//send those values on to a script that enters them into a database
	 	$.post( "/wp-content/themes/woolworthshq/php/review-capture.php", { id: id, reaction: reaction, shop: shop, tell: tell },
			function(html){
				//html contains the response from the form. In review-capture.php we check if the data is valid or not. Notify the user by passing the response on. 
				if(html != ''){
					$('#response').html(html);
					$('#response').show();
				}else{
					$('#response').hide();
					$('#form').html('Thanks for answering the questions!');
				}
				
			}
		);		
	 }
	 
	 $(function() {  
	    // if the function argument is given to overlay, 
	    // it is assumed to be the onBeforeLoad event listener 
	    toolsApi = $("a[rel]").overlay({ 
	 
	        onBeforeLoad: function() { 
	 
	            // grab wrapper element inside content 
	            var wrap = this.getContent().find(".contentWrap"); 
	 
	            // load the page specified in the trigger 
	            wrap.load(this.getTrigger().attr("href"));
	        } 
	 
	    }); 
	});
	
	 	
	