$(document).ready(function() 
{
	init();
});
function init()
{
	//Cufon.replace('span.nr,#navigation a', {hover: true});

	$('#breadcrumbs li a:gt(0)').before(' &raquo; ');
	$('#navigation li:first').addClass('first');
	$('a[rel=external]').attr('target', '_blank');

	$('.slider li').each(function(){
		if ( $(this).find('a').attr('href') )
		{
			$(this).css('cursor', 'pointer');
			$(this).click(function(){
				window.location=$(this).find('a').attr('href');return false;
			});
		}
	});
	
	$('#navigation li').hover(function(){
		$(this).addClass('hover');
	}, function() {
		$(this).removeClass('hover');
	});
	$('input[type=image]').hover(function(){
		$(this).attr('src', $(this).attr('src').replace('submit\.', 'submit\.hover\.') );
	}, function() {
		$(this).attr('src', $(this).attr('src').replace('submit\.hover\.', 'submit\.') );
	});
	
	if ( $('.slider').length > 0 )
	{
		$('.slider').each(function()
		{
			var sId	= $(this).attr('id');
			$('#' + sId).before('<div class="slidenav" id="nav' + sId + '"></div>').cycle({
				fx: 'fade',
				timeout: 5000,
				pager:  '#nav' + sId,
				pagerEvent: 'mouseover',
				pause: 1
			});
			$('.' + sId + ' ul a').each(function(i)
			{
				$('#nav' + sId + ' a').eq(i).html( $(this).attr('title') );
				$('#nav' + sId + ' a').eq(i).click(function(){
					window.location=$(this).attr('href');return false;
				});
				$('#nav' + sId + ' a').eq(i).attr('href', $(this).attr('href') );
				$(this).attr('title', '');
			});
		});
	}

	$('#partners').cycle({
		fx: 'fade',
		timeout: 5000,
		pause: 1
	});
	
	$('input[type=text]').each( function() {
		if ( $(this).attr('title') != '' )
		{
			var sTitle	= $(this).attr('title') + '...';
			if ( $(this).val() == '' )
				$(this).val( sTitle );

			$(this).focus(function () {
				if ( $(this).val() == sTitle )
					$(this).val('');
			});
			$(this).blur(function () {
				if ( $(this).val() == '' )
					$(this).val(sTitle);
			});
		}
	});
};
