﻿/* **** CUSTOM MAPPING CODE **** 
This code defines the images and CSS that are used for the
various PointTypes used in mapping throughout the site.
*/
Map_PointIconSet.prototype.SetType = function(strPointType)
{
        if(strPointType.indexOf('GROUP') > -1)
    {
        this.iconImage = '/images/mapping/Default_ClusterPin.gif';
        this.iconImageShadow = ''; // /images/mapping/Default_ClusterPin_Shadow.gif'; removing the barely-visible star shadow improves load time greatly.
        this.pushpinWidth = 21;
        this.pushpinHeight = 21;
        this.tooltipClassName = 'Map_Yellow_ToolTip';
        this.isGrouping = true;
        this.pushPinOrientation = 'Center';
    }
    else if(strPointType.indexOf('PROPERTY_FEATURED') > -1)
    {
        this.iconImage = '/images/mapping/Red_Pin.gif';
        this.iconImageShadow = '/images/mapping/Default_Pin_Shadow.gif';
        this.pushpinWidth = 19;
        this.pushpinHeight = 40;
        this.tooltipClassName = 'Map_Red_ToolTip';
        this.isGrouping = false;
    }
    else if(strPointType.indexOf('PROPERTY_OPENHOUSE') > -1)
    {
        this.iconImage = '/images/mapping/Yellow_Pin.gif';
        this.iconImageShadow = '/images/mapping/Default_Pin_Shadow.gif';
        this.pushpinWidth = 19;
        this.pushpinHeight = 40;
        this.tooltipClassName = 'Map_Yellow_ToolTip';
        this.isGrouping = false;
    }
    else if(strPointType.indexOf('PROPERTY_MULTIPHOTO') > -1)
    {
        this.iconImage = '/images/mapping/Green_Pin.gif';
        this.iconImageShadow = '/images/mapping/Default_Pin_Shadow.gif';
        this.pushpinWidth = 19;
        this.pushpinHeight = 40;
        this.tooltipClassName = 'Map_Green_ToolTip';
        this.isGrouping = false;
    }
    else if(strPointType.indexOf('PROPERTY_SCHOOL') > -1)
    {
        this.iconImage = '/images/mapping/Red_Pin.gif';
        this.iconImageShadow = '/images/mapping/Default_Pin_Shadow.gif';
        this.pushpinWidth = 19;
        this.pushpinHeight = 40;
        this.tooltipClassName = 'Map_Purple_ToolTip';
        this.isGrouping = false;
    }
    else //DEFAULT
    {
        this.iconImage = '/images/mapping/Default_Pin.gif';
        this.iconImageShadow = '/images/mapping/Default_Pin_Shadow.gif';
        this.pushpinWidth = 19;
        this.pushpinHeight = 40;
        this.tooltipClassName = 'Map_Default_ToolTip';
        this.isGrouping = false;
    }
};








/* This function is used in the /_include/mapping/MapDetail_PropertyRequestInfo.asp */
function submitMapRequestInfo()
{
    var frm = document.getElementById("frmMapRequestInfo");
	var msg = '';
	
	if (!validateTextBox(frm.FIRSTNAME) || !validateTextBox(frm.LASTNAME)){msg=msg+'First and Last Name\n';}
	if (!validateEmail(frm.mailfrom)){msg=msg+'Valid E-Mail Address\n';}
	if (!validateTextBox(frm.COMMENTS)){msg=msg+'Comments\n';}
	
	if (msg != '')
	{
        msg = 'Error: The following field(s) are required.\n\n' + msg + '\n';
		alert(msg);
		return false;
	}
	else
	{
	    ///Submit the form
		var strParameters = '';
        var elem = frm.elements;
        var strVal='';
        for(var i = 0; i < elem.length; i++){if(elem[i].name.length != 0){strVal = elem[i].value;strVal = strVal.replace(/[%]/g, '%25');strVal = strVal.replace(/[?]/g, '%3F');strVal = strVal.replace(/[&]/g, '%26');if(strParameters.length > 0){strParameters += '&';}strParameters += elem[i].name + '=' + strVal;}}
        var url = frm.action;var myRequest = XMLHTTPRequest_createRequester();
	    myRequest.onreadystatechange = function(){if (myRequest.readyState == 4){if (myRequest.status == 200){document.getElementById('Map_Detail_IFrame').innerHTML = myRequest.responseText;}else{alert('There was a problem with the request.');}}};
        myRequest.open('POST', url, true);
        myRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        myRequest.setRequestHeader("Content-length", strParameters.length);
        myRequest.send(strParameters);
	    return false;
	}
}

/* ***************************************** */
/* **** NO NEED TO EDIT BELOW THIS LINE **** */
/* ***************************************** */
var SlideShow_IntervalID = 0;var SlideShow_MaxPic = 0;var SlideShow_Count = 1;
function NextSlideShow(){SlideShow_Count++;if(SlideShow_Count > SlideShow_MaxPic){SlideShow_Count = 1;}LoadSlideShow();}
function PrevSlideShow(){SlideShow_Count--;if(SlideShow_Count==0){SlideShow_Count = SlideShow_MaxPic;}LoadSlideShow();}
function LoadSlideShow(){if(document.all){document.getElementById('p').style.filter='blendTrans(duration=2)';document.getElementById('p').style.filter='blendTrans(duration=crossFadeDuration)';document.getElementById('p').filters.blendTrans.Apply();}eval("document.getElementById('p').src=p" + SlideShow_Count + ".src;");if(document.all){document.getElementById('p').filters.blendTrans.Play();}}
function StopSlideShow(){document.getElementById("slidebutton").value='Stop';clearInterval(SlideShow_IntervalID);SetPlayPauseButtonImage();}
function PlayPauseSlideShow(){if(document.getElementById("slidebutton").value=='Play'){StopSlideShow();}else{document.getElementById("slidebutton").value = 'Play';startPix();}SetPlayPauseButtonImage();}
function SetPlayPauseButtonImage(){if(document.getElementById("slidebutton").value=='Play'){document.getElementById('photoPlayMiniButton').src = '/images/photoPauseMini.gif';}else{document.getElementById('photoPlayMiniButton').src = '/images/photoPlayMini.gif';}}
function startPix(){var rotate_delay=4000;/*delay in milliseconds (3000 = 3 secs)*/if(SlideShow_IntervalID != 0){clearInterval(SlideShow_IntervalID);}SlideShow_IntervalID = setInterval("slideshow()", rotate_delay);}
function slideshow(){try{if(document.getElementById("slidebutton").value=="Play"){NextSlideShow();}}catch(e){if(SlideShow_IntervalID != 0){clearInterval(SlideShow_IntervalID);}}}