
//
// Sandalwood Management USA
//
// written by Patrick Irie
// patrick irie photography & new media
// www.irievolution.com
//
// Copyright 2004-2009, 2010 Sandalwood Management
// ALL RIGHTS RESERVED.
//
// May 6, 2010
// ver 1.5.1
//
//
//
/////////////////////////////////////////////////////////////////////////


//
// global variable definitions
//

browserName = navigator.appName;

var selectedPropWin;


//Build Menu
//
// set = 'w' for white
//
function buildMenu(set, current) {

	if(set == "w") {
		document.write("			<br>");
		if(current == "home")
			document.write("			<img name=\"home\" border=0 width=98 height=23 src=\"bw_home_on.gif\">");
		else
			document.write("			<A href=\"home.htm\" onMouseOver=\"bRoll('" + set + "', 'home', 'over'); window.status='Home'; return true;\" onMouseOut=\"bRoll('" + set + "', 'home', 'off'); window.status=''; return true;\"><img name=\"home\" border=0 width=98 height=23 src=\"bw_home_off.gif\"></A>");

		if(current == "about")
			document.write("			<img name=\"about\" border=0 width=98 height=23 src=\"bw_about_on.gif\">");
		else
			document.write("			<A href=\"aboutus.htm\" onMouseOver=\"bRoll('" + set + "', 'about', 'over'); window.status='About Sandalwood Management'; return true;\" onMouseOut=\"bRoll('" + set + "', 'about', 'off'); window.status=''; return true;\"><img name=\"about\" border=0 width=98 height=23 src=\"bw_about_off.gif\"></A>");

		if(current == "prop")
			document.write("			<img name=\"prop\" border=0 width=98 height=23 src=\"bw_prop_on.gif\">");
		else
			document.write("    		<A href=\"properties.htm\" onMouseOver=\"bRoll('" + set + "', 'prop', 'over'); window.status='Sandalwood Management properties'; return true;\" onMouseOut=\"bRoll('" + set + "', 'prop', 'off'); window.status=''; return true;\"><img name=\"prop\" border=0 width=98 height=23 src=\"bw_prop_off.gif\"></A>");

		if(current == "contact")
			document.write("			<img name=\"contact\" border=0 width=98 height=23 src=\"bw_contact_on.gif\">");
		else
			document.write("			<A href=\"contact.htm\" onMouseOver=\"bRoll('" + set + "', 'contact', 'over'); window.status='Contact Saldalwood Management'; return true;\" onMouseOut=\"bRoll('" + set + "', 'contact', 'off'); window.status=''; return true;\"><img name=\"contact\" border=0 width=98 height=23 src=\"bw_contact_off.gif\"></A>");

		if(current == "rent")
			document.write("			<img name=\"contact\" border=0 width=98 height=23 src=\"bw_rent_on.gif\">");
		else
			document.write("			<A nohref onClick=\"spawnWin('https://sandalwood.eresidentportal.com');\" onMouseOver=\"bRoll('" + set + "', 'rent', 'over'); window.status='Online Rent Payment'; return true;\" onMouseOut=\"bRoll('" + set + "', 'rent', 'off'); window.status=''; return true;\"><img name=\"rent\" border=0 width=98 height=23 src=\"bw_rent_off.gif\"></A>");

		if(current == "canada")
			document.write("			<img name=\"canada\" border=0 width=98 height=23 src=\"bw_canada_on.gif\">");
		else
			document.write("			<A href=\"http://www.sandalwoodmgt.com/canada\" onMouseOver=\"bRoll('" + set + "', 'canada', 'over'); window.status='Go to the Canadian website (Gestion Sandalwood)'; return true;\" onMouseOut=\"bRoll('" + set + "', 'canada', 'off'); window.status=''; return true;\"><img name=\"canada\" border=0 width=98 height=23 src=\"bw_canada_off.gif\"></A>");

	}


	if(set == "b") {
		document.write("			<br>");
		if(current == "home")
			document.write("			<img name=\"home\" border=0 width=98 height=23 src=\"bb_home_on.gif\">");
		else
			document.write("			<A href=\"home.htm\" onMouseOver=\"bRoll('" + set + "', 'home', 'over'); window.status='Home'; return true;\" onMouseOut=\"bRoll('" + set + "', 'home', 'off'); window.status=''; return true;\"><img name=\"home\" border=0 width=98 height=23 src=\"bb_home_off.gif\"></A>");

		if(current == "about")
			document.write("			<img name=\"about\" border=0 width=98 height=23 src=\"bb_about_on.gif\">");
		else
			document.write("			<A href=\"aboutus.htm\" onMouseOver=\"bRoll('" + set + "', 'about', 'over'); window.status='About Sandalwood Management'; return true;\" onMouseOut=\"bRoll('" + set + "', 'about', 'off'); window.status=''; return true;\"><img name=\"about\" border=0 width=98 height=23 src=\"bb_about_off.gif\"></A>");

		if(current == "prop")
			document.write("			<img name=\"prop\" border=0 width=98 height=23 src=\"bb_prop_on.gif\">");
		else
			document.write("    		<A href=\"properties.htm\" onMouseOver=\"bRoll('" + set + "', 'prop', 'over'); window.status='Sandalwood Management properties'; return true;\" onMouseOut=\"bRoll('" + set + "', 'prop', 'off'); window.status=''; return true;\"><img name=\"prop\" border=0 width=98 height=23 src=\"bb_prop_off.gif\"></A>");

		if(current == "contact")
			document.write("			<img name=\"contact\" border=0 width=98 height=23 src=\"bb_contact_on.gif\">");
		else
			document.write("			<A href=\"contact.htm\" onMouseOver=\"bRoll('" + set + "', 'contact', 'over'); window.status='Contact Saldalwood Management'; return true;\" onMouseOut=\"bRoll('" + set + "', 'contact', 'off'); window.status=''; return true;\"><img name=\"contact\" border=0 width=98 height=23 src=\"bb_contact_off.gif\"></A>");

		if(current == "rent")
			document.write("			<img name=\"contact\" border=0 width=98 height=23 src=\"bb_rent_on.gif\">");
		else
			document.write("			<A nohref onClick=\"spawnWin('https://sandalwood.eresidentportal.com');\" onMouseOver=\"bRoll('" + set + "', 'rent', 'over'); window.status='Online Rent Payment'; return true;\" onMouseOut=\"bRoll('" + set + "', 'rent', 'off'); window.status=''; return true;\"><img name=\"rent\" border=0 width=98 height=23 src=\"bb_rent_off.gif\"></A>");

		if(current == "canada")
			document.write("			<img name=\"canada\" border=0 width=98 height=23 src=\"bb_canada_on.gif\">");
		else
			document.write("			<A href=\"http://www.sandalwoodmgt.com/canada\" onMouseOver=\"bRoll('" + set + "', 'canada', 'over'); window.status='Go to the Canadian website (Gestion Sandalwood)'; return true;\" onMouseOut=\"bRoll('" + set + "', 'canada', 'off'); window.status=''; return true;\"><img name=\"canada\" border=0 width=98 height=23 src=\"bb_canada_off.gif\"></A>");

	}

}





