$(function() {

	// add overlabel class to all relevant form fields
	$('DIV#Reiss1971_BlogSignUp DIV').addClass('overlabel');
	
	// hide the default label for each form field and restore when input=""		
	$('DIV#Reiss1971_BlogSignUp INPUT:text, DIV#Reiss1971_BlogSignUp LABEL.default').each(function() {
		if($(this).val() != "") {
			$(this).prev().hide();
		}
	});
	
	$('DIV#Reiss1971_BlogSignUp INPUT:text, DIV#Reiss1971_BlogSignUp LABEL.default').focus(function() {
		$(this).prev().hide();
	});
	
	$('DIV#Reiss1971_BlogSignUp INPUT:text, DIV#Reiss1971_BlogSignUp LABEL.default').blur(function() {
		if($(this).val() == "") {
			$(this).prev().show();
		}
	});
	
	$('#Reiss1971_Container FORM *').each(function() {
		$(this).css('background-color', '#ffffff');
	});
	
	$('#Reiss1971_BlogNav LI').mouseover(function() {
		if ( $(this).attr('id') == 'navReiss1971ShopMensSS10' || $(this).attr('id') == 'navReiss1971ShopWomensSS10' ) {
			$(this).removeClass($(this).attr('id') + '_off');
			$(this).addClass($(this).attr('id') + '_on');
		}
		else {
			$(this).addClass('hover');
		}
	});
	
	$('#Reiss1971_BlogNav LI').mouseout(function() {
		if ( $(this).attr('id') == 'navReiss1971ShopMensSS10' || $(this).attr('id') == 'navReiss1971ShopWomensSS10' ) {
			$(this).removeClass($(this).attr('id') + '_on');
			$(this).addClass($(this).attr('id') + '_off');
		}
		else {
			$(this).removeClass('hover');
		}
	});
	
	$('#Reiss1971_BlogPlayPause LI').click(function() {
		if ( $(this).hasClass('hover') ) {
			$(this).removeClass('hover');
		}
		else {
			$(this).addClass('hover');
		}
	});
	
	if(window.location.href.indexOf('#images') > 0) {
		$('.Reiss1971_BlogContent').each(function() {
			// Hide 'click to view' link
			$(this).prev().hide();
			
			// Show images
			$(this).show();
		});
		
		$('div#Reiss1971_AboutContainer .Reiss1971_BlogTitle a, div#Reiss1971_AboutContainer .Reiss1971_BlogClickToView a').click(function() {
			return false;
		});
	} else {
		$('div#Reiss1971_AboutContainer .Reiss1971_BlogTitle a, div#Reiss1971_AboutContainer .Reiss1971_BlogClickToView a').click(function() {
			var container_id = $(this).parent().parent().attr('id');
			
			// Collapse all images
			$('.Reiss1971_BlogContent').each(function() {
				if ( container_id != $(this).parent().attr('id') ) {
					// Hide images
					$(this).slideUp('slow', function() {
						// Show 'click to view' link
						$(this).prev().slideDown('normal');
					});
				}
			});
			
			// Get images container
			var elem = $('.Reiss1971_BlogContent', $(this).parent().parent());
			
			if ( elem.css('display') == 'none' ) {
				// Hide 'click to view' link
				elem.prev().slideUp('normal');
				
				// Show images
				elem.slideDown('slow');
			}
			else {
				// Hide images
				elem.slideUp('slow', function() {
					// Show 'click to view' link
					$(this).prev().slideDown('normal');
				});
			}
			
			return false;
		});
	}
	
	$('div.Reiss1971_BlogImages a').each(function() {
		$(this).mouseover(function () {
			$(this).fadeTo('normal', 0.5);
		});
		
		$(this).mouseout(function () {
			$(this).fadeTo('normal', 1);
		});
		
		$(this).click(function() {
			var elem = $(this).children();
			
			if ( elem.attr('height') == '135' ) {
				$(elem).animate({
					height: '270px'
				}, 'normal', 'swing');
			}
			else {
				$(elem).animate({
					height: '135px'
				}, 'normal', 'swing');
			}
			return false;
		});
	});
	
	function slideUpImages(linkId, divId) {
		$(linkId).html('more/');
		$(divId).slideUp('slow');
	}
	
	$('.Reiss1971_BlogLatestLink').each(function() {
		$(this).click(function() {
			
			var id = $(this).attr('id');
			if ( $(this).html() == 'more/' ) {
				$('.Reiss1971_BlogLatestLink').each(function() {
					$(this).html('more/');
					$('div#Reiss1971_BlogContent' + $(this).attr('id')).slideUp('slow');
				});
				
				$(this).html('less/');
				$('div#Reiss1971_BlogContent' + id).slideDown('slow');
			}
			else {
				$(this).html('more/');
				$('div#Reiss1971_BlogContent' + id).slideUp('slow');
			}
			return false;
		});
	});
	
	$('.Reiss1971_BlogSignupLink').click(function() {
		$('#Reiss1971_BlogSingUpFormAct').val('submit_form');
		$('#Reiss1971_BlogSignUpForm').trigger('submit');
		return false;
	});
	
});
