﻿//根据ID获取指定对象
function $(e) 
{
   return document.getElementById ? document.getElementById(e) : null;
}

var Items = new Array();
Items[0] = "Player";
Items[1] = "InfoMation";
Items[2] = "Card";
Items[3] = "Lostion";
Items[4] = "specialty";
Items[5] = "loadding";
//三维
function Menu1(imgsrc,PlayName)
{  
if($("subcont")!=null)
  {
    $("subcont").innerHTML = "<img src='images/3d.gif' alt='三维' />";
  }   
  if(typeof imgsrc!="undefined")
  {
    Simgsrc=imgsrc;
  }
  if(typeof PlayName!="undefined")
  {
     SPlayName=PlayName;
  }
  ShowItem(0);
  $("Postion").innerHTML = "三维实景展播 > "+SPlayName; 
//  if(Simgsrc.length <= 10)
//  {
//    $("PlayMovie").innerHTML = "<div style='height:358px;color:red;background:url(loading.gif) no-repeat;text-align:center;line-height:450px;text-indent:24px;'>三维实景正在制作中...</div>";
//  }
//  else
//  {
//  $("PlayMovie").innerHTML = OutApplert(Simgsrc,"605px","420px");    
//  }
OutApplert(Simgsrc,"605px","400px");

        
}
//在指定位置输出指定影片
function OutMovie(id,Url,Name,AutoCode)
{
//OutApplert(Url,"450px","306px");
     $("PalysdName").innerHTML = "<a target='_blank' href='info.aspx?id="+AutoCode+"'>"+Name+"</a>";
}
///输出影片
function OutApplert(ImgURL,Width,Height)
{
$("PalyFrame").src ="3dPlayer.aspx?TheUrl="+ImgURL+"&izdPlayWidth="+Width+"&izdPlayHeight="+Height+"&barx="+Math.ceil(parseInt(Width)/3.5)+"&bary="+Math.ceil(parseInt(Height)/3+parseInt(Height)/3);

}
//简介
function Menu2()
{
  ShowItem(1);
  $("Postion").innerHTML = "药店简介";
  if($("subcont")!=null)
  {
    $("subcont").innerHTML = "<img src='images/sum.gif' alt='药店简介' />";
  }
}
//名片
function Menu3()
{
  ShowItem(2);
  $("Postion").innerHTML = "电子名片";
    if($("subcont")!=null)
  {
    $("subcont").innerHTML = "<img src='images/card1.gif' alt='电子名片' />";
  }

}
//位置
function Menu4()
{
    ShowItem(3);
    $("Postion").innerHTML = "地理位置";
        if($("subcont")!=null)
  {
    $("subcont").innerHTML = "<img src='images/pos1.gif' alt='地理位置' />";
  }

}
//专长
function Menu5()
{
  ShowItem(4);
  $("Postion").innerHTML = "特色专长";
}

//显示和隐藏
function ShowItem(item)
{
   $(Items[0]).style.display = "none";
   $(Items[1]).style.display = "none";
   $(Items[2]).style.display = "none";
   $(Items[3]).style.display = "none";
   $(Items[4]).style.display = "none";
   $(Items[5]).style.display = "none";
   $(Items[item]).style.display = "block";
}
//多点翻页
var jz_cur_screen = 1;
function show_jz(x) {

var jz_container = $("PlayList") ;
var lis = jz_container.getElementsByTagName('li');
if(lis.length < 1)
{
return false;
}
var max_screen = Math.ceil(lis.length / 5) ;
if (x < 1) {
x = max_screen;
}
if (x > max_screen) {
x = 1;
}
for (i=0;i<5;i++) {
var hidden_cnt = (jz_cur_screen-1)*5+i ;
 var display_cnt = (x-1)*5+i ;
if (hidden_cnt < lis.length) {
 lis[hidden_cnt].style.display = "none" ; //隐藏前面显示的
 }
 if (display_cnt < lis.length) {
 lis[display_cnt].style.display = "block" ; //显示当前
 }
 }
 jz_cur_screen = x ;
 return false ;
}
var xmlHttp;
function CreateXmlHttp()
{
    try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
    catch(e){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
    catch(e){try{xmlHttp=new XMLHttpRequest();}
    catch(e){xmlHttp=false;}}}
}
//药店列表
function Hospitallist(pageIndex)
{
    var cityId=QueryString("city");
    var provinceId=QueryString("provinceId");
    var sScutcheon=QueryString("sScutcheon");//某品牌标记ID
    var iBusinessTime=QueryString("iBusinessTime");//是24小时营业标记
    var url="Process.aspx?city="+cityId+"&provinceId="+provinceId+"&pageIndex="+pageIndex+"&sScutcheon="+sScutcheon+"&iBusinessTime="+iBusinessTime;    
    var id=$("divTypeName");
    var id1=$("middle");
    AjaxProcess(url,id,id1);
}