//Properties menu
//
function buildPropMenu(set) {

		if(set == "com") {
			document.write("	<a nohref onMouseOver=\"pRoll(this, 'rates', 'over');\" onMouseOut=\"pRoll(this, 'rates', 'out');\" onClick=\"pRoll(this, 'rates', 'click');\"><img name=\"rates\" width=120 height=28 border=0 src=\"bp_rates_off.gif\"></a>");
			document.write("	<a nohref onMouseOver=\"pRoll(this, 'avspace', 'over');\" onMouseOut=\"pRoll(this, 'avspace', 'out');\" onClick=\"pRoll(this, 'avspace', 'click');\"><img name=\"avspace\" width=120 height=28 border=0 src=\"bp_avspace_off.gif\"></a>");
			document.write("	<a nohref onMouseOver=\"pRoll(this, 'directions', 'over');\" onMouseOut=\"pRoll(this, 'directions', 'out');\" onClick=\"pRoll(this, 'directions', 'click');\"><img name=\"directions\" width=120 height=28 border=0 src=\"bp_directions_off.gif\"></a>");
			document.write("	<a nohref onMouseOver=\"bRoll('p', 'map', 'over');\" onMouseOut=\"bRoll('p', 'map', 'off');\" onClick=\"bRoll('p', 'map', 'on'); spawnWin(mapURL);\"><img name=\"map\" width=120 height=28 border=0 src=\"bp_map_off.gif\"></a>");
			document.write("	<a nohref onMouseOver=\"pRoll(this, 'photos', 'over');\" onMouseOut=\"pRoll(this, 'photos', 'out');\" onClick=\"pRoll(this, 'photos', 'click');\"><img name=\"photos\" width=120 height=28 border=0 src=\"bp_photos_off.gif\"></a>");
		} else {
			document.write("	<a nohref onMouseOver=\"pRoll(this, 'amenities', 'over');\" onMouseOut=\"pRoll(this, 'amenities', 'out');\" onClick=\"pRoll(this, 'amenities', 'click');\"><img name=\"amenities\" width=120 height=28 border=0 src=\"bp_amenities_off.gif\"></a>");
			document.write("	<a nohref onMouseOver=\"pRoll(this, 'rates', 'over');\" onMouseOut=\"pRoll(this, 'rates', 'out');\" onClick=\"pRoll(this, 'rates', 'click');\"><img name=\"rates\" width=120 height=28 border=0 src=\"bp_rates_off.gif\"></a>");
			document.write("	<a nohref onMouseOver=\"pRoll(this, 'floorplans', 'over');\" onMouseOut=\"pRoll(this, 'floorplans', 'out');\" onClick=\"pRoll(this, 'floorplans', 'click');\"><img name=\"floorplans\" width=120 height=28 border=0 src=\"bp_floorplans_off.gif\"></a>");
			document.write("	<a nohref onMouseOver=\"pRoll(this, 'directions', 'over');\" onMouseOut=\"pRoll(this, 'directions', 'out');\" onClick=\"pRoll(this, 'directions', 'click');\"><img name=\"directions\" width=120 height=28 border=0 src=\"bp_directions_off.gif\"></a>");
			document.write("	<a nohref onMouseOver=\"bRoll('p', 'map', 'over');\" onMouseOut=\"bRoll('p', 'map', 'off');\" onClick=\"bRoll('p', 'map', 'on'); spawnWin(mapURL);\"><img name=\"map\" width=120 height=28 border=0 src=\"bp_map_off.gif\"></a>");
			document.write("	<a nohref onMouseOver=\"pRoll(this, 'photos', 'over');\" onMouseOut=\"pRoll(this, 'photos', 'out');\" onClick=\"pRoll(this, 'photos', 'click');\"><img name=\"photos\" width=120 height=28 border=0 src=\"bp_photos_off.gif\"></a>");
			if(infoURL !="")
				document.write("	<a nohref onMouseOver=\"bRoll('p', 'info', 'over');\" onMouseOut=\"bRoll('p', 'info', 'off');\" onClick=\"bRoll('p', 'info', 'on'); spawnWin(infoURL);\"><img name=\"info\" width=120 height=28 border=0 src=\"bp_info_off.gif\"></a>");
			else
				document.write("	<img name=\"info\" width=120 height=28 border=0 src=\"bp_info_na.gif\">");
			if(broURL !="")
				document.write("	<a nohref onMouseOver=\"bRoll('p', 'brochure', 'over');\" onMouseOut=\"bRoll('p', 'brochure', 'off');\" onClick=\"bRoll('p', 'brochure', 'on'); spawnWin(broURL);\"><img name=\"brochure\" width=120 height=28 border=0 src=\"bp_brochure_off.gif\"></a>");
			else
				document.write("	<img name=\"brochure\" width=120 height=28 border=0 src=\"bp_brochure_na.gif\">");		
		}

}







