//#############################################
// Title            api
// Date             22 - Aug - 2002
// Author           Mehdi Nejad
// Description       to do misc things, cross browser
function printTrace (thisObj) {
    var str = "";
    for (var xx in thisObj) {
        str += xx + "<br> ";
    }
    document.write (str);
}
function createLayer( name ) {
    layerStyle = "position: absolute; left: 0px; top: 0px; width: 100px; height: 100px; visibility: visible;";
    layerDefinition = "<div id='" + name + "' style='" + layerStyle + "'></div>";
    if( document.all) {
        document.body.insertAdjacentHTML("BeforeEnd", layerDefinition);
    } else if (document.getElementById) {
        var docBody = document.getElementsByTagName( "body" ).item(0);
        myDiv = document.createElement( "div" );
        myDiv.setAttribute( "id", name );
        myDiv.setAttribute( "style", layerStyle );
        docBody.appendChild( myDiv );
    } else {
        var tempLayer = document.layers[name] = new Layer( 100 );
        eval( "document." + name + " = tempLayer");
    }
     return name;
}

function getObject (objectName) {
    // dom
    if (document.getElementById) {
        return document.getElementById(objectName);
    }
    //ns 4
    if (document.layers) {
        return document.layers[objectName];
    }
    // by now, ie 4..
    if (document.all) {
        return document.all[objectName];
    }
}
function hideLayer (objectName) {


    if (document.getElementById) {
        getObject(objectName).style.visibility = "hidden";
    } else if (document.all) {
        getObject(objectName).style.visibility = "hidden";
    } else {


		if (getObject(objectName).visibility !="hide") {
			//alert ("already hidden");
			//alert ("hidding |" +objectName+ "|");
			getObject(objectName).visibility = "hidden";
		}


    }
}
function showLayer (objectName) {



    if (document.getElementById) {
        getObject(objectName).style.visibility = "visible";
    } else if (document.all) {
        getObject(objectName).style.visibility = "visible";
    } else {
		if (getObject(objectName)) {
			getObject(objectName).visibility = "visible";
		} else if (objectName.visibility) {
			objectName.visibility = "visible";
		} else {
			alert ("could not refernce visibility for " + objectName);
		}

    }
}

function setLayerLeft ( name, left ) {
    // take in the name of the layer...
    var thisLayer = getObject(name);
    if ( (document.getElementById) ) {
        thisLayer.style.left = left + "px";
    } else if (document.layers) {
        eval("document." + name + ".left = " + left);
    } else {
        thisLayer.style.left = left + "px";
    }

}

// ******************************************************************
// Written by TNT Employees

