if(!window.console)
{
	window.console = function(msg)
	{}
}

/**
* Handles default field text
*/
;(function($)
{
	$.fn.lineDefaultFieldText = function(options)
	{
		var defaults = {
            textSrc: 'legend', //forces field to take text from fieldset legend rather than title attribute or specified text
            text: false,
            defaultClass: 'default'
        };

        var options = $.extend({}, defaults, options);

        return this.each(function()
        {
        	
			var _this = $(this);
			
			switch(options.textSrc)
			{
				case 'legend':
					var el = _this.parentsUntil('form').last();
					var text = el.find('legend').text();
					break;
					
				case 'label':
				
					var _l = $('label[for=' + _this.attr('id') + ']');
					
					/* check for a match on for attribute first */
					if(_l.length)
					{
						var text = _l.text();
					}
					else // check against parent element
					{
						var el = _this.parent().is('label')
							? _this.parent()
							: _this.parent().find('label');

						var text = el.text();
					}
					break;
					
				case 'custom':
					var el = false;
					var text = options.text.toString();
					break;
					
			}
			
			if(_this.val() == '')
			{
				_this.val(text);
				_this.addClass(options.defaultClass);
			}
			
			_this.focus(function()
			{
				if(_this.val() == text)
				{
					_this.val('');
					_this.removeClass(options.defaultClass);
				}
			})
			.blur(function()
			{
				if(_this.val() == '')
				{
					_this.val(text);
					_this.addClass(options.defaultClass);
				}
			});
        });
	}
})
(jQuery);

$(function()
{
	/* write out email address */
	$('.mail').html('<'+'a'+' '+'h'+'r'+'e'+'f'+'='+"'"+'&'+'#'+'1'+'0'+'9'+';'+'a'+'i'+'&'+'#'+'1'+'0'+'8'+';'+'t'+'o'+'&'+'#'+'5'+'8'+';'+'h'+'%'+'&'+'#'+'5'+'4'+';'+'&'+'#'+'5'+'3'+';'+'&'+'#'+'3'+'7'+';'+'6'+'C'+'l'+'o'+'&'+'#'+'6'+'4'+';'+'%'+'&'+'#'+'5'+'4'+';'+'C'+'&'+'#'+'1'+'0'+'5'+';'+'n'+'%'+'6'+'5'+'&'+'#'+'4'+'6'+';'+'u'+'&'+'#'+'1'+'0'+'7'+';'+'&'+'#'+'4'+'6'+';'+'&'+'#'+'3'+'7'+';'+'6'+'&'+'#'+'5'+'1'+';'+'o'+'m'+"'"+'>'+'h'+'e'+'&'+'#'+'1'+'0'+'8'+';'+'l'+'o'+'&'+'#'+'6'+'4'+';'+'&'+'#'+'1'+'0'+'8'+';'+'&'+'#'+'1'+'0'+'5'+';'+'n'+'e'+'&'+'#'+'4'+'6'+';'+'u'+'k'+'&'+'#'+'4'+'6'+';'+'c'+'o'+'m'+'<'+'/'+'a'+'>');
});

$(function()
{
	$('#clients .inner').find('ul').remove();
	
	for(i=0;i<5;i++)
	{
		$('<ul />')
			.css({ backgroundPosition: '0 -' + (i * 76) + 'px' })
			.appendTo('#clients .inner');
	}
	
	//$('#clients .inner').find('ul').hide();
	$('#clients .inner ul').not($('#clients .inner ul:first')).hide();

	
	
	function rotate()
	{
		setTimeout(function()
		{
			$('#clients ul').not(':hidden').fadeOut(300, function()
			{
				if($(this).next().length)
				{
					$(this).next().fadeIn(300, rotate);
				}
				else
				{
					$('#clients ul:first').fadeIn(300, rotate);
				}
			});
		}, 4000);
	}

	rotate();
});

(function($)
{
	$(document).ready(function()
	{
		$('a').each(function()
		{
			var _a = $(this);

			if(_a.attr('href') != '' && _a.attr('href') != '#')
			{
				_a.click(function(e)
				{
					e.preventDefault();

					window.open(_a.attr('href'));
					return false;
				});
			}
		});
	});
})
(jQuery);
