// [PAGE=KONTAKT]

function initGMap() 
{
      if (GBrowserIsCompatible()) 
      {
       // create a simple map and center it on atb location
        var map = new GMap2(document.getElementById("gmap"));
        map.setCenter(new GLatLng(52.3690327, 9.7438606), 14);
        
        // add controls for moving and zooming
        map.addControl(new GSmallMapControl());
        
        // add the atb marker
        var atbmarker = new GMarker(new GLatLng(52.3690327, 9.7438606));
        map.addOverlay(atbmarker);
       
       // and show the info window when clicked
       atbmarker.bindInfoWindowHtml("<p style=\"color:#000\"><strong>ATB Sport GmbH<\/strong><br>Marienstr. 3<br>30171 Hannover<\/p>");
	}
}

// [PAGE=SORTIMENT]

function initAssortment()
{
	// display categories
	document.getElementById("assortmentcats").style.display = "inline-block";
	
	// hide everything in cats
	document.getElementById("catmtb").style.display = "none";
	document.getElementById("cattrekking").style.display = "none";
	document.getElementById("catfitness").style.display = "none";
	document.getElementById("catsinglespeed").style.display = "none";
	document.getElementById("catleichtcity").style.display = "none";
	document.getElementById("catstadt").style.display = "none";
	document.getElementById("catkinder").style.display = "none";
	document.getElementById("catbmx").style.display = "none";
	document.getElementById("catcruiser").style.display = "none";
	document.getElementById("catholland").style.display = "none";
	document.getElementById("catzubehor").style.display = "none";
	
	markLinked();
}

function focusEntry(ID)
{
	// security
	if(ID == "catmtb" || ID == "cattrekking" || ID == "catfitness"
		|| ID == "catsinglespeed" || ID == "catleichtcity" || ID == "catstadt"
		|| ID == "catkinder" || ID == "catbmx" || ID == "catcruiser"
		|| ID == "catholland" || ID == "catzubehor")
	{
		// Hide everything
		document.getElementById("catmtb").style.display = "none";
		document.getElementById("cattrekking").style.display = "none";
		document.getElementById("catfitness").style.display = "none";
		document.getElementById("catsinglespeed").style.display = "none";
		document.getElementById("catleichtcity").style.display = "none";
		document.getElementById("catstadt").style.display = "none";
		document.getElementById("catkinder").style.display = "none";
		document.getElementById("catbmx").style.display = "none";
		document.getElementById("catcruiser").style.display = "none";
		document.getElementById("catholland").style.display = "none";
		document.getElementById("catzubehor").style.display = "none";
		
		// just allow the element with the given id

		document.getElementById(ID).style.display = "inline-block";
	}
	// otherwise do nothing
}

function markLinked()
{
	string1 = document.URL;
	pos = string1.search("#");
	string2 = string1.slice(pos+2);
	string3 = string2.toLowerCase();
	
	focusEntry(string3);
}


// [PAGE=LADEN]

function ShopPlan(PlanElement, nWidth, nHeight, sUrl, sClassName)
{
	this.PlanElement = PlanElement;
	this.nWidth = nWidth;
	this.nHeight = nHeight;
	this.sClassName = sClassName;
	
	this.render = function(nX, nY, sUrl)
	{
		// create new stuff
		var Link = document.createElement("a");
		Link.innerHTML = "&nbsp;";
		Link.className = this.sClassName;
		Link.style.top = nY+"px";
		Link.style.left = nX+"px";
		Link.href = "pics/map/"+sUrl;
		Link.title = "Bild";
		Link.rel = "lightbox";
		
		this.PlanElement.appendChild(Link);
	}
}

function initPlan()
{
	var aPics = Array(28, 47, "zum_og.jpg",
							28,262, "kasse1.jpg",
							28,125, "mtb1.jpg",
							84,362, "mtb2.jpg",
							84,398, "mtb4.jpg",
							120,160,"mtb3.jpg",
							240,446,"front.jpg",
							526,369,"kasse2.jpg",
							180,83, "cross1.jpg",
							355,23, "cross2.jpg",
							473,17, "buero.jpg",
							473,153,"kinder.jpg",
							438,265,"bmx1.jpg",
							473,193,"bmx2.jpg",
							438,332,"cruiser1.jpg",
							352,332,"cruiser2.jpg",
							472,332,"cruiser3.jpg",
							438,153,"kinder2.jpg",
							559,404,"cruiser4.jpg");
	var PlanElement = document.getElementById("shopplan");
	var MyShopPlan = new ShopPlan(PlanElement, 40, 40, "images/bg_shopplanpreview.jpg", "shopplanpreview");

	for(var nI = 0; nI < aPics.length; nI+=3)
		MyShopPlan.render(aPics[nI], aPics[nI+1], aPics[nI+2]);
}