    //Enumerations
var VIEW_GOLF = 1;
var VIEW_OCEAN = 2;
var VIEW_MARSH = 3;
var VIEW_LAKE = 4;
var VIEW_WOODS = 5;
var AMEN_POOL = 1;
var AMEN_1STORY = 2;
var AMEN_PROG = 3;

//Community Links
var Links = new Object();
Links.frederica = {MapLink:'Frederica_Map.pdf',PageLink:'fredericahome.html'};
Links.oceanforest = {MapLink:'Ocean_Forest_Map.pdf',PageLink:'oceanforesthome.html'};
Links.seaislandcottages = {MapLink:'SeaIsland_Cottages_Map.pdf',PageLink:'seaislandcottageshome.html'};
Links.hawkinsisland = {MapLink:'Hawkins_Island_Map.pdf',PageLink:'hawkinsislandhome.html'};
Links.beachclubandsuites = {MapLink:'Beach_Club_MAP.pdf',PageLink:'beachclubhome.html'};
Links.lakecottages = {MapLink:'LakeCottages_Map.pdf',PageLink:'lakecottageshome.html'};
Links.kingspoint = {MapLink:'Kings_Point_Map.pdf',PageLink:'kingspointhome.html'};
Links.golfretreatnorth = {MapLink:'GolfRetreat_North_MAP.pdf',PageLink:'golfretreathome.html'};
Links.seaside = {MapLink:'SeaSide_Map.pdf',PageLink:'seasidehome.html'};
Links.lodgesuites = {MapLink:'TheLodge_Map.pdf',PageLink:'lodgesuiteshome.html'};
Links.oceanclubresidences = {MapLink:'#',PageLink:'oceanclubhome.html'};
Links.cloisterocean = {MapLink:'map_cloisterOcean.pdf',PageLink:'cloisteroceanhome.html'};
Links.blackbanksriverresidences = {MapLink:'#',PageLink:'blackbanksriverresidenceshome.html'}; 
Links.stsimonsislandclubretreat = {MapLink:'#',PageLink:'stsimmonshome.html'};
Links.riverclub = {MapLink:'#',PageLink:'riverclubhome.html'};
Links.hamiltonlanding = {MapLink:'#',PageLink:'hamiltonlandinghome.html'};
Links.blackbanks = {MapLink:'#',PageLink:'blackbankshome.html'};
Links.wildlifepreserve = {MapLink:'#',PageLink:'wildlifehomepreserve.html'};
Links.commercial = {MapLink:'#',PageLink:'commercialhome.html'};
Links.other = {MapLink:'#',PageLink:'otherhome.html'};

//Misc. (but necessary) variables
var curIdx = 0
var aProducts = [];
var GalleryCount = 0;
var GalleryWin = null;
var oFormData = null;
var curDivID = '';

function CreateJSONArray(sIDs)
{
	var json = new Array();
	var ary = sIDs.split(",");
	
	for(var i=0; i<ary.length; i++)
		if(parseInt(ary[i]) == InitProd.ID) {
			json[i] = InitProd;
			curIdx = i;
		} else {
			json[i] = {ID:parseInt(ary[i]), _loaded:false, _ErrorCode:0};
		}
	
	return json;
}

