﻿var map;
var overlay;
var wooGoverlays = [];
var woo1Goverlays = [];
var woo2Goverlays = [];
var tempNo;
//var mark;
function MapInitialize(){
	map = new GMap(document.getElementById("gmap"));
	tempNo = 0;
	map.setCenter(new GLatLng(22.64063,120.302417),16);//預設中心點
    map.enableScrollWheelZoom();
    map.addControl(new GLargeMapControl());
    map.addControl(new GOverviewMapControl());
    map.addControl(new GMapTypeControl());
    map.enableGoogleBar();
    GEvent.addListener(map, "click", function(overlay) {
        if (overlay != null && overlay instanceof GMarker) { //有點擊到overlay 並且型態是 GMarker
        	showInfo(overlay);
        	//overlay.setImage("images/woo1.png"); 
        }
    });
    var OptionValue;
   	GEvent.addListener(map, "addoverlay", function(overlay) { 
   		//alert(overlay.getTitle());
			wooGoverlays.push(overlay);
					//var OptionValue:GroundOverlayOptions;
					var iconObj;
			    GEvent.addListener(overlay, "mouseover", function() {
  					setOver(overlay);
      		});
      		GEvent.addListener(overlay, "mouseout", function() {
      			setOut(overlay);
      		});
    });

}
function setOver(overlay){
	overlay.setImage("images/h2.gif"); 
	//alert(document.getElementById(overlay.getTitle()).className);
	//document.getElementById(overlay.getTitle()).className="red";
	//alert(document.getElementById(overlay.getTitle()).className);
	//var oldHTML = document.getElementById(overlay.getTitle()).innerHTML;
	//alert(oldHTML);
	//var newHTML = "<span style='color:red'>" + oldHTML + "</span>";
	//alert(newHTML);
	//document.getElementById(overlay.getTitle()).innerHTML = newHTML;
	var titleId = overlay.getTitle();
	//alert(titleId);
	//alert("GET ID="+titleId);
	var tdId1 = titleId+"_1";
	var tdId2 = titleId+"_2";
	var tdId3 = titleId+"_3";
	var tdId4 = titleId+"_4";
	var tdId5 = titleId+"_5";
	var tdId6 = titleId+"_6";
  document.getElementById(tdId1).style.backgroundColor="yellow";
  document.getElementById(tdId2).style.backgroundColor="yellow";
  document.getElementById(tdId3).style.backgroundColor="yellow";
  document.getElementById(tdId4).style.backgroundColor="yellow";
  document.getElementById(tdId5).style.backgroundColor="yellow";
  document.getElementById(tdId6).style.backgroundColor="yellow";
  document.getElementById(tdId6).style.color = "yellow";
	//var oldHTML = document.getElementById(tdId6).innerHTML;
	//alert(oldHTML);
  
  var tempNo = document.getElementById(tdId1).innerText;
  tempNo = trim(tempNo);
  var scrollSize = document.getElementById('queryresult').scrollHeight * tempNo / 100 - 50;
  
  document.getElementById('queryresult').scrollTop = scrollSize;
  //alert("tempNo ="+tempNo+" and total size="+document.getElementById('queryresult').scrollHeight);
  //if(tempNo > 50){
  	//alert("大於50"+tempNo);
  	//document.getElementById('queryresult').scrollTop=document.getElementById('queryresult').scrollHeight;
	//}else{
		//alert("小於50"+tempNo);
		//document.getElementById('queryresult').scrollTop=0; 
	//}
  
  //alert(document.getElementById('queryresult').scrollHeight);
  //document.getElementById('queryresult').scrollTop=document.getElementById('queryresult').scrollHeight;

  //alert(document.getElementById("queryresult").style.backgroundColor);
  //document.getElementById(overlay.getTitle()).background-color="red";
}
function setOut(overlay){
//	overlay.setImage("images/h3.gif");
	var titleId = overlay.getTitle();
	var tdId1 = titleId+"_1";
	var tdId2 = titleId+"_2";
	var tdId3 = titleId+"_3";
	var tdId4 = titleId+"_4";
	var tdId5 = titleId+"_5";
	var tdId6 = titleId+"_6";
	var tdId7 = titleId+"_7";
  document.getElementById(tdId1).style.backgroundColor="";
  document.getElementById(tdId2).style.backgroundColor="";
  document.getElementById(tdId3).style.backgroundColor="";
  document.getElementById(tdId4).style.backgroundColor="";
  document.getElementById(tdId5).style.backgroundColor="";
  document.getElementById(tdId6).style.backgroundColor="";
  var cType = document.getElementById(tdId7).innerHTML;
		if(cType=="待標"){
				overlay.setImage("images/h1.gif");
			}else if(cType=="得標"){
				overlay.setImage("images/h2.gif");
			}else if(cType=="流標"){
				overlay.setImage("images/h3.gif");
			}else if(cType=="停拍"){
				overlay.setImage("images/h4.gif");
			}
}


