// JavaScript Document

function copy_obj(o){
	  	var c = new Object();
		
		for (var e in o) {
			c[e] = o[e];
		}
		return c;
	  }
	  

function compfrmreturn(form, buttonName, enhanced){
// require that at least one checkbox be checked
		var commid = document.getElementById('commid').value;
		var checkSelected = false;
		var checkCounter = 0;
		var listMLNUM ='';
		for (i = 0;  i < document.compareForm.listMLNUM.length;  i++){
			if (document.compareForm.listMLNUM[i].checked){
				checkSelected = true;
				checkCounter = checkCounter + 1;
				listMLNUM += document.compareForm.listMLNUM[i].value ;
				listMLNUM += ',';
				}
				
		}
		if (!checkSelected)	{
			alert("Please select at least one of the listings.");
			
		}
		if (checkCounter > 5){
			alert("You are only allowed to select up to 5 lisitng.\n Please uncheck one or some of your selection in order to select more.");
			
		}
		
		listMLNUM = listMLNUM.concat('-999');
		//alert(listMLNUM);
		if(checkSelected && checkCounter <= 5 ){
			
			if(buttonName =='Compare'){
				 win=window.open('','myWin','width=850,height=900,scrollbars=yes,resizable=yes,left:0px, top:0px'); 
				document.compareForm.target='myWin';
				 document.compareForm.action='http://search.har.com/engine/dispSetMycartTransit.cfm'
		
			 }else {
				document.compareForm.target = '';
				document.compareForm.action='dispSearch.cfm?commid='+commid+'&listSRND=yes&listMLNUM='+listMLNUM;
			 }
			 document.compareForm.submit();
			
		}
	
} 
function checkNumber(chObj){
	if(typeof(chObj)=="string"){
		var myObj=document.getElementsByName(chObj);	
	}else{
		var myObj=document.getElementsByName(chObj.name);
	}
	var tot=0;
	for(var i=0;i<myObj.length;i++){
			if(myObj[i].checked==true){
				tot++;	
			}
	}
	if(tot>5){
				chObj.checked=false;
				alert("You are only allowed to select up to 5 lisitng.");
				return false;
	}

		return true;
	
}

//JSScript from dispProfile.cfm

function zoompic(i){
		window.open ("/masterplanned/images/large/" + i , "newWin", "width=640,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=1");
	}
	
	
	
//JSScript from dispSearch.cfm
function HideContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "block";
}
function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
else { document.getElementById(d).style.display = "none"; }
}



	  
function buildArray(lgt) {
    for (var i=0; i<= lgt; i++) this[i]=0;
    this.length = lgt;
    return this;
}

function buildGSpot(mlongtitude,mlatitude, mhtml, mlabel,mcolor) { 
    this.LONGITUDE=mlongtitude;
    this.LATITUDE=mlatitude;
	this.html = mhtml;
  	this.label = mlabel;
	this.color = mcolor;
    return this;
}


function buildCenterSpot(mlongtitude,mlatitude, mhtml) { 
    this.LONGITUDE=mlongtitude;
    this.LATITUDE=mlatitude;
	this.html = mhtml;
  	
	return this;
};


function buildGSpotSingle(maddr, mlat,mlng) { 
 	this.label = maddr;
	this.lat = mlat;
	this.lng = mlng;
    return this;
};

