function doZoomIn() {
	document.map.newZoomLevel.value = parseInt(document.map.newZoomLevel.value) + 1;
	document.map.submit();	
	return true;
}

function doZoomOut() {
	document.map.newZoomLevel.value = parseInt(document.map.newZoomLevel.value) - 1;
	document.map.submit();
	return true;
}

function doZoom(zoomIndex) {
	//alert(zoomIndex);
	document.map.newZoomLevel.value = parseInt(zoomIndex);
	document.map.submit();
	return true;
}

function doPan(panDirection, centerLat, centerLong, neLat, neLong, swLat, swLong) {
	    if (panDirection != null )
		{
            if (panDirection == "N")
			{
				centerLat = neLat;
			} 
			else if (panDirection == "NE")
			{
				centerLat = neLat;
				centerLong = neLong;
			} 
			else if (panDirection=="E")
			{
				centerLong = neLong;
			} 
			else if (panDirection=="SE")
			{
				centerLat = swLat;
				centerLong = neLong;
			} 
			else if (panDirection=="S")
			{
				centerLat = swLat;
			} 
			else if (panDirection=="SW")
			{
				centerLat = swLat;
				centerLong = swLong;
			} 
			else if (panDirection=="W")
			{
				centerLong = swLong;
			} 
			else if (panDirection=="NW")
			{
				centerLat = neLat;
				centerLong = swLong;
			} 
		}

	document.map.mapCenterLat.value = centerLat;
	document.map.mapCenterLong.value = centerLong;

	document.map.submit();
	return true;
}

function displayDetails(xPos, yPos, name, category, address, city, state, zip, phone, url, mapType)
{
	var country = 'US';
	displayDetails(xPos, yPos, country, name, category, address, city, state, zip, phone, url, mapType);

}


//Show the attraction info container
function displayDetails(xPos, yPos, country, name, category, address, city, state, zip, phone, url, mapType, deHotelFound){

	//alert("Inside displayDetails - mapType = " + mapType);

	// Create a container which displays the info
	var info = document.createElement("div");
	info.className = "attractionInfo";
	var infoInner = document.createElement("div");
	infoInner.className = "innerContainer";
	//For Non-Destinations pages, the hotel pushpin URL should open in same window
	if(mapType != 4)
	{
		if (category == 'Marriott Hotel')
		{
			var cat = category;
			category = "";
		}
		else
		{
			category = "";
		}   
	}                 
	
	if (xPos == 0 || yPos == 0){
		info.style.position = "relative";	
	}
	
	// Create a list
	var list = document.createElement("ul");

	var item1, item2, item3, item4, item5;
	item1 = document.createElement("li");
	
	if(category != null && category != "")
	{
		item2 = document.createElement("li");
	}
	
	if(address != null && address != "")
	{
		item3 = document.createElement("li");
	}
	
	if(city != null && city != "")
	{
		item4 = document.createElement("li");
	}
	
	if(phone != null && phone != "")
	{
		item5 = document.createElement("li");
	}
	
	// Piece the header tags together
	var header = document.createElement("p");
	
	if (url != "" )
	{
		var link = document.createElement("a");
		var image = document.createElement("img");
		
		if (cat != null && cat == 'Marriott Hotel' && country != 'DE')
		{
			if (mapType != "" && !(mapType == 0 || mapType == 1 || mapType == 2 || mapType == 3 || mapType == 5 || mapType == 10))
			{
				image.setAttribute("src", "http://cache.marriott.com/images/icons/external_icon.gif");
			
			}
		}
		else
		{
			if (deHotelFound != 'true')
			{
				if (mapType != 4)
				{
					image.setAttribute("src", "http://cache.marriott.com/images/icons/external_icon.gif");
			
				}
			}
		}
		
		link.setAttribute("href", url);
		
		if (cat != null && cat == 'Marriott Hotel' && country != 'DE')
		{

			if (mapType == 0 || mapType == 1 ||mapType == 2 || mapType == 3 || mapType == 5 || mapType == 10)
			{
				link.setAttribute("target", "_self");
			}
			else
			{
				link.setAttribute("target", "_blank");
			}
		}
		else
		{
			if (deHotelFound != 'true')
			{
				link.setAttribute("target", "_blank");
			}
			else
			{
				link.setAttribute("target", "_self");
			}
		}
		
	}

	var attraction = document.createTextNode(name);
	if (url != "" )
	{
		link.appendChild(attraction);
		header.appendChild(link);
		if (cat != null && cat == 'Marriott Hotel' && country != 'DE')
		{

			if (mapType != "" && !(mapType == 0 || mapType == 1 || mapType == 2 || mapType == 3 || mapType == 5|| mapType == 10))
			{
				header.appendChild(image);		
			}
		}
		else
		{
			if (deHotelFound != 'true')
			{
				if (mapType != 4)
				{
					header.appendChild(image);
				}
			}
		}

	}
	else
	{
		header.appendChild(attraction);
	}
	
	// Add the header to the container, then add the list to keep correct order
	info.appendChild(infoInner);
	infoInner.appendChild(header);
	infoInner.appendChild(list);
	if(navigator.appName == "Microsoft Internet Explorer") {
		var iframe = document.createElement("iframe");
		info.appendChild(iframe);
	}
	// Create a new list item
	if(category != null && category != "")
	{
		var category = document.createTextNode(category);
		item2.appendChild(category);
		list.appendChild(item2);
	}
	
	// Create a new list item
	if(address != null && address != "")
	{
		var address = document.createTextNode(address);
		item3.appendChild(address);
		list.appendChild(item3);
	}
	
	// Create a new list item
	if(city != null && city != "")
	{
		if (state != "") {
			if (zip !=  "" ) {
				var cityStateZip = document.createTextNode(city + ", " + state + ", " + zip);
			} else {
				var cityStateZip = document.createTextNode(city + ", " + state);
			}
		} else {
				if (zip !=  "" ) {
						var cityStateZip = document.createTextNode(city + ", "  + zip);
					} else {
						var cityStateZip = document.createTextNode(city);
				}
		}
		item4.appendChild(cityStateZip);
		list.appendChild(item4);
	}	

	// Create a new list item
	if(phone != null && phone != "")
	{	
		var phone = document.createTextNode(phone);
		item5.appendChild(phone);
		list.appendChild(item5);
	}
	
	// Add the new node to the page body
	document.body.appendChild(info);
	
	// Continue displaying window if user navigates on info box
	info.onmouseover = function(){
		info.style.display = "block";
	}
	
	// Calculate popup height
	var divHeight;
    if(info.offsetHeight){
    	divHeight = info.offsetHeight;
    }
    else if(info.style.pixelHeight){
       	divHeight = info.style.pixelHeight;
    }
    
    // Determine the position of the info container
	info.style.left = (xPos + 0) + "px";
	info.style.top = (yPos - divHeight) + "px";
	
}
// Hide info when user navigates away from attraction icon
function hideDetails(){
	var divs = document.getElementsByTagName('div');
	
	for(var i = 0; i < divs.length; i++){
		if((divs[i].className) == "attractionInfo"){
			divs[i].style.display = "none";
		}
	}
}

// Hide roll-over popup containers on the map
function clearPopups(){
	var browserName = navigator.appName;
	var ie = "Microsoft Internet Explorer";
	
	if (browserName != ie){
		hideDetails();	
	}
		
}

