var MAP_SERVER_URL = "http://map.infomine.com/";
var REDIRECT_URL = "http://www.infomine.com/";
// 730
var MAP_WINDOW = "status=no,menubar=no,resizable=no,scrollbars=yes";

document.write('<form name="id_form" method="post" action="' + MAP_SERVER_URL +'map.asp" target="window_map">');
document.write('<input type="hidden" name="location_id" value=""/>');
document.write('<input type="hidden" name="open_section" value="PROP,WORL"/>');
document.write('<input type="hidden" name="cmd" value="ZOOMLOCATION"/>');
document.write('<input type="hidden" name="location_section" value="PROP"/>');
document.write('</form>');

function loadMapWindow(thisAction, thisID)
{
		
	if (MapBrowserConfirm())
	{

		switch (thisAction)
		{   
			case "PROP":       
				mapWindow = window.open(MAP_SERVER_URL + "map.asp?open_section=PROP,WORL,WGEO&cmd=ZOOMSINGLE&location_section=PROP&location_id=" + thisID,"window_map", MAP_WINDOW);
				break;
				
			case "MINESITE":       
				mapWindow = window.open(MAP_SERVER_URL + "map.asp?open_section=PROP,WORL,WGEO&cmd=ZOOMSINGLE&location_section=PROP&location_id=" + thisID,"window_map", MAP_WINDOW);
				break;

			case "SEAR":
				mapWindow = window.open(MAP_SERVER_URL + "blank.htm","window_map", MAP_WINDOW);
				document.id_form.submit();
				break;
			
			default :
				mapWindow = window.open(MAP_SERVER_URL + "map.asp?open_section=PROP,WORL&cmd=MAP&location_id=","window_map", MAP_WINDOW);
				break;
				
		}

	}
	
}


// any server ... will launch off the mapserver

function loadMapWindowFromMapServer(thisAction, thisID, thisURL, thisParentLoad)
{
	//var mapWindow;
	
	loadMapWindow(thisAction, thisID);

	if(thisParentLoad == "yes" || thisParentLoad == "")
	{
		if (thisURL == null || thisURL == "" || thisURL.indexOf("infomine.com") < 0)
		{
			location.href = REDIRECT_URL;
		}
		else
		{
			//alert(history[0]);
			location.href = thisURL;
		}
	}
	else
	{
		if(history.length > 0)
		{
			history.back();
		}
		else
		{
			location.href = REDIRECT_URL;
		}
	}
}


// any infomine server other than the map server

function loadMapWindowFromOtherServer(thisAction, thisID)
{
	loadMapWindow(thisAction, thisID);	
}


// allow both IE 5 + and Netscape6

function MapBrowserConfirm()
{
	var pos;
	var ua = window.navigator.userAgent; 

	if((pos = ua.indexOf ( "MSIE " )) >= 0)
	{
		if (parseInt (ua.substring (pos+5, ua.indexOf (".", pos ))) < 5)
		{
			MsgIncorrectBrowser();
			return false;
		}
		else
		{
			return true;
		}
	}
	else if(ua.indexOf ( "Netscape6" ) >= 0 || ua.indexOf ( "Netscape/7.0" ) >= 0 || ua.indexOf ( "Mozilla" ) >= 0 )
	{
		return true;
	}
	else
	{
		MsgIncorrectBrowser();
		return false;
	}
}
		
function MsgIncorrectBrowser()
{
	alert("map.InfoMine.com requires a minimum of Internet Explorer 5.0 or Netscape 6.");
	return;
}