function MapInitialize2(x,y){
	map.setCenter(new GLatLng(x,y),16);
}

function queryData(){
	var county = document.getElementById("county").value;
	var area = document.getElementById("area").value;
	var address = document.getElementById("address").value;
	var priceStart = document.getElementById("priceStart").value;
	var priceEnd = document.getElementById("priceEnd").value;
	var sizeStart = document.getElementById("sizeStart").value;
	var sizeEnd = document.getElementById("sizeEnd").value;
	var startYear = document.getElementById("startYear").value;
	var startMonth = document.getElementById("startMonth").value;
	var startDate = document.getElementById("startDate").value;
	var startDay = startYear+"/"+startMonth+"/"+startDate;
	var endYear = document.getElementById("endYear").value;
	var endMonth = document.getElementById("endMonth").value;
	var endDate = document.getElementById("endDate").value;
	var endDay = endYear+"/"+endMonth+"/"+endDate;
	var closeType = document.getElementById("closeType").value;
	var case1 = document.getElementById("case1").checked;
	var case2 = document.getElementById("case2").checked;
	var case3 = document.getElementById("case3").checked;
	var case4 = document.getElementById("case4").checked;
	var path = "/queryresult.asp?catch="+(new Date()).getTime();
	path+="&county="+county+"&area="+area+"&address="+address+"&case1="+case1+"&case2="+case2+"&case3="+case3+"&case4="+case4;
	path+="&priceStart="+priceStart+"&priceEnd="+priceEnd+"&sizeStart="+sizeStart+"&sizeEnd="+sizeEnd;
	path+="&startDay="+startDay+"&endDay="+endDay+"&closeType="+closeType;
	path = encodeURI(path);
	new Ajax.Request(path, { method: 'post',
		onComplete: function(httpObj) {
			//alert(httpObj.responseText);
			document.getElementById("queryresult").innerHTML = httpObj.responseText;
			//alert(document.getElementById("tDiv").innerHTML);
			//document.getElementById("tDiv").innerHTML = "RRRRRRRRRR";
			//alert(document.getElementById("queryresult").innerHTML);
			//依序將地標填入
			map.clearOverlays();//清除上次查詢地標
			setMap(httpObj);
		}
	});

}
function setMap(httpObj)
//多點搜尋
{
	var resultText=httpObj.responseText;
	//alert(resultText);
	var stringData = resultText.split("<tr");


	for (var i=2; i<stringData.length; i++) 
	{
		var temp = stringData[i].split(';">');

		var tx = temp[1].split('</td>');
		var ty = temp[2].split('</td>');
		var caseType = temp[3].split('</td>');
		var title = temp[4].split('</td>');
		var txx = temp[5].split('</td>');
		var markerOptions;
		var wooIcon = new GIcon(G_DEFAULT_ICON);
		var cType = caseType[0].replace(/(\s*$)/g, ""); 
        var cType0 = txx[0].replace(/(\s*$)/g, ""); 
			if(cType=="待標"){
                wooIcon.image = "/images/h1.gif";
				if(cType0=="大樓"){
				   wooIcon.image = "/images/h1a.gif";
			    }else if(cType0=="公寓"){
				   wooIcon.image = "/images/h1b.gif";
			    }else if(cType0=="透天"){
				   wooIcon.image = "/images/h1c.gif";
			    }else if(cType0=="一樓"){
				   wooIcon.image = "/images/h1d.gif";
			    }else if(cType0=="土地"){
				   wooIcon.image = "/images/h1e.gif";
		        }
			}else if(cType==".."){
                wooIcon.image = "/images/h1.gif";
				if(cType0=="大樓"){
				   wooIcon.image = "/images/h1a.gif";
			    }else if(cType0=="公寓"){
				   wooIcon.image = "/images/h1b.gif";
			    }else if(cType0=="透天"){
				   wooIcon.image = "/images/h1c.gif";
			    }else if(cType0=="一樓"){
				   wooIcon.image = "/images/h1d.gif";
			    }else if(cType0=="土地"){
				   wooIcon.image = "/images/h1e.gif";
		        }
			}else if(cType=="得標"){
				wooIcon.image = "/images/h2.gif";
				if(cType0=="大樓"){
				   wooIcon.image = "/images/h2a.gif";
			    }else if(cType0=="公寓"){
				   wooIcon.image = "/images/h2b.gif";
			    }else if(cType0=="透天"){
				   wooIcon.image = "/images/h2c.gif";
			    }else if(cType0=="一樓"){
				   wooIcon.image = "/images/h2d.gif";
			    }else if(cType0=="土地"){
				   wooIcon.image = "/images/h2e.gif";
			    }else if(cType0=="店面"){
				   wooIcon.image = "/images/google0.gif";
		        }
			}else if(cType=="承受"){
				wooIcon.image = "/images/h2.gif";
				if(cType0=="大樓"){
				   wooIcon.image = "/images/h2a.gif";
			    }else if(cType0=="公寓"){
				   wooIcon.image = "/images/h2b.gif";
			    }else if(cType0=="透天"){
				   wooIcon.image = "/images/h2c.gif";
			    }else if(cType0=="一樓"){
				   wooIcon.image = "/images/h2d.gif";
			    }else if(cType0=="土地"){
				   wooIcon.image = "/images/h2e.gif";
		        }
			}else if(cType=="流標"){
				wooIcon.image = "/images/h3.gif";
				if(cType0=="大樓"){
				   wooIcon.image = "/images/h3a.gif";
			    }else if(cType0=="公寓"){
				   wooIcon.image = "/images/h3b.gif";
			    }else if(cType0=="透天"){
				   wooIcon.image = "/images/h3c.gif";
			    }else if(cType0=="一樓"){
				   wooIcon.image = "/images/h3d.gif";
			    }else if(cType0=="土地"){
				   wooIcon.image = "/images/h3e.gif";
		        }
			}else if(cType=="停拍"){
				wooIcon.image = "/images/h4.gif";
				if(cType0=="大樓"){
				   wooIcon.image = "/images/h4a.gif";
			    }else if(cType0=="公寓"){
				   wooIcon.image = "/images/h4b.gif";
			    }else if(cType0=="透天"){
				   wooIcon.image = "/images/h4c.gif";
			    }else if(cType0=="一樓"){
				   wooIcon.image = "/images/h4d.gif";
			    }else if(cType0=="土地"){
				   wooIcon.image = "/images/h4e.gif";
		        }
            }else if(cType=="撤回"){
				wooIcon.image = "/images/h4.gif";
				if(cType0=="大樓"){
				   wooIcon.image = "/images/h4a.gif";
			    }else if(cType0=="公寓"){
				   wooIcon.image = "/images/h4b.gif";
			    }else if(cType0=="透天"){
				   wooIcon.image = "/images/h4c.gif";
			    }else if(cType0=="一樓"){
				   wooIcon.image = "/images/h4d.gif";
			    }else if(cType0=="土地"){
				   wooIcon.image = "/images/h4e.gif";
		        }
			}
		wooIcon.iconSize = new GSize(22, 20);
		wooIcon.shadowSize = new GSize(22, 20);	
		markerOptions = { icon:wooIcon,title:title[0]};
		if(i==2){//將第一筆記錄設為地圖中心點
			map.setCenter(new GLatLng(ty[0],tx[0]),16);
			back2Center(title[0],tx[0],ty[0]);
		}
		var mark = new GMarker(new GLatLng(ty[0],tx[0]), markerOptions);
   	map.addOverlay(mark);
   	//wooGoverlays.push(mark);
	}
        //alert(wooGoverlays.length);
}
function hover(overlay,no){
 		alert(wooGoverlays[no].getTitle());
}
function MapInit(){
	map = new GMap(document.getElementById("gmap"));
	//map.setCenter(new GLatLng(25.022481,121.467612),16);//預設中心點
    map.enableScrollWheelZoom();
    map.addControl(new GLargeMapControl());
    map.addControl(new GOverviewMapControl());
    map.addControl(new GMapTypeControl());

    map.enableGoogleBar();
    GEvent.addListener(map, "click", function(overlay) {
        if (overlay != null && overlay instanceof GMarker) { //有點擊到overlay 並且型態是 GMarker
        	showInfo(overlay);
        }
    });
}

