﻿
function openTable(tableid) {
    which = document.getElementById(tableid);
    if (which.style.display == "block") {
        which.style.display = "none";
    }
    else {
        which.style.display = "block";
    }
}
//added by us

function trimAll(sString) 
{
while (sString.substring(0,1) == ' ')
{
sString = sString.substring(1, sString.length);
}
while (sString.substring(sString.length-1, sString.length) == ' ')
{
sString = sString.substring(0,sString.length-1);
}
return sString;
}


function setPointer() { 
	if (document.all) document.body.style.cursor = 'wait';
	if (document.myMap) document.myMap.style.cursor = 'wait';
}


function GoToMap(mProduct,mScale)  {
        
	
	setPointer(); 
	var version = parseInt(navigator.appVersion);
	var mimagex = 570;
	var mimagey = 330;
	var mZoom=3200;
	var mCenterX=-95.8;
	var mCenterY=37;
	var mWhereFrom = "";
	var mBaseMap = 7;
	if (mProduct=='LandSat5' || mProduct=='LandSat7' || mProduct =='DGlobe' || mProduct == 'IntDEM' || mProduct == 'IntVec' || mProduct == 'intTOPO' 
		|| mProduct == 'TeleInt')  {
		mZoom=21000;
		mCenterX=0;
		mCenterY=0;
		mBaseMap = 1;
	}
	if (mProduct=='NewYork')  {
		mProduct = 'NAPP'
		mZoom=34.99;
		mCenterX=-73.8845;
		mCenterY=40.7564;
		mBaseMap = 7;
	}

	if (version >= 4)
		{mimagey = window.screen.availHeight;
		 mimagex = window.screen.availWidth;}
	if (mimagex <= 880) mimagex = 550;
   	else mimagex = mimagex - 330;
	if (mimagey <= 650) mimagey = 330;
	else mimagey = Math.ceil(mimagex * .61);
	if (self != top) mWhereFrom = parent.HiddenFrame.document.WhereFrom.From.value;
	else if (mProduct == "teleAtlasEMail")
		{mProduct = "teleAtlas"; mWhereFrom="EMail";	}
	else if (mProduct == "geoORTHOEMail")
		{mProduct = "geoORTHO"; mWhereFrom="EMail";	}
	else mWhereFrom ='MapMart';	

	

	location.href="http://www.mapmart.com/scripts/hsrun.exe/Single/MapMart_New/MapXtreme.htx;start=HS_Handler?mscale="
	+ mScale + "&mproduct=" + 
	mProduct + "&mWhereFrom=" +
	mWhereFrom + "&mpage=Zoom&mimagex=" +
 	mimagex + "&mimagey=" +
	mimagey + "&munique=0&mqd=0&mdata=''&mzoom="+mZoom+"&mcenterx=" + mCenterX + "&mcentery=" + mCenterY +"&mBaseMap=" + mBaseMap;
}

function GoToMapServer(mProduct,mScale)  
{
	str='http://216.241.101.9/international/resolution.aspx?Product='+mProduct+''
	window.open(str,target="_self")

}

function GoToMapSection(product)
{
	str='http://maps.mapmart.com/MAPMARTmapping/detectresolution.aspx?category='+product+''
	//str='http://216.241.101.19/MAPMARTmapping/detectresolution.aspx?category='+product+''
	window.open(str,target="_self")
}

function GoToServer1()
{
	str='http://mapping.mapmart.com/pictometry/resolution.aspx'
	//str='http://216.241.101.9/pictometry/resolution.aspx'
	window.open(str,target="_self")
}


function GoToCountryCheckout(product,tabfile)
{
	str='http://maps.mapmart.com/MapmartMappingExtra/GenerateImage.aspx?category='+product+'&&TabFile='+tabfile+''
	//str='http://216.241.101.19/MapmartMappingExtra/GenerateImage.aspx?category='+product+'&&TabFile='+tabfile+''
	window.open(str,target="_self")
}



function formHandler(form){
var URL = window.document.form.site.options[document.form.site.selectedIndex].value;
window.location.href = URL;
}
function formHandler2(form2){
var URL = window.document.form2.site2.options[document.form2.site2.selectedIndex].value;
window.location.href = URL;
}
function formHandler3(form3){
var URL = window.document.form3.site3.options[document.form3.site3.selectedIndex].value;
window.location.href = URL;
}

function clearSearchBox(clientId)
{
    document.getElementById(clientId).value="";
}

function RotateBanner()
    {
        var randomNumber=Math.floor(Math.random()*24);
        var banner = document.getElementById("header-bg-img");
        banner.style.backgroundImage = 'url(/images/Banner/'+randomNumber+'.jpg)';
    }

function PopUp(target,WindowName,mheight,mwidth)
{
    if (window.window1) window1.close;
    var window1 = window.open(target,WindowName,'scrollbars=yes,width='+mwidth+',height='+mheight+',top=10,left=10,resizable=yes');
    if (window1.opener == null) window1.opener = self;
    if (!window1.closed) window1.focus();
}

var win = null;
function NewWindow(mypage,myname,w,h,scroll)
{
    LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
    TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
    settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable';
    win = window.open(mypage,myname,settings);
}



last_tab = 'tab1';
function show(layerName) { 
document.getElementById(layerName).style.display = '';

} 

function hide(layerName) { 
document.getElementById(layerName).style.display = 'none';
} 

function show_next(tab_name) {
document.getElementById(last_tab).className = 'tab';
var curr = document.getElementById(tab_name);
curr.className='tab_hover';
hide(last_tab+'_data');
show(tab_name+'_data');
last_tab=tab_name;
}

function Redirect(product)
{
    if(product=='Microsoft')
        window.location = "http://216.241.101.19/MAPMARTmapping/detectresolution.aspx?category=AerialImagery";
    else if(product=='NAIP')
        window.location = "/Dynamic/NAIP/";
    else if(product=='DEM')
        window.location = "javascript:GoToMap('IntDEM','24k')";
    else if(product=='Satellite')
        window.location = "http://216.241.101.19/MAPMARTmapping/detectresolution.aspx?category=SatelliteImagery";
    else if(product=='Topo')
        window.location = "javascript:GoToMapServer('InternationalData','24k')";
    else if(product=='Aerial')
        window.location = "http://216.241.101.19/MAPMARTmapping/detectresolution.aspx?category=AerialImagery";
    else if(product=='Topo States')
        window.location = "http://www.mapmart.com/Topo/ras_24mainu.htm";
    else if(product=='DEM States')
        window.location = "javascript:GoToMap('NED','24k')";
else if(product=='NAIP States')
        window.location = "/Dynamic/NAIP/";

}