//Build Menu rollover preload
//
function buildMenuPreload(set) {

	if(set == "w") {
			document.write('<img width=98 height=23 src="bw_home_over.gif">');
			document.write('<img width=98 height=23 src="bw_about_over.gif">');
			document.write('<img width=98 height=23 src="bw_prop_over.gif">');
			document.write('<img width=98 height=23 src="bw_contact_over.gif">');
			document.write('<img width=98 height=23 src="bw_rent_over.gif">');
			document.write('<img width=98 height=23 src="bw_canada_over.gif">');

	} else if(set == "b") {

			document.write('<img width=98 height=23 src="bb_home_over.gif">');
			document.write('<img width=98 height=23 src="bb_about_over.gif">');
			document.write('<img width=98 height=23 src="bb_prop_over.gif">');
			document.write('<img width=98 height=23 src="bb_contact_over.gif">');
			document.write('<img width=98 height=23 src="bb_rent_over.gif">');
			document.write('<img width=98 height=23 src="bb_canada_over.gif">');
	}

}






//Build PropMenu rollover preload
//
function buildPropMenuPreload() {
			document.write('<img width=120 height=28 border=0 src="bp_amenities_on.gif">');
			document.write('<img width=120 height=28 border=0 src="bp_rates_on.gif">');
			document.write('<img width=120 height=28 border=0 src="bp_floorplans_on.gif">');
			document.write('<img width=120 height=28 border=0 src="bp_directions_on.gif">');
			document.write('<img width=120 height=28 border=0 src="bp_map_on.gif">');
			document.write('<img width=120 height=28 border=0 src="bp_photos_on.gif">');
			document.write('<img width=120 height=28 border=0 src="bp_info_on.gif">');
			document.write('<img width=120 height=28 border=0 src="bp_brochure_on.gif">');

			document.write('<img width=120 height=28 border=0 src="bp_amenities_over.gif">');
			document.write('<img width=120 height=28 border=0 src="bp_rates_over.gif">');
			document.write('<img width=120 height=28 border=0 src="bp_floorplans_over.gif">');
			document.write('<img width=120 height=28 border=0 src="bp_directions_over.gif">');
			document.write('<img width=120 height=28 border=0 src="bp_map_over.gif">');
			document.write('<img width=120 height=28 border=0 src="bp_photos_over.gif">');
			document.write('<img width=120 height=28 border=0 src="bp_info_over.gif">');
			document.write('<img width=120 height=28 border=0 src="bp_brochure_over.gif">');
}






