// This file contains all the necessary javascript 
// routines and variables for the Maetzold Homes website.

function newImage(imgname) {
        if (document.images) {
                nwimg = new Image();
                nwimg.src = imgname;
                return nwimg;
        }
}
var imgspreloaded = false;
function changeImages() {
        if (document.images && (imgspreloaded == true)) {
                for (var i = 0; i < changeImages.arguments.length; i += 2) {
                        document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
                }
        }
        window.status = " ";
}
function preloadImages() {
	changephotos("default");
	write_textbox("default");
        if (document.images) {
            email_on    	= newImage("images/email_on_33.gif");
            aboutus_on    	= newImage("images/menu_aboutus_on.gif");
            testimonials_on    	= newImage("images/menu_testimonials_on.gif");
            gallery_on    	= newImage("images/menu_gallery_on.gif");
            resources_on    	= newImage("images/menu_resources_on.gif");
            contacts_on    	= newImage("images/menu_contacts_on.gif");
            locations_on    	= newImage("images/menu_locations_on.gif");
//            frame1src = newImage("images/house2_cc19.jpg");
//            frame2src = newImage("images/fireplace21.jpg");
//            frame3src = newImage("images/kitchen_382S_05.jpg");
//            frame4src = newImage("images/house29.jpg");
            frame5src = newImage("images/jon_rock_cc10.jpg");
            frame6src = newImage("images/jon_cc19.jpg");
            frame7src = newImage("images/man_in_door_cc25.jpg");
            frame8src = newImage("images/house_sunrise_cc10.jpg");
            frame9src = newImage("images/living_380S_05.jpg");
            frame10src = newImage("images/house3_cuwg_cc26.jpg");

//gallery
            frame11src = newImage("images/entry_cc10.jpg");
//            frame12src = newImage("images/fireplace_cc21.jpg");
            frame12src = newImage("images/bathroom_387_05.jpg");
            frame13src = newImage("images/entry_b2_cc25.jpg");

            frame14src = newImage("images/dining_377S_05.jpg");
            frame15src = newImage("images/livingdining_296S_05.jpg");
            frame16src = newImage("images/house_green_cc29.jpg");
            frame17src = newImage("images/livingroom_372S_05.jpg");
            frame18src = newImage("images/house_back_cc21.jpg");
            frame19src = newImage("images/columns_383S_05.jpg");
            frame20src = newImage("images/man_frame_cc29.jpg");

            imgspreloaded = true;
        }
}
function changephotos(which_set) {
	if (which_set == "default") {
//                document.Frame10.src = "images/clear2.gif";
                document.Frame19.src = "images/house2_cc19.jpg";
                document.Frame21.src = "images/fireplace_301S_05.jpg";
                document.Frame25.src = "images/kitchen_382S_05.jpg";
                document.Frame26.src = "images/clear2.gif";
                document.Frame29.src = "images/house29.jpg";
	}
	if (which_set == "aboutus") {
                document.Frame10.src = "images/jon_rock_cc10.jpg";
                document.Frame19.src = "images/jon_cc19.jpg";
                document.Frame21.src = "images/clear2.gif";
                document.Frame25.src = "images/man_in_door_cc25.jpg";
                document.Frame26.src = "images/clear2.gif";
//                document.Frame29.src = "images/clear2.gif";
	}
	if (which_set == "testimonials") {
                document.Frame10.src = "images/house_sunrise_cc10.jpg";
                document.Frame19.src = "images/living_380S_05.jpg";
//                document.Frame21.src = "images/clear2.gif";
//                document.Frame25.src = "images/clear2.gif";
                document.Frame26.src = "images/house3_cuwg_cc26.jpg";
                document.Frame29.src = "images/clear2.gif";
	}
	if (which_set == "gallery") {
                document.Frame10.src = "images/entry_cc10.jpg";
//                document.Frame19.src = "images/clear2.gif";
//                document.Frame21.src = "images/fireplace_cc21.jpg";
                document.Frame21.src = "images/bathroom_387_05.jpg";
                document.Frame25.src = "images/entry_b2_cc25.jpg";
                document.Frame26.src = "images/clear2.gif";
                document.Frame29.src = "images/clear2.gif";
	}
	if (which_set == "resources") {
                document.Frame10.src = "images/clear2.gif";
                document.Frame19.src = "images/dining_377S_05.jpg";
                document.Frame21.src = "images/livingdining_296S_05.jpg";
//                document.Frame25.src = "images/clear2.gif";
//                document.Frame26.src = "images/clear2.gif";
                document.Frame29.src = "images/house_green_cc29.jpg";
	}
	if (which_set == "contacts") {
                document.Frame10.src = "images/clear2.gif";
//                document.Frame19.src = "images/studs_cc19.jpg";
                document.Frame19.src = "images/jon_cc19.jpg";
                document.Frame21.src = "images/clear2.gif";
//                document.Frame25.src = "images/clear2.gif";
                document.Frame26.src = "images/clear2.gif";
                document.Frame29.src = "images/livingroom_372S_05.jpg";
	}
	if (which_set == "locations") {
                document.Frame10.src = "images/clear2.gif";
                document.Frame19.src = "images/clear2.gif";
                document.Frame21.src = "images/house_back_cc21.jpg";
                document.Frame25.src = "images/columns_383S_05.jpg";
//                document.Frame26.src = "images/clear2.gif";
                document.Frame29.src = "images/man_frame_cc29.jpg";
	}
	return true;
}
function clearsubmenu() {
	var submenuId;
	submenuId = document.getElementById("submenu"); 
	submenuId.innerHTML = "<img name='Frame8' src='images/clear2.gif' width=137 height=105>";
}
function showsubmenu(which_submenu) {
	var submenuId;
	var submenuhtml;

	submenuId = document.getElementById('submenu'); 
	
	if (which_submenu == 'contacts') {
		submenuhtml = "<span class='submenutype'>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>";
		submenuhtml += "<a class='subMenuLink' href='mailto:sales@maetzoldhomes.com'>&nbsp;Greg Anderson&nbsp;</a><br>";
		submenuhtml += "<a class='subMenuLink' href='mailto:jon@maetzoldhomes.com'>&nbsp;Jon Maetzold&nbsp;</a><br>";
		submenuhtml += "</span>";
		submenuId.innerHTML = submenuhtml;
	}
	if (which_submenu == 'locations') {
		submenuhtml = "<span class='submenutype'>&nbsp;<br>";
		submenuhtml += "<a class='subMenuLink' href='#' onclick='openfeaturewindow(0);return true;'>&nbsp;Mayer&nbsp;</a><br>&nbsp;<br>";
		submenuhtml += "<a class='subMenuLink' href='#' onclick='openfeaturewindow(1);return true;'>&nbsp;New&nbsp;Germany&nbsp;</a><br>&nbsp;<br>";
		submenuhtml += "<a class='subMenuLink' href='#' onclick='openfeaturewindow(2);return true;'>&nbsp;Waconia&nbsp;</a><br>&nbsp;<br>";
		submenuhtml += "<a class='subMenuLink' href='#' onclick='openfeaturewindow(3);return true;'>&nbsp;Watertown&nbsp;</a>";

		submenuhtml += "</span>";
		submenuId.innerHTML = submenuhtml;
	}
	if (which_submenu == 'testimonials') {
		submenuhtml = "<span class='submenutype'>&nbsp;<br>&nbsp;<br>";
//		submenuhtml += "<a class='subMenuLink' href='#' onclick='openmoviewindow();return true;'>Movies</a><br>";
		submenuhtml += "<a class='subMenuLink' href='#' onclick='openmoviewindow();return true;'>&nbsp;Real Interviews!&nbsp;<br>&nbsp;Real People!&nbsp;</a><br>";
//		submenuhtml += "&nbsp;<br><a class='subMenuLink' href='#' onclick='openmoviewindowTour();return true;'>House Tour</a><br>";
		submenuhtml += "</span>";
		submenuId.innerHTML = submenuhtml;
	}
	if (which_submenu == 'resources') {
		submenuhtml = "<span class='submenutype'>&nbsp;<br>&nbsp;<br>";
		submenuhtml += "<a class='subMenuLink' href='http://www.advisorswest.com'>&nbsp;AdvisorsWest.com&nbsp;</a><br>";
		submenuhtml += "<a class='subMenuLink' href='http://www.batconline.org'>&nbsp;Batconline.org&nbsp;</a><br>";
		submenuhtml += "<a class='subMenuLink' href='http://www.co.carver.mn.us'>&nbsp;co.carver.mn.us&nbsp;</a><br>";
		submenuhtml += "<a class='subMenuLink' href='http://mayer.govoffice.com'>&nbsp;mayer.govoffice.com&nbsp;</a><br>";
		submenuhtml += "<a class='subMenuLink' href='http://home-smart.org'>&nbsp;home-smart.org&nbsp;</a><br>";
		submenuhtml += "</span>";
		submenuId.innerHTML = submenuhtml;
	}
	if (which_submenu == 'virtual_tours') {
		submenuhtml = "<span class='submenutype'>";
		submenuhtml += "<a class='subMenuLink' target='vt_window' href='http://ts.rtvpix.com/tour/RE/tour.view.php?utl=RE-6036-SW4AZB-01' >&nbsp;Mayer 05 Spring Rambler&nbsp;</a><br>";
		submenuhtml += "<a class='subMenuLink' target='vt_window' href='http://ts.rtvpix.com/tour/RE/tour.view.php?utl=RE-1293-9V4IKP-01'>&nbsp;Mayer 06 Spring Rambler&nbsp;</a><br>&nbsp;<br>";
		submenuhtml += "<a class='subMenuLink' target='vt_window' href='http://ts.rtvpix.com/tour/VL/tour.view.php?utl=VL-6629-5AOIH9-01'>&nbsp;Waconia 05 Fall Rambler&nbsp;</a><br>";
		submenuhtml += "<a class='subMenuLink' target='vt_window' href='http://ts.rtvpix.com/tour/RE/tour.view.php?utl=RE-5311-G865K4-01' >&nbsp;Waconia 06 Spr. 2-Story&nbsp;</a><br>&nbsp;<br>";
		submenuhtml += "<a class='subMenuLink' target='vt_window' href='http://ts.rtvpix.com/tour/RE/tour.view.php?utl=RE-6505-1QXVYW-01' >&nbsp;New Germany 06 Spring&nbsp;</a><br>";
		submenuhtml += "</span>";
		submenuId.innerHTML = submenuhtml;
	}
}
function write_textbox(which_text) {
	var textBoxId;

	var default_text = "<span class='textboxtype'><b>Building Better Homes</b><p>";
	default_text += "'BUILDING BETTER HOMES' has become more then a slogan, it is our ";
	default_text += "commitment.  We believe it is better for everyone if things are done ";
	default_text += "right the first time.  Done right by our workers, subcontractors, ";
	default_text += "vendors, sales team and of course our clients.  Quality is always a ";
	default_text += "better value.  'It would be our pleasure to help.'";
	aboutus_text += "</span>";

	var aboutus_text = "<span class='textboxtype'>";
	aboutus_text += "Maetzold Homes Inc. is the realization of a lifelong goal for Jon Maetzold. ";
	aboutus_text += "As a 4th generation resident of Carver County, Jon literally grew up ";
	aboutus_text += "around the construction industry.  He started out in the family ";
	aboutus_text += "lumber business and while ";
	aboutus_text += "still in high school, began building. ";
	aboutus_text += "After graduating from Hennepin Technical College with a degree in ";
	aboutus_text += "carpentry, and winning national recognition in carpentry competitions, ";
	aboutus_text += "Jon started his own company doing work for some of the areas most ";
	aboutus_text += "respected builders.<br>";
	aboutus_text += "Today, Maetzold Homes Inc. enjoys a sterling reputation with clients ";
	aboutus_text += "and subcontractors, as well as the hard-earned respect of its peers.";
	aboutus_text += "</span>";

	var location_text = "<span class='textboxtype'><b>Locations</b><p>";
//	location_text += "Our newest model 1614  Sparrow Rd called the Vail is a spacious 2 Story home with an ";
//	location_text += "open floor plan.  The upper level has 5 bedrooms and a 300 plus sq. ft. bonus room.  ";
//	location_text += "The master bedroom has a Spa bath w/walk-in shower and in floor heat.  Unfinished walk-out.  ";

	location_text += "Our newest family design, The Vail, is spacious and features an open great room with stone fireplace. ";
	location_text += "The upper level has four ample-sized bedrooms. The secluded master bedroom has a spa bath ";
	location_text += "with separate walk-in shower and in-floor heat. Unfinished walkout. ";

	location_text += "We offer several other smartly designed plans for you to choose from. ";
	location_text += "Experience the Maetzold Homes Inc. difference.  For more info about the Oakpointe development ";
	location_text += "in Waconia please call Greg at 952-368-0345";

	location_text += "</span>";

	var testimonial_text = "<span class='textboxtype'><b>Testimonials</b><p>";
	testimonial_text += "We invite you to hear what a few of our clients have to say about ";
	testimonial_text += "MAETZOLD HOMES INC., just click 'Real Interviews, Real People'.";
	testimonial_text += "</span>";

	var gallery_text = "<span class='textboxtype'><b>Gallery</b><p>";
	gallery_text += "We invite you to take a look at some of the fine craftsmanship that goes into a ";
	gallery_text += "MAETZOLD HOME";
	gallery_text += "</span>";

	textBoxId = document.getElementById('textBox'); 
	if (which_text == "default") {
		textBoxId.innerHTML = default_text;
	}
	else if (which_text == "aboutus") {
		textBoxId.innerHTML = aboutus_text;
	}
	else if (which_text == "location") {
		textBoxId.innerHTML = location_text;
	}
	else if (which_text == "testimonials") {
		textBoxId.innerHTML = testimonial_text;
	}
	else if (which_text == "gallery") {
		textBoxId.innerHTML = gallery_text;
	}
}

