function myInit() {
	
	/*
	$("#navigation ul > li").hover( function () {		
		$("#navigation ul > li").removeClass('hover');
		$(this).addClass('hover');
		},function () {
		$(this).removeClass('hover');
		}
		);
	*/
	$("a[href^='http:']").not("[href*='houseoftwits.co.uk']").attr('target','_blank');
	
	$('#navigation ul li:has(li.selected)').addClass('selected');
	
	$('#content #gallery img').hover( function () {				
		src = $(this).attr("src");
		newsrc = src.replace("t1_","");		
		$('#content #gallery #mainImage img').attr("src",newsrc);
		},function () {		
		}
		);
	
	$("#commentForm").submit(function() {		
		$('#commentForm').attr('method','post');
		errors = '';	
		if (!$('#cf_comment').val()) {
			errors += "Comment\n";
			}
		if (!$('#cf_name').val()) {
			errors += "Name\n";
			}
		if (!$('#cf_email').val()) {
			errors += "Email\n";
			}
		if (errors) {			
			alert("The following fields are required:\n\n"+errors);
			return false;
			} 	
		});

	$('#quote_container').cycle({
		fx: 'fade',
		timeout: 5000,
		cleartypeNoBg: true 
	});
	
	$('#advert ul').cycle({
		fx: 'fade',
		timeout: 9000,
		cleartypeNoBg: true 
	});
	
	
	$("#sortable").Sortable({
		accept : "sortitem",
		axis:          "vertically",
		opacity: 		0.8,
		fx:				200,
		revert:			true,
		floats:			true,
		tolerance:		"pointer",
		onchange : function (sorted) {
			serial = $.SortSerialize("sortablePhoto");			
			//alert(serial.hash);
			/*$.ajax({
				url: "gallery_sort.php",
				type: "POST",
				data: serial.hash
				});*/
			}
		});
	
	
	
	$("#pollVoteForm").submit(function() {		
		
		var answer = $("input[name='poll']:checked").val();
		var errors = "";
		if (!answer) {
			alert("Please select from the available options");
			return false;
			}
		$.ajax({
			type: "POST",
			url: "/pollResult.php",
			data: "answer="+answer,
			success: function(returned){					
				getPollResults();
				}
			});				
		return false;	
		
	   });	
	
	
	}
	
	
	
function getPollResults() {
	
	$.ajax({
		type: "POST",
		url: "/pollResult.php",
		data: "",
		success: function(returned){					
			$('#pollVoteForm').fadeOut("fast", function() {
				$('#pollResults').html(returned).fadeIn("fast");
				});
			
			}
		});		
	}