if(window)
{
	
	
	window.onload = loadlinks;
	
}


function loadlinks()
{
	
	
	loadfooterlinks();
	loadheaderlinks();
	
	//loadsearchengine();
}


function loadheaderlinks()
{
	var writerFooter = '';
	writerFooter +='<a style="color:#77858f"   href="http://www.' + StageURL()  +'" title="travelonomy-home" target="_self">home</a>'
	writerFooter +='<a style="color:#ac1e8a"   href="http://maps.' + StageURL()  +'/index.phtml" title="travelonomy-maps" target="_self">maps</a>'
	writerFooter +='<a style="color:#94c948; text-decoration:none"    href="http://hostels.' + StageURL()  +'" title="travelonomy-accommodation" target="_self">accommodation</a>'
	writerFooter +='<a style="color:#0099d9; "   href="http://activities.' + StageURL()  +'" title="travelonomy-activities" target="_self">activities</a>'
	writerFooter +='<a style="color:#77858f"   href="http://community.' + StageURL()  +'" title="travelonomy-community" target="_self">community				&nbsp;&raquo;</a>'
			
	writeIntoObject("header", writerFooter);
}
function loadsearchengine()
{
	
   
   var currentstage = StageURL();

   document.write('<sc'+'ript');
   document.write(' type="text/javascript"');
   document.write(' language="JavaScript"');
   
   if(currentstage == 'local')
   {
    document.write(' src="http://securebookings.travelfat.local.doloforge.com/Scripts/activities/searchengine_portal_vertical.js"');
   }
   else if(currentstage == 'test')
   {
    document.write(' src="http://securebookings.travelfat.test.doloforge.com/Scripts/activities/searchengine_portal_vertical.js"');
   }
   else
   {
    document.write(' src="http://securebookings.travelonomy.com/Scripts/activities/searchengine_portal_vertical.js"');
   }
   document.write(' >');
   document.write('</sc'+'ript>'); 
   
	document.write('<sc'+'ript');
	document.write(' type="text/javascript"');
	document.write(' language="JavaScript"');
	     
	  if(currentstage == 'local')
	  {
	   document.write(' src="http://securebookings.travelfat.local.doloforge.com/countrydata/activities/travelfatdata.js');
	  }
	  else if(currentstage == 'test')
	  {
	   document.write(' src="http://securebookings.travelfat.test.doloforge.com/countrydata/activities/travelfatdata.js"');
	  }
	  else
	  {
	   document.write(' src="http://securebookings.travelonomy.com/countrydata/activities/travelfatdata.js"');
	  }
	  document.write(' >');
	  document.write('</sc'+'ript>');
   
}

