var map = null;
var locs = new Array;
var pinid=0;
var defaultView='r';
var dashboardSize='Small';  //Normal, Small or Tiny
var tileBuffer=0;
var center =null;
var zoom =null;
var layer=null;
var zStart;
var zEnd;

/*
function GetMap(){
	 try{
		map = new VEMap('myMap');
	//	map.SetDashboardSize(getDashboardObj(dashboardSize));
		map.HideDashboard();
	//	map.onLoadMap = function(){ center=map.GetCenter(); zoom=map.GetZoomLevel();};
	//	defaultView=parent.document.getElementById("defaultView").value;
	//	map.LoadMap(null, null, defaultView, null, null, false);
	//	var options = new VEMapOptions();   
	//	options.EnableBirdseye = false;
	//	map.LoadMap(null, null, defaultView, null, null, false, 0, options);  
		map.LoadMap(null, null, defaultView);  
		map.ClearInfoBoxStyles();
		AddMyControl();
		AddPushpin();
		map.AttachEvent("onclick",ClickHandler);
	}catch(e){
//		alert(e.faultCode?e.faultCode:e.message?e.message:e);
	}
}
*/

function GetMap()
{
	try{
	map = new VEMap('myMap');
	map.HideDashboard();
	map.onLoadMap = function(){ center=map.GetCenter(); zoom=map.GetZoomLevel();};
	map.LoadMap(new VELatLong(0,0), 11 ,'r' ,false);
	mapcontrol = null;	
	AddMyControl();	
	map.ClearInfoBoxStyles();
	AddPushpin();
	//map.AttachEvent("onclick",ClickHandler);
	
	//store the center and zoom for the resetMap function
	center=map.GetCenter();
	zoom=map.GetZoomLevel();	
	}catch(e){
		alert(e.faultCode?e.faultCode:e.message?e.message:e);
	}

}

function GetMapAltSell()
{
	try{
	map = new VEMap('myMap');
	map.HideDashboard();
	map.onLoadMap = function(){ center=map.GetCenter(); zoom=map.GetZoomLevel();};
	map.LoadMap(new VELatLong(0,0), 11 ,'r' ,false);
	AddMyControl();
	map.ClearInfoBoxStyles();
	AddPushpin();
	//map.AttachEvent("onclick",ClickHandler);
	
	//store the center and zoom for the resetMap function
	center=map.GetCenter();
	zoom=map.GetZoomLevel();	
	}catch(e){}

}


function ClickHandler(e) {
	if (e.rightMouseButton) {
		var latlng = map.PixelToLatLong(new VEPixel(e.mapX, e.mapY));
		//alert (latlng);
		GetLocationInfo(latlng);
	}
}

function GetLocationInfo(latlng) {

	var shape = new VEShape(VEShapeType.Pushpin, latlng);
	shape.SetCustomIcon("<div class='pinStyle1'><div class='text'>#</div></div>");
	shape.SetTitle("New Location");
	shape.SetDescription("Latitude: "+latlng.Latitude+"<br>Longitude: "+latlng.Longitude);
	map.AddShape(shape);

//	document.getElementById("lat").value = latlng.Latitude;
//	document.getElementById("long").value = latlng.Longitude;

}