function showInfo(mark){
	var path="/showInfo.asp?no="+mark.getTitle();
	new Ajax.Request(path, { method: 'post',
		onComplete: function(httpObj) {
			//調整點擊後資訊視窗的資料
			mark.openInfoWindowHtml("<image src='/images/woo.gif' ALIGN='left'>"+httpObj.responseText); 
			var xx = httpObj.responseText.split("<div id=XX style=display:none>");
			xx = xx[1].split("</div>");
			var yy = xx[1].split("<div id=YY style=display:none>");
			yy = yy[1].split("</div>");
			document.getElementById("streetDiv").innerHTML = "";
			var myPano = new GStreetviewPanorama(document.getElementById("streetDiv"));
		    fenwayPark = new GLatLng(yy[0],xx[0]);
		    myPOV = {yaw:0,pitch:5};
		    myPano.setLocationAndPOV(fenwayPark, myPOV);

		}
	});
	
	//var xx= document.getElementById("XX").innerText;
	//var yy= document.getElementById("YY").innerText;
	//alert(xx);
	//alert(yy);
}

function showInfo1(mark){
	//var path="/showInfo.asp?no="+mark.getTitle();
	var path="/showInfo.asp?no=71417";
	new Ajax.Request(path, { method: 'post',
		onComplete: function(httpObj) {
			//調整點擊後資訊視窗的資料
			//alert(httpObj.responseText);
			mark.openInfoWindowHtml("<image src='/images/woo.gif' ALIGN='left'>"+httpObj.responseText); 
		}
	});
}

