// JavaScript Document

var arNavOrderFeatured = [];
var arNavOrderType = [];
var arNavOrderAll = [];

arNavOrderFeatured[0] = "../sfmoma/sfmoma.html?mode=featured";
arNavOrderFeatured[1] = "../cca_graduate_center/cca_graduate_center.html?mode=featured";
arNavOrderFeatured[2] = "../twin_peaks/twin_peaks_residence.html?mode=featured";
arNavOrderFeatured[3] = "../turner_duckworth/turner_duckworth_offices.html?mode=featured";
arNavOrderFeatured[4] = "../cca_graduate_studios/cca_graduate_studios.html?mode=featured";
arNavOrderFeatured[5] = "../kbpw/kpbw_offices.html?mode=featured";

arNavOrderType[0] = "../cca_graduate_center/cca_graduate_center.html?mode=type";
arNavOrderType[1] = "../cca_graduate_studios/cca_graduate_studios.html?mode=type";
arNavOrderType[2] = "../childrens_day_school/childrens_day_school.html?mode=type";
arNavOrderType[3] = "../cca_jewett/cca_jewett_studios.html?mode=type";
arNavOrderType[4] = "../cca_helzel/cca_helzel_boardroom.html?mode=type";

arNavOrderType[5] = "../sfmoma/sfmoma.html?mode=type";
arNavOrderType[6] = "../slow_food_nation/slow_food_nation.html?mode=type";
arNavOrderType[7] = "../walden_studios/walden_mixed_use.html?mode=type";
arNavOrderType[8] = "../ann_hamilton_tower/ann_hamilton_tower.html?mode=type";
arNavOrderType[9] = "../moca_lbc/moca_at_luther_burbank_center.html?mode=type";
arNavOrderType[10] = "../mountain_hut/mountain_hut.html?mode=type";
arNavOrderType[11] = "../san_jose_state_university_art_museum/san_jose_state_university_art_museum.html?mode=type";

arNavOrderType[12] = "../turner_duckworth/turner_duckworth_offices.html?mode=type";
arNavOrderType[13] = "../kbpw/kpbw_offices.html?mode=type";
arNavOrderType[14] = "../angry_monkey/angry_monkey_offices.html?mode=type";

arNavOrderType[15] = "../poppybox/poppybox_gardens.html?mode=type";
arNavOrderType[16] = "../osho/osho_restaurant.html?mode=type";
arNavOrderType[17] = "../california_closets/california_closets.html?mode=type";
arNavOrderType[18] = "../ms_lingerie/marks_spencer_lingerie.html?mode=type";

arNavOrderType[19] = "../kokoris/kokoris_residence.html?mode=type";
arNavOrderType[20] = "../house_on_the_bay/house_on_the_bay.html?mode=type";
arNavOrderType[21] = "../sail_house/sail_house.html?mode=type";
arNavOrderType[22] = "../twin_peaks/twin_peaks_residence.html?mode=type";
arNavOrderType[23] = "../koren-burchiellaro/koren_burchiellaro.html?mode=type";
arNavOrderType[24] = "../scrap_house/scrap_house.html?mode=type";
arNavOrderType[25] = "../walden_caretaker/walden_caretaker_residence.html?mode=type";
arNavOrderType[26] = "../chestnut/chestnut_residence.html?mode=type";
arNavOrderType[27] = "../perkins-hebert/perkins-hebert_residence.html?mode=type";
arNavOrderType[28] = "../twin_flats/twin_flats_residence.html?mode=type";
arNavOrderType[29] = "../tan_fitzgerald/tan_fitzgerald.html?mode=type";            
	
arNavOrderAll[0] = "../sfmoma/sfmoma.html?mode=all";
arNavOrderAll[1] = "../slow_food_nation/slow_food_nation.html?mode=all";
arNavOrderAll[2] = "../childrens_day_school/childrens_day_school.html?mode=all";
arNavOrderAll[3] = "../kokoris/kokoris_residence.html?mode=all";
arNavOrderAll[4] = "../house_on_the_bay/house_on_the_bay.html?mode=all";
arNavOrderAll[5] = "../walden_studios/walden_mixed_use.html?mode=all";
arNavOrderAll[6] = "../ann_hamilton_tower/ann_hamilton_tower.html?mode=all";
arNavOrderAll[7] = "../sail_house/sail_house.html?mode=all";
arNavOrderAll[8] = "../cca_graduate_center/cca_graduate_center.html?mode=all";
arNavOrderAll[9] = "../twin_peaks/twin_peaks_residence.html?mode=all";
arNavOrderAll[10] = "../turner_duckworth/turner_duckworth_offices.html?mode=all";
arNavOrderAll[11] = "../koren-burchiellaro/koren_burchiellaro.html?mode=all";
arNavOrderAll[12] = "../scrap_house/scrap_house.html?mode=all";
arNavOrderAll[13] = "../walden_caretaker/walden_caretaker_residence.html?mode=all";
arNavOrderAll[14] = "../moca_lbc/moca_at_luther_burbank_center.html?mode=all";            
arNavOrderAll[15] = "../cca_graduate_studios/cca_graduate_studios.html?mode=all";          
arNavOrderAll[16] = "../mountain_hut/mountain_hut.html?mode=all";
arNavOrderAll[17] = "../chestnut/chestnut_residence.html?mode=all";       
arNavOrderAll[18] = "../san_jose_state_university_art_museum/san_jose_state_university_art_museum.html?mode=all";            
arNavOrderAll[19] = "../kbpw/kpbw_offices.html?mode=all";
arNavOrderAll[20] = "../poppybox/poppybox_gardens.html?mode=all";
arNavOrderAll[21] = "../perkins-hebert/perkins-hebert_residence.html?mode=all";
arNavOrderAll[22] = "../osho/osho_restaurant.html?mode=all";
arNavOrderAll[23] = "../angry_monkey/angry_monkey_offices.html?mode=all";
arNavOrderAll[24] = "../california_closets/california_closets.html?mode=all";              
arNavOrderAll[25] = "../twin_flats/twin_flats_residence.html?mode=all";
arNavOrderAll[26] = "../tan_fitzgerald/tan_fitzgerald.html?mode=all";
arNavOrderAll[27] = "../ms_lingerie/marks_spencer_lingerie.html?mode=all";
arNavOrderAll[28] = "../cca_jewett/cca_jewett_studios.html?mode=all";
arNavOrderAll[29] = "../cca_helzel/cca_helzel_boardroom.html?mode=all";
	
//this guy handles getting URL parameters
function getURL( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}


function fnNavNext(strMode, strPosition, strDirection)
{
	var intPosition = ((parseInt(strPosition)) - 1);
	var arNavArray = [];
	
	//get the correct array for the view mode
	if(strMode == "featured") {
		arNavArray = arNavOrderFeatured.slice();
	}
	else if(strMode == "type") {
		arNavArray = arNavOrderType.slice();
	}
	else if(strMode == "all") {
		arNavArray = arNavOrderAll.slice();
	}
	
		
	//determine if we are moving forward or back
	if(strDirection == "f") {
		//make sure we're not at the end
		if(intPosition == arNavArray.length - 1) {
			window.location.href = arNavArray[0];
		}
		else {
			window.location.href = arNavArray[intPosition + 1];
		}
	}
	
	if(strDirection == "r") {
		//make sure we're not at the end
		if(intPosition == 0) {
			window.location.href = arNavArray[(arNavArray.length - 1)];
		}
		else {
			window.location.href = arNavArray[intPosition - 1];
		}
	}
	
	
}