function AddPushpin(){

	try{
		var propsSize =parent.document.getElementById('propsSize').value;
		var poilatlng =parent.document.getElementById('poilatlng').value;
		//alert(parent.document.getElementById("checkInDate").value);
		var nodates=(parent.document.getElementById("checkInDate").value =="mm/dd")? true : false;
		if (!nodates)
		{
			nodates=(parent.document.getElementById("checkInDate").value =="dd/mm")? true : false;
		}
		var points = new Array();
		var shapes = new Array();
		var myPropertyLatLng = poilatlng.split ( ';' );

		for(var i=myPropertyLatLng.length -2;i>=0;i--) {
		
			var latlng = myPropertyLatLng[i];
			var proplat = latlng.split ( ',' );
			var lat =null;
			var lng =null;
			var shape = null;
			for(j=0;j<proplat.length-1;j++){
				lat =proplat[j];
				lng =proplat[j+1];
				shape = new VEShape(VEShapeType.Pushpin,new VELatLong(lat,lng));
			}
			var prop_cnt=parent.document.getElementById("prop_cnt"+(i+1)).value;
			var propNumber=parent.document.getElementById("propNumber"+(prop_cnt)).value;
			var customIcon ="<div class='pinStyle1'><div class='text1'>"+propNumber+"</div></div>";
			var pop= '';			
			if(parent.document.getElementById("mapPopupHtml"+(prop_cnt)) != null){
				pop+=parent.document.getElementById("mapPopupHtml"+(prop_cnt)).innerHTML;
			}

			if(pop != ''){
				shape.SetDescription(pop);
			}
			shape.SetCustomIcon(customIcon);
			shape.SetZIndex(1010,1010);
			shapes.push(shape);

			var point =new VELatLong(lat,lng);
			points.push(point);
		}

		var altsellpoilatlngobj =parent.document.getElementById('altSellLatLng');
		if(altsellpoilatlngobj != undefined && altsellpoilatlngobj != '')
		var altsellpoilatlng =altsellpoilatlngobj.value;
		if(altsellpoilatlng != undefined && altsellpoilatlng != ''){
			var proplat = altsellpoilatlng.split ( ',' );
			var lat = proplat[j-1];
			var	lng = proplat[j];
			
			shape = new VEShape(VEShapeType.Pushpin,new VELatLong(lat,lng));
			var customIcon ="<div class='pinStyleAltSell'></div>";
			shape.SetCustomIcon(customIcon);
			shape.SetZIndex(1020,1020);
			
			var point =new VELatLong(lat,lng);
			
			shapes.push(shape);
			points.push(point);
		}

		
		map.AddShape(shapes);
		map.SetMapView(points);
		
		if (propsSize < 2 && map.GetZoomLevel() > 12) { 
//		alert(map.GetZoomLevel());
		map.SetZoomLevel(12); 
		}

	}catch(e){
//		alert(e.faultCode?e.faultCode:e.message?e.message:e);
	}
}

var mapcontrolSar;

function AddMyControlSar()
{
	if (mapcontrolSar == null)
	{
		mapcontrolSar = document.createElement("div");
		mapcontrolSar.id = "myControl";
		mapcontrolSar.style.position = "absolute";
		mapcontrolSar.style.top ="0px";
		mapcontrolSar.style.left = "0px";
		mapcontrolSar.style.height = "28px";
		mapcontrolSar.style.width = "70px";
		mapcontrolSar.style.zIndex = 10;
		//mapcontrol.style.border = "1px solid black";
		mapcontrolSar.style.background = "transparent";
		mapcontrolSar.innerHTML = '<table cellspacing=0 cellpadding=0><tr valign=top>'
			+ '<td><input id="zoomin" type="image" src="http://www.ramada.com/Ramada/images/map/ZoomIn.gif" onclick="map.ZoomIn(); return false;" ondblclick="map.ZoomIn(); return false;" onMouseOver="this.src=\'http://www.ramada.com/Ramada/images/map/ZoomIn2.gif\';" onMouseOut="this.src=\'http://www.ramada.com/Ramada/images/map/ZoomIn.gif\';"/></td>'
			+ '<td><input id="zoomout" type="image" src="http://www.ramada.com/Ramada/images/map/ZoomOut.gif" onclick="map.ZoomOut(); return false;" ondblclick="map.ZoomOut(); return false;" onMouseOver="this.src=\'http://www.ramada.com/Ramada/images/map/ZoomOut2.gif\';" onMouseOut="this.src=\'http://www.ramada.com/Ramada/images/map/ZoomOut.gif\';"/><img src="http://www.ramada.com/Ramada/images/map/Seperator.gif"></td>'
			+ '<td><input id="reset" type="image" src="http://www.ramadahotels.de/img/wyndham/DE_26544.gif" onclick="resetMap3(); return false;" onMouseOver="this.src=\'http://www.ramadahotels.de/img/wyndham/DE_26545.gif\';" onMouseOut="this.src=\'http://www.ramadahotels.de/img/wyndham/DE_26544.gif\';"/></td>'
			+ '</tr></table>';
		document.getElementById('myMap').appendChild(mapcontrolSar);
	}

}