function DrawProduct(Product)
{
	var aHTML = new Array();
	var bGallery = bFloorPlan = false;
	
	if(Product.IsFeatured)
		aHTML.push('<table class="PropertyFeatured">');
	else
		aHTML.push('<table class="Property">');
		
	aHTML.push('<tr>');
	aHTML.push('<td class="Header"><strong>' + Product.Development + ' - ' + Product.Community + '</strong> - [' + Product.Type + ']</td>');
	aHTML.push('</tr><tr>');
	aHTML.push('<td class="Body">');
	
	if(Product.Image.length > 0)
		aHTML.push('<div align="center" style="margin-bottom:8px;"><img src="/DSN/wwwseaislandpropcom/Commerce/ProductImages/' + Product.Image + '" class="BlockIMG" alt="' + Product.Name + '" border="0" onload="document.body.style.cursor=\'default\';"></div>');
	else
		aHTML.push('<div align="center" style="margin-bottom:8px;"><img src="/DSN/wwwseaislandpropcom/Commerce/ProductImages/Detail View_NoImage.jpg" class="BlockIMG" border="0" onload="document.body.style.cursor=\'default\';"></div>');
	
	aHTML.push('<div class="PropertyOptions">');
	
	if(Product.Gallery.length > 0) {
		aHTML.push('<a href="javascript:void(ShowGallery(\'GalleryDiv\'));" class="Arrow">Photo Gallery</a><br>');
		bGallery = true;
	}
	
	if(Product.VirtualTour.length > 0)
		aHTML.push('<a href="javascript:void(DisplayPreview(\'/DSN/wwwseaislandpropcom/Commerce/ProductImages/' + Product.VirtualTour + '\', 525, 375, true));" class="Arrow">Virtual Tour</a><br>');
	
	if(Product.FloorPlan.length > 0) {
		aHTML.push('<a href="javascript:void(ShowGallery(\'FloorPlanDiv\'));" class="Arrow">Floor Plan</a><br>');
		bFloorPlan = true;
	}
	
	if(Product.PrintFlyer.length > 0)
		aHTML.push('<a href="/DSN/wwwseaislandpropcom/Commerce/ProductImages/' + Product.PrintFlyer + '" class="Arrow" target="_blank">Print Flyer</a><br>');
		
	aHTML.push('<a href="javascript:void(SendEmail(' + Product.ID + '));" class="Arrow">E-Mail This Listing</a>');

	// added print flyer aug 08
	aHTML.push('<br /><a href="javascript:void(OpenFlyer(' + Product.ID + '));" class="Arrow">Print Flyer</a>');
	//

	aHTML.push('<div style="border-top:1px solid #FFF;margin-top:3px;padding-top:2px;"><a href="/tools/requestmoreinfo.html" class="Arrow">Request More Information</a></div>');
	aHTML.push('</div>');
	
	if(Product.Views.length > 0)
	{
		var views = Product.Views.split(",");
		aHTML.push('<div style="float:right;margin-right:150px;position:relative;">');
		for(var i=0; i<views.length; i++)
			switch(parseInt(views[i])) {
				case VIEW_GOLF:
					aHTML.push('<img src="/DSN/wwwseaislandpropcom/Commerce/searchIcons/golf.gif" border="0" onmouseover="ToolTip(this, \'Golf\');" onmouseout="HideTip(this.lang);">');
				break;
				case VIEW_LAKE:
					aHTML.push('<img src="/DSN/wwwseaislandpropcom/Commerce/searchIcons/lake.gif" border="0" onmouseover="ToolTip(this, \'Lake\');" onmouseout="HideTip(this.lang);">');
				break;			
				case VIEW_MARSH:
					aHTML.push('<img src="/DSN/wwwseaislandpropcom/Commerce/searchIcons/marsh.gif" border="0" onmouseover="ToolTip(this, \'Marsh\');" onmouseout="HideTip(this.lang);">');
				break;
				case VIEW_OCEAN:
					aHTML.push('<img src="/DSN/wwwseaislandpropcom/Commerce/searchIcons/ocean.gif" border="0" onmouseover="ToolTip(this, \'Ocean\');" onmouseout="HideTip(this.lang);">');
				break;
				case VIEW_WOODS:
					aHTML.push('<img src="/DSN/wwwseaislandpropcom/Commerce/searchIcons/woods.gif" border="0" onmouseover="ToolTip(this, \'Woods\');" onmouseout="HideTip(this.lang);">');
				break;
			}	
		aHTML.push('</div>');
	}
	
	if(Product.IsFeatured) {
		aHTML.push('<img src="/DSN/wwwseaislandpropcom/Content/Images/default/FeaturedPropLabel.jpg" class="BlockIMG">');
		aHTML.push('<p style="margin-top:2px;">');
	} else {
		aHTML.push('<p>');
	}
	
	if(Product.Price != '$0')
		aHTML.push('<strong>' + Product.Price + '</strong></p>');
	else
		aHTML.push('<strong>TBA</strong></p>');
	
	if(Product.Name.trim() == Product.Address.trim() || Product.Address.indexOf(Product.Name) != -1)
		aHTML.push('<p>' + Product.Address);
	else	
		aHTML.push('<p>' + Product.Name + '<br>' + Product.Address);
	
	
	aHTML.push('<ul style="margin:0 0 0 17px;padding:0;">');
	
	if(Product.BedBaths.length > 0)
		aHTML.push('<li>' + Product.BedBaths + '</li>');
	
	if(Product.SquareFt.length > 1)
		aHTML.push('<li>' + Product.SquareFt + ' sq. ft.</li>');
	
	if(Product.Acreage.length > 1)
		aHTML.push('<li>' + Product.Acreage + ' acres</li>');
	
	if(Product.Amenities.length > 0)
	{
		var amens = Product.Amenities.split(",");
		for(var i=0; i<amens.length; i++)
			switch(parseInt(amens[i])) {
				case AMEN_POOL:
					aHTML.push('<li>Pool</li>');
				break;
				case AMEN_1STORY:
					aHTML.push('<li>One-Story</li>');
				break;			
				case AMEN_PROG:
					aHTML.push('<li>Elgibile for Rental Program</li>');
				break;
			}	
	}
	
	aHTML.push('</ul>');
	
	aHTML.push('<p><a href="/DSN/wwwseaislandpropcom/Content/PDF/' + Links[Product._LinkVar].MapLink + '" class="Arrow" style="color:#827D7A;" target="_blank"><strong>View ' + Product.Community + ' Map</strong>'
		+ '<img src="/DSN/wwwseaislandpropcom/Content/Images/default/sm_pdf_icon.gif" border="0"></a></p>');
	
	aHTML.push('<p><strong>Special Features:</strong> ' + Product.LeadIn + '</p>');
	aHTML.push('<p>' + Product.Desc);
	aHTML.push('<br><a href="/realestate/' + Links[Product._LinkVar].PageLink + '" style="color:#827D7A;" class="Arrow"><strong>Learn More About ' + Product.Community + '</strong></a></p>');
	aHTML.push('</td></tr></table>');
	
	GetTag("DisplayDiv").innerHTML = aHTML.join('\n');
	
	if(bGallery) BuildGallery('GalleryDiv', Product.Gallery);
	if(bFloorPlan) BuildGallery('FloorPlanDiv', Product.FloorPlan);
}

