var currentSection;
var pageFolder;

function getCurrentSection(){

	pathis=window.location.href;
	new_array=pathis.split("/");
	pageFolder=new_array[3];
	
	currentSection=0;
	if(pageFolder=="development"){
		currentSection=1;
	}else if(pageFolder=="brokerage"){
		currentSection=2;
	}else if(pageFolder=="available" ){
		currentSection=3;
	}else if(pageFolder=="affiliated"){
		currentSection=4;
	}
	//for loopnet
	if(new_array[2]=="www.loopnet.com" || new_array[6]=="loopnet.com"){
			currentSection=3;
	}

}

//properties image gallery 
function showLargePhoto(imageSrc){
	pathis=window.location.href;
	new_array=pathis.split("/");
	if(new_array[3]=="development"){
		newSrc='/'+new_array[3]+'/'+new_array[4]+'/'+new_array[5]+'/images/'+imageSrc;
	}

	document.getElementById("largePhoto").src=newSrc;
}

//This styles all links within the secondaryNav div, and creates onMouse events for the TDs.
function styleSecondaryNav(){	
	var secondaryNavDefault=new Image();
	var secondaryNavHover=new Image();
	secondaryNavDefault.src="http://www.tnrg.net/common/images/secondaryNavArrow.gif";
	secondaryNavHover.src="http://www.tnrg.net/common/images/secondaryNavArrow2.gif";
	var theTable = document.getElementById('secondaryNavTable');
	var theRows = theTable.getElementsByTagName('tr');
	var theLinks = theTable.getElementsByTagName('a');
	var curr_row;
	
	for (curr_row = 0; curr_row < theRows.length; curr_row++)
	{
		currentpath=window.location.href;
		newpath=theLinks[curr_row].href;
		curr_array=currentpath.split("/");
		new_array=newpath.split("/");

		if(curr_array[curr_array.length-1]=="" || curr_array[curr_array.length-1]=="#" || curr_array[curr_array.length-1]=="default.aspx"){
				//remove empty value or test link
				curr_array.pop();
		}
		if(new_array[new_array.length-1]=="" || new_array[new_array.length-1]=="default.aspx"){
				new_array.pop();
		}
		//alert(curr_array[curr_array.length-1]+" = "+new_array[new_array.length-1]);
		theRow=curr_row;
		//theLinks[curr_row].className="secondaryNav";
		
			if(curr_array[curr_array.length-1]==new_array[new_array.length-1] && newpath.lastIndexOf('#')<0){
				theRows[curr_row].className="secondaryNavSelect secondaryNavTD";
				theLinks[curr_row].style.color="#000000";
			}else{
				theRows[curr_row].className="secondaryNavOut secondaryNavTD";
		
				theLinks[curr_row].onmouseover = function() {
					this.parentNode.className="secondaryNavOver secondaryNavTD";		
				}
				theLinks[curr_row].onmouseout = function() {
					this.parentNode.className="secondaryNavOut secondaryNavTD";	
				}
				
			}
	}
	
}

function stylePopupNav(){	
	//var secondaryNavDefault=new Image();
	//var secondaryNavHover=new Image();
	//secondaryNavDefault.src="/common/images/secondaryNavArrow.gif";
	//secondaryNavHover.src="/common/images/secondaryNavArrow2.gif";
	var theTable = document.getElementById('floatMenu');
	var theRows = theTable.getElementsByTagName('tr');
	var theLinks = theTable.getElementsByTagName('a');
	var curr_row;
	
	for (curr_row = 0; curr_row < theRows.length; curr_row++)
	{
		currentpath=window.location.href;
		newpath=theLinks[curr_row].href;
		curr_array=currentpath.split("/");
		new_array=newpath.split("/");

		//alert(curr_array[curr_array.length-1]+" = "+new_array[new_array.length-1]);
		theRow=curr_row;
		//theLinks[curr_row].className="secondaryNav";
		
				//theRows[curr_row].className="secondaryNavOut secondaryNavTD";
		
				theLinks[curr_row].onmouseover = function() {
					this.parentNode.className="floatMenuOver";		
				}
				theLinks[curr_row].onmouseout = function() {
					this.parentNode.className="floatMenuOut";	
				}
				
			
	}
	
}
