<!--
// This JavaScript is (c) Dooman Productions Pty. Ltd. 2003
// **== Magpies Rule ==**

// Define the expiry date for cookies.  This expiry date is set to five years
//---------------------------------------------------------------------------
var cookieExpDate = new Date();
cookieExpDate.setTime(cookieExpDate.getTime()+(5*365*24*3600*1000));


//==========================================================
// FUNCTION: startIndexPage
//-------------------------
//

function startIndexPage(){

var startCountry = '';

if (!(startCountry = recoverCookie('indexCountry'))){
   startCountry = 'AUS';
}

gotoIndexPage(startCountry,'',true);

}  // end of startIndexPage()


//==========================================================
// FUNCTION: changeCountry
//------------------------
//

function changeCountry(pmNewCountry){

var newCountry = stripDelimeters(pmNewCountry);

writeCookie('indexCountry',newCountry,cookieExpDate);
gotoIndexPage(newCountry,'../',false);

}  // end of changeCountry()


//==========================================================
// FUNCTION: gotoIndexPage
//------------------------
//

function gotoIndexPage(pmCountry,pmPrefix,pmStartWebsite){

var indexAUS = pmPrefix + 'en_aus/index.html';
var indexUSA = pmPrefix + 'en_usa/index.html';

switch(pmCountry){

   case 'AUS':
      if (pmStartWebsite){
         window.location.replace(indexAUS);
      }
      else{
         window.location.href = indexAUS;
      }
      break;

   case 'USA':
      if (pmStartWebsite){
         window.location.replace(indexUSA);
      }
      else{
         window.location.href = indexUSA;
      }
      break;

};

}  // end of gotoIndexPage()


//==========================================================
// FUNCTION stripDelimeters
//=========================
//

function stripDelimeters(pmStripText){

var retval = '';
var delimChar = '/';

pmStripText += '';

for (i=0;i < pmStripText.length;i++){
   if (pmStripText.charAt(i) != delimChar){
      retval += pmStripText.charAt(i);
   }
}

return retval;

} // end of function stripDelimeters


//-->

