You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

517 lines
7.0 KiB

/*----------------------------------------
页面通用js
-----------------------------------------*/
/* 页面位置定义 */
document.write( unescape("%3Cscript src='/skin/default/js/common.js' type='text/javascript'%3E%3C/script%3E") );
headerInit = function( hostAreaCode )
{
newHeadInit(hostAreaCode);
HeadDropList.init();
newMapInit("web_service");
NavSelectWhere();
return;
}
footerInit = function( LandTuStatus, kfNoShowFlag )
{
document.write( unescape("%3Cscript src='/skin/default/js/jquery-1.8.3.min.js' type='text/javascript'%3E%3C/script%3E") );
searchObjInit();
SetReferer();
if( LandTuStatus!=1 )
{
}
return;
}
var _indexT = null;
function newHeadInit(AreaCode)
{
hostAreaCode = AreaCode;
try{
getElementById("city").onmouseover = function()
{
clearTimeout(_indexT);
getElementById('citys').className = '';
}
getElementById("city").onmouseout = function()
{
_indexT=setTimeout("getElementById('citys').className = 'dpn'",1000);
}
getElementById("citys").onmouseover = function()
{
this.className = '';
clearTimeout(_indexT);
}
getElementById("citys").onmouseout = function()
{
this.className = 'dpn';
}
var tempObj = getElementById("cityC").getElementsByTagName("h1");
if(tempObj.length>0)
{
tempObj[0].style.cursor = "pointer";
}
}catch(e){}
return;
}
//新头部下拉菜单
var HeadDropList = {
showDiv : null,
showType : 0, //1首页模式 0其他
contentDiv : null,
currId : 0,
timer : null,
second : 100, //隐藏延时
city_num : 1, //城市
divList : [],
contentList : [],
cateContent : '',
init : function(){
if(city_num>0)
this.city_num = city_num;
if(typeof(_pageIndex)!='undefined' && _pageIndex==1){
if(!getElementById('cateMapD'))
return;
this.showType = 1;
}
if(!getElementById('_cateMapDiv'))
return;
this.cateContent = getElementById('_cateMapDiv').innerHTML;
// getElementById('_cateMapDiv').style.display='';
// return;
var cList = getElementById('_cateDetail').getElementsByTagName('DIV');
index = 0;
for(i=0;i<cList.length;i++){
if(cList[i].id.match(/cateCon_\d/))
this.contentList[index++] = cList[i].innerHTML;
}
switch(this.showType){
case 1:
getElementById('cateMapD').innerHTML = this.cateContent;
var List = getElementById('cateMapD').getElementsByTagName('DIV');
for(i=0;i<List.length;i++){
if(List[i].id=='cateMapList')
this.contentDiv = List[i];
else if(List[i].id=='')
this.divList[i] = List[i];
}
break;
case 0:
var str = '<div style="height:0px;"><div id="insetObj" style="position:absolute;width:100%;left:0;display:none;float:left;">';
str += '<div style="margin:0 auto;width:1200px; overflow:hidden;">';
str += '<div id="nsl" class="container clear">';
str += '<div class="left" id="cateMapD" style="box-shadow:none;" >';
str += this.cateContent;
str += '</div></div></div>';
str += '</div></div>'
document.write(str)
this.showDiv = getElementById('insetObj');
var List = getElementById('cateMapD').getElementsByTagName('DIV');
for(i=0;i<List.length;i++){
if(List[i].id=='cateMapList'){
this.contentDiv = List[i];
}else if(List[i].id==''){
this.divList[i] = List[i];
}
}
getElementById('hot-destination').onmouseover = function(){
HeadDropList.contentDiv.style.display = 'none';
HeadDropList.contentDiv.innerHTML = '';
HeadDropList.clearTimer();
HeadDropList.listShow();
}
getElementById('hot-destination').onmouseout = function(){
HeadDropList.createTimer();
}
break;
}
for(i=0;i<this.divList.length;i++){
this.divList[i].onmouseover = function(){
HeadDropList.clearTimer();
HeadDropList.hideCurrent();
var id = '';
var divList = getElementById('cateMapD').getElementsByTagName('DIV');
for(i=0;i<divList.length;i++){
if(this==divList[i]){
id = i;
break;
}
}
HeadDropList.currId = id;
HeadDropList.showCateList();
HeadDropList.showCurrent();
}
this.divList[i].onmouseout = function(){
var className = this.className;
if(className.indexOf('current')==-1)
divList[i].className += ' current';
HeadDropList.createTimer();
}
}
this.contentDiv.onmouseover = function(){
HeadDropList.clearTimer();
divList = HeadDropList.divList;
for(i=0;i<divList.length;i++){
var className = divList[i].className;
if(HeadDropList.currId == i){
if(className.indexOf('current')==-1)
divList[i].className += ' current';
}else{
divList[i].className = className.replace(' current','');
}
}
}
this.contentDiv.onmouseout = function(){
HeadDropList.showCurrent();
HeadDropList.createTimer();
return;
divList = HeadDropList.divList;
for(i=0;i<divList.length;i++){
var className = divList[i].className;
if(HeadDropList.currId!=i)
divList[i].className = className.replace(' current','');
}
}
return;
},
createTimer : function(){
this.clearTimer();
this.timer = setTimeout("HeadDropList.listHide()",this.second);
},
clearTimer : function(){
if(this.timer){
clearTimeout(this.timer);
}
},
showCurrent : function(){
if(this.divList){
var div = this.divList[this.currId];
className = div.className;
if(className.indexOf('current')==-1){
div.className += ' current';
}
}
},
hideCurrent : function(){
var divList = getElementById('cateMapD').getElementsByTagName('DIV');
for(i=0;i<divList.length;i++){
className = divList[i].className;
divList[i].className = className.replace(' current','');
}
},
listShow : function(){
this.showDiv.style.display = '';
},
listHide : function(){
if(this.showType==0)
this.showDiv.style.display = 'none';
this.contentDiv.style.display = 'none';
this.hideCurrent();
},
createHtmlStr : function(){
var str = '';
for(var id in indexCateList){
if(id=='0')
str += '<div class="region first">';
else
str += '<div class="region">';
str += '<i class="icon">'+indexCateList[id]["icon"]+'</i><strong>'+indexCateList[id]["title"]+'</strong><p>';
var itemArr = indexCateList[id]["itemArr"];
var len = 0;
for(var i in itemArr){
if(itemArr[i]["city"] && itemArr[i]["city"].substring(num,num+1)!='1')
continue;
len += itemArr[i]["title"].length+1;
if(len>12){
str += '<br />';
len = itemArr[i]["title"].length + 1;
}
str += '<a href="'+itemArr[i]["url"]+'" target="_blank">'+itemArr[i]["title"]+'</a>';
}
str += '</div>';
}
str += '<div class="list" id="cateMapList">';
str += '</div>';
return str;
},
showCateList : function(){
if(this.currId<0)
return;
var id = this.currId;
this.contentDiv.innerHTML = this.contentList[id];
this.contentDiv.style.display = 'block';
return;
}
}