function resetMap(){
	map.SetMapStyle(VEMapStyle.Road);
	map.SetCenterAndZoom(center, zoom);
}

function resetMap3(){
	map.SetMapStyle(VEMapStyle.Road);
	map.SetCenterAndZoom(center, zoom);
}

function resetMap2(){
	map2.SetMapStyle(VEMapStyle.Road);
	map2.SetCenterAndZoom(center2, zoom2);
}
		 
function getDashboardObj(dashboardSize){
	if (dashboardSize == 'Normal'){
		dashboardObj = VEDashboardSize.Normal;
	}else if (dashboardSize == 'Small'){
		dashboardObj = VEDashboardSize.Small;
	}else if (dashboardSize == 'Tiny'){
		dashboardObj = VEDashboardSize.Tiny;
	}else{
		dashboardObj = VEDashboardSize.Normal;
	}
	return dashboardObj;
}


//(Bing)----------------------------------------------------------------->
function GetMapBingDir(start, end, param3)
         {
         try{
	      var manLat = (document.getElementById('manLat').value);
	      var manLng = (document.getElementById('manLng').value);
	      map = new VEMap('myMap');
	      map.HideDashboard();
	      var options = new VEMapOptions();
             map.LoadMap(new VELatLong(manLat,manLng),12,VEMapStyle.Road, null, null, false, 0, options);
	      AddMyControl();
             map.ClearInfoBoxStyles();
             GetRouteMap2('noReset', start, end, 'MAN', param3);
	      	      
	  }catch(e){
		//alert(e.faultCode?e.faultCode:e.message?e.message:e);
	  }
         }


function GetMapSar(start, end, fromPg)
{
	try{
	    var poilatlng =parent.document.getElementById('poilatlng').value;
	    var lat;
	    var lng;
	    //alert(poilatlng);
	    if (poilatlng != ""){
	    	var myPropertyLatLng = poilatlng.split( ';' );
           	var latlng = myPropertyLatLng[0];
           	var proplat = latlng.split ( ',' );
	    	lat =proplat[0];
           	lng =proplat[1];
	    }else{
		lat = 0;
		lng = 0;
	    }

	    map = new VEMap('myMap');
	    map.HideDashboard();
	    var options = new VEMapOptions();
	    map.LoadMap(new VELatLong(lat,lng),12,VEMapStyle.Road, null, null, false, 0, options);
	    AddMyControlSar();
	    map.ClearInfoBoxStyles();
	    zStart = start;
           zEnd = end;
	    GetRouteMap2('noReset', start, end, 'SRR', "NC");
	    AddSARPushpin(start, end, fromPg);
		
	}catch(e){ 
		//alert("Error " + e);
	}

}

//(Bing)----------------------------------------------------------------->
function GetRouteMap2(from, st, ed, forPg, param3)
         {
	   try{
            var locations;
	     var x1;
	     var add1 = ed;			//document.getElementById('end_address').value;
            //document.getElementById('MSVE_obliqueNotification').style.visibility = "hidden";
	     var toAdd = add1;
	     var fromAdd = st;		//document.getElementById('strt_address').value;
            
	     var stPt = fromAdd;
    	     var edPt = add1;
	     var locations;
	     var sLL;
            var eLL;
	     if(param3 == 'NC'){
	     	sLL = new VELatLong (document.getElementById('strtLat').value, document.getElementById('strtLng').value);
	     	eLL = new VELatLong (document.getElementById('edLat').value, document.getElementById('edLng').value);
	     }else{
		sLL = new VELatLong (document.getElementById('edLat').value, document.getElementById('edLng').value);
		eLL = new VELatLong (document.getElementById('strtLat').value, document.getElementById('strtLng').value);
	     }
            locations = new Array(sLL, eLL);
            
            var options = new VERouteOptions;

            // Otherwise what's the point?
            options.DrawRoute      = true;

            // So the map doesn't change:
            options.SetBestMapView = true;

            // Call this function when map route is determined:
	if(forPg == 'MAN'){
            options.RouteCallback = ShowTurns2;
	     //options.SetBestMapView = true;
	} else {
		options.RouteCallback = ShowTurns3;
	     //options.SetBestMapView = false;
	}
            
            // Show as miles
            if(document.getElementById('msrUnit').value == "mi")
            {
            	options.DistanceUnit   = VERouteDistanceUnit.Mile;
            }else{
            	options.DistanceUnit   = VERouteDistanceUnit.Kilometer;
            }

            
            // Show the disambiguation dialog
            options.ShowDisambiguation = true;

	     if("reset"==from.toLowerCase()){
            	map.GetDirections(locations);
	     }else{
              map.GetDirections(locations, options);
            }
	     	     
	   }catch(e){
		//alert(e.faultCode?e.faultCode:e.message?e.message:e);
          }
      }
