<!--
//preload --------------------------------------------------
if(document.images)
{
  var image_array = new Array();
  var path = 'http://www.placesforafrica.com/images/nav/';

  image_array[0] = path + "home-on.gif";
  image_array[1] = path + "search-on.gif";
  image_array[2] = path + "advertise-on.gif";
  image_array[3] = path + "contact-us-on.gif";

  var preload_image = new Array ();
 
  for(var i=0; i<image_array.length; i++)
  {
    preload_image[i]= new Image();
    preload_image[i].src = image_array[i];
  }
}

function rollover(name, filename)
{
  var fullpath = 'http://www.placesforafrica.com/images/nav/' + filename;
  document.images[name].src = fullpath;
}

//bookmark --------------------------------------------------
function bkmrk(url, title)
{
	if(window.sidebar)
	{ 
		window.sidebar.addPanel(title, url,""); 
	}
	else if(document.all)
	{ 
		window.external.AddFavorite(url, title); 
	}
	else if(window.opera && window.print)
	{ 
		return true; 
	}	
}

//travel bag and share --------------------------------------------------
function subnavFrame()
{
	document.write('<div id="bkglayer"></div>');
	document.write('<div id="tblayer"></div>');
	//document.write('<div id="shlayer"></div>');
}

function issetCookie(name)
{
	if(document.cookie.length > 0)
  	{
  		c_start=document.cookie.indexOf(name + "=");
  		if(c_start!=-1)
    	{
			c_start=c_start + name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
    	}
  	}
	return "";
}

//check if cookie has been set
var checkcookie = issetCookie('pfatb_list');
if(checkcookie == "") //cookie not set
{
	document.cookie = "pfatb_list=0; path=/";
}

function readCookie(name)
{  
	var cookiename = name + "=";  
	var ca = document.cookie.split(';');  
	for(var i=0;i < ca.length;i++)  
	{  
		var c = ca[i];  
		while(c.charAt(0)==' ') c = c.substring(1,c.length);  
		if(c.indexOf(cookiename) == 0) return c.substring(cookiename.length,c.length);  
	}  
	return null;  
}

function numentriesCookie()
{
	var numentriescookie = readCookie('pfatb_list');
	var numentriescookie_array = numentriescookie.split("_");
	var numentries = 0;
	while(numentries < numentriescookie_array.length)
 	{
  		numentries+=1;
  	}
	return numentries-1; //remove an extra 1
}

function additemTB(pfaURL)
{
	var addcookiecontent = readCookie('pfatb_list');
	addcookiecontent = addcookiecontent + "_" + pfaURL;
	document.cookie = "pfatb_list="+addcookiecontent+"; path=/";
	
	document.getElementById('showbtn-' + pfaURL).innerHTML = "<img src=\"../images/icons/remove-sm.gif\" width=\"16\" height=\"16\">";
	document.getElementById('showlink-' + pfaURL).innerHTML = "<a class=\"results-nav-link\" onmouseover=\"this.style.cursor='pointer';\" onClick=\"removeitemTB('"+pfaURL+"')\">Remove from Travel Bag</a>";

	document.getElementById('showlinks').innerHTML = "<a class=\"nav-link\" onmouseover=\"this.style.cursor='pointer'; this.style.textDecoration='underline';\" onmouseout=\"this.style.textDecoration='none';\" onClick=\"showTBLayer()\">View Travel Bag ("+numentriesCookie()+")</a>";
}

function removeitemTB(pfaURL)
{
	var removecookiecontent = readCookie('pfatb_list');
	removecookiecontent = removecookiecontent.replace("_" + pfaURL, "");
	document.cookie = "pfatb_list="+removecookiecontent+"; path=/";
	
	document.getElementById('showbtn-' + pfaURL).innerHTML = "<img src=\"../images/icons/add-sm.gif\" width=\"16\" height=\"16\">";
	document.getElementById('showlink-' + pfaURL).innerHTML = "<a class=\"results-nav-link\" onmouseover=\"this.style.cursor='pointer';\" onClick=\"additemTB('"+pfaURL+"')\">Add to Travel Bag</a>";

	document.getElementById('showlinks').innerHTML = "<a class=\"nav-link\" onmouseover=\"this.style.cursor='pointer'; this.style.textDecoration='underline';\" onmouseout=\"this.style.textDecoration='none';\" onClick=\"showTBLayer()\">View Travel Bag ("+numentriesCookie()+")</a>";
}