function setBigMap(no,x,y,cType,cType0)
{  
 //單點定位原點
		var markerOptions;
		var wooIcon = new GIcon(G_DEFAULT_ICON);
			if(cType=="待標"){
                wooIcon.image = "/images/h1.gif";
				if(cType0=="大樓"){
				   wooIcon.image = "/images/h1a.gif";
			    }else if(cType0=="公寓"){
				   wooIcon.image = "/images/h1b.gif";
			    }else if(cType0=="透天"){
				   wooIcon.image = "/images/h1c.gif";
			    }else if(cType0=="一樓"){
				   wooIcon.image = "/images/h1d.gif";
			    }else if(cType0=="土地"){
				   wooIcon.image = "/images/h1e.gif";
		        }
			}else if(cType==".."){
				wooIcon.image = "/images/h1.gif";
                if(cType0=="大樓"){
				   wooIcon.image = "/images/h1a.gif";
			    }else if(cType0=="公寓"){
				   wooIcon.image = "/images/h1b.gif";
			    }else if(cType0=="透天"){
				   wooIcon.image = "/images/h1c.gif";
			    }else if(cType0=="一樓"){
				   wooIcon.image = "/images/h1d.gif";
			    }else if(cType0=="土地"){
				   wooIcon.image = "/images/h1e.gif";
		        }
			}else if(cType=="得標"){
				wooIcon.image = "/images/h2.gif";
                if(cType0=="大樓"){
				   wooIcon.image = "/images/h2a.gif";
			    }else if(cType0=="公寓"){
				   wooIcon.image = "/images/h2b.gif";
			    }else if(cType0=="透天"){
				   wooIcon.image = "/images/h2c.gif";
			    }else if(cType0=="一樓"){
				   wooIcon.image = "/images/h2d.gif";
			    }else if(cType0=="土地"){
				   wooIcon.image = "/images/h2e.gif";
			    }else if(cType0=="店面"){
				   wooIcon.image = "/images/google0.gif";
		        }
			}else if(cType=="承受"){
				wooIcon.image = "/images/h2.gif";
                if(cType0=="大樓"){
				   wooIcon.image = "/images/h2a.gif";
			    }else if(cType0=="公寓"){
				   wooIcon.image = "/images/h2b.gif";
			    }else if(cType0=="透天"){
				   wooIcon.image = "/images/h2c.gif";
			    }else if(cType0=="一樓"){
				   wooIcon.image = "/images/h2d.gif";
			    }else if(cType0=="土地"){
				   wooIcon.image = "/images/h2e.gif";
		        }
			}else if(cType=="流標"){
				wooIcon.image = "/images/h3.gif";
                if(cType0=="大樓"){
				   wooIcon.image = "/images/h3a.gif";
			    }else if(cType0=="公寓"){
				   wooIcon.image = "/images/h3b.gif";
			    }else if(cType0=="透天"){
				   wooIcon.image = "/images/h3c.gif";
			    }else if(cType0=="一樓"){
				   wooIcon.image = "/images/h3d.gif";
			    }else if(cType0=="土地"){
				   wooIcon.image = "/images/h3e.gif";
		        }
			}else if(cType=="停拍"){
				wooIcon.image = "/images/h4.gif";
                if(cType0=="大樓"){
				   wooIcon.image = "/images/h4a.gif";
			    }else if(cType0=="公寓"){
				   wooIcon.image = "/images/h4b.gif";
			    }else if(cType0=="透天"){
				   wooIcon.image = "/images/h4c.gif";
			    }else if(cType0=="一樓"){
				   wooIcon.image = "/images/h4d.gif";
			    }else if(cType0=="土地"){
				   wooIcon.image = "/images/h4e.gif";
		        }
            }else if(cType=="撤回"){
				wooIcon.image = "/images/h4.gif";
                if(cType0=="大樓"){
				   wooIcon.image = "/images/h4a.gif";
			    }else if(cType0=="公寓"){
				   wooIcon.image = "/images/h4b.gif";
			    }else if(cType0=="透天"){
				   wooIcon.image = "/images/h4c.gif";
			    }else if(cType0=="一樓"){
				   wooIcon.image = "/images/h4d.gif";
			    }else if(cType0=="土地"){
				   wooIcon.image = "/images/h4e.gif";
		        }
		}
		wooIcon.iconSize = new GSize(22, 20);
		wooIcon.shadowSize = new GSize(22, 20);	
		markerOptions = { icon:wooIcon,title:no};
		MapInit();
		back2Center(no,x,y);
		map.setCenter(new GLatLng(y,x),16);
		map.addOverlay(new GMarker(new GLatLng(y,x), markerOptions));
}

