// Browser Window Size and Position
// copyright Stephen Chapman, 3rd Jan 2005, 8th Dec 2005
function pageWidth() {
	return window.innerWidth != null ? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
}
function pageHeight() {
	return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;
}
function posLeft() {
	return typeof window.pageXOffset != 'undefined' ? window.pageXOffset :document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;
}
function posTop() {
	return typeof window.pageYOffset != 'undefined' ?  window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;
}
function posRight() {
	return posLeft()+pageWidth();
} 
function posBottom() {
	return posTop()+pageHeight();
}
             
             
/////////////////////////////////             
if(myPath == "_root"){
	myPath = "";
}else{
	var myPath = "../";
}




/////////////////////////////////             
// div writers added by P Brandt, www.tinCrow.co.za 2009              
function fnWriteDiv(which){
	
	var myTop = 69;
	var contentH = (pageHeight() - (69 + 35)) + "px";
	var myZIndex = 12;

	if(which == 'peopleHome'){
		myTop = 69;//46;
		myZIndex = 0;
		contentH = (pageHeight() - (46 + 35)) + "px";
		var contentW = (pageWidth()) + "px";
	}else if(which == 'news'){
		var contentW = (pageWidth() - 350) + "px";
	}else if(which == 'areasHome'){
		var contentW = (pageWidth()) + "px";
	}else if(which == 'areas'){
		var contentW = (pageWidth() - 470) + "px";
	}else if(which == 'people'){
		var contentW = (pageWidth() - 350) + "px";
	}else if(which == 'feedback'){
		var contentW = (pageWidth() - 350) + "px";
	}else if(which == 'sitemap'){
		var contentW = (pageWidth() - 400) + "px";
	}
	
	document.write('<div style="position:relative; float:right; top:' + myTop + 'px; width:' + contentW + '; height:' + contentH + ';'
		+ 'overflow:auto; scroll:auto; border: 0px solid green; z-index:' + myZIndex + ';">');
		//+ 'scrollbar-face-color: white; scrollbar-shadow-color: white; scrollbar-highlight-color: white; scrollbar-3dlight-color: black; scrollbar-darkshadow-color: black; scrollbar-track-color:white; scrollbar-arrow-color:black;	">');
		//Note: scrollbar styles coded in above for Opera
}


function fnWriteLeftDiv(){
	document.write("<div style='position:absolute; top:" + (pageHeight()-401) + "px; left:50px; overflow:visible; border:0px solid red; z-index:11; scroll:none;'>");
}
   
   
   
//function fnBot(bot){
//	//var myName = "bgBot" + bot;
//	var myName = "bgBot1";	
	
//	var numRand = Math.floor(Math.random() * 12)+1;	//alert(numRand);
//	var strImageName = myPath + "images/by" +  bot + "/by" + numRand + ".gif"; 
	
//	var myOffset;
//	bot == 1 ? myOffset = 460: myOffset = 330;
//	//check that it doesn;t cause a line break on smaller screens
//	myOffset+446 > pageWidth() ? myOffset = 60: myOffset;
	
//	document.write('<div style="position:absolute; top:' + (pageHeight()-35) + 'px; width:' + pageWidth() + "px" + '; height:35px; border: 0px solid green;'
//		+ ' background-image: url('+ myPath +'images/' +  myName + '.gif); background-repeat: repeat-x; z-index:15;">'
//		+ '<img src="' + myPath + 'images/clear.gif" width=' + myOffset + ' height=35 border=0><img src=' + strImageName + ' width=446 height=35 border=0 alt="edward nathan sonnenbergs" title="edward nathan sonnenbergs">'
//		+ '</div>');
//}
function fnBot(bot){
	var myName = "bgLTFiP";	
	
	
	var numRand = Math.floor(Math.random() * 12)+1;	//alert(numRand);
	var strImageName = myPath + "images/by" +  bot + "/by" + numRand + ".gif"; 
	
	var myOffset;
	bot == 1 ? myOffset = 460: myOffset = 330;
	//check that it doesn;t cause a line break on smaller screens
	myOffset+446 > pageWidth() ? myOffset = 60: myOffset;
	
	document.write('<div style="position:absolute; top:' + (pageHeight()-35) + 'px; width:' + pageWidth() + "px" + '; height:35px; border: 0px solid green; background-color:#f4e702;'
			+ ' background-image: url('+ myPath +'images/' +  myName + '.jpg); background-repeat: no-repeat; background-position: right; z-index:15;">'
			+ '<span><span class="footerLTFiP"><b class="footerLTFiP footerAfrica">africa</b><b class="footerLTFiP footerIP">IP</b><b class="footerLTFiP footerForensics">forensics</b><b class="footerLTFiP footerTax">tax</b><b class="footerLTFiP footerLaw">law</b><span class="footerRating"><b class="footerB">level 3</b> BBBEE contributor <b class="footerB">AA</b> rating</span></span></span>'
			+ ''
		+ '</div>');
}


function fnGetMyWidth(){
		return (pageWidth());
}
function fnGetMyHeight(){
		return (pageHeight());
}

/////////////////////////
//function called when resizing:
function fnReload(){
	//alert('j');
	location.reload(true);
}