function DrawScreen(bMulti)
{
	var aHTML = new Array();
	
	if(bMulti)
	{
		aHTML.push('<form action="/realestate/listings.html" method="' + oFormData.PassMethod + '" name="PropertyDisplay" id="PropertyDisplay">');
		aHTML.push('<p align="left"><strong><span style="font-size:15px;">Search Listings:</span> <span id="ViewList"></span></strong></p>');
		aHTML.push('<div class="SearchUtilities">');
		aHTML.push('<table width="96%" cellpadding="0" cellspacing="0" border="0" align="center"><tr>');
		
		if(oFormData.PassMethod == 'GET')
			aHTML.push('<td align="left"><input type="button" class="FormButtons" value="Back to Listings" onclick="GetTag(\'PropertyDisplay\').submit();"></td>');
		else
			aHTML.push('<td align="left"><input type="submit" name="SendSearch" class="FormButtons" value="Back to Listings"></td>');
		
		aHTML.push('<td align="right" width="100"><div class="SearchPaging" id="SearchPager"></div></td>');
		aHTML.push('</tr></table>');
		aHTML.push('</div>');
		
		for(x in oFormData)
			if(x != 'PassMethod')
				aHTML.push('<input type="hidden" name="' + x + '" value="' + oFormData[x] + '">');
		
		aHTML.push('</form>');
	}
	
	aHTML.push('<div id="DisplayDiv"></div>');
	aHTML.push('<div id="GalleryDiv" style="display:none;"></div>');
	aHTML.push('<div id="FloorPlanDiv" style="display:none;"></div>');
	aHTML.push('<div id="HTMLEmailDiv" style="display:none;"></div>');
	
	GetTag("ScreenDiv").innerHTML = aHTML.join('\n');
	
	if(bMulti) {
		curIdx--;
		ChangeProduct('+');
	} else {
		document.body.style.cursor = 'wait';
		DrawProduct(InitProd);
	}
}

function DrawPager(idx)
{
	var aHTML = new Array();
	
	aHTML.push('<table cellpadding="1" cellspacing="0" border="0" align="center"><tr>');
	
	if(idx == 0)
		aHTML.push('<td><img src="/DSN/wwwseaislandpropcom/Content/Images/default/icon_bluearrow_left.jpg" class="BlockIMG" border="0"></td>')
	else
		aHTML.push('<td><a href="javascript:void(ChangeProduct(\'-\'));"><img src="/DSN/wwwseaislandpropcom/Content/Images/default/icon_bluearrow_left.jpg" class="BlockIMG" border="0"></a></td>')
		
	aHTML.push('<td style="white-space:nowrap;">&nbsp;PAGE ' + (idx+1) + ' of ' + aProducts.length + '&nbsp;</td>');
	
	if(idx >= (aProducts.length-1))
		aHTML.push('<td><img src="/DSN/wwwseaislandpropcom/Content/Images/default/icon_bluearrow_right.jpg" class="BlockIMG" border="0"></td>');
	else
		aHTML.push('<td><a href="javascript:void(ChangeProduct(\'+\'));"><img src="/DSN/wwwseaislandpropcom/Content/Images/default/icon_bluearrow_right.jpg" class="BlockIMG" border="0"></a></td>');
		
	aHTML.push('</tr></table>');
	
	GetTag('ViewList').innerHTML = 'Viewing List ' + (idx+1) + ' of ' + aProducts.length + '.';
	GetTag('SearchPager').innerHTML = aHTML.join('\n');
}

