function doSubscribe() {
	var regEmail = /^[A-Za-z0-9\-_]+(\.[A-Za-z0-9\-_]+)*@([A-Za-z0-9\-_\.]+\.)+[A-Za-z]{2,8}$/i;
	
    if (document.getElementById('mailing').FirmEmail.value < 1) {
			alert("Please enter e-mail address!");
            document.getElementById('mailing').FirmEmail.focus();
            return false;
    } else {
        if (document.getElementById('mailing').FirmEmail.value.search(regEmail) == -1) {
            alert("Please enter valid e-mail address!");
            document.getElementById('mailing').FirmEmail.focus();
            return false;
        }
    }
}

$(document).ready( function() {
	if($("#left").height() > $("#right").height()) // Height hack - #right
		$("#right .last").css('height', $("#left").height() - $("#right").height() + $("#right .last").height() + 15 + 'px');
	
	var font10 = 10;
	var font11 = 11;
	
	$(".bigger").click( function() {
		font10 = font10 + 1;
		font11 = font11 + 1;

		$("body").css('font-size', font11 + 'px');
		$("#bar").css('font-size', font10 + 'px');
		$("#footer").css('font-size', font10 + 'px');
	});
	
	$(".smaller").click( function() {
		font10 = font10 - 1;
		font11 = font11 - 1;

		$("body").css('font-size', font11 + 'px');
		$("#bar").css('font-size', font10 + 'px');
		$("#footer").css('font-size', font10 + 'px');
	});

	$("form#mailing input.submit").hover( function() {
		$(this).attr('src', '/share/images/site/buttonOkHover.gif');
	}, function() {
		$(this).attr('src', '/share/images/site/buttonOk.gif');
	});
	
	$("input.submit").hover( function() {
		$(this).css('background-position', '0 -20px');
	}, function() {
		$(this).css('background-position', '0 0');
	});

	$("#bottom .mail").click( function() {
		$('form#send-to-friend-form input.text').each( function() {
			$(this).get(0).value = '';
			$(this).removeClass('error');
		});

		$("#send-to-friend").show();

		return false;
	});
	
	$('form#send-to-friend-form .close').click( function() {
		$("#send-to-friend").hide();

		return false;
	});
	
	$('form#send-to-friend-form').submit( function() {
		error = 0;

		$('form#send-to-friend-form input.text').each( function() {
			if($(this).val() == '') {
				$(this).addClass('error');
				error = 1;
			} else {
				$(this).removeClass('error');
			}
		});

		if(error > 0) {
			alert('Please fill all fields in red');

			return false;
		}

        return jform.submit(this, {
            onComplete: function(data) {
				$("#send-to-friend").hide();
				$("#send-to-friend-thank-you").show();
			}
        });
	});
	
	$("#send-to-friend-thank-you input.close").click( function() {
		$("#send-to-friend-thank-you").hide();
	});

	$(".this-module-functions").toggle( function() {
		$(".slide-up-down").slideUp( function() {
			Resize.now();
		});

		$("#"+$(this).get(0).name).slideDown( function() {
			Resize.now();
		});

		return false;
	}, function() {
		$("#"+$(this).get(0).name).slideUp( function() {
			Resize.now();
		});

		return false;
	});
	
	$(".current-version").toggle( function() {
		$(".slide-up-down").slideUp( function() {
			Resize.now();
		});

		$("#"+$(this).get(0).name).slideDown( function() {
			Resize.now();
		});

		return false;
	}, function() {
		$("#"+$(this).get(0).name).slideUp( function() {
			Resize.now();
		});

		return false;
	});

	$(".old-versions").toggle( function() {
		$(".slide-up-down").slideUp( function() {
			Resize.now();
		});

		$("#"+$(this).get(0).name).slideDown( function() {
			Resize.now();
		});

		return false;
	}, function() {
		$("#"+$(this).get(0).name).slideUp( function() {
			Resize.now();
		});

		return false;
	});

	$(".platform-current-versions").toggle( function() {
		$(".slide-up-down").slideUp( function() {
			Resize.now();
		});

		$("#"+$(this).get(0).name).slideDown( function() {
			Resize.now();
		});

		return false;
	}, function() {
		$("#"+$(this).get(0).name).slideUp( function() {
			Resize.now();
		});

		return false;
	});	
	
	$(".platform-old-versions").toggle( function() {
		$(".slide-up-down").slideUp( function() {
			Resize.now();
		});

		$("#"+$(this).get(0).name).slideDown( function() {
			Resize.now();
		});

		return false;
	}, function() {
		$("#"+$(this).get(0).name).slideUp( function() {
			Resize.now();
		});

		return false;
	});	
});

FillForm = {
	build : function( fieldId, value ) {
		$("#"+fieldId+"").get(0).value = value;
	}
}

Resize = {
	now : function() {
		$("#right .last").css('height', $("#left").height() - $("#right").height() + $("#right .last").height() + 15 + 'px');
	}
}