function ajaxClock() {
    $.ajax(
    		{
    		    type: "GET",
    		    url: "/images/dotclear.gif",
    		    cache: false,
    		    complete: function(xhr, status) {

    		        if (status == 'success' && xhr.getResponseHeader("Date")) {
    		            var d = Date.parse(xhr.getResponseHeader("Date"));

    		            $('#time').html(d.toString("hh:mm tt "));
    		            $('#date').html(d.toString("dddd, ddS MMMM yyyy "));
    		            setTimeout(function() { ajaxClock(); }, 60000);
    		        }
    		    },
    		    error: function() {
    		        setTimeout(function() { ajaxClock(); }, 60000);
    		    }
    		});

}
$(document).ready(function(){
		/*Search text box*/
		$("#txtSearch").focus(function(){if ($(this).val() == $(this)[0].title)$(this).val("");});
		$("#txtSearch").blur(function(){if ($(this).val() == "")$(this).val($(this)[0].title);});
		$("#txtSearch").blur();
		
		/*Clock*/
		ajaxClock();
		
		/*Member login: Forgot Password*/
		$(".loginForgotPWordFormFields").hide();
		
		$("<div class='forgotPassword'>Forgot Password?</div>").insertAfter(".loginStandardFormFields .formSubmitRow input");
		$(".forgotPassword").click(function(){
			$(".loginForgotPWordFormFields").slideToggle("fast");
		});
		
		
   	
		/*Footer Navigation*/
		var strSectionName = $(".currentLi ul.currentParentLi_Ul").html() != null ? $(".currentLi a").html() : "";
		var strSectionParentName = $(".currentParentLi a").html() == null ? "" : $(".currentParentLi a").html(); 

		/*Second Level Footer navigation*/		
		if ($("#footer #secondLevelNav").length <= 0){
			/*if ($("#footerMainNavigation .currentLi").length > 0){*/
			if ($("#PublicMemberNavigation").length > 0){
				$("#footer #footerMainNavigation").before("<div id='secondLevelNav' class='floatLeft'></div>");
			}
			else{
				$("#footer #footerMainNavigation").after("<div id='secondLevelNav' class='floatLeft'></div>");
			}
		}
				
		/*Add second level headings*/
		if ( strSectionParentName.length > 0 ){
			$("#footer #secondLevelNav").append("<span class='sectionName'>" + strSectionParentName + "</span>");
			
		}
		else if (strSectionName.length > 0){
			$("#footer #secondLevelNav").prepend("<span class='sectionName'>" + strSectionName + "</span>");
			
		}
		
		/*Add second level items*/	
		if ( pageType == 'append' )
		{				
			$("#footerMainNavigation ul.currentParentLi_tier2Ul").appendTo($("#footer #secondLevelNav"));
		}
		else
		{
			$("#PublicMemberNavigation ul.currentParentLi_tier2Ul").appendTo($("#footer #secondLevelNav"));
		}
		
		
		
		/*Third Level Footer navigation*/
		if ($("#footer #secondLevelNav .currentParentLi_tier3Ul").length > 0){
			$("#footer #secondLevelNav").after("<div id='thirdLevelNav' class='floatLeft'></div>");
			
			/*Add third level items*/
			$("#footer #secondLevelNav .currentParentLi_tier3Ul").appendTo("#footer #thirdLevelNav");
		}
		
		/*Add third level headings*/		
		if (($("#secondLevelNav .currentParentLi a").html() != null) && ($("#secondLevelNav .currentParentLi a").html()).length > 0 ){
			$("#footer #thirdLevelNav").prepend("<span class='sectionName'>" + $("#secondLevelNav .currentParentLi a").html() + "</span>");
		}
		else if (($("#secondLevelNav .currentLi a").html() != null) &&  ($("#secondLevelNav .currentLi a").html()).length > 0){
			$("#footer #thirdLevelNav").prepend("<span class='sectionName'>" + $("#secondLevelNav .currentLi a").html() + "</span>");
		}
		
		if ( pageType == 'append' )
		{
			$("#PublicMemberNavigation").after($("#footerMainNavigation"));	
		}
		
	
   	 	 	
   	 	
   	 	
		jQuery.preloadImages = function()
		{
			var a = (typeof arguments[0] == 'object')? arguments[0] : arguments;
			for( var i = 0; i <= a.length -1; i++) 
			{
				jQuery("<img>").attr("src", a[i]);
				$('#slideshow').append( jQuery("<img>").attr("src", a[i]) );
			}
		}
		  	 
		$(window).bind('load', function() 
		{	
			/*	slideshow */
			if ( typeof getBannerImgPathList === 'function' )
			{
				var bannerImgPathList = getBannerImgPathList ( );					
				imgPathArray = bannerImgPathList.split ( ',' );
				
				$.preloadImages ( imgPathArray );
				
				if ( imgPathArray.length > 1 )
				{
					$('#slideshow').cycle(
					{
						fx:      'fade', 
						speed:  2100,
						timeout:  7000
					});
				}
			}/*	//slideshow */	
		});	
   	 	
   	
   	/*@cc_on

	  @if (@_jscript_version == 5.6)	  	
	  	
	    $("#primaryMenu ul:first").hover(function() {	
							$('select').css("visibility","hidden");              
						}, function() {
							$('select').css("visibility","visible"); 
					});
	
	  @end

		@*/

   	 	
});