//(Bing)-------------------------------------------------------------------------->

function ShowTurns3(route)
	  {
	   try{
	     if (route != null) {
		center=map.GetCenter();
             	zoom=map.GetZoomLevel();
	     }
	   }
	   catch(e){
	   }
	   AddSARPushpin(zStart, zEnd, 'SRR');
	  }

function ShowTurns2(route)
         {
	   try{
            var turns = "<table border='0' width='100%'><br>";
	     if (route != null) {
               // Unroll route and populate DIV
               var legs          = route.RouteLegs;
               var leg           = null;
               var turnNum       = 0;  // The turn #

               // Get intermediate legs
               for(var i = 0; i < legs.length; i++)
               {
                  // Get this leg so we don't have to derefernce multiple times
                  leg = legs[i];  // Leg is a VERouteLeg object

                  var legNum = i + 1;
                  
                  // Unroll each intermediate leg
                  var turn        = null;  // The itinerary leg
                  var legDistance = null;  // The distance for this leg
                  
                  for(var j = 0; j < leg.Itinerary.Items.length; j ++)
                  {
                     turnNum++;
                     
                     turn = leg.Itinerary.Items[j];  // turn is a VERouteItineraryItem object

                     turns += "<tr><td valign='top' align='left' class='boldRed searchResNCol' style='padding: 0 0 0 13;' width='15'>" + turnNum + ".</td><td valign='top' align='left' class='normal' width='450'>" + turn.Text + "</td><td valign='top' align='left' class='normal' width='15'>&nbsp;&nbsp;</td>" ;

                     legDistance    = turn.Distance;

                     // So we don't show 0.0 for the arrival
                     if(legDistance > 0)
                     {
                        // Round distances to 1/10ths
                        if(document.getElementById('msrUnit').value == "mi")
					{
			  			turns += "<td valign='top' align='right' style='padding:0 31 0 0;' class='normal' width='80'><b> " + legDistance.toFixed(1) + " Mi";
            				}else{
            					turns += "<td valign='top' align='right' style='padding:0 31 0 0;' class='normal' width='80'><b> " + legDistance.toFixed(1) + " Km";
            				}

                        // Append time if found
                        if(turn.Time != null)
                        {
                           turns += "</b></td><td valign='top' align='left' class='normal' width='170'>" + GetTime(turn.Time);
                        }

                        turns += "</td></tr><tr><td colspan='4' style='padding:10 0 0 60;'></td></tr>";
                     }
                  }

                  turns += "</tr></table>";
		    turns += "<table border='0' align='left' width='100%'>"
		    turns += "<tr><td colspan='4'><img src='http://www.ramada.com/Ramada/images/navigation/spacer.gif' alt='' border='0' width='1' height='10'></td></tr>" 
		    turns += "<tr><td colspan='4' class='divider1'><img src='http://www.ramada.com/Ramada/images/navigation/spacer.gif' alt='' border='0' width='1' height='1'></td></tr>"
		    turns += "<tr><td colspan='4'><img src='http://www.ramada.com/Ramada/images/navigation/spacer.gif' alt='' border='0' width='1' height='10'></td></tr>" 
			if(document.getElementById('msrUnit').value == "mi"){
		    		turns += "<tr><td align='left' valign='top' class='normal' style='padding: 0 0 0 13;' width='230'><b>Total Est. Distance:</b> " + route.Distance.toFixed(1) + " Mi</td></tr>";
			}else{
		    		turns += "<tr><td align='left' valign='top' class='normal' style='padding: 0 0 0 13;' width='230'><b>Total Est. Distance:</b> " + route.Distance.toFixed(1) + " Km</td></tr>";
			}

		    turns += "<tr><td align='left' valign='top' class='normal' style='padding: 0 0 0 13;' width='270'><b>Total Est. Time:</b> " + GetTime(route.Time) + "</td></tr></table>";


               //}

               // Populate DIV with directions
                  SetDirections(turns);
		    center=map.GetCenter();
             	    zoom=map.GetZoomLevel();
		    //map.SetZoomLevel(zoom);
            	}
	         } 
         }catch(e){
		//alert(e.faultCode?e.faultCode:e.message?e.message:e);
 	  }
         }

         function SetDirections(s)
         {
	  try{
            var d = document.getElementById("directions");
            d.innerHTML = s;
	  }catch(e){
		//alert(e.faultCode?e.faultCode:e.message?e.message:e);
	  }
         }

         // time is an integer representing seconds
         // returns a formatted string
         function GetTime(time)
         {
	  try{
            if(time == null)
            {
               return("");
            }

            if(time > 60)
            {                                 // if time == 100
               var seconds = time % 60;       // seconds == 40
               var minutes = time - seconds;  // minutes == 60
               minutes     = minutes / 60;    // minutes == 1


               if(minutes > 60)
               {                                     // if minutes == 100
                  var minLeft = minutes % 60;        // minLeft    == 40
                  var hours   = minutes - minLeft;   // hours      == 60
                  hours       = hours / 60;          // hours      == 1

                  return(hours + " hr(s), " + minLeft + " min(s), " + seconds + " sec(s)");
               }
               else
               {
                  return(minutes + " mins, " + seconds + " secs");
               }
            }
            else
            {
               return(time + " secs");
            }
	  }catch(e){
		//alert(e.faultCode?e.faultCode:e.message?e.message:e);
	  }
         }


