var flashLinks = {
	skyMountain: 'http://www1.southafrica.net/Cultures/sv-SE/consumer.southafrica.net/Things+to+Do/Attractions/NaturalAttractions/Journey+to+a+Mountain+in+the+Sky.htm?SEARCH=%2fcultures%2fsv-SE%2fconsumer.southafrica.net%2fsearchresults.aspx%3fKeyword%3dmountain%2520in%2520the%2520sky',
	tableMountainHikingTrail: 'http://www1.southafrica.net/Cultures/sv-SE/consumer.southafrica.net/Why+South+Africa/Media+Gallery/New+Table+Mountain+Hiking+Trail.htm?SEARCH=%2fcultures%2fsv-SE%2fconsumer.southafrica.net%2fsearchresults.aspx%3fKeyword%3dtable%2520mountain',
	capePeninsula: 'http://www1.southafrica.net/Cultures/sv-SE/consumer.southafrica.net/Plan+your+Trip/Example+Itineraries/Cape+Peninsula+Example+Itinerary+1.htm?SEARCH=%2fcultures%2fsv-SE%2fconsumer.southafrica.net%2fsearchresults.aspx%3fKeyword%3dtable%2520mountain',
	greenJohannesburg: 'http://www1.southafrica.net/Cultures/sv-SE/consumer.southafrica.net/Things+to+Do/Attractions/NaturalAttractions/Green+Johannesburg.htm?SEARCH=%2fcultures%2fsv-SE%2fconsumer.southafrica.net%2fsearchresults.aspx%3fKeyword%3djohannesburg',
	awakeningTheGiant: 'http://www1.southafrica.net/Cultures/sv-SE/consumer.southafrica.net/Things+to+Do/Attractions/CulturalHistoricReligiousSites/Awakening+the+Giant.htm?SEARCH=%2fcultures%2fsv-SE%2fconsumer.southafrica.net%2fsearchresults.aspx%3fKeyword%3djohannesburg',
	tasteOfSoweto: 'http://www1.southafrica.net/Cultures/sv-SE/consumer.southafrica.net/Plan+your+Trip/Where+to+Stay/A+Taste+of+Soweto.htm?SEARCH=%2fcultures%2fsv-SE%2fconsumer.southafrica.net%2fsearchresults.aspx%3fKeyword%3djohannesburg',
	conflictOfNations: 'http://www1.southafrica.net/Cultures/sv-SE/consumer.southafrica.net/Things+to+Do/Attractions/CulturalHistoricReligiousSites/The+Battles+-+Conflict+of+Nations.htm',
	goldenMile: 'http://www1.southafrica.net/Cultures/sv-SE/consumer.southafrica.net/Things+to+Do/Activities/Entertainment/The+New+Golden+Mile.htm?SEARCH=%2fcultures%2fsv-SE%2fconsumer.southafrica.net%2fsearchresults.aspx%3fKeyword%3dkwazulu',
	bigFiveSensations: 'http://www1.southafrica.net/Cultures/sv-SE/consumer.southafrica.net/Why+South+Africa/Best+of+SA/Experiences/Big+Five+Sensations.htm?SEARCH=%2fcultures%2fsv-SE%2fconsumer.southafrica.net%2fsearchresults.aspx%3fKeyword%3dkwazulu',
	whaleOfATime: 'http://www1.southafrica.net/Cultures/sv-SE/consumer.southafrica.net/Why+South+Africa/Best+of+SA/Experiences/A+Whale+of+a+Time.htm?SEARCH=%2fcultures%2fsv-SE%2fconsumer.southafrica.net%2fsearchresults.aspx%3fKeyword%3dwildlife',
	kgalagadi: 'http://www1.southafrica.net/Cultures/sv-SE/consumer.southafrica.net/Things+to+Do/Attractions/NaturalAttractions/Kgalagadi+Transfrontier+Park.htm?SEARCH=%2fcultures%2fsv-SE%2fconsumer.southafrica.net%2fsearchresults.aspx%3fKeyword%3dwildlife',
	takeToTheTrees: 'http://www1.southafrica.net/Cultures/sv-SE/consumer.southafrica.net/Things+to+Do/Activities/WildlifeActivities/Take+to+the+Trees.htm',
	godsWindow: 'http://www1.southafrica.net/Cultures/sv-SE/consumer.southafrica.net/Things+to+Do/Attractions/NaturalAttractions/Gods+Window+on+the+World.htm?SEARCH=%2fcultures%2fsv-SE%2fconsumer.southafrica.net%2fsearchresults.aspx%3fKeyword%3dblyde',
	aLandWhereTimeStoodStill: 'http://www1.southafrica.net/Cultures/sv-SE/consumer.southafrica.net/Places+to+Go/Routes/The+Ivory+Route.htm?SEARCH=%2fcultures%2fsv-SE%2fconsumer.southafrica.net%2fsearchresults.aspx%3fKeyword%3dblyde',
	krugerToCanyon: 'http://www1.southafrica.net/Cultures/sv-SE/consumer.southafrica.net/Things+to+Do/Attractions/NaturalAttractions/Kruger+to+Canyon+Biosphere+Reserve.htm?SEARCH=%2fcultures%2fsv-SE%2fconsumer.southafrica.net%2fsearchresults.aspx%3fKeyword%3dblyde'	
}

