$(document).ready(
		function(){
			
			var elms;
			
			elms = $('#newsletter_form input[@type=text], #directions_form input[@type=text]');
			if (elms.length > 0)
			{
				elms.each(
					function()
					{
						

						// hack to shorten text
						switch (this.value)
						{
							case 'Enter your First Name':
								this.value = 'Enter your name';
								break;

							case 'Enter your Email address':
								this.value = 'Enter your email';
								break;							
							
							default:
						}
						
						var text_default_value = this.value;
			
						var _this = $(this);
						_this.focus(
							function()
							{
								if (this.value == text_default_value)
									this.value = '';
							}
						);
						
						_this.blur(
							function()
							{
								if (this.value == '')
								{
									this.value = text_default_value;
								}
							}
						);
					}
				);
				
			}
				
			if ($.tabs)
			{
				var testimonial_count = $('#container > .tabs-container').length;
				var testimonial_pick = Math.floor(1 + testimonial_count * Math.random());
				$('#container').tabs(testimonial_pick, { fxFade: true });

				setTimeout(function()
					{
						$('#container').triggerTab(testimonial_pick);
					}, 2000);
				var tab_count = $('#services-container > .services-tabs > li').length;
				
				$('#services-container').tabs(Math.floor(1 + tab_count * Math.random()),{ fxFade: true });
				
				//$('#services-container > li').length;
				
				
				if ( ! window._services_container_interval )
				{
					window._services_container_interval = setInterval(
						function()
						{
							var tab_count = $('#services-container > .services-tabs > li').length;
							var current_tab = $('#services-container').activeTab();
							
							current_tab++;
							
							if (current_tab > tab_count) current_tab = 1;
							
							$('#services-container').triggerTab(current_tab);
						}, 5000);
				}
				
			}
			
			/*$('#services').innerfade({
				animationtype: 'fade',
				speed: 2000,
				timeout: 5000,
				type: 'sequence',
				containerheight: '122px'
			})*/;
			
			$('#brands').innerfade({
				speed: 2000,
				timeout: 8000,
				type: 'sequence',
				containerheight: '292px'
			});

			// IE6 hover fix
			if ($.browser.msie && ($('#ie6').length > 0))
			{
				$('#nav a').html( "<img src='http://static.darganfinancial.com.au/images/common/spacer.gif' width='100' height='50' />");
			}
			
			if(typeof sIFR == "function"){

				// This is the preferred "named argument" syntax
					sIFR.replaceElement(
						named(
							{
								sSelector:"body h1", 
								sFlashSrc:"http://static.darganfinancial.com.au/flash/avenir_65.swf", 
								sColor:"#0089ff", 
								sLinkColor:"#0089ff", 
								sBgColor:"#FFFFFF", 
								sHoverColor:"#CCCCCC", 
								nPaddingTop:0, 
								nPaddingBottom:0 
								//sFlashVars:"textalign=left&offsetTop=6"
							}
						)
					);
					
					sIFR.replaceElement(
						named(
							{
								sSelector:"body h2", 
								sFlashSrc:"http://static.darganfinancial.com.au/flash/avenir_65.swf", 
								sColor:"#0089ff", 
								sLinkColor:"#0089ff", 
								sBgColor:"#FFFFFF", 
								sHoverColor:"#CCCCCC", 
								nPaddingTop:0, 
								nPaddingBottom:0 
								//sFlashVars:"textalign=left&offsetTop=6"
							}
						)
					);
				/*
				// This is the older, ordered syntax
					sIFR.replaceElement("h5#pullquote", "vandenkeere.swf", "#000000", "#000000", "#FFFFFF", "#FFFFFF", 0, 0, 0, 0);
					sIFR.replaceElement("h2", "tradegothic.swf", "#000000", null, null, null, 0, 0, 0, 0);
					sIFR.replaceElement("h4.subhead", "tradegothic.swf", "#660000", null, null, null, 0, 0, 0, 0);
					sIFR.replaceElement("h3.sidebox","tradegothic.swf","#000000", "#000000", "#DCDCDC", "#DCDCDC", 0, 0, 0, 0, null);
					sIFR.replaceElement("h3", "tradegothic.swf", "#000000", null, null, null, 0, 0, 0, 0, null);
				*/
				
			};


	});
	
	