function ChangeProduct(dir)
{
	document.body.style.cursor = 'wait';
	eval('curIdx'+dir+dir);
	DrawProduct(aProducts[curIdx]);
	
	try{ DrawPager(curIdx); } catch(e) { }
	
	if(curIdx != 0)
		LoadProduct(curIdx-1);
	
	if(curIdx != (aProducts.length-1))
		LoadProduct(curIdx+1);

	document.location.hash = aProducts[curIdx].ID;
}

function LoadProduct(idx)
{
	if(aProducts[idx]._loaded || aProducts[idx]._ErrorCode != 0) return;
	
	var ajax = CreateAJAXObject();
	
	if(ajax == null) {
		DrawScreen(false);
		return;	
	}
	
	ajax.open("GET", "/DSN/wwwseaislandpropcom/Content/AJAX/ProductInfo.asp?PID=" + aProducts[idx].ID, true);
	
	ajax.onreadystatechange = function() {
		if(ajax.readyState == 4 && ajax.status == 200) {
			var PData = eval('[' + ajax.responseText + ']');
			aProducts[idx] = PData[0];
		}
	}
	
	ajax.send(null);
}

function BuildGallery(DivID, aPhotos)
{
	var aHTML = new Array();
	
	for(var i=0; i<aPhotos.length; i++)
		aHTML.push('<img src="/DSN/wwwseaislandpropcom/Commerce/ProductImages/' + aPhotos[i] + '" border="0" id="' + DivID + 'Pic' + i + '" style="margin-bottom:15px;" class="BlockIMG">');
	
	GetTag(DivID).innerHTML = aHTML.join('\n');
}

function ShowGallery(DivID)
{
	var aHTML = new Array();
	var imgs = GetTag(DivID).getElementsByTagName("img");
	var sInitHTML = '';
	curDivID = DivID;
	GalleryCount = imgs.length;
	
	for(var i=0; i<imgs.length; i++)
		imgs[i].style.display = 'none';
/*	sInitHTML = '<html>\n<head>\n<title>Photo Gallery</title>\n'
	sInitHTML += '<link rel="StyleSheet" type="text/css" href="/DSN/wwwseaislandpropcom/Style/Public_wwwseaislandpropcom.css">\n';
    sInitHTML += '<scr' + 'ipt language="javascript">\n';
    sInitHTML += 'var aHTML = new Array();\n';
	sInitHTML += 'aHTML.push(\'<div style="width:800px;margin:auto;"><img id="GCPhoto" style="margin-bottom:12px;">\');\n';
	sInitHTML += 'aHTML.push(\'<div style="float:right;width:140px;padding:3px 5px;" align="left" class="DynContentFill">\');\n';
	sInitHTML += 'aHTML.push(\'<a href="#" onClick="window.print();return false" class="Arrow">Print</a><br>\');\n';
	sInitHTML += 'aHTML.push(\'<a href="javascript:window.close();" class="Arrow">Close Window</a>\\n</div>\');\n';
	sInitHTML += 'aHTML.push(\'<table id="PopUpGalleryControls" style="margin:auto;" align="center"><tr>\');\n';
	sInitHTML += 'aHTML.push(\'<td id="GCLeft"><img src="/DSN/wwwseaislandpropcom/Content/Images/default/TourArrowLeft.jpg" border="0"></td>\');\n';
	sInitHTML += 'aHTML.push(\'<td><span id="GCCount">1</span> of ' + imgs.length + '</td>\');\n';
	if(imgs.length > 1)
		sInitHTML += 'aHTML.push(\'<td id="GCRight"><a href="javascript:void(0);"><img src="/DSN/wwwseaislandpropcom/Content/Images/default/TourArrowRt.jpg" border="0"></a></td>\');\n';
	else
		sInitHTML += 'aHTML.push(\'<td id="GCRight"><img src="/DSN/wwwseaislandpropcom/Content/Images/default/TourArrowRt.jpg" border="0"></td>\');\n';
	sInitHTML += 'aHTML.push(\'</tr></table></div>\\n\');\n';
	sInitHTML += 'function doPrint(){\n';
	sInitHTML += 'window.print();\n';
	sInitHTML += 'window.status = \'Attempting Print\';\n';
	sInitHTML += 'return false;}\n';
	sInitHTML += '</scr' + 'ipt>\n';
    sInitHTML += '</head>\n<body style="margin:8px auto 0px;text-align:center;"><span id="initHolder">\n';
	sInitHTML += '<scr' + 'ipt language="javascript">document.getElementById(\'initHolder\').innerHTML = aHTML.join(\'\\n\');window.opener.ChangePhoto(1);</scr' + 'ipt>\n';
	sInitHTML += '</span></body></html>\n';
	GalleryWin = window.open('gallerypopup.html', 'GalleryWin', 'width=850,height=700,status=no,scrollbars=auto,resizable=no');
*/
	GalleryWin = window.open('/DSN/wwwseaislandpropcom/Content/JavaScript/listingGallery.html?Length=' + imgs.length, 'GalleryWin', 'width=850,height=700,status=no,scrollbars=auto,resizable=no');
//	GalleryWin.document.write(sInitHTML);
	//GalleryWin.document.getElementById('initHolder').innerHTML = aHTML.join('\n');
	//GalleryWin.document.write(aHTML.join('\n'));
	return false;
}