///////////////////////////////////////////////////////////////////////////
//new addpushpin
///////////////////////////////////////////////////////////////////////////
function AddSARPushpin_bkp(sti, edi, frmPg){

	try{
		var propsSize =parent.document.getElementById('propsSize').value;
		var poilatlng =parent.document.getElementById('poilatlng').value;
		//alert(parent.document.getElementById("checkInDate").value);
		var nodates=(parent.document.getElementById("checkInDate").value =="mm/dd")? true : false;
		if (!nodates)
		{
			nodates=(parent.document.getElementById("checkInDate").value =="dd/mm")? true : false;
		}
		var points = new Array();
		var shapes = new Array();
		var myPropertyLatLng = poilatlng.split ( ';' );
		var cntr = 0;

		for(var i=myPropertyLatLng.length -2;i>=0;i--) {
			var latlng = myPropertyLatLng[i];
			var proplat = latlng.split ( ',' );
			var lat =null;
			var lng =null;
			var shape = null;
			for(j=0;j<proplat.length-1;j++){
				lat =proplat[j];
				lng =proplat[j+1];
				//if(cntr==0 && frmPg=='SRR'){
        				//alert(response[j].foundLocation.latLong.latitude);
        			//	GetMapSar(sti, edi, lat, lng);
        			//}
				var latlong = new VELatLong(lat, lng);
				shape = new VEShape(VEShapeType.Pushpin,latlong);
			}
			
			cntr++;
			var prop_cnt=parent.document.getElementById("prop_cnt"+(i+1)).value;
			var propName=parent.document.getElementById("propName"+prop_cnt).value;
			var brandId=parent.document.getElementById("brandId"+prop_cnt).value;
			var phLink=parent.document.getElementById("photoLink"+prop_cnt).value;
			var photoLink=phLink.replace(/\s/g,"%20");
			var mnPhoto=parent.document.getElementById("mainPhoto"+(prop_cnt)).value;
			var mainPhoto=mnPhoto.replace(/\s/g,"%20");
			var address=parent.document.getElementById("Address"+(prop_cnt)).value;
			var address2=parent.document.getElementById("Address2"+(prop_cnt)).value;
			var city=parent.document.getElementById("city"+(prop_cnt)).value;
			var stateCode=parent.document.getElementById("stateCode"+(prop_cnt)).value;
			var zip=parent.document.getElementById("Zip"+(prop_cnt)).value;
			var country=parent.document.getElementById("Country"+(prop_cnt)).value;
			var phone=parent.document.getElementById("Phone"+(prop_cnt)).value;
			var btLink=parent.document.getElementById("buttonLink"+(i+1)).value;
			var buttonLink=btLink.replace(/\s/g,"%20");
			var availability=parent.document.getElementById("availability"+(prop_cnt)).value;
			var propNumber=parent.document.getElementById("propNumber"+(prop_cnt)).value;
			var photoTour=photoLink.replace(/tab1/,"tab3");
			var distance=parent.document.getElementById("distance"+(prop_cnt)).value;
			var altImage=null;
			var aImage=parent.document.getElementById("Altimage"+(prop_cnt)).value;
                       var customIcon ="<div class='pinStyle1'><div class='text'>"+propNumber+"</div></div>";
                       var amenitiesList =parent.document.getElementById("AmenitiesList"+(prop_cnt)).innerHTML;
			//alert(amenitiesList);
 
			if(aImage==""){
				altImage= mnPhoto.replace(/[0-9][0-9].*/, 'SRBrandLogo.gif');
			}else{
				altImage= mnPhoto.replace(/[0-9][0-9].*/, aImage);
			}
			
			var text = "Reserve";
			if (brandId=="KG")
			{
				text = "Check Rates";
			}
			if (brandId=="TL")
			{
				text = "Show Rates & Rooms";
			}
			text = (availability!="")?text:"Check Alternative Dates";
			text = (brandId=="WY")? "Check Availability & Rates" : text;
			var customIcon ="<div class='pinStyle1'><div class='text1'>"+propNumber+"</div></div>";

			var pop= '';
			if (navigator.appName == "Microsoft Internet Explorer") {
			pop = '<div style="width:450px; margin-right: 0px; margin-left: 0px; margin-top: 10px; margin-bottom: -15px; z-index:90;"><table cellpadding="2" cellspacing="0" border="0" width="450"><tr valign="top">'
				+ '<td style="padding:0 0 10px 0;" align=center><a href="'+photoLink+'"><img src="'+mainPhoto+'" width="88" height="67" border="0" alt="Foto vom Hotel"></a>';
			}else{
			pop = '<div style="width:450px; margin-right: 0px; margin-left: 0px; margin-top: 10px; margin-bottom: -50px; z-index:90;"><table cellpadding="2" cellspacing="0" border="0" width="450"><tr valign="top">'
				+ '<td style="padding:0 0 10px 0;" align=center><a href="'+photoLink+'"><img src="'+mainPhoto+'" width="88" height="67" border="0" alt="Foto vom Hotel"></a>';
			}	
			if (brandId!='WY') {
				pop+= '<br><a href="'+photoTour+'" style="font-size:10px; color:black;">Photo Tour</a>';
			}
			pop+='<br><br><img src="'+altImage+'" border="0" alt="Stufe"></td>'
				+ '<td width="20" style="font-size:95%;"><span class="boldRed searchResNCol" style="padding:2px; margin:0;">'+propNumber+'.</span></td>'
				+ '<td width="175" style="font-size:95%;"><span class="bigBold"><a style="text-decoration:none;" href="'+photoLink+'">'+propName+'</a></span>'
				+ '<table width="175"><tr><td><div class="checkmarkPad smallest" style="padding:0 10px 0 0;"><br>'+address+address2+city+stateCode+zip+country+'<br>'+phone+'<br>&nbsp;</div></td></tr>'
				+ '<tr><td><a href="'+buttonLink+'"class="buttontext"><div class="checkBtn" style="width:166px; margin:5px 0;">'+text+'</div></a></td></tr>'
				+ '</table></td>'
				+ '<td><div class="featureBorder" style="padding: 0pt 0pt 0pt 1px;">'+amenitiesList+'</div>'
				+ '</td></tr>'
				+ '<tr valign="top"><td colspan="4" align="right"; style="font-size:12px;">'+distance+'</td></tr>';
			if (!nodates && brandId!='WY') {
				var statusText=parent.document.getElementById("statusText"+(prop_cnt)).value;
				pop+= '<tr valign="top"><td colspan="4" align=right><div class="thinBorderHeader"><div class="thinBorderHeaderLink" style="font-size:95%;padding:3 5 3 0;">'+statusText+'</div></div></td></tr>';
			}
			pop+= '</table></div>';
			shape.SetDescription(pop);
			shape.SetCustomIcon(customIcon);
			shape.SetZIndex(1010,1010);
			shapes.push(shape);

			var point =new VELatLong(lat,lng);
			points.push(point);
		}
		map.AddShape(shapes);
		//map.SetMapView(points);
		//center=map.GetCenter();
       	//zoom=map.GetZoomLevel();
		//map.SetZoomLevel(zoom);
		
		if (propsSize < 2 && map.GetZoomLevel() > 12) { 
		//alert(map.GetZoomLevel());
		//map.SetZoomLevel(12); 
		}

	}catch(e){
		//alert(e.faultCode?e.faultCode:e.message?e.message:e);
	}
}


