/**
*	'Human' interaction test script
*
	// ======================================================================================
	// ved bruker trigget søk kalles en php handler og setter $_SESSION['human-only'] = true;
	// ======================================================================================
*/
var $j = jQuery;
$j(document).ready(function(){
	

	
	// =====================================================
	// bruker klikker på en lenke innenfor <human-only> node
	// =====================================================
	$j('.human-only a').click(function () {
		$j.ajax({
			type: "GET",
			url: "/humanOnlyHandler.php?human=1",
			async: false,
			success: function(response){
				// no op
			}

		});		
	});

	// =========================================================
	// bruker klikker på en lenke i et <map> (organisasjonskart)
	// =========================================================
	$j('.human-only area').click(function () {
		$j.ajax({
			type: "GET",
			url: "/humanOnlyHandler.php?human=1",
			async: false,
			success: function(response){
				// no op
			}

		});		
	});

		


	// ==============================
	// bruker submitter form'en
	// ==============================
	$j("input[type=submit].human-only ").click(function() {
		$j.ajax({
			type: "GET",
			url: "/humanOnlyHandler.php?human=1",
			async: false,
			success: function(response){
				// no op
			}
		});		
	});


	// =============================================
	// bruker trykker 'Enter' i et element i form'en
	// =============================================
	$j('#humanonlyform').keypress(function(event) {
		if (event.keyCode == '13') {
			$j.ajax({
				type: "GET",
				url: "/humanOnlyHandler.php?human=1",
				async: false,
				success: function(response){
					// no op
				}
			});		
			$(this).trigger("submit");
		}
	});



	// =============================================================
	//	
	//	Spesialvariant for NHOReiseliv	
	//
	// bruker klikker på en checkbox i form'en
	// =============================================================
	$j(".human-checkbox").click(function() {
		$j.ajax({
			type: "GET",
			url: "/humanOnlyHandler.php?human=1",
			async: false,
			success: function(response){
				// no op
			}
		});		
	});


});