var tjs_img; 
var tjs_src=urlPrefix + "images/global-landing-travel-trade.jpg";   // speed test
//tjs_src= 'http://d629118.host202.hostafrica.org/templates/geo table-less/images/global-landing-travel-trade.jpg';	// testing speed test
var tjs_size=20480;		 // Size of picture
var tjs_delai=33; 
var tjs_nb=-1; 
var tjs_delai_max=20000; // 
var timer1=0; var timer2=0;
var tjs_fin="";
var tot_tme;
var totTme;

function callURL(tag) {
	urchinTracker('/' + tag); // url's MUST begin with a "/"
	document.location.href = eval('flashLinks.' + tag);
}

function gel(id) {
	return document.getElementById(id);
}

function Checkkos() {
	// launch cx verification
	tjs_img=new Image();
	timer1=new Date();
	timer1=timer1.getTime();
	tjs_img.src=tjs_src+"?dummy="+timer1;
	tjs_nb=0;
	setTimeout(SpeedTimeCal,tjs_delai);
}

function SpeedTimeCal() {
	var anim="-"
	tjs_nb++;
		
	if (tjs_nb*tjs_delai>=tjs_delai_max) { // Fin de la dure maxi
		tjs_fin=EvalConnexion(0);
		totTme=Number(tjs_fin);
	} else {
		if (tjs_img.complete) {
			timer2=new Date(); timer2=timer2.getTime();
			//alert(tjs_size+', '+(timer2-timer1));
			tjs_fin=EvalConnexion(tjs_size/(timer2-timer1));
			totTme=Number(tjs_fin);
		} else {
			setTimeout(SpeedTimeCal,tjs_delai);
			return;
		}
	}
	speedTest();								// calc which Flash to display
	addFlvPlayer(flaToLoad, flvToLoad);			
}

function EvalConnexion(kos) {
	tjs_nb=-1;
	res=1;
	if ( kos < 15 ) {
		res=1;
	} else if ( 25 > kos >= 15 ) {
		res=2;
	} else if ( kos >= 25 ) {
		res=3;
	}
	return res;
}
Checkkos();

// Copied from the 2010 sample site and adapted a little

var D_Day = new Date("11 June 2010 08:00:00 GMT+2");

function toSt(n){
	s=""
	if(n<10) s+="0";
	return s+n.toString();
}

function countdown(){
	if ( !gel('theDay') ) return;
	d = new Date();
	count = Math.floor((D_Day.getTime()-d.getTime())/1000);
	if(count <= 0)
	{
		gel("theDay").innerHTML  ="----";
		gel("theHour").innerHTML  ="--";
		gel("theMinute").innerHTML  ="--";
		gel("theSecond").innerHTML  ="--";
		return;
	}
  
	gel("theSecond").innerHTML = toSt(count%60);
	count=Math.floor(count/60);
	gel("theMinute").innerHTML = toSt(count%60)  + ' ';
	count=Math.floor(count/60);
	gel("theHour").innerHTML = toSt(count%24) + ' ';
	count=Math.floor(count/24);
	gel("theDay").innerHTML = count + ' ';
	setTimeout("countdown()",500);
}
		
function addFlvPlayer(swf, path) {
	var songinfo = {flvPath:path};
	var params = {wmode:'transparent', allowScriptAccess:'sameDomain'};
	swfobject.embedSWF(swf, 'flvinner', '624', '335', '9.0.0', urlPrefix + 'expressinstall.swf', songinfo, params, {id: 'flv_player'});
}

var randomnumber = Math.floor(Math.random()*6 + 1);
var randomnumber2 = Math.floor(Math.random()*2 + 1);

/*
	* default swf to load handles flv's
	* low swf handles, frame based file
	* set the flv to load, the base swf will then progressivly load and play the flv
	*/
var flaToLoad = 'video_life_worth_telling_lowres.swf';
var flvToLoad = '0';

function speedTest() {
	if (totTme == 3) {		// fast connection
		flaToLoad = "video_life_worth_telling_base.swf";
		flvToLoad = "768x440_01.flv";
	} 
	if (totTme == 2) {		// medium connection
		flaToLoad = "video_life_worth_telling_base.swf";
		flvToLoad = "768x440_011.flv";
	}
	if (totTme == 1) {		// slow connection
		flaToLoad = "video_life_worth_telling_lowres.swf";
		flvToLoad = "0";
	}
	
	flaToLoad = (flaToLoad.indexOf('.swf') > -1)?urlPrefix + flaToLoad:flaToLoad;
	flvToLoad = (flvToLoad.indexOf('.flv') > -1)?urlPrefix + flvToLoad:flvToLoad;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function bodyOnLoad() {
	if ( !gel("shadowBottom") ) {
		setTimeout(bodyOnLoad, 40);
	} else {
		sIFR.replaceElement(named({sSelector:"h1", sFlashSrc: urlPrefix + "/flash/mundosans.swf"}));
		//countdown();
	}
}

setTimeout(bodyOnLoad, 40);