function submit_search_form()
{
	var search_value;
	search_value=document.getElementById("header_searchbox").value;
	if(search_value!="")
		document.forms["search_form"].submit();
}
function header_login_fs_action(obj)
{
	if(obj.className=='fold') {
		obj.className='spread';
		obj.innerHTML='Private Members Login&nbsp;&nbsp;<font class="mscolor">&and;</font>';
		document.getElementById('header_login_window').className='show';
	} else {
		obj.className='fold';
		obj.innerHTML='Private Members Login&nbsp;&nbsp;<font class="mscolor">&or;</font>';
		document.getElementById('header_login_window').className='hide';
	}
}
function mailpage()
{
	mail_str = "mailto:?subject=Check out the site";
	mail_str += "&body=I thought you might be interested in this company's website. ";
	mail_str += " You can view it at, " + location.href + ".";
	location.href = mail_str;
}

function set_current_time () {

	// create Date object for current location
    var curtime_local = new Date();
    
    // convert to msec
    // add local time zone offset 
    // get UTC time in msec
    var utc = curtime_local.getTime() + (curtime_local.getTimezoneOffset() * 60000);
    
	// obtain and add destination's UTC time offset
	// for example, Bombay 
	// which is UTC + 5.5 hours
	var offset = 8;   
	var est = utc + (3600000*offset);

    // create new Date object for different city
    // using supplied offset
    var curtime = new Date(est);
	
	var curhour = curtime.getHours();
	var curmin = curtime.getMinutes();
	var cursec = curtime.getSeconds();
	var curyear = curtime.getFullYear();
	var curmonth = curtime.getMonth()+1;
	var curdate = curtime.getDate();
	var curday = curtime.getDay();
	var curday_string;
	switch(curday) {
	case 1:
		curday_string="Mon";
		break;
	case 2:
		curday_string="Tue";
		break;
	case 3:
		curday_string="Wed";
		break;
	case 4:
		curday_string="Thu";
		break;
	case 5:
		curday_string="Fri";
		break;
	case 6:
		curday_string="Sat";
		break;
	case 0:
		curday_string="Sun";
		break;
	}
	
	var time = "";
	
	if(curhour == 0) curhour = 12;
	time = "Current Time :  " +
		curday_string + ", " + 
		(curmonth < 10 ? "0" : "") + curmonth + "/" + 
		(curdate < 10 ? "0" : "") + curdate + "/" + 
		curyear + " " +
		(curhour > 12 ? curhour - 12 : curhour) + ":" +
		(curmin < 10 ? "0" : "") + curmin + ":" +
		(cursec < 10 ? "0" : "") + cursec + " " +
		(curhour > 12 ? "PM" : "AM") + 
		" SGT";
	
	document.getElementById("list_current_time").value = time;
}

function createMarker(point, title, html, n, tooltip) {
	if(n >= 0) { n = -1; }
	var marker = new GMarker(point,{'title': tooltip});
	var tabFlag = isArray(html);
	if(!tabFlag) { html = [{"contentElem": html}]; }
	
	to_htmls[counter] = html[0].contentElem + '<form class="gmapDir" id="gmapDirTo" style="white-space: nowrap;" action="http://maps.google.com/maps" method="get" target="_blank">' +
						 '<span class="gmapDirHead" id="gmapDirHeadTo">Directions: <strong>To here</strong> - <a href="javascript:fromhere(' + counter + ')">From here</a></span>' +
						 '<p class="gmapDirItem" id="gmapDirItemTo"><label for="gmapDirSaddr" class="gmapDirLabel" id="gmapDirLabelTo">Start address: (include addr, city st/region)<br /></label>' +
						 '<input type="text" size="40" maxlength="40" name="saddr" class="gmapTextBox" id="gmapDirSaddr" value="" onfocus="this.style.backgroundColor = \'#e0e0e0\';" onblur="this.style.backgroundColor = \'#ffffff\';" />' +
						 '<span class="gmapDirBtns" id="gmapDirBtnsTo"><input value="Get Directions" type="submit" class="gmapDirButton" id="gmapDirButtonTo" /></span></p>' +
						 '<input type="hidden" name="daddr" value="' +
						 point.y + ',' + point.x + "(" + title.replace(new RegExp(/"/g),'&quot;') + ")" + '" /></form>';
						  from_htmls[counter] = html[0].contentElem + '<p /><form class="gmapDir" id="gmapDirFrom" style="white-space: nowrap;" action="http://maps.google.com/maps" method="get" target="_blank">' +
						 '<span class="gmapDirHead" id="gmapDirHeadFrom">Directions: <a href="javascript:tohere(' + counter + ')">To here</a> - <strong>From here</strong></span>' +
						 '<p class="gmapDirItem" id="gmapDirItemFrom"><label for="gmapDirSaddr" class="gmapDirLabel" id="gmapDirLabelFrom">End address: (include addr, city st/region)<br /></label>' +
						 '<input type="text" size="40" maxlength="40" name="daddr" class="gmapTextBox" id="gmapDirSaddr" value="" onfocus="this.style.backgroundColor = \'#e0e0e0\';" onblur="this.style.backgroundColor = \'#ffffff\';" />' +
						 '<span class="gmapDirBtns" id="gmapDirBtnsFrom"><input value="Get Directions" type="submit" class="gmapDirButton" id="gmapDirButtonFrom" /></span></p>' +
						 '<input type="hidden" name="saddr" value="' +
						 point.y + ',' + point.x + encodeURIComponent("(" + title.replace(new RegExp(/"/g),'&quot;') + ")") + '" /></form>';
						 
	html[0].contentElem = html[0].contentElem + '<p /><div id="gmapDirHead" class="gmapDir" style="white-space: nowrap; color:#000000;">Directions: <a href="javascript:tohere(' + counter + ')" style="color:#56becb;">To here</a> - <a href="javascript:fromhere(' + counter + ')" style="color:#56becb;">From here</a></div>';
	
	if(!tabFlag) { html = html[0].contentElem; }if(isArray(html)) { GEvent.addListener(marker, "mouseover", function() { 		marker.openInfoWindowTabsHtml(html); }); }
	else { GEvent.addListener(marker, "mouseover", function() { marker.openInfoWindowHtml(html); }); }
	
	points[counter] = point;
	markers[counter] = marker;
	counter++;
	return marker;
}
function isArray(a) {return isObject(a) && a.constructor == Array;}
function isObject(a) {return (a && typeof a == 'object') || isFunction(a);}
function isFunction(a) {return typeof a == 'function';}
function showInfoWindow(idx,html) {
	map.centerAtLatLng(points[idx]);
	markers[idx].openInfoWindowHtml(html);
}
function tohere(idx) {
	markers[idx].openInfoWindowHtml(to_htmls[idx]);
}
function fromhere(idx) {
	markers[idx].openInfoWindowHtml(from_htmls[idx]);
}
//]]>