function loadfooterlinks()
{
	var writerFooter = '';
	writerFooter += '<table  align="center" class = "TopLinksTable">'
	writerFooter += '<tr class="TopLinksHeaders"><td width="134" style="color:#ac1e8a;">Destinations Top 5:</td>'
	writerFooter += '<td width="304" class = "TopLinks">'
	writerFooter += '<a href="http://maps.' + StageURL()  +'/index.phtml?S=Australia" title="travelonomy-Australia" target="_self">Australia;</a>&nbsp;'
	writerFooter += '<a href="http://maps.' + StageURL()  +'/index.phtml?S=New Zealand" title="travelonomy-Australia" target="_self">New Zealand;</a>&nbsp;'
	writerFooter += '<a href="http://maps.' + StageURL()  +'/index.phtml?S=Italy" title="travelonomy-Australia" target="_self">Italy;</a>&nbsp;'
	writerFooter += '<a href="http://maps.' + StageURL()  +'/index.phtml?S=USA" title="travelonomy-USA" target="_self">USA;</a>&nbsp;'
	writerFooter += '<a href="http://maps.' + StageURL()  +'/index.phtml?S=Sydney" title="travelonomy-Sydney" target="_self">Sydney;</a>&nbsp;</td>'
	writerFooter += '</tr>'

	writerFooter += '<tr class="TopLinksHeaders"><td style="color:#94c948;">Places to Stay Top 5:</td>'
	writerFooter += '<td class = "TopLinks">'
	writerFooter += '<a href="http://maps.' + StageURL()  +'/index.phtml?S=El Paso Hostel" title="travelonomy-El Paso" target="_self">El Paso Hostel;</a>&nbsp;'
	writerFooter += '<a href="http://maps.' + StageURL()  +'/index.phtml?S=Calypso Backpackers" title="travelonomy-Calypso" target="_self">Calypso;</a>&nbsp;'
	writerFooter += '<a href="http://maps.' + StageURL()  +'/index.phtml?S=Auckland Central Backpackers (ACB)" title="travelonomy-ACB" target="_self">ACB;</a>&nbsp;'
	writerFooter += '<a href="http://maps.' + StageURL()  +'/index.phtml?S=Plus Camping Roma" title="travelonomy-Camping Roma" target="_self">Camping Roma;</a>&nbsp;'
	writerFooter += '<a href="http://maps.' + StageURL()  +'/index.phtml?S=Rainforest Backpackers" title="travelonomy-Rainforest Backpackers" target="_self">Rainforest Backpackers;</a>&nbsp;'
	writerFooter += '</td></tr>'

	writerFooter += '<tr class="TopLinksHeaders"><td style="color:#0099d9">Activities Top 5:</td>'
	writerFooter += '<td class = "TopLinks">'
	writerFooter += '<a href="http://maps.' + StageURL()  +'/index.phtml?S=Kayaking" title="travelonomy-Fitzroy Island Sea Kayaking" target="_self">Kayaking;</a>&nbsp;'
	writerFooter += '<a href="http://maps.' + StageURL()  +'/index.phtml?S=Sailing" title="travelonomy-Sailing" target="_self">Sailing;</a>&nbsp;'
	writerFooter += '<a href="http://maps.' + StageURL()  +'/index.phtml?S=Skydive" title="travelonomy-Skydive" target="_self"> Skydive;</a>&nbsp;'
	writerFooter += '<a href="http://maps.' + StageURL()  +'/index.phtml?S=Rafting" title="travelonomy-Rafting" target="_self">Rafting;</a>&nbsp;'
	writerFooter += '<a href="http://maps.' + StageURL()  +'/index.phtml?S=Bungy" title="travelonomy-Bungy" target="_self">Bungy;</a>&nbsp;'
	writerFooter += '</td></tr>'
	writerFooter += '</table>' 
	writerFooter += '<br />'

	writerFooter += '<div class="JoinLinks">'
	writerFooter += '<a href="http://hannah.wufoo.com/forms/customer-feedback-form/">Support Centre</A>&nbsp;|&nbsp;'
	writerFooter += '<a href="http://corporate.'+ StageURL() +'">Corporate</A>&nbsp;|&nbsp;'
	writerFooter += '<a href="http://accommodationjoinnow.travelfat.com">Join Now</A>'
	writerFooter += '<a href="http://accommodationjoinnow.travelfat.com"><img class="JoinLinksImages" src="images/joinnow_miniBTN-purple.jpg" alt="travelonomy"/></A>&nbsp;|&nbsp;'
	//writerFooter += 'Login &nbsp;'
	writerFooter += '<a href="http://backoffice.'+ StageURL() +'">Login</A>'
	//writerFooter += '<a href="http://activities.' + StageURL();  +'/Backoffice/">Activities</A>&nbsp;'

	writerFooter += '</div>'
	
	writerFooter += '<div class="SocialLogos">'
	writerFooter += '<a href="http://community.' + StageURL()  +'"><img src="images/socail/blinklist.png" alt="blinklist"/></a>'
	writerFooter += '<a href="http://community.' + StageURL()  +'"><img src="images/socail/delicious.png" alt="del.icio.us"/></a>'
	writerFooter += '<a href="http://community.' + StageURL()  +'"><img src="images/socail/digg.png" alt="digg"/></a>'
	writerFooter += '<a href="http://community.' + StageURL()  +'"><img src="images/socail/furl.png" alt="Furl"/></a>'
	writerFooter += '<a href="http://community.' + StageURL()  +'"><img src="images/socail/newsvine.png" alt="Newsvine"/></a>'
	writerFooter += '<a href="http://community.' + StageURL()  +'"><img src="images/socail/reddit.png" alt="reddit"/></a>'
	writerFooter += '<a href="http://community.' + StageURL()  +'"><img src="images/socail/feed-icon.gif" alt="RSS"/></a>'
	writerFooter += '<a href="http://community.' + StageURL()  +'"><img src="images/socail/travelfat.png" alt="travelonomy"/></a>'
	writerFooter +='<div>'

	writeIntoObject("footer", writerFooter);
}
function StageURL()
{
	var currentstage = window.location.href.split('.')[2];
	var URL = "travelonomy.com"
	/*if(currentstage == 'local')
	{
	  URL = "travelonomy.local.doloforge.com"
	}
	else if(currentstage == 'test')
	{
	  URL = "travelonomy.test.doloforge.com"
	}*/
	
	return URL;
}

function writeIntoObject(objectName, htmlText)
{
	var object = getObject(objectName);

	if(object)
	{
		object.innerHTML = (htmlText == null) ? ' ' : htmlText;
	}
}

function getObject(objId)
{
	var obj = null;
	
	if(document.getElementById)
	{
		obj = document.getElementById(objId);
	}

	return obj;
}
function includeScript(parent, filename)
{
	var head = document.getElementsByTagName('head');

	if(head[0])
	{
		var script = document.createElement('script');

		if(script)
		{
			script.type = 'text/javascript';
			script.src =  filename;
			
			head[0].appendChild(script);
		}
	}
}