/// <reference path="jquery-1.4.1-vsdoc.js" />
/// <reference path="swfobject-vsdoc.js" />

$(document).ready(function() {

    var h1;
    var h2;
    var h3;

    h1 = $("#div_middle_top_center").height();
    h2 = $("#div_middle_top_left").height();

    if (h1 == 0) {
        h1 = $(".list_ingress").height()+40;
    }

    //alert(h1);
    //alert(h2);
    if (h1 > h2) {
        h3 = 0;
    }
    else {
        h3 = (h2 - h1);
        //alert(h1);
        //alert(h2);
    }
    $("#div_boksok_slide").css("margin-top", h3 + "px");


    //    var h4;
    //    h4 = $(".imgFrontpage").height();
    //    alert(h4);
});

/* Google Maps integration -------------------------------------------------------------------------------------- */
function AttachGMap(address, infobox, id, form_id) {

	var geocoder = null;
	var map = null;

	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById(id));

		// Add marker for store address
		var geocoder = new GClientGeocoder();
		var point = geocoder.getLatLng(address, function(point) {

			if (!point) {
				//alert(address + " not found");
				// address not found, make maps invisible
				$("#" + id).css("background", "#fff");

			} else {
				var marker0 = new GMarker(point);
				marker0.title = "";
				map.addOverlay(marker0);
				map.setCenter(point, 13);
				GEvent.addListener(marker0, "click", function() {
					// submit to maps.google.no
					document.getElementById(form_id).submit();
				});
			}

			map.addControl(new GLargeMapControl());
			map.addControl(new GMapTypeControl());
			map.addControl(new GScaleControl());
		});
	}

	// hide copyrightinfo on the bottom. I did this because it was too big and went outside designated area.
	//$("#" + id + " .gmnoprint,#" + id + " > div:last").css("display", "none");
}