//Menu Buttons
//
function bRoll(set, request, state) {

	switch(state) {
		case "on":
			document [request].src = "b" + set + "_" + request + "_on.gif";
			break;

		case "over":
			document [request].src = "b" + set + "_" + request + "_over.gif";
			break;

		case "off":
			document [request].src = "b" + set + "_" + request + "_off.gif";
			break;

		// unused
		case "click":
			document [request].src = "b" + set + "_" + request + "_click.gif";
			break;
	}

}



//Properties Menu buttons
//
function pRoll(obj, request, state) {

	switch(state) {
		case "over":
			if (browserName == "Microsoft Internet Explorer")
				obj.style.cursor='hand';
			else
				obj.style.cursor='pointer';

			if(request != selectedPropWin)
				document [request].src = "bp_" + request + "_over.gif";

			break;



		case "out":
			if(request != selectedPropWin)
				document [request].src = "bp_" + request + "_off.gif";

			break;



		case "click":
			document [request].src = "bp_" + request + "_on.gif";

			if(!selectedPropWin) document.getElementById('_pay').style.visibility='hidden';
			
			else if(selectedPropWin && (request == selectedPropWin)) { 
				document [selectedPropWin].src = "bp_" + selectedPropWin + "_off.gif";
				document.getElementById('_' + selectedPropWin).style.visibility='hidden';

				if(selectedPropWin == "floorplans" || selectedPropWin == "avspace")
					document.getElementById('_plan' + fCount).style.visibility='hidden';
					
				document.getElementById('_pay').style.visibility='visible';
				
				selectedPropWin = "";
				
				break;
			}

			if(selectedPropWin && (request != selectedPropWin)) {
				document [selectedPropWin].src = "bp_" + selectedPropWin + "_off.gif";
				document.getElementById('_' + selectedPropWin).style.visibility='hidden';

				if(selectedPropWin == "floorplans" || selectedPropWin == "avspace")
					document.getElementById('_plan' + fCount).style.visibility='hidden';
			}

			selectedPropWin = request;
			document.getElementById('_' + selectedPropWin).style.visibility='visible';

			if(selectedPropWin == "floorplans" || selectedPropWin == "avspace")
				document.getElementById('_plan' + fCount).style.visibility='visible';


			break;

	}

}






