//*********************** Text replacement **************************//	
Cufon.replace('#nav li a.main');
Cufon.replace('h1', {
	textShadow: '#999 -1px -1px, #333 1px 1px'
});
Cufon.replace('#main_content h2');
Cufon.replace('#main_content h3');
Cufon.replace('.slide_msg h3');
Cufon.replace('#notification strong', { fontFamily: 'Century Gothic', fontWeight: '400' });

// Start Jquery goodness //
$(document).ready(function() {
	
	jQuery('#list1c').accordion({
		autoheight: false

	});

//*********************** Special CSS classes **************************//

$("#comments .comment:odd").addClass("odd");
$("table tr:odd").addClass("odd");
$("#location_block .location_option:odd").addClass("odd");

//*********************** Location form **************************//	
$('#location_block').hide();

$('#change_location').click(function() {
  $('#location_block').toggle('fast');
  $(this).text($(this).text() == 'Change' ? 'Close' : 'Change');
});

//*********************** Login form **************************//
$('#loginForm_div').hide();

$('#login_but').click(function() {
  $('#loginForm_div').show();
  $('#username').focus();
});

$('#loginForm_div .close').click(function() {
	$('#loginForm_div').hide();
});


//*********************** Topnav **************************//
$("#nav li .sub").css('visibility', 'hidden');
$("#nav li").hover(function(){

	$(this).addClass("hover");
	$('.sub:first',this).css('visibility', 'visible');
	
	}, function(){
	
	$(this).removeClass("hover");
	$('.sub:first',this).css('visibility', 'hidden');

});

//*********************** Notification **************************//	
	$('.close_notice').click(function() {
	  $('#notification').hide('fast');
});


//*********************** Search text **************************//	
	autoFill($("#search_field"), "Enter Keyword(s)");

//*********************** Rounded corners **************************//	

	$("#home_container a.capsule").corner("7px");
	$(".comment").corner("7px");
	$("#loginForm_div").corner("7px");	
	$("#poll_block").corner("7px");	
	$("#denybox").corner("7px");
	$("#shareblock").corner("7px");
		
	$("#nav li a.main").corner("7px");		
	if ($("#nav li[class=active]")) { // check for active state
	$("#nav li.active a.main").uncorner();	  
    $("#nav li.active a.main").corner("top");
};

//*********************** Comments **************************//	

	$("#replyform").hide();
	$("#reply_trigger").click(function() {
	$('#replyform').slideToggle(400);
	$(this).text($(this).text() == 'Post a reply' ? 'Hide reply box' : 'Post a reply');
	$(this).toggleClass("reveal_up");
	return false;
});

//*********************** hover for input elements **************************//	
$("input.capsule, input.capsule_long, .search_b").hover(
  function () {
    $(this).css('color','#A8E1F4');
  },
  function () {
    $(this).css('color','#fff');
  }
);

//*********************** select box **************************//	
        $("#news_release_feed_select, #news_release_group_select").change(function(e) {
            window.location.href = $(this).val();
        });
	
//*********************** Bookmark and email etc **************************//	

        $(".email-link").click(function() {
           window.location = "mailto:"+"?subject=Daily Mail and General Trust" + "&body=" + "I thought this link might interest you: " + document.title + ", which is available at the following address, " + document.location;
        	return false;
        });    
                  
        $(".print-link").click(function() {
         window.print();
         return false;
        });  
        
        $(".bookmark-link").click(function() {
                var url = document.location;
				var title = document.title; 
				if (window.sidebar) 
					{
					// Mozilla						
					window.sidebar.addPanel(title, url,"");						
					} else if( window.external ) 
					{
					// IE Favorite
					window.external.AddFavorite( url, title);
					}
					else if(window.opera && window.print) 
					{
					// Opera
					}
			return false;
        });  
        return false;   
    });