///xmlHttp处理
function AjaxProcess(url,id,id1)
{
    CreateXmlHttp();    
    xmlHttp.open("POST",url);
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            id.innerHTML=xmlHttp.responseText.split("<# 5izd #>")[0];
            id1.innerHTML=xmlHttp.responseText.split("<# 5izd #>")[1];
        }           
    }
    xmlHttp.send(null);
}
function AddressAjaxProcess(url,id,id1,id2)
{
    CreateXmlHttp();    
    xmlHttp.open("POST",url);
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {            
            id.innerHTML=xmlHttp.responseText.split('|')[0];
            id1.innerHTML=xmlHttp.responseText.split('|')[1];      
            id2.innerHTML=xmlHttp.responseText.split('|')[2];
            Search(1);                                            
        }          
    }
    xmlHttp.send(null);
}
//综合页搜索
function SearchDefault()
{    
    var keyWord=escape($("txtKeyWord").value);
     if(trim(keyWord)=="")
    {
        alert("请输入关键字!");
        return;
    }  
    var scutcheon=$("ddlScutcheon").value;
    var province=$("hidProvince").value;   
    var city=$("ddlCity").value;
    var county=$("ddlCounty").value;
    var village=$("ddlVillage").value;    
    window.location.href="List.aspx?keyword="+keyWord+"&province="+province+"&city="+city+"&county="+county+"&village="+village+"&sScutcheon="+scutcheon;   
}
function SearchDataBing(province,city,county,village,keyWord,scutcheon)
{    
    $("hidProvince").value=province;
    $("txtKeyWord").value=keyWord;
    $("ddlScutcheon").value=scutcheon;
    var idCity=$("divCity");
    var idCounty=$("divCounty");
    var idVillage=$("divVillage");   
    var url="../UserControl/AddressProcess.aspx?action=all&province="+province+"&city="+city+"&county="+county+"&village="+village;
    AddressAjaxProcess(url,idCity,idCounty,idVillage);
    
      
}
function Search(pageIndex)
{
    var keyWord=escape(trim($("txtKeyWord").value));
     if(trim(keyWord)=="")
    {
        alert("请输入关键字!");
        return;
    }
    var scutcheon=$("ddlScutcheon").value;         
    var province=$("hidProvince").value;   
    var city=$("ddlCity").value;
    var county=$("ddlCounty").value;
    var village=$("ddlVillage").value;
    var id=$("divTypeName");
    var id1=$("middle");
    var url="Process.aspx?city="+city+"&provinceId="+province+"&countyId="+county+"&villageId="+village+"&keyword="+keyWord+"&pageIndex="+pageIndex+"&sScutcheon="+scutcheon;    
    AjaxProcess(url,id,id1);  
}
function ltrim(s){ return s.replace( /^\s*/, ""); }//去左空格; 
function rtrim(s){ return s.replace( /\s*$/, ""); }//去右空格; 
function trim(s){ return rtrim(ltrim(s)); }//去左右空格;






































