function showTBLayer()
{
	document.getElementById('bkglayer').className='showbkglayer';
	document.getElementById('bkglayer').style.visibility='visible';
	
	var winH = parent.document.body.scrollHeight;	
	document.getElementById('bkglayer').style.height = winH + "px";

	document.getElementById('tblayer').innerHTML = '<iframe src="http://www.placesforafrica.com/includes/travel-bag.php" width="782" height="290" scrolling="no" frameborder="0" marginheight="0" marginwidth="0">Your browser does not support iframes.</iframe>';
	document.getElementById('tblayer').className='showtblayer';
	document.getElementById('tblayer').style.visibility='visible';
		
	//hide all dropdowns on the page
    for (f = 0; f < parent.document.forms.length; f++)
    {
        var elements = parent.document.forms[f].elements;
        for (e = 0; e < elements.length; e++)
        {
            if (elements[e].type == "select-one")
            {
                elements[e].style.display = 'none';
            }
        }
    }
}

function hideTBLayer()
{
	document.getElementById('bkglayer').style.visibility='hidden';
	document.getElementById('bkglayer').style.height = 100 + "%";
	
	document.getElementById('tblayer').style.visibility='hidden';
	
	//show all dropdowns on the page again
	for (f = 0; f < document.forms.length; f++)
    {
        var elements = document.forms[f].elements;
        for (e = 0; e < elements.length; e++)
        {
            if (elements[e].type == "select-one")
            {
                elements[e].style.display = 'inline';
            }
        }
    }
	
	//location.reload(false); //need this so parent page reloads, to show correct add/remove for travel bag	
}

/*function showSHLayer()
{
	document.getElementById('bkglayer').className='showbkglayer';
	document.getElementById('bkglayer').style.visibility='visible';
	
	var winH = parent.document.body.scrollHeight;	
	document.getElementById('bkglayer').style.height = winH + "px";

	document.getElementById('shlayer').innerHTML = '<iframe src="http://www.placesforafrica.com/includes/share.php" width="462" height="298" scrolling="no" frameborder="0" marginheight="0" marginwidth="0">Your browser does not support iframes.</iframe>';
	document.getElementById('shlayer').className='showshlayer';
	document.getElementById('shlayer').style.visibility='visible';
	
	//hide all dropdowns on the page
    for (f = 0; f < parent.document.forms.length; f++)
    {
        var elements = parent.document.forms[f].elements;
        for (e = 0; e < elements.length; e++)
        {
            if (elements[e].type == "select-one")
            {
                elements[e].style.display = 'none';
            }
        }
    }
}

function hideSHLayer()
{
	document.getElementById('bkglayer').style.visibility='hidden';
	document.getElementById('bkglayer').style.height = 100 + "%";
	
	document.getElementById('shlayer').style.visibility='hidden';
	
	//show all dropdowns on the page again
	for (f = 0; f < document.forms.length; f++)
    {
        var elements = document.forms[f].elements;
        for (e = 0; e < elements.length; e++)
        {
            if (elements[e].type == "select-one")
            {
                elements[e].style.display = 'inline';
            }
        }
    }	
}*/

//scroller --------------------------------------------------
scrollStep=1

timerLeft=""
timerRight=""

function scrollDivRight(id)
{
  clearTimeout(timerLeft)
  document.getElementById(id).scrollLeft-=scrollStep
  timerLeft=setTimeout("scrollDivRight('"+id+"')",10)
}

function scrollDivLeft(id)
{
  clearTimeout(timerRight) 
  document.getElementById(id).scrollLeft+=scrollStep
  timerRight=setTimeout("scrollDivLeft('"+id+"')",10)
}

function stopMe()
{
  clearTimeout(timerRight) 
  clearTimeout(timerLeft)
}

//prevent right click --------------------------------------------------
/*function clickIE()
{
	if(document.all)
	{
		alert("© PlacesForAfrica.com");		
		return false;
	}	
}

function clickNS(e)
{
	if(document.layers||(document.getElementById&&!document.all))
	{
		if(e.which==2||e.which==3)
		{
			alert("© PlacesForAfrica.com");			
			return false;
		}
	}	
}

if(document.layers)
{
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown=clickNS;
}
else
{
	document.onmouseup=clickNS;
	document.oncontextmenu=clickIE;
}*/
//-->