function setMapInfo(no,x,y,cType,cType0)
    //單點定位鄰近法拍屋
{
	//var path = "/showInfo.asp?no="+no;
	//new Ajax.Request(path, { method: 'post',
	//	onComplete: function(httpObj) {
			var markerOptions;
			var wooIcon = new GIcon(G_DEFAULT_ICON);
			if(cType=="待標"){
				wooIcon.image = "/images/h1.gif";
				if(cType0=="大樓"){
				   wooIcon.image = "/images/h1a.gif";
			    }else if(cType0=="公寓"){
				   wooIcon.image = "/images/h1b.gif";
			    }else if(cType0=="透天"){
				   wooIcon.image = "/images/h1c.gif";
			    }else if(cType0=="一樓"){
				   wooIcon.image = "/images/h1d.gif";
			    }else if(cType0=="土地"){
				   wooIcon.image = "/images/h1e.gif";
		        }
			}else if(cType==".."){
				wooIcon.image = "/images/h1.gif";
				if(cType0=="大樓"){
				   wooIcon.image = "/images/h1a.gif";
			    }else if(cType0=="公寓"){
				   wooIcon.image = "/images/h1b.gif";
			    }else if(cType0=="透天"){
				   wooIcon.image = "/images/h1c.gif";
			    }else if(cType0=="一樓"){
				   wooIcon.image = "/images/h1d.gif";
			    }else if(cType0=="土地"){
				   wooIcon.image = "/images/h1e.gif";
		        }
			}else if(cType=="得標"){
				wooIcon.image = "/images/h2.gif";
				if(cType0=="大樓"){
				   wooIcon.image = "/images/h2a.gif";
			    }else if(cType0=="公寓"){
				   wooIcon.image = "/images/h2b.gif";
			    }else if(cType0=="透天"){
				   wooIcon.image = "/images/h2c.gif";
			    }else if(cType0=="一樓"){
				   wooIcon.image = "/images/h2d.gif";
			    }else if(cType0=="土地"){
				   wooIcon.image = "/images/h2e.gif";
			    }else if(cType0=="店面"){
				   wooIcon.image = "/images/google0.gif";
		        }
			}else if(cType=="承受"){
				wooIcon.image = "/images/h2.gif";
                if(cType0=="大樓"){
				   wooIcon.image = "/images/h2a.gif";
			    }else if(cType0=="公寓"){
				   wooIcon.image = "/images/h2b.gif";
			    }else if(cType0=="透天"){
				   wooIcon.image = "/images/h2c.gif";
			    }else if(cType0=="一樓"){
				   wooIcon.image = "/images/h2d.gif";
			    }else if(cType0=="土地"){
				   wooIcon.image = "/images/h2e.gif";
		        }
			}else if(cType=="流標"){
				wooIcon.image = "/images/h3.gif";
                if(cType0=="大樓"){
				   wooIcon.image = "/images/h3a.gif";
			    }else if(cType0=="公寓"){
				   wooIcon.image = "/images/h3b.gif";
			    }else if(cType0=="透天"){
				   wooIcon.image = "/images/h3c.gif";
			    }else if(cType0=="一樓"){
				   wooIcon.image = "/images/h3d.gif";
			    }else if(cType0=="土地"){
				   wooIcon.image = "/images/h3e.gif";
		        }
			}else if(cType=="停拍"){
				wooIcon.image = "/images/h4.gif";
                if(cType0=="大樓"){
				   wooIcon.image = "/images/h4a.gif";
			    }else if(cType0=="公寓"){
				   wooIcon.image = "/images/h4b.gif";
			    }else if(cType0=="透天"){
				   wooIcon.image = "/images/h4c.gif";
			    }else if(cType0=="一樓"){
				   wooIcon.image = "/images/h4d.gif";
			    }else if(cType0=="土地"){
				   wooIcon.image = "/images/h4e.gif";
		        }
            }else if(cType=="撤回"){
				wooIcon.image = "/images/h4.gif";
                if(cType0=="大樓"){
				   wooIcon.image = "/images/h4a.gif";
			    }else if(cType0=="公寓"){
				   wooIcon.image = "/images/h4b.gif";
			    }else if(cType0=="透天"){
				   wooIcon.image = "/images/h4c.gif";
			    }else if(cType0=="一樓"){
				   wooIcon.image = "/images/h4d.gif";
			    }else if(cType0=="土地"){
				   wooIcon.image = "/images/h4e.gif";
		        }
			}
			wooIcon.iconSize = new GSize(22, 20);
			wooIcon.shadowSize = new GSize(22, 20);	
			markerOptions = { icon:wooIcon,title:no};
			map.addOverlay(new GMarker(new GLatLng(y,x), markerOptions));
  //}
	//});

}
function back2Center(no,x,y){
	map.setCenter(new GLatLng(y,x));
	var path = "/showInfo.asp?no="+no;
	new Ajax.Request(path, { method: 'post',
		onComplete: function(httpObj) {
			map.openInfoWindowHtml(new GLatLng(y,x),"<image src='/images/woo.gif' ALIGN='left'>"+httpObj.responseText,new GSize(10,-20));
		}
	});
}
	function changeto(highlightcolor){ 
		source=event.srcElement
		if(source == null) return;
		if(source.tagName=="A") {
			//source=source.parentElement.parentElement.parentElement
			//if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore") 
			source.style.backgroundColor=highlightcolor
			var seq = source.parentElement.parentElement.parentElement.children[0].innerText;
			seq = trim(seq) - 1;
			//alert(seq);
			//alert(wooGoverlays.length);
			//alert("SEQ = "+seq);
			//alert("TITLE = "+wooGoverlays[seq].getTitle());
			setOver(wooGoverlays[seq]);

		}

	};
	function changeback(originalcolor){ 
		source=event.srcElement
		if(source == null) return;
		if(source.tagName=="A") {
			//source=source.parentElement.parentElement.parentElement
			//if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore") 
			source.style.backgroundColor=originalcolor
			var seq = source.parentElement.parentElement.parentElement.children[0].innerText;
			seq = trim(seq) - 1;
			setOut(wooGoverlays[seq]);
		}
	};
function trim(stringToTrim){ 
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
