$(document).ready(function () {
	
	$("form.validate").validate({
		rules: {
			password_confirm: {
				equalTo: '#password'
			}
		}
	});
	
	// Show remove links on fix-markers
	$("a.remove").show();
	$("a.remove").click(function () {
		var marker = $(this).attr('href');
		$("#" + marker).val('');
		$("div." + marker).fadeOut('fast');
		return false;
	});
	
	// highlight embed code on click
	$("#embed_code").click(function () {
		$(this).select();
	});
	
	
	/**
	 * 
	 * Compare maps
	 */
	$("#merge td").not("#merge td:last").hover(function() {
		$(this).addClass('active');
	}, function () {
		$(this).removeClass('active');
	}).click(function () {
		$(this).toggleClass('on');
	});
	
	$(".create_comparison").click(function () {
		var url = 'guids='
		$("#merge td.on").each(function (i) {
			url = url + $(this).attr('id').replace('map_', '') + ';';
		});
		
		url = '/merge/create/?' + url;
		window.location=url;
		
		
	});
});