function ChangePhoto(page)
{
	var idx = parseInt(page) - 1;
	var next = parseInt(page) + 1;
	var prev = parseInt(page) - 1;
	
	GalleryWin.document.getElementById("GCPhoto").src = GetTag(curDivID+"Pic"+idx).src;
		
	if(idx != 0)
		GalleryWin.document.getElementById("GCLeft").innerHTML = '<a href="javascript:void(window.opener.ChangePhoto(' + prev + '));"><img src="/DSN/wwwseaislandpropcom/Content/Images/default/TourArrowLeft.jpg" border="0"></a>';
	else
		GalleryWin.document.getElementById("GCLeft").innerHTML = '<img src="/DSN/wwwseaislandpropcom/Content/Images/default/TourArrowLeft.jpg" border="0">';
	
	if(idx <= GalleryCount-1)
		GalleryWin.document.getElementById("GCRight").innerHTML = '<a href="javascript:void(window.opener.ChangePhoto(' + next + '));"><img src="/DSN/wwwseaislandpropcom/Content/Images/default/TourArrowRt.jpg" border="0"></a>';
	else
		GalleryWin.document.getElementById("GCRight").innerHTML = '<img src="/DSN/wwwseaislandpropcom/Content/Images/default/TourArrowRt.jpg" border="0">';

	if(idx == GalleryCount-1)
		GalleryWin.document.getElementById("GCRight").innerHTML = '<a href="javascript:void(window.opener.ChangePhoto(1));"><img src="/DSN/wwwseaislandpropcom/Content/Images/default/TourArrowRt.jpg" border="0"></a>';

	
	GalleryWin.document.getElementById("GCCount").innerHTML = page;
}

function SendEmail(PID)
{
	var prod;
	
	for(var i=0; i<aProducts.length; i++)
		if(aProducts[i].ID == PID) {
			prod = aProducts[i];
			break;
		}
	
	CreateEmailBody(prod);
	
	window.open('/DSN/wwwseaislandpropcom/Content/ASP/EmailListing.html', 'EmailIt', 'width=520,height=500,status=no,scrollbars=auto,resizable=no');
}


