﻿/** main site scripts **/

var baseUrl = "http://architectscollaborative.net/";
var workImgDir = "images/work/";

var i = 0;
var j = 0;
var arrHomePics = new Array();
var preload_image_object = new Array();
arrHomePics[0] = "homepage/balcony-new.jpg";
arrHomePics[1] = "homepage/conference.jpg";
arrHomePics[2] = "homepage/door.jpg";
arrHomePics[3] = "homepage/exterior.jpg";
arrHomePics[4] = "homepage/front2.jpg";
arrHomePics[5] = "homepage/lobby3.jpg";
arrHomePics[6] = "homepage/reception.jpg";
arrHomePics[7] = "homepage/sign.jpg";
arrHomePics[8] = "homepage/Canopy3.jpg";

/** gallery **/
function galleryLoadImg(ldImg) {
	$("#sidebarCont").fadeOut("slow");
	setTimeout("galleryLoadImg2('"+ldImg+"')",0);
}

function galleryLoadImg2(ldImg) {
	//$("#sidebarCont").fadeIn("slow");
	$("#sidebarCont").html("");
	setTimeout("galleryLoadImg3('"+ldImg+"')",500);
	//$("#sidebarCont").fadeOut("slow");
}

function galleryLoadImg3(ldImg) {
	$("#sidebarCont").html("<img src='" + baseUrl + workImgDir + ldImg + "' border='0'>");
	$("#sidebarCont").fadeIn("slow");
}

function scrollGalNav(elemID, animFctr) {
	$("#galNavScrUp").animate({ opacity: 0.99 }, 1000);
	$("#galNavScrDn").animate({ opacity: 0.99 }, 1000);
	$(elemID).animate({ 
        marginTop: animFctr
	}, 1500);
}

function galScrlHide() {
	$("#galNavScrUp").animate({ opacity: 0.5 }, 1000);
	$("#galNavScrDn").animate({ opacity: 0.5 }, 1000);
}

/** end gallery **/

/** home page **/
/*
function homeLoadImg(ldImg) {
	$("#homeGalleryCont").fadeOut("slow");
	setTimeout("homeLoadImg2('"+ldImg+"')",0);
}

function homeLoadImg2(ldImg) {
	//$("#homeGalleryCont").fadeIn("slow");
	$("#homeGalleryCont").html("");
	setTimeout("homeLoadImg3('"+ldImg+"')",500);
	//$("#homeGalleryCont").fadeOut("slow");
}

function homeLoadImg3(ldImg) {
	$("#homeGalleryCont").html("<img src='" + baseUrl + workImgDir + ldImg + "' border='0'>");
	$("#homeGalleryCont").fadeIn("slow");
}
*/

function homeLoadImg(ldImg) {
	//$("#homeGalleryCont").fadeOut("fast");
	$("#homeGalleryCont").html("<img src='" + baseUrl + workImgDir + ldImg + "' border='0'>");
	//$("#homeGalleryCont").fadeIn("fast");
}

function sequenceLoad() {
	if(i < arrHomePics.length) {
		setTimeout("homeLoadImg('"+arrHomePics[i]+"');",2000);
		i++;
	} else {
		setTimeout("homeLoadImg('"+arrHomePics[0]+"');",2000);
		i = 1;
	}
	setTimeout("sequenceLoad();",5000);
}

function sequencePreLoad() {
	for(j=0; j<arrHomePics.length; j++) {
		preload_image_object[j] = new Image(810,392)
		preload_image_object[j].src = baseUrl + workImgDir + arrHomePics[j];
	}	
}
/** end home page **/

/** menu **/
function showSubMenu(togElem) {
	$(togElem).fadeIn("slow");
}

function hideSubMenu(togElem) {
	setTimeout("$('"+togElem+"').fadeOut('slow');",5000);
}

function hideSubMenuFast(togElem) {
	$(togElem).fadeOut("fast");
}

function setActive(togElem, pos) {
	//$(""+togElem+" li:eq("+pos+")").attr("class","active");
	$(""+togElem+" li:eq("+pos+")").addClass("active");
}

function setNormal(togElem, pos) {
	$(""+togElem+" li:eq("+pos+")").removeClass("active");
}

function setNormalMulti(togElem) {
	$(""+togElem+" li").removeClass("active");
}

function clickCommercial() {
	hideSubMenuFast('#fm3 .inactiveresi, #fm3 .active, #fm3 .inactiveeduc');
	showSubMenu('#fm3 .inactivecomm');
	setActive('#fm2', '0');
	setNormal('#fm2', '1');
	setNormal('#fm2', '2');	
}

function clickResidential() {
	hideSubMenuFast('#fm3 .inactivecomm, #fm3 .active, #fm3 .inactiveeduc');
	showSubMenu('#fm3 .inactiveresi');
	setActive('#fm2', '1');
	setNormal('#fm2', '0');
	setNormal('#fm2', '2');
}

function clickEducational() {
	hideSubMenuFast('#fm3 .inactivecomm, #fm3 .active, #fm3 .inactiveresi');
	showSubMenu('#fm3 .inactiveeduc');
	setActive('#fm2', '2');
	setNormal('#fm2', '0');
	setNormal('#fm2', '1');
}

function clickWork() {
	hideSubMenuFast('#fm3 .inactivecomm, #fm3 .active, #fm3 .inactiveresi, #fm3 .inactiveeduc, #fm2 .inactiveboar');
	showSubMenu('#fm2 .inactive');
	setActive('#fm1', '1');
	setNormal('#fm1', '0');
	setNormal('#fm1', '2');
	setNormal('#fm1', '3');
}

function clickBoards() {
	hideSubMenuFast('#fm3 .inactivecomm, #fm3 .active, #fm3 .inactiveresi, #fm3 .inactiveeduc, #fm2 .inactive');
	showSubMenu('#fm2 .inactiveboar');
	setActive('#fm1', '3');
	setNormal('#fm1', '0');
	setNormal('#fm1', '1');
	setNormal('#fm1', '2');
}
/** end menu**/