$(function() {
	$('#search_box').autocomplete(allseries ,{
		scroll: false,
		matchContains: 'word',
		limit: 20
	}).result(function(e,d,f){
		window.location = d[1]; // the actual url
	});
	
	$('#header-search-box,#search-sidebar').parent().formHints();

	// resend email
	$('#resend-mail-link').click(function()
	{
		var l = $(this);
		
		$.get(this.href+'&ajax=1',function(data)
		{
			if (data == 'ok')
			{
				// @todo: should validate here
			}
			
			l.replaceWith('Sent');
		});
		
		return false;
	});
	
	var save_cookie = function() {
		var cookie = '';
		$('.close-notice img').parents('.gn').each(function(){
			if (!$(this).is(':visible'))
				cookie += this.id.substr(4) + '|';
		});
		
		$.cookie('notices', cookie, {
			path: '/',
			expires: 365
		});
	}
	
	// global notice
	$('.close-notice img').click(function(){
		var n = $(this).parents('.gn').eq(0);
		
		n.slideUp(function(){
			save_cookie();
		});
	});
});


/***********************************************
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

/* Modified to support Opera */
function bookmarksite(title,url){
	if (window.sidebar) // firefox
		window.sidebar.addPanel(title, url, "");
	else if(window.opera && window.print){ // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	} 
	else if(document.all)// ie
		window.external.AddFavorite(url, title);
}