function submitpollvote(){
	var pollval=$("input[name='pollanswer']:checked").val();
	var pollid=$("input[name='pollid']").val();
	$("#pollcontent").html("<div align='center'><br/><br/><br/><img src='/template/7/images/loading_imageonly1.gif' /></div>"); 
	showpollresults(pollid,pollval);
	theheight=$("#pollcontent").height()+50; $("#pollcontent").css("height",theheight+"px"); 
}

function showpollresults(pollid,pollval){
	$.get("/ajaxcontent/submitpollvote/"+pollid+"/"+pollval, function(data){ 
		$("#pollcontent").html(data).fadeIn("slow");
	});
}

function showhidenewsletter(){
		$(".newslettersubscribe").slideToggle(); 
}

function subscribetonewsletter(){
	var emailaddress=$(".emailinput").val();
	var emailaddress_fixed=emailaddress.replace(/@/, "-----");
	$.get("/ajaxcontent/addnewnewslettersubscriber/"+emailaddress_fixed, function(data){
		$('.emailinput').attr('disabled','disabled');
    	$("#newslettersubscriberresult").html(data).fadeIn("slow");	
		setTimeout("$('#newslettersubscriberresult').fadeOut('slow');$('.emailinput').removeAttr('value');$('.emailinput').removeAttr('disabled');",3000);
	});
}

function replytocomment(commentid,message){
	$("input[name='replycomment']").val(commentid);
	$(".replycomment").show();
	$("#replyto").html(message);	
}

function cancelreply(){
	$("#replyto").html("");	
	$(".replycomment").hide();
	$("input[name='replycomment']").removeAttr('value');
}

function editcomment(commentid){
	$("input[name='modifycomment']").val(commentid);
	$(".modifycommentmessage").show();
	thecomment=$("#"+commentid+"comment").html();	
	thecomment=thecomment.replace(/<p>/gi,"\n");
	thecomment=thecomment.replace(/<\/p>/gi,"");
	$("textarea[name='addcomment']").val(thecomment);
}

function cancelmodify(){
	$(".modifycommentmessage").hide();
	$("input[name='modifycomment']").removeAttr('value');
	$("textarea[name='addcomment']").removeAttr('value');
}

function featuredstories(){
	stepcarousel.setup({
		galleryid: 'featuredcontent', //id of carousel DIV
		beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
		panelclass: 'featureditem', //class of panel DIVs each holding content
		autostep: {enable:true, moveby:1, pause:3000},
		panelbehavior: {speed:500, wraparound:false, persist:true},
		defaultbuttons: {enable: true, moveby: 1, leftnav: ['/template/7/images/featured_leftarrow.jpg', -16, 80], rightnav: ['/template/7/images/featured_rightarrow.jpg', 2, 80]},
		statusvars: ['statusA', 'statusB', 'statusC'], //register 3 variables that contain current panel (start), current panel (last), and total panels
		contenttype: ['inline'] //content setting ['inline'] or ['external', 'path_to_external_file']
	});
}

function WinOpen(page,windowname,horz,vert) { OpenWin = window.open(page,windowname,'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=0,width=' + horz + ',height=' + vert ); }

function checkemailafriendform(errormessage){
	if($("#fromName").val() == "" || $("#to").val() == "" || $("#fromEmail").val() == ""){
		window.alert(errormessage);	
		return false;
	}
}

function showcommentrules(){
    $("#commentrules").html("<div style='text-align:center;'><br/><br/><br/><br/><img src='/template/7/images/loading_imageonly1.gif' /></div>").slideDown();	
	$.get("/ajaxcontent/getcommentrules", function(data){
    	$("#commentrules").html(data);	
	});
	
}