// JavaScript Document

// Writes email links to protect from spam bots
function writeMLink(text, mailPrefix, mailDomain, domainType){  
	em = mailPrefix + "@" + mailDomain + "." + domainType;  
	if (text == null){ 
	 	text = em; 
	} 
	document.write("\n<br/><a href='mailto:"+em+"'>"+text+"</a>\n" ); 
}

function navToRandomPortfolioPg(section){
	
	// Define all the variable swe'll be working with
	var urlRoot 	='http://www.bremik.com/portfolio/'; 
	var urlArray 	= null; // TBD
	var randomUrl 	= null; // TBD
 

	// Determine whic set of URLs to select a random url from
	if (section == 'New Construction') {
	  urlArray =   new Array('New_Construction/Franklin_Park.php',
							'New_Construction/Lodge_Government_Camp.php',
							'New_Construction/Mt_Hood_ski.php' );
	} else if (section == 'Renovation') {
	  urlArray =   new Array('Renovation/White_Stag.php',
							'Renovation/Smith_Block.php',
							'Renovation/Freimann_Building.php',
							'Renovation/Grand_Central.php',
							'Renovation/Jones_Cash.php',
							'Renovation/Bateman_Carroll.php'); 
	} else if (section == 'Education') {
	  urlArray =   new Array('Education/UO_Portland.php',
							'Education/Tigard_High.php',
							'Education/ClearCreek_Middle.php',
							'Education/Gresham_High.php',
							'Education/Riverdale_High.php');   
	} else if (section == 'Mixed Use') {
	  urlArray =   new Array('Mixed_Use/Milepost.php',
							'Mixed_Use/Lodge_Government.php');
	} else if (section == 'Featured Projects') {
	  urlArray =   new Array('Renovation/Freimann_Building.php',
							 'Renovation/Grand_Central.php',
							 'New_Construction/Mt_Hood_ski.php',
							 'New_Construction/Lodge_Government_Camp.php',
							 'New_Construction/Franklin_Park.php',
							 'Renovation/White_Stag.php');
	} else if (section == 'Tenant Improvement') {
	  urlArray =   new Array('Tenant_Improvement/UO_Portland.php',
							'Tenant_Improvement/Venerable_Properties.php',
							'Tenant_Improvement/Foster_Dobbs.php',
							'Tenant_Improvement/Gigi_Salon.php',
							'Tenant_Improvement/Waterleaf_Architecture.php',
							'Tenant_Improvement/Govy_Store.php',
							'Tenant_Improvement/Lee_Eastman%20_Studio.php',
							'Tenant_Improvement/Grand_Central_banking.php',
							'Tenant_Improvement/Bonneville_Foundation.php',
							'Tenant_Improvement/Totem_Steel_office.php',
							'Tenant_Improvement/onPoint_Credit.php');  
	} else if (section == 'LEED/Green Building') {
	  urlArray =   new Array('LEED_Green_Building/');
	} else {
		// Let them know there's no section by this name
	    alert('This is not a known portfolio section name. See the JS If Else statement for details.');
	}
	 
	// Grab a random one and send them on their way 
	randomUrl =  urlArray[Math.floor(Math.random()*urlArray.length)]; 
	window.location = (urlRoot + randomUrl);
}