/*	National Brokers Navigation Version 1.0
	Copyright (c) 2008 National Brokers
*/

/* Replace all occurances of a string
  (Parameters) totalValue:'complete string' 
		oldValue:'value to be replaced' newValue:'value used for replace' */

function Replace(totalValue,oldValue,newValue)
{
	while(totalValue.indexOf(oldValue) > -1)
		totalValue=totalValue.replace(oldValue,newValue);
			return totalValue;
}


/* Set first level navigations */
function Set1stLevelNav(TopNav, BottomNav) 
{
	divTopNav = document.getElementById(TopNav);	
	divBottomNav = document.getElementById(BottomNav);

	var context = "<a href='index.html'>Home</a> | <a href='.about.html'>About us</a> | <a href='buy.html'>Buy</a> | <a href='sell.html'>Sell</a> | <a href='invest.html'>Invest</a> | <a href='rent.html'>Rent</a> | <a href='contact.html'>Contact us</a>";

	if (divTopNav)
	{
		var output = Replace(divTopNav.innerHTML,"(::nav::)",context);;
		divTopNav.innerHTML = output;
	}

	if (divBottomNav)
	{
		var output = Replace(divBottomNav.innerHTML,"(::nav::)",context);;
		divBottomNav.innerHTML = output;
	}
}

/* Set second level navigations */
function Set2ndLevelNav(TopNav, BottomNav) 
{
	divTopNav = document.getElementById(TopNav);	
	divBottomNav = document.getElementById(BottomNav);

	var context = "<a href='../index.html'>Home</a> | <a href='../about.html'>About us</a> | <a href='../buy.html'>Buy</a> | <a href='../sell.html'>Sell</a> | <a href='../invest.html'>Invest</a> | <a href='../rent.html'>Rent</a> | <a href='../contact.html'>Contact us</a>";

	if (divTopNav)
	{
		var output = Replace(divTopNav.innerHTML,"(::nav::)",context);;
		divTopNav.innerHTML = output;
	}

	if (divBottomNav)
	{
		var output = Replace(divBottomNav.innerHTML,"(::nav::)",context);;
		divBottomNav.innerHTML = output;
	}
}

/* Set copyright info */
function SetCopyright(copyRight) 
{
	divCopyRight = document.getElementById(copyRight);	

	var context = "Copyright 2008-2010, National Brokers - All rights reserved.";

	if (divCopyRight)
	{
		var output = Replace(divCopyRight.innerHTML,"(::text::)",context);;
		divCopyRight.innerHTML = output;
	}
}

function qs( qsParm ) 
{
	var query = window.location.search.substring(1);
	var parms = query.split('&');
	for (var i=0; i<parms.length; i++) 
	{
		var pos = parms[i].indexOf('=');
		if (pos > 0) 
		{
			var key = parms[i].substring(0,pos);
			var val = parms[i].substring(pos+1);
			qsParm[key] = val;
		}
	}
}