////////////////////////////////////////////////////////////////////
//New updated sar pushpin code
////////////////////////////////////////////////////////////////////
function AddSARPushpin(sti, edi, frmPg){
	try{
		var propsSize =parent.document.getElementById('propsSize').value;
		var poilatlng =parent.document.getElementById('poilatlng').value;
		var nodates=(parent.document.getElementById("checkInDate").value =="mm/dd")? true : false;
		
		if (!nodates){
			nodates=(parent.document.getElementById("checkInDate").value =="dd/mm")? true : false;
		}
		
		var points = new Array();
		var shapes = new Array();
		
		if (poilatlng != ""){
			var myPropertyLatLng = poilatlng.split ( ';' );

			for(var i=myPropertyLatLng.length -2;i>=0;i--) {
				var latlng = myPropertyLatLng[i];
				var proplat = latlng.split ( ',' );
				var lat =null;
				var lng =null;
				var shape = null;

				for(j=0;j<proplat.length-1;j++){
					lat =proplat[j];
					lng =proplat[j+1];
					shape = new VEShape(VEShapeType.Pushpin,new VELatLong(lat,lng));
				}

                //var prop_cnt=parent.document.getElementById("prop_cnt"+(i+1)).value;
				//var propNumber=parent.document.getElementById("propNumber"+(prop_cnt)).value;
				
				var customIcon ="<div class='pinStyle1'><div class='text1'>"+(i+1)+"</div></div>";
				var pop= '';
				
				/*if(parent.document.getElementById("mapPopupHtml"+(prop_cnt)) != null){
					pop+=parent.document.getElementById("mapPopupHtml"+(prop_cnt)).innerHTML;
				}*/

                if(pop != ''){
					//shape.SetDescription(pop);
				}

                shape.SetCustomIcon(customIcon);
				shape.SetZIndex(1010,1010);
				shapes.push(shape);
				
				/*var point =new VELatLong(lat,lng);
				points.push(point);*/
			}

			map.AddShape(shapes);
			//map.SetMapView(points);
			//center=map.GetCenter();
			//zoom=map.GetZoomLevel();
			//map.SetZoomLevel(zoom);

			if (propsSize < 2 && map.GetZoomLevel() > 12) {
				//alert(map.GetZoomLevel());
				//map.SetZoomLevel(12);
			}
		}
	}catch(e){
		//alert(e.faultCode?e.faultCode:e.message?e.message:e);
	}

}
