var SiteUrl = "http://festival.goldendays.dk/"; // remember "/"

var map = null;
var ewindow = null;

$(document).ready(
	function() {
	    if (GBrowserIsCompatible()) {
	        var mapId = document.getElementById("map_canvas");
	        if (mapId) {
	            map = new GMap2(mapId);
	            map.setCenter(new GLatLng(55.67633, 12.57831), 13);
	            map.addControl(new GSmallZoomControl3D());

	            var iconCustom = new GIcon();
	            iconCustom.image = 'http://festival.goldendays.dk/images/gmaps/marker.png';
	            iconCustom.iconSize = new GSize(13, 13);
	            iconCustom.iconAnchor = new GPoint(7, 7);
	            iconCustom.infoWindowAnchor = new GPoint(7, 7);

	            var options = { icon: iconCustom, draggable: false };
	            ewindow = new EWindow(map, E_STYLE_F);
	            map.addOverlay(ewindow);

	            for (var i = 0; i < locations.length; i++) {
	                locations[i].marker = new GMarker(new GLatLng(locations[i].lng, locations[i].lat), options);
	                map.addOverlay(locations[i].marker);
	                GEvent.bind(locations[i].marker, "click", locations[i], LocationShowBubble);
	            }
	            GEvent.addListener(map, "click", function(marker, point) {
	                if (point) {
	                    ewindow.hide();
	                }
	            });
	        }
	    }
	}
);
$(document).ready(
	function(){
		initCastomForms();
		$(".navigation .lnk-login").click(function(){
			$(".login").slideDown("slow");
			return false;
		});
		$(".login strong a").click(function(){
			$(".login").slideUp("slow");
			return false;
		});
		$('#events-box.hidden .slide-part').hide();
		$("#events-box .heading h2 a").click(function(){
			$("#events-box .slide-part").slideToggle("slow");
			$("#events-box").toggleClass("hidden");
			return false;
		});
	}
);
$(document).ready(
    function(){
	    if ($('div.scroller').galleryScroll)
	    {
		    $('div.scroller').galleryScroll({
			    btPrev: '.lnk-prev',
			    btNext: '.lnk-next',
			    holderList: 'div',
			    scrollElParent: 'ul',
			    scrollEl: 'li',
			    slideNum: false,
			    duration : 1000,
			    step: 1,
			    circleSlide: true,
			    disableClass: 'disable',
			    funcOnclick: null
		    });
	    }
    }
);

function PrintContent(id)
{
    var DocumentContainer = document.getElementById(id);
    var WindowObject = window.open('', "_blank","width=684,height=400,top=200,left=250,toolbars=no,scrollbars=yes,status=no,resizable=no");
    WindowObject.document.open();
    WindowObject.document.writeln("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
    WindowObject.document.write('<html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" href="'+SiteUrl+'css/all.css" type="text/css" media="all" /></head><body>'+DocumentContainer.innerHTML+'</body></html>');
    WindowObject.document.title = "Golden Days";
    WindowObject.document.close();
    WindowObject.focus();
    
    WindowObject.print();
    //WindowObject.close();
}

function PrintEvent(id)
{
    var DocumentContainer = document.getElementById(id);
    var date = new Date();
    var WindowObject = window.open('', '_blank','width=690,height=400,top=0,left=0,toolbars=no,scrollbars=yes,status=no,resizable=no',false);
    WindowObject.document.open();
    WindowObject.document.writeln('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
    WindowObject.document.write('<html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" href="'+SiteUrl+'css/all.css" type="text/css" media="all" /><style type="text/css">.wrap-3 .col-1 {width:20%;float:left;border:none;padding:0 0 9px 0;}\n.wrap-3 .col-2{width: 75%;float: right;display: inline;border: 1px solid #d9d9d9;padding:0 0 20px 0;margin:0;}</style></head><body><div class="wrap-3">' + DocumentContainer.innerHTML + '</div></body></html>');
    WindowObject.document.title = 'Golden Days';
    WindowObject.document.close();
    WindowObject.focus();
    
    WindowObject.print();
    //WindowObject.close();
}
function LocationShowBubble() {
    var org = this.marker.getPoint();
    map.panTo(new GLatLng(org.lat()+0.005, org.lng()+0.016));
    ewindow.openOnMarker(this.marker,this.text)
}
function LocationDirectLink() {
    location.href = this.link; 
}
var ShowEdit = false;
function ToggleEdit()
{
    $('#editform > .hold > .edited').css("display", (ShowEdit) ? "block" : "none");
    $('#editform > .hold > .fieldhold').css("display", (ShowEdit) ? "none" : "block");
    ShowEdit = !ShowEdit;
}
function ShowEditing()
{
    ShowEdit = true;
    $('#editform > .hold > .edited').css("display", "none");
    $('#editform > .hold > .fieldhold').css("display", "block");
}