function CreateEmailBody(Product)
{
	var aHTML = new Array();
		
	if(Product.IsFeatured)
		aHTML.push('<table style="clear:both;width:527px;margin:5px auto;border-collapse:collapse;border: 3px solid #FFFFFF;">');
	else
		aHTML.push('<table style="clear:both;width:527px;margin:5px auto;border-collapse:collapse;border: 1px solid #FFFFFF;">');
		
	aHTML.push('<tr>');
	
	if(Product.IsFeatured)
		aHTML.push('<td style="color:#FFF;background-color:#77786A;font-size:15px;padding:3px 8px;font-family:\'times new roman\';"><strong>' + Product.Development + ' - ' + Product.Community + '</strong> - [' + Product.Type + ']</td>');
	else
		aHTML.push('<td style="color:#817C76;background-color:#EBECE6;font-size:15px;padding:3px 8px;font-family:\'times new roman\';"><strong>' + Product.Development + ' - ' + Product.Community + '</strong> - [' + Product.Type + ']</td>');
			
	aHTML.push('</tr><tr>');
	
	if(Product.IsFeatured)
		aHTML.push('<td style="color:#817C76;background-color:#E8E6D7;padding:6px;font-family:\'times new roman\';">');
	else
		aHTML.push('<td style="color:#817C76;background-color:#EBECE6;padding:6px;font-family:\'times new roman\';">');
	
	if(Product.Image.length > 0)
		aHTML.push('<div align="center" style="margin-bottom:8px;"><img src="http://seaislandproperties.com/DSN/wwwseaislandpropcom/Commerce/ProductImages/' + Product.Image + '" style="display:block;margin:0;" alt="' + Product.Name + '" border="0"></div>');
		
	if(Product.Views.length > 0)
	{
		var views = Product.Views.split(",");
		aHTML.push('<div style="float:right;margin-right:150px;position:relative;">');
		for(var i=0; i<views.length; i++)
			switch(parseInt(views[i])) {
				case VIEW_GOLF:
					aHTML.push('<img src="http://www.seaislandproperties.com/DSN/wwwseaislandpropcom/Commerce/searchIcons/golf.gif" border="0">');
				break;
				case VIEW_LAKE:
					aHTML.push('<img src="http://www.seaislandproperties.com/DSN/wwwseaislandpropcom/Commerce/searchIcons/lake.gif" border="0">');
				break;			
				case VIEW_MARSH:
					aHTML.push('<img src="http://www.seaislandproperties.com/DSN/wwwseaislandpropcom/Commerce/searchIcons/marsh.gif" border="0">');
				break;
				case VIEW_OCEAN:
					aHTML.push('<img src="http://www.seaislandproperties.com/DSN/wwwseaislandpropcom/Commerce/searchIcons/ocean.gif" border="0">');
				break;
				case VIEW_WOODS:
					aHTML.push('<img src="http://www.seaislandproperties.com/DSN/wwwseaislandpropcom/Commerce/searchIcons/woods.gif" border="0">');
				break;
			}	
		aHTML.push('</div>');
	}
	
	if(Product.IsFeatured) {
		aHTML.push('<img src="http://seaislandproperties.com/DSN/wwwseaislandpropcom/Content/Images/default/FeaturedPropLabel.jpg" class="BlockIMG">');
		aHTML.push('<p style="margin-top:2px;">');
	} else {
		aHTML.push('<p>');
	}
	
	if(Product.Price != '$0')
		aHTML.push('<strong>' + Product.Price + '</strong></p>');
	else
		aHTML.push('<strong>TBA</strong></p>');
	
	if(Product.Name.trim() == Product.Address.trim() || Product.Address.indexOf(Product.Name) != -1)
		aHTML.push('<p>' + Product.Address);
	else	
		aHTML.push('<p>' + Product.Name + '<br>' + Product.Address);
	
	
	aHTML.push('<ul style="margin:0 0 0 17px;padding:0;">');
	
	if(Product.BedBaths.length > 0)
		aHTML.push('<li>' + Product.BedBaths + '</li>');
	
	if(Product.SquareFt.length > 1)
		aHTML.push('<li>' + Product.SquareFt + ' sq. ft.</li>');
	
	if(Product.Acreage.length > 1)
		aHTML.push('<li>' + Product.Acreage + ' acres</li>');
	
	if(Product.Amenities.length > 0)
	{
		var amens = Product.Amenities.split(",");
		for(var i=0; i<amens.length; i++)
			switch(parseInt(amens[i])) {
				case AMEN_POOL:
					aHTML.push('<li>Pool</li>');
				break;
				case AMEN_1STORY:
					aHTML.push('<li>One-Story</li>');
				break;			
				case AMEN_PROG:
					aHTML.push('<li>Elgibile for Rental Program</li>');
				break;
			}	
	}
	
	aHTML.push('</ul>');
	
	aHTML.push('<p><strong>Special Features:</strong> ' + Product.LeadIn + '</p>');
	aHTML.push('<p>' + Product.Desc + '</p>');
	
	aHTML.push('<p><a href="http://www.seaislandproperties.com/realestate/propertydetails.html?PID=' + Product.ID
		+ '" style="color:#857045;font-weight:bold;padding-left:9px;background:url(http://www.seaislandproperties.com/DSN/wwwseaislandpropcom/Content/Images/default/link-arrow_right.gif) 0 5px no-repeat;'
		+ 'font-family:garamond;text-decoration:none;" target="_blank">View Full Listing</a>');
		
	aHTML.push('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.seaislandproperties.com/tools/requestmoreinfo.html'
		+ '" style="color:#857045;font-weight:bold;padding-left:9px;background:url(http://www.seaislandproperties.com/DSN/wwwseaislandpropcom/Content/Images/default/link-arrow_right.gif) 0 5px no-repeat;'
		+ 'font-family:garamond;text-decoration:none;" target="_blank">Request More Information</a></p>');
	
	aHTML.push('</td></tr></table>');
	
	GetTag("HTMLEmailDiv").innerHTML = aHTML.join('\n');
}



