// JavaScript Document
function $(_sId){return document.getElementById(_sId)}
var ListArrayID=new Array("ShowHotelPhotoID","ShowHotelDetailsID","ShowHotelAddressInfoID","ShowHotelPriceID","ShowHotelServiceItemID","ShowHotelEatEquipmentID","ShowHotelPastimeQuipmentID","ShowHotelUseCardID","ShowHotelRemarkID","ShowHotelServiceItemNav","ShowHotelCommunityID")

function ListItem(PostNum)
{
  switch(PostNum){
  case 0 :
  SetItemListN()
  SetItemListB()
  eval("document.getElementById('ListItem"+PostNum+"').bgColor='#ECF2F6'")
  CheckItemText()
  break;
  case 1 :
  SetItemListN()
  eval("document.getElementById('ListItem"+PostNum+"').bgColor='#ECF2F6'")  
  document.getElementById("ShowHotelPriceID").style.display="";
  CheckItemText()
  break;
  case 2://
  SetItemListN()
  eval("document.getElementById('ListItem"+PostNum+"').bgColor='#ECF2F6'")
  document.getElementById("ShowHotelServiceItemNav").style.display=""; 
  document.getElementById("ShowHotelServiceItemID").style.display="";
  document.getElementById("ShowHotelEatEquipmentID").style.display="";
  document.getElementById("ShowHotelPastimeQuipmentID").style.display="";
  document.getElementById("ShowHotelUseCardID").style.display="";
  document.getElementById("ShowHotelRemarkID").style.display=""; 
  CheckItemText()
  break;
  case 3 ://
  SetItemListN()
  eval("document.getElementById('ListItem"+PostNum+"').bgColor='#ECF2F6'")  
  document.getElementById("ShowHotelCommunityID").style.display="";
  CheckItemText()
  break
  default:
  }
}

function SetItemListN()
{
	for(var i=0;i<ListArrayID.length;i++)
	{
	  ListArrayID[i]!="ShowHotelPhotoID||"?document.getElementById(ListArrayID[i]).style.display="none":true;
	}
	for(var i=0;i<4;i++)
	{
      eval("document.getElementById('ListItem"+i+"').bgColor='#FFFFFF'")  
	}
	
}

function ListPhoto()
{
var j=0;
var str=""
if (imagearray1[0].indexOf(".gif")!=-1||imagearray1[0].indexOf(".jp")!=-1||imagearray1[0].indexOf(".bmp")!=-1){

str+='<div class="hot_pic">'
str+='<div class="da_img">'
str+='<img id="da_img" src='+imagearray1[0]+'>'
str+='</div>'
str+='<ul>'
for(var s=0;s<imagearray1.length;s++)
{
if (imagearray1[s].indexOf(".gif")!=-1||imagearray1[s].indexOf(".jp")!=-1||imagearray1[s].indexOf(".bmp")!=-1){
str+='<li><img src='+imagearray1[s]+'  id=pic'+String(j)+'   onclick="imgsclick(\'pic'+String(j)+'\')"  onerror="src=\'/hotels/images/noimg.gif\'";></li>'
}
j++
}
str+='</ul>'
str+='</div>'
}

document.getElementById('hotel_photo').innerHTML=str
}
function imgsclick(imgsid)
{

	for(var i=0;i<imagearray1.length;i++)
	{
	document.getElementById('pic'+String(i)).className="";
	}
	document.getElementById(imgsid).className='kuan'	
	document.getElementById('da_img').src=document.getElementById(imgsid).src
	
}

function SetItemListB()
{
	for(var i=0;i<ListArrayID.length;i++)
	{
	  document.getElementById(ListArrayID[i]).style.display="";
	}		
	
}

function CheckItemText()
{
	for(var i=4;i<ListArrayID.length;i++)
	{
	if(eval("document.getElementById('"+ListArrayID[i].replace("ID",'')+"').innerHTML==''"))
	{
	document.getElementById(ListArrayID[i]).style.display="none"		  
	}
	}		
	
}
function ListArea(PostNum)
{
	if (PostNum==1)
	{
	document.getElementById("ListArea1").style.display = "block";
	document.getElementById("ListArea0").style.display = "none"
	document.getElementById("Area0").className = "AreaNavNS"	
	document.getElementById("Area1").className = "AreaNavYS"		
		
	}
	else
	{
	document.getElementById("ListArea1").style.display = "none";
	document.getElementById("ListArea0").style.display = "block"
	document.getElementById("Area0").className = "AreaNavYS"	
	document.getElementById("Area1").className = "AreaNavNS"
	}
}