//Properties buttons (Res/Com)
//
function propButt(obj, request, state) {

var _COMMERCIAL = 'blue';
var _RESIDENTIAL = 'purple';

	switch(state) {
		case "over":
			if (browserName == "Microsoft Internet Explorer")
				obj.style.cursor='hand';
			else
				obj.style.cursor='pointer';

			if(request == "com" && _selectedProp != "Com") {
				bRoll('', _COMMERCIAL, 'on');
				window.status='View commercial properties';
				return true;
			} else if(request == "res" && _selectedProp != "Res") {
				bRoll('', _RESIDENTIAL, 'on');
				window.status='View residential properties';
				return true;
			}

			break;


		case "out":

			if(request == "com") {
				bRoll('', _COMMERCIAL, 'off');
				window.status='';
				return true;
			} else if(request == "res") {
				bRoll('', _RESIDENTIAL, 'off');
				window.status='';
				return true;
			}

			break;



		case "click":

			document.select2.style.visibility='visible';

			if(request == "com") {
				document.getElementById('main' + _selectedProp).style.visibility='hidden';
				document.getElementById('mainCom').style.visibility='visible';

				document.getElementById('map' + _selectedProp).style.visibility='hidden';
				document.getElementById('mapCom').style.visibility='visible';

				document.getElementById('resProps').style.visibility='hidden';
				document.getElementById('comProps').style.visibility='visible';

				_selectedProp = "Com";

			} else if(request == "res") {
				document.getElementById('main' + _selectedProp).style.visibility='hidden';
				document.getElementById('mainRes').style.visibility='visible'

				document.getElementById('map' + _selectedProp).style.visibility='hidden';
				document.getElementById('mapRes').style.visibility='visible';

				document.getElementById('comProps').style.visibility='hidden';
				document.getElementById('resProps').style.visibility='visible';

				_selectedProp = "Res";
			}

			break;

	}

}








//Properties rollover handler
// 1. box next to individual properties
// 2. Geographical state rollover
//
function propRoll(request, state, loc) {

	if(state == "on") {
		document [request].style.visibility='visible';

		document.getElementById('map' + _selectedProp).style.visibility='hidden';
		document.getElementById('map' + _selectedProp + loc).style.visibility='visible';
	} else {
		document [request].style.visibility='hidden';

		document.getElementById('map' + _selectedProp + loc).style.visibility='hidden';
		document.getElementById('map' + _selectedProp).style.visibility='visible';

	}

}








// footer (c)
//
function footer(set) {

	document.write("<span style='font-family:Arial, Helvetica, sans-serif; font-size:6pt; color:#4F7286; letter-spacing:0.05em; font-weight:100;'>&copy;2010 Copyright Sandalwood Management, All Rights Reserved.</span><br>");

}




// random image selector
//
function randTop3() {

	var rand = Math.round(Math.random()*3)+1;

	document.write("<img width=294 height=96 src=\"top3boxes_" + rand + ".jpg\" border=0>");

}




// arrow rollover
//
function arrowRoll(obj, request, dir, state) {

	switch(dir) {
		case "-":
			if(state == "over") {
				if (browserName == "Microsoft Internet Explorer")
					obj.style.cursor='hand';
				else
					obj.style.cursor='pointer';

				document [request].src = "arrow_left_on.gif";

			} else
				document [request].src = "arrow_left_off.gif";

			break;

		case "+":
			if(state == "over") {
				if (browserName == "Microsoft Internet Explorer")
					obj.style.cursor='hand';
				else
					obj.style.cursor='pointer';

				document [request].src = "arrow_right_on.gif";

			} else
				document [request].src = "arrow_right_off.gif";

			break;
	}

}




