

function getMap(MapLinkID)
{
	//document.getElementById("dvMap").style.display= "none";
	//document.getElementById("dvMap").style.visibility="hidden";
	ToggleDiv(document.getElementById(MapLinkID), document.getElementById("dvMap"), 'r');

	switch(MapLinkID)
	{
	    case "durban":
	        document.getElementById("ifMap").src = "DurbanLocation.html";
	    break;
	    
	    case "joburg":
	        document.getElementById("ifMap").src = "JoburgLocation.html";
	    break;
	    
	    case "delhi":
	        document.getElementById("ifMap").src = "NoidaLocation.html";
	    break;
	}
}


function closeMap()
{
	document.getElementById("dvMap").style.display= "none";
	document.getElementById("dvMap").style.visibility="hidden";
}





/*
description:	toggles index divs in correct position relative to their anchors
parameters:		anchor(object that anchors div), div (object)
notes:			
*/
var offsetY = 30;											
var iconW = 20;

function ToggleDiv(anchor, div, align)
{
	switch (div.style.visibility)
	{		
		case "hidden":
			var coords = getObjCoords(anchor); 
			div.style.top = (coords.y) + offsetY;
			
			if (align== "l")
				div.style.left = (coords.x) - parseInt(div.style.width);
			else
				div.style.left = coords.x;
				
			div.style.display= "";
			div.style.visibility= "visible";
		break;
		
		
		case "visible":
			div.style.display= "none";
			div.style.visibility="hidden";
		break;
	}
}




/*
description:	gets specified objects co-ordinates
parameters:		inputElement(object)
notes:			eg. getObjCoords(someElement).y;
*/
function getObjCoords(inputElement) 
{
    var coords =  new Object();
    coords.x = 0;
    coords.y = 0;

    try 
    {
        targetElement = inputElement;
        if(targetElement.x && targetElement.y)
        { 
            coords.x = targetElement.x;
            coords.y = targetElement.y;
        } 
		else
		{ 
			if(targetElement.offsetParent)
			{ 
				coords.x += targetElement.offsetLeft;
				coords.y += targetElement.offsetTop;

				while(targetElement = targetElement.offsetParent) 
  				{
					coords.x += targetElement.offsetLeft;
					coords.y += targetElement.offsetTop;
				}
			} 
			else 
			{
				//alert(\"Could not find any reference for coordinate positioning.\");
			}
		}
		return coords;
		//alert(inputElement.id +  " x: " + coords.x + "; y: " + coords.y);		
    } 
    catch(error) 
    {
        //alert(error.msg);
        return coords;
    }
}			

