$(document).ready(function() {
	$(".navigation").find("a").each(function() {
			if($(this).next().find("a").size() > 0) {
				$(this).addClass("haschildren");
			}
	});
	
	$("input[type=text]").each(function() {
			var defaultValue = $(this).val();
			$(this).blur(function() {
					if($(this).val() == '') {
						$(this).val(defaultValue);
					}
			});
			
			$(this).focus(function() {
					if($(this).val() == defaultValue) {
						$(this).val('');
					}
			});
	});
  
  $(".loginpasswordfakefield").unbind().each(function() {
    var realField = $('.loginpasswordfield');
    $(this).focus(function() {
      $(this).hide();
      realField.show().focus();
    });
	});
  
  $(".loginpasswordfield").each(function() {
    var fakeField = $('.loginpasswordfakefield');		
    $(this).blur(function() {
      if ($(this).val() == '') {
        $(this).hide();
        fakeField.show();
      }
    });
	});
	
	var options = { 
		success: showThankyou   
	}; 
		 
	$('#newsletterForm').submit(function() { 
			$(this).ajaxSubmit(options); 

			return false;
	});
	
	$(".slideshowhover").click(function() {
			alert($(".slideshow object")[0]);
	});
	
	var IE6 = false /*@cc_on || @_jscript_version <= 5.7 @*/;
	if(IE6) {
		$(".logo").find("img").attr("src", "/1image/1x1spacer.gif")[0].runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/1image/logo.png',sizingMethod='scale')";
		$(".middle").css("backgroundImage", "none");
		if($(".middle").hasClass("middlebig")) {
			$(".middle")[0].runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/1image/midbgbig.png',sizingMethod='scale')";
		} else {
			$(".middle")[0].runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/1image/midbg.png',sizingMethod='scale')";
		}
		$(".footerwrapper").css("backgroundImage", "none")[0].runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/1image/buttom.png',sizingMethod='scale')";
		$(".slideeshowhover").css("backgroundImage", "none")[0].runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/1image/top_banner_corner.png',sizingMethod='scale')";
	}
});

function showThankyou(responseText, statusText) {
	if(responseText.indexOf("newslettererror") != -1) {
		$(".feedback").html(responseText).show();
	} else {
		document.location = responseText;
	}
}