var featureWin = null;
//function openfeaturewindow(htmlfile) {
//function openfeaturewindow() {
function openfeaturewindow(loc) {
	var htmlfile = "feature.html";
	if (loc == 1) {
		htmlfile = "feature1.html";
	}
	if (loc == 2) {
		htmlfile = "feature2.html";
	}
	if (loc == 3) {
		htmlfile = "feature3.html";
	}
	if (featureWin == null || featureWin.closed) {
             featureWin = window.open("","","resizable=yes,scrollbars=yes,toolbar=yes,status=no,width=620,height=475,left=100,top=0");
 	}
	featureWin.location = htmlfile;
	featureWin.focus();
	featureWin.status="Copyright 2003-2006 Maetzold Homes Inc.";
}
var movieWin = null;
function openmoviewindow() {
	var htmlfile = "testimonials.html";
	if (movieWin == null || movieWin.closed) {
             movieWin = window.open("","Testimonials","resizable=yes,scrollbars=yes,toolbar=yes,status=no,width=390,height=450,left=100,top=0");
 	}
	movieWin.location = htmlfile;
	movieWin.focus();
	movieWin.status="Copyright 2003-2006 Maetzold Homes Inc.";
}
var movieTourWin = null;
function openmoviewindowTour() {
	var htmlfile = "tour.html";
	if (movieTourWin == null || movieTourWin.closed) {
             movieTourWin = window.open("","Tour","resizable=yes,scrollbars=yes,toolbar=yes,status=no,width=360,height=250,left=100,top=0");
 	}
	movieTourWin.location = htmlfile;
	movieTourWin.focus();
	movieTourWin.status="Copyright 2003-2006 Maetzold Homes Inc.";
}