function HotelMap()
{

		var H=screen.availHeight
        var W=screen.availWidth
		var WinH=300
		var WinW=630
		var city=document.getElementById("city").value

		var HotelName=document.getElementById("HotelMapName").value
		window.open("/hotels/Map.htm?city="+city+"&HotelName="+HotelName,"","height="+WinH+",width="+WinW+",scrollbars=yes,toolbar=no,resizable=yes,location=no, status=no,top="+(H-WinH)/2+"px,left="+(W-WinW)/2+"px");
}	
function LoadMap(MapID,Width,Height)
{
		  	
		 var PointX=document.getElementById("PointX").value
	   	 var PointY=document.getElementById("PointY").value
	
		 document.getElementById(MapID).innerHTML='<div id="gomap"   style="width:'+Width+'px; height:'+Height+'px;align:center;position:absolute; margin-left:0px;margin-top:0px;"></div>'
     
          gomapjs();
          var i=1;
          var map;
          var currentOverlay = null;
         // function load() {
			 	
          if (GBrowserIsCompatible()) {
	
            map = new GMap2(document.getElementById("gomap"));
            var p = new GLatLng(PointX,PointY);
            map.setCenter(p, 15);
 		    //map.addControl(new GMapTypeControl());
            map.addControl(new GSmallMapControl ());
			
			
			//map.addControl(new GOverviewMapControl());
			//map.addControl(new GMapTypeControl());
			var icon=new GIcon();
			icon.image="http://www.366hotel.com/hotels/images/hotel_map.gif";
			icon.iconSize = new GSize(21, 21);
			icon.iconAnchor = new GPoint(0,0);//这一句一定要有，不然会出错
			map.addOverlay(new GMarker(map.getCenter(),{icon:icon,draggable:true,dragCrossMove:true}));				
			GIcon(copy,image);
	
						
            var marker = new GMarker(p);
    

	
	        map.addOverlay(marker);


	
            var catorMsg = '';
            marker.openInfoWindowHtml(catorMsg);
            GEvent.addListener(marker, "click", function() {
               marker.openInfoWindowHtml(catorMsg);
            });
			
			  GEvent.addListener(map, 'click', function(overlay, point) {
				
				 if (overlay) {
                    if(event.button==2) map.removeOverlay(overlay);
                } else if (point) {
				     marker.openInfoWindowHtml(catorMsg);
                }
            });
        }
   // }
		
          
	
	
	
//document.getElementById(MapID).innerHTML='<iframe id="MapFrame" name="MapFrame" frameborder=0 src="/Hotels/IframeMap.asp?PointX='+document.getElementById("HotelID").value+'&PointX='+PointX+'&PointY='+PointY+'&Width='+Width+'&Height='+Height+'"  style="border:solid 1px #999;height:'+Height+'px;width:'+Width+'" marginheight="0" marginwidth="0"></iframe>'
				
    }	
	


function CheckComm()
{

        var ByID=document.SearchForm.Body 
		if(ByID.value=="")
		{
		
		   ByID.focus()
		   alert('评语内容不能为空')
		   
		   return false
		}	
		if(document.SearchForm.Body.value.length<5)
		{
		
		   ByID.focus()
		   alert('评语内容不能太短,至少5个字符或以上')
		   return false
		}
		var CS1=0
		var CS2=0
		var CS3=0
		var CS4=0
		for(var j=0;j<5;j++)//酒店评分
		{
			if(document.SearchForm.Service[j].checked==true)
				{
				CS1=CS1+document.SearchForm.Service[j].value
				}
			if(document.SearchForm.Circumstance[j].checked==true)
				{		
				CS2=CS2+document.SearchForm.Circumstance[j].value
				}
			if(document.SearchForm.Establishment[j].checked==true)
				{		
				CS3=CS3+document.SearchForm.Establishment[j].value
				}
			if(document.SearchForm.CommPrice[j].checked==true)
				{		
				CS4=CS4+document.SearchForm.CommPrice[j].value
				}
		}
	if(CS1==0)
		{
		document.SearchForm.Service[0].focus();
		alert('请对此酒店服务进行评分！')	
		return false
		}	
	if(CS2==0)
		{
		document.SearchForm.Circumstance[0].focus();
		alert('请对此酒店环境进行评分！')	
		return false
		}	
	if(CS3==0)
		{
		document.SearchForm.Establishment[0].focus();
		alert('请对此酒店设施进行评分！')	
		return false
		}	
	if(CS4==0)
		{
		document.SearchForm.CommPrice[0].focus();
		alert('请对此酒店价格评分！')	
		return false
		}
		document.SearchForm.action="/Hotels/HotelDetails.aspx?HotelID="+document.SearchForm.HotelID.value+"&rmate=comm"	
		//alert("/Hotels/"+document.SearchForm.action)
		document.SearchForm.submit();

     
return true
}