//AJAX functions
function CreateAJAXObject()
{
	var request = null;
	
	try {
		request = new XMLHttpRequest();
	} catch(a) {
		try {
			request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(i) { }
		}
	}
	
	return request;
}

/// Print Flyer Added By David on Aug 08
function OpenFlyer(PID)
{
	var prod;
	
	for(var i=0; i<aProducts.length; i++)
		if(aProducts[i].ID == PID) {
			prod = aProducts[i];
			break;
		}
	
	CreateFlyerBody(prod);
	
}

function CreateFlyerBody(Product)
{
	

	var aHTML = new Array();

	aHTML.push('<div style="width:660px;background-color:#EBECE6;padding:10px;">');

	aHTML.push('<div align="left" style="font-weight:bold">' + Product.Development + ' - ' + Product.Community + '</div>');
	aHTML.push('<div style="border-width:2px;border-color:#ffffff;border-style:solid;background-color:#E9E6D5;padding:5px;">');
	aHTML.push('<table width="100%" cellpadding="0" cellspacing="0">');
	aHTML.push('<tr>');
       if(Product.Image.length > 0)
	aHTML.push('<td rowspan="2"><img width="444px" height="209px" src="/DSN/wwwseaislandpropcom/Commerce/ProductImages/' + Product.Image + '" alt="'+ Product.Name +'"/></td>');
       else
	aHTML.push('<td rowspan="2"><img width="444px" height="209px" src="/DSN/wwwseaislandpropcom/Commerce/ProductImages/Detail View_NoImage.jpg" alt="'+ Product.Name +'" /></td>');

	aHTML.push('<td valign="top"><img src="/DSN/wwwseaislandpropcom/Content/Images/flyerLogo.jpg" alt="Sea Island Logo" /></td>');
	aHTML.push('</tr>');
	aHTML.push('<tr>');
	aHTML.push('<td>');
	aHTML.push(Product.Price + '<br />');
	aHTML.push(Product.Name + '<br />');
       
       if (Product.Name.trim() == Product.Address.trim())
	 { } 
       else
	 { aHTML.push(Product.Address + '<br />'); }
	
	aHTML.push('</td>');
	aHTML.push('</tr>');
	aHTML.push('<tr>');
	aHTML.push('<td>');
	aHTML.push('<br /><ul>');
	if(Product.BedBaths.length > 0)
		aHTML.push('<li>' + Product.BedBaths + '</li>');
	if(Product.SquareFt.length > 1)
		aHTML.push('<li>' + Product.SquareFt + ' sq. ft.</li>');
	if(Product.Acreage.length > 1)
		aHTML.push('<li>' + Product.Acreage + ' acres</li>');
	aHTML.push('</ul><br />');
       
       if(Product.Views.length > 0)
       {
	  var views = Product.Views.split(",");
	  var comma = "";
	  aHTML.push('<strong>View : </strong>');

	  for(var i=0; i<views.length; i++)
          {
		switch(parseInt(views[i])) {
			case VIEW_GOLF:
				aHTML.push(comma + 'Golf');
				break;
			case VIEW_LAKE:
				aHTML.push(comma + 'Lake');
				break;
			case VIEW_MARSH:
				aHTML.push(comma + 'Marsh/River');
				break;
			case VIEW_OCEAN:
				aHTML.push(comma + 'Ocean');
				break;
			case VIEW_WOODS:
				aHTML.push(comma + 'Woods');
				break;

		}
		comma = ",";
	  }
	  
	  aHTML.push('<br />');

       }

	aHTML.push('<strong>Special Features:</strong> ' + Product.LeadIn + '<br /><br />');
	aHTML.push('</td>');
	aHTML.push('</tr>');
	aHTML.push('<tr><td colspan="2">' +  Product.Desc + '</td></tr>');
	aHTML.push('</table>');

       if (Product.Gallery.length > 0)
       {
	 
		// design based on # of photos
		if (Product.Gallery.length == 1)
		{

			aHTML.push('<table cellpadding="0" cellspacing="10" align="center" >');
			aHTML.push('<tr>');
			aHTML.push('<td align="center"><img width="305" src="/DSN/wwwseaislandpropcom/Commerce/ProductImages/' + Product.Gallery[0] + '" alt="Flyer Photo 1" /></td>');
		   if (Product.FloorPlan.length > 0)
			aHTML.push('<td><img width="305" src="/DSN/wwwseaislandpropcom/Commerce/ProductImages/' + Product.FloorPlan[0] + '" alt="Flyer Photo" /></td>');
		   else

			aHTML.push('</tr>');
			aHTML.push('</table>');


		} // end design for one photo

		if (Product.Gallery.length == 2)
		{

			aHTML.push('<table cellpadding="0" cellspacing="10" align="center" >');
			aHTML.push('<tr>');
			aHTML.push('<td><img width="305" src="/DSN/wwwseaislandpropcom/Commerce/ProductImages/' + Product.Gallery[0] + '" alt="Flyer Photo 1" /></td>');
			aHTML.push('<td><img width="305" src="/DSN/wwwseaislandpropcom/Commerce/ProductImages/' + Product.Gallery[1] + '" alt="Flyer Photo 2" /></td>');
			aHTML.push('</tr>');
		   if (Product.FloorPlan.length > 0)
			aHTML.push('<tr><td align="center" colspan="2"><img width="305" src="/DSN/wwwseaislandpropcom/Commerce/ProductImages/' + Product.FloorPlan[0] + '" alt="Flyer Photo" /></td></tr>');
		   else
			aHTML.push('</table>');


		} // end design for two photo


		if (Product.Gallery.length >= 3)
		{
			
			aHTML.push('<table cellpadding="0" cellspacing="10" align="center" >');
			aHTML.push('<tr>');
			aHTML.push('<td><img width="305" src="/DSN/wwwseaislandpropcom/Commerce/ProductImages/' + Product.Gallery[0] + '" alt="Flyer Photo 1" /></td>');
			aHTML.push('<td><img width="305" src="/DSN/wwwseaislandpropcom/Commerce/ProductImages/' + Product.Gallery[1] + '" alt="Flyer Photo 2" /></td>');
			aHTML.push('</tr>');
			aHTML.push('<tr>');
			aHTML.push('<td><img width="305" src="/DSN/wwwseaislandpropcom/Commerce/ProductImages/' + Product.Gallery[2] + '" alt="Flyer Photo 3" /></td>');
			
		   if (Product.FloorPlan.length > 0)
		    {	
			aHTML.push('<td><img width="305" src="/DSN/wwwseaislandpropcom/Commerce/ProductImages/' + Product.FloorPlan[0] + '" alt="Flyer Photo" /></td>');
		    }
		   else
		    {
			if (Product.Gallery.length > 3)
			{
			   aHTML.push('<td><img width="305" src="/DSN/wwwseaislandpropcom/Commerce/ProductImages/' + Product.Gallery[3] + '" alt="Flyer Photo 3" /></td>');
			}
			else
			{
			   aHTML.push('<td></td>');
			}

			aHTML.push('</tr>');
			aHTML.push('</table>');

		    }// end floor plan if


		} // end design for three of more photo

       } 
       else
       {
		aHTML.push('<table cellpadding="0" cellspacing="10" align="center" >');
		aHTML.push('<tr>');
		if (Product.FloorPlan.length > 0)
			aHTML.push('<td><img width="500" src="/DSN/wwwseaislandpropcom/Commerce/ProductImages/' + Product.FloorPlan[0] + '" alt="Flyer Photo" /></td>');
		else

		 	aHTML.push('</tr>');
			aHTML.push('</table>');
       }
       
	aHTML.push('</div>');
	aHTML.push('</div>');

	//GetTag("HTMLPrintDiv").innerHTML = aHTML.join('\n');

	//document.getElementById("HTMLPrintDiv").innerHTML = aHTML.join('\n');
/*
	FlyerWin = window.open('/DSN/wwwseaislandpropcom/Content/JavaScript/PrintFlyer.htm', 'PrintFlyer', 'width=696,height=600,status=no,scrollbars=yes,resizable=no');

	FlyerWin.onload = function() {
		FlyerWin.document.getElementById("HTMLPrintDiv").innerHTML = aHTML.join('\n');
		FlyerWin.print();
	}
*/
	window.HTMLContent = aHTML.join('\n');
	FlyerWin = window.open('/DSN/wwwseaislandpropcom/Content/JavaScript/PrintFlyer.htm', 'PrintFlyer', 'width=696,height=600,status=no,scrollbars=yes,resizable=no');

}