// build slideshow counter
//
function buildCounter(set, property) {

	switch(set) {
		case "photos":
			if(Photos > 1) {
				document.write("&nbsp;&nbsp;&nbsp;<img name=\"photoCount\" width=15 height=16 src=\"" + pCount + ".gif\"><img width=18 height=16 src=\"of.gif\"><img width=15 height=16 src=\"" + Photos + ".gif\"><br>");
				document.write("&nbsp;&nbsp;&nbsp;<a nohref onMouseOver=\"arrowRoll(this, 'photoLeft', '-', 'over');\" onMouseOut=\"arrowRoll(this, 'photoLeft', '-', 'out');\" onClick=\"slide('pic', '" + property + "', Photos, '-');\"><img name=\"photoLeft\" width=24 height=25 src=\"arrow_left_off.gif\"></a><a nohref onMouseOver=\"arrowRoll(this, 'photoRight', '+', 'over');\" onMouseOut=\"arrowRoll(this, 'photoRight', '+', 'out');\" onClick=\"slide('pic', '" + property + "', Photos, '+');\"><img name=\"photoRight\" width=24 height=25 src=\"arrow_right_off.gif\"></a><br><br>");
			} else if(Photos == 1) {
				document.write("&nbsp;&nbsp;&nbsp;<img name=\"photoCount\" width=15 height=16 src=\"" + pCount + ".gif\"><img width=18 height=16 src=\"of.gif\"><img width=15 height=16 src=\"" + Photos + ".gif\"><br><br>");
			}

			break;

		case "floorplans":
			if(Plans > 1) {
				document.write("&nbsp;&nbsp;&nbsp;<img name=\"planCount\" width=15 height=16 src=\"" + fCount + ".gif\"><img width=18 height=16 src=\"of.gif\"><img width=15 height=16 src=\"" + Plans + ".gif\"><br>");
				document.write("&nbsp;&nbsp;&nbsp;<a nohref onMouseOver=\"arrowRoll(this, 'planLeft', '-', 'over');\" onMouseOut=\"arrowRoll(this, 'planLeft', '-', 'out');\" onClick=\"slide('plan', '" + property + "', Plans, '-');\"><img name=\"planLeft\" width=24 height=25 src=\"arrow_left_off.gif\"></a><a nohref onMouseOver=\"arrowRoll(this, 'planRight', '+', 'over');\" onMouseOut=\"arrowRoll(this, 'planRight', '+', 'out');\" onClick=\"slide('plan', '" + property + "', Plans, '+');\"><img name=\"planRight\" width=24 height=25 src=\"arrow_right_off.gif\"></a><br><br>");
			} else if(Plans == 1) {
				document.write("&nbsp;&nbsp;&nbsp;<img name=\"planCount\" width=15 height=16 src=\"" + fCount + ".gif\"><img width=18 height=16 src=\"of.gif\"><img width=15 height=16 src=\"" + Plans + ".gif\"><br><br>");
			}


			break;

	}

}




// slideshow
//
function slide(set, property, max, dir) {
var cnt;

	switch(set) {
		case "pic":
			cnt = pCount;

			if(dir == "+") {
				cnt++;
				if(cnt > max) cnt = 1;
			} else {
				cnt--;
				if(cnt == "0") cnt = max;
			}

			pCount = cnt;

			document.photoCount.src = pCount + ".gif";
			document.photo.src = "Properties/" + property + "/pic" + cnt + ".jpg";

			break;


		case "plan":
			cnt = fCount;

			if(dir == "+") {
				cnt++;
				if(cnt > max) cnt = 1;
			} else {
				cnt--;
				if(cnt == "0") cnt = max;
			}

			document.getElementById('_plan' + fCount).style.visibility='hidden';

			fCount = cnt;

			document.planCount.src = fCount + ".gif";
			document.floorplan.src = "Properties/" + property + "/plan"  + cnt + ".jpg";
			document.getElementById('_plan' + fCount).style.visibility='visible';

			break;

	}

}





// Spawn popup map or brochure (URL) window
//
function spawnWin(_URL) {

	if (browserName == "Netscape") {
		xPos = window.screenX + 35;
		yPos = window.screenY + 35;
	} else {
		xPos = window.screenLeft + 40;
		yPos = window.screenTop - 60;
	}


	_spawned=window.open(_URL, '_spawned', 'resizable=yes, scrollbars=yes, width=990, height=627, top=' + yPos + ', left=' + xPos);
	_spawned.focus();
}