/*
    Document   : main
    Created on : Jul 14, 2011, 12:08:32 PM
    Author     : TJ Beatrice <tj@artlabx.com>
    Description:

*/
$(window).load(function() {
    $('#slider').nivoSlider({
		effect:'fade',
		controlNavThumbs:true,
		controlNavThumbsSearch: '.jpg',
		controlNavThumbsReplace: '_tn.jpg',
		manualAdvance:true
    });
});

	function popUp(img,imgw,imgh){
		win_w = imgw+110;
		win_h = imgh+100;
		//centering will not work in Netscape 4
		win_lft = (screen.width/2)-(win_w/2);
		win_top = (screen.height/2)-(win_h/2);	
		TheNewWin = window.open("page_samples.php?img="+img+"&imgh="+imgh+"&imgw="+imgw,"sample","width="+win_w+",height="+win_h+",resizable=yes,scrollbars=1,top="+win_top+",left="+win_lft);			
		TheNewWin.focus()
	}	
	
	function mmLoadMenus() {
		if (window.visitor) return;
		
		var mmfont, mmfontcolor, mmfonthilite, mmbg, mmbghigh, subxoffset, subyoffset
		mmfont = "Verdana, Arial, Helvetica, sans-serif";
		mmfontcolor = "#ffffff";
		mmfonthilite = "696143";
		mmbg = "#696143";
		mmbghigh = "#FFF6D6";
		subxoffset = 0;
		subyoffset = 0;
		// function Menu(label, mw, mh, fnt, fs, fclr, fhclr, bg, bgh, halgn, valgn, pad, space, to, sx, sy, srel, opq, vert, idt, aw, ah) 
		// label, menu width, menu item height, font, font size, font color, font hilite color, menu item background
		// menu item background hilite, menu item horiz align, menu item vert align, menu item padding, menu item spacing
		// hide timeout, sub menu x offset, sub menu y offset, submenu relative to item, menu border opaque, vertical, menu item indent
		// aw=?, ah=?
		// hide timout must be over 400 to work in NN4
		window.who = new Menu("who",150,19,mmfont,11,mmfontcolor,mmfonthilite,mmbg,mmbghigh,"left","middle",5,1,510,subxoffset,subyoffset,true,false,true,0,true,true);
		who.addMenuItem("Overview","location='page_whoweare.php'");
		who.addMenuItem("The Team","location='page_team.php'");
		who.fontWeight="plain";
		who.hideOnMouseOut=true;
		
		window.why = new Menu("why",300,19,mmfont,11,mmfontcolor,mmfonthilite,mmbg,mmbghigh,"left","middle",5,1,510,subxoffset,subyoffset,true,false,true,0,true,true);
		why.addMenuItem("Overview","location='page_whychooseus.php'");
		why.addMenuItem("Our Process","location='page_process.php'");
		why.addMenuItem("Working with your Architects and Builders","location='page_workingarchbuild.php'");
		why.addMenuItem("The Final Product","location='page_finalproduct.php'");
		why.addMenuItem("Customer Testimonials","location='page_testimonials.php'");
		why.addMenuItem("Environment","location='page_keepitgreen.php'");
		why.fontWeight="plain";
		why.hideOnMouseOut=true;
		
		window.gallery = new Menu("gallery",190,19,mmfont,11,mmfontcolor,mmfonthilite,mmbg,mmbghigh,"left","middle",5,1,510,subxoffset,subyoffset,true,false,true,0,true,true);
		gallery.addMenuItem("Going Green","location='page_gallery.php?catid=0'");
		gallery.addMenuItem("Works in Progress","location='page_gallery.php?catid=1'");
		gallery.addMenuItem("Timber Frame Homes","location='page_gallery.php?catid=2'");
		gallery.addMenuItem("Barns & Stables","location='page_gallery.php?catid=3'");
		gallery.addMenuItem("Commercial Buildings","location='page_gallery.php?catid=4'");
		gallery.addMenuItem("One-of-a-Kind Structures","location='page_gallery.php?catid=5'");
		gallery.addMenuItem("Eastern Influence","location='page_gallery.php?catid=6'");
		gallery.addMenuItem("Trusses & Components","location='page_gallery.php?catid=7'");
		gallery.addMenuItem("Restoration","location='page_gallery.php?catid=8'");
		gallery.addMenuItem("Video","location='page_videos.php'");
		gallery.fontWeight="plain";
		gallery.hideOnMouseOut=true;
	
		window.products = new Menu("products",210,19,mmfont,11,mmfontcolor,mmfonthilite,mmbg,mmbghigh,"left","middle",5,1,510,subxoffset,subyoffset,true,false,true,0,true,true);
		products.addMenuItem("Overview","location='page_products.php'");
		products.addMenuItem("Timber Frame Signature Homes","location='page_tframehomes.php'");
		products.addMenuItem("Heavy Timber Trusses","location='page_heavytimbertrusses.php'");
		products.addMenuItem("Flooring","location='page_flooring.php'");
		products.addMenuItem("Structural Insulated Panels","location='page_insulatedpanels.php'");
		products.addMenuItem("Bike Path Kiosk","location='page_bikekiosk.php'");
		products.addMenuItem("Timber Frame Bench","location='page_bench.php'");
		//products.addMenuItem("Panel Products","location='page_panelproducts.php'");
		products.fontWeight="plain";
		products.hideOnMouseOut=true;
		
		window.archbuild = new Menu("archbuild",155,19,mmfont,11,mmfontcolor,mmfonthilite,mmbg,mmbghigh,"left","middle",5,1,510,subxoffset,subyoffset,true,false,true,0,true,true);
		archbuild.addMenuItem("Architects","location='page_architects.php'");
		archbuild.addMenuItem("Builders","location='page_builders.php'");
		archbuild.fontWeight="plain";
		archbuild.hideOnMouseOut=true;
		
	
		window.news = new Menu("news",170,19,mmfont,11,mmfontcolor,mmfonthilite,mmbg,mmbghigh,"left","middle",5,1,510,subxoffset,subyoffset,true,false,true,0,true,true);
		news.addMenuItem("Raisings/Open House","location='page_frameraisings.php'");
		news.addMenuItem("Trade Shows","location='page_tradeshows.php'");
		news.addMenuItem("First LEED House in RI","location='page_LEED.php'");
		news.addMenuItem("Featured Stories","location='page_featuredstories.php'");
		news.fontWeight="plain";
		news.hideOnMouseOut=true;
		window.writeMenus();
	}
	
	giflist = new Array("who","why","answers","gallery","products","archbuild","news","contact");
	
	function preloadGIF(){
		if (document.images) {
			for (i=0;i<giflist.length;i++){
				//over
				eval(giflist[i]+"over = new Image()");			
				eval(giflist[i]+"over.src = 'images/hdr_nav_butt_"+giflist[i]+"_over.gif'");
				//out
				eval(giflist[i]+"out = new Image()");
				eval(giflist[i]+"out.src = 'images/hdr_nav_butt_"+giflist[i]+".gif'");
			}
		}
	}	
	
	function changeImage(imagetochange,state){
		document[changeImage.arguments[0]].src = eval(imagetochange + state + ".src");
	}