// *********************
// Function to open links to other country homepages.
function Move_Country(country)
{



language = "/en";

  if (country.options[country.selectedIndex].value != '')
  {
      ht = (screen.availheight * 2) / 3;
      wd = (screen.availwidth * 2) / 3;

      if (country.options[country.selectedIndex].value == 'uk') 
      {  new_win = 1;
          win_name = "UK_Window";
          url = "http://www.tntlogistics.co.uk";
      } else if (country.options[country.selectedIndex].value == 'it') 
      {  new_win = 1;
          win_name = "IT_Window";
          url = "http://www.tntlogistics.it";
      } else if (country.options[country.selectedIndex].value == 'br') 
      {  new_win = 1;
          win_name = "BR_Window";
          url = "http://www.tntlogistics.com.br";
      } else if (country.options[country.selectedIndex].value == 'cz') 
      {  new_win = 1;
          win_name = "CZ_Window";
          url = "http://www.tntlogistics.cz";
      } else if (country.options[country.selectedIndex].value == 'es') 
      {  new_win = 1;
          win_name = "ES_Window";
          url = "http://www.tntlogistics.es";
      } else if (country.options[country.selectedIndex].value == 'tr') 
      {  new_win = 1;
          win_name = "TR_Window";
          url = "http://www.tntlogistics.com.tr";
      } else if (country.options[country.selectedIndex].value == 'au') 
      {  new_win = 1;
          win_name = "AU_Window";
          url = "http://www.tntlogistics.com.au";
      } else if (country.options[country.selectedIndex].value == 'us') 
      {  new_win = 1;
          win_name = "US_Window";
          url = "http://www.tntlogistics.us";
      } else if (country.options[country.selectedIndex].value == 'ca') 
      {  new_win = 0;
          win_name = "CA_Window";
          url = language + "/about_tnt/global_footprint/north_america/canada/";
      } else if (country.options[country.selectedIndex].value == 'ar') 
      {  new_win = 0;
          win_name = "AR_Window";
          url = language + "/about_tnt/global_footprint/south_america/argentina/";
      } else if (country.options[country.selectedIndex].value == 'mx') 
      {  new_win = 0;
          win_name = "MX_Window";
          url = language + "/about_tnt/global_footprint/south_america/mexico/";
      } else if (country.options[country.selectedIndex].value == 'dk') 
      {  new_win = 0;
          win_name = "DK_Window";
          url = language + "/about_tnt/global_footprint/northern_europe/denmark/";
      } else if (country.options[country.selectedIndex].value == 'fi') 
      {  new_win = 0;
          win_name = "FI_Window";
          url = language + "/about_tnt/global_footprint/northern_europe/finland/";
      } else if (country.options[country.selectedIndex].value == 'no') 
      {  new_win = 0;
          win_name = "NO_Window";
          url = language + "/about_tnt/global_footprint/northern_europe/norway/";
      } else if (country.options[country.selectedIndex].value == 'se') 
      {  new_win = 0;
          win_name = "SE_Window";
          url = language + "/about_tnt/global_footprint/northern_europe/sweden/";
      } else if (country.options[country.selectedIndex].value == 'at') 
      {  new_win = 0;
          win_name = "AT_Window";
          url = language + "/about_tnt/global_footprint/western_europe/austria/";
      } else if (country.options[country.selectedIndex].value == 'be') 
      {  new_win = 1;
          win_name = "BE_Window";
          url = "http://www.tntlogistics.be";
      } else if (country.options[country.selectedIndex].value == 'de') 
      {  new_win = 1;
          win_name = "DE_Window";
          url = "http://www.tntlogistics.de";
      } else if (country.options[country.selectedIndex].value == 'nl') 
      {  new_win = 1;
          win_name = "NL_Window";
          url = "http://www.tntlogistics.nl";
      } else if (country.options[country.selectedIndex].value == 'fr') 
      {  new_win = 1;
          win_name = "FR_Window";
          url = "http://www.tntlogistics.fr";
      } else if (country.options[country.selectedIndex].value == 'gr') 
      {  new_win = 0;
          win_name = "GR_Window";
          url = language + "/about_tnt/global_footprint/southern_europe/greece/";
      } else if (country.options[country.selectedIndex].value == 'pt') 
      {  new_win = 0;
          win_name = "PT_Window";
          url = language + "/about_tnt/global_footprint/southern_europe/portugal/";
      } else if (country.options[country.selectedIndex].value == 'hu') 
      {  new_win = 0;
          win_name = "HU_Window";
          url = language + "/about_tnt/global_footprint/eastern_europe/hungary/";
      } else if (country.options[country.selectedIndex].value == 'pl') 
      {  new_win = 1;
          win_name = "PL_Window";
          url = "http://www.tntlogistics.pl";
      } else if (country.options[country.selectedIndex].value == 'cn') 
      {  new_win = 0;
          win_name = "CN_Window";
          url = language + "/about_tnt/global_footprint/asia/china/";
      } else if (country.options[country.selectedIndex].value == 'in') 
      {  new_win = 0;
          win_name = "IN_Window";
          url = language + "/about_tnt/global_footprint/asia/india/";
      } else if (country.options[country.selectedIndex].value == 'id') 
      {  new_win = 0;
          win_name = "ID_Window";
          url = language + "/about_tnt/global_footprint/asia/indonesia/";
      } else if (country.options[country.selectedIndex].value == 'jp') 
      {  new_win = 0;
          win_name = "JP_Window";
          url = language + "/about_tnt/global_footprint/asia/japan/";
      } else if (country.options[country.selectedIndex].value == 'my') 
      {  new_win = 0;
          win_name = "MY_Window";
          url = language + "/about_tnt/global_footprint/asia/malaysia/";
      } else if (country.options[country.selectedIndex].value == 'sg') 
      {  new_win = 0;
          win_name = "SG_Window";
          url = language + "/about_tnt/global_footprint/asia/singapore/";
      } else if (country.options[country.selectedIndex].value == 'kr') 
      {  new_win = 0;
          win_name = "kr_Window";
          url = language + "/about_tnt/global_footprint/asia/south_korea/";
      } else if (country.options[country.selectedIndex].value == 'tw') 
      {  new_win = 0;
          win_name = "TW_Window";
          url = language + "/about_tnt/global_footprint/asia/taiwan/";
      } else if (country.options[country.selectedIndex].value == 'th') 
      {  new_win = 1;
          win_name = "TH_Window";
          url = "http://www.tntlogistics.co.th/";
      } else if (country.options[country.selectedIndex].value == 'vn') 
      {  new_win = 0;
          win_name = "VN_Window";
          url = language + "/about_tnt/global_footprint/asia/vietnam/";
      } else if (country.options[country.selectedIndex].value == 'nz') 
      {  new_win = 0;
          win_name = "NZ_Window";
          url = language + "/about_tnt/global_footprint/pacific/new_zealand/";
      } else if (country.options[country.selectedIndex].value == 'com') 
      {  new_win = 1;
          win_name = "TNT_Logistics_Window";
          url = "http://www.tntlogistics.com/";
      } 

      //-- INTRANET SITES ONLY VISIBLE ON TNT INTRANET
      else if (country.options[country.selectedIndex].value == 'bdws') 
      {  new_win = 1;
          win_name = "BDWS_Window";
          url = "http://10.225.1.101/bdws";
      }

      else if (country.options[country.selectedIndex].value == 'globe') 
      {  new_win = 1;
          win_name = "GLoBE_Window";
          url = "http://164.39.9.26/applications/globe/r5/r5globe.nsf?opendatabase&login";
      }

      else if (country.options[country.selectedIndex].value == 'northamerica') 
      {  new_win = 1;
          win_name = "North_America";
          url = "http://corp.tntlogistics.com";
      }

      else if (country.options[country.selectedIndex].value == 'loguk') 
      {  new_win = 1;
          win_name = "LogUK_Window";
          url = "http://10.225.1.83/";
      }
      else if (country.options[country.selectedIndex].value == 'tpgconnect') 
      {  new_win = 1;
          win_name = "TPGConnect_Window";
          url = "http://www.tpgconnect.com";
      }
      else if (country.options[country.selectedIndex].value == 'tpgsource') 
      {  new_win = 1;
          win_name = "TPGSource_Window";
          url = "http://www.tpgconnect.com/tpgsource";
      }
      else if (country.options[country.selectedIndex].value == 'tpgis') 
      {  new_win = 1;
          win_name = "TPGIS_Window";
          url = "http://tpgnet/Applications/Intranet/TPGIS_cm.nsf/intranethp/$first?opendocument";
      }
      else if (country.options[country.selectedIndex].value == 'financenet') 
      {  new_win = 1;
          win_name = "FinanceNet_Window";
          url = "http://164.39.43.45/applications/intranet/finance_cm.nsf/intranethp/$first?opendocument";
      }
      else if (country.options[country.selectedIndex].value == 'movingtheworld') 
      {  new_win = 1;
          win_name = "MovingtheWorld_Window";
          url = "http://www.movingtheworld.org/";
      }
      else if (country.options[country.selectedIndex].value == 'expressdhonet') 
      {  new_win = 1;
          win_name = "DHONet_Window";
          url = "http://164.39.43.45/applications/intranet/express_cm.nsf";
      }
      else if (country.options[country.selectedIndex].value == 'expressgamnet') 
      {  new_win = 1;
          win_name = "GAMNet_Window";
          url = "http://164.39.43.45/applications/intranet/gam_cm.nsf";
      }
      else if (country.options[country.selectedIndex].value == 'intranetmailnl') 
      {  new_win = 1;
          win_name = "Intranetmail_Window";
          url = "http://intranet.tpgpost.nl/main/index.asp";
      }

    
      features = "location,scrollbars,toolbar,titlebar,status,menubar,resizable=yes,screenX=0,screenY=0,height=" + ht + ",width=" + wd + ",left=0,top=0";

      // If goes to another website, open a new window
      if (new_win == 1) 
      {
         window.open(url,win_name, features);
      } else
      {
         window.location.href = url;
      }

   } // if country value is not ""
}