﻿// JScript File
var step_ratio = 0.1;
objs = new Array();
objs_x = new Array();
objs_y = new Array();

function addfollowmark(name, x, y) {
  i = objs.length;
  objs[i] = document.getElementById(name);
  objs_x[i] = x;
  objs_y[i] = y;
}

function followmark() {
  for(var i=0; i<objs.length; i++) {
    var fm = objs[i];
    var fm_x = typeof(objs_x[i]) == 'string' ? eval(objs_x[i]) : objs_x[i];
    var fm_y = typeof(objs_y[i]) == 'string' ? eval(objs_y[i]) : objs_y[i];

    if (fm.offsetLeft != document.body.scrollLeft + fm_x) {
      var dx = (document.body.scrollLeft + fm_x - fm.offsetLeft) * step_ratio;
      dx = (dx > 0 ? 1 : -1) * Math.ceil(Math.abs(dx));
      fm.style.left = fm.offsetLeft + dx;
    }

    if (fm.offsetTop != document.body.scrollTop + fm_y) {
      var dy = (document.body.scrollTop + fm_y - fm.offsetTop) * step_ratio;
      dy = (dy > 0 ? 1 : -1) * Math.ceil(Math.abs(dy));
      fm.style.top = fm.offsetTop + dy;
    }
    fm.style.display = '';
  }
}



function Addme(){ 
    //url = "http://www.010bus.net"; //你自己的主页地址 setWeather();getText();
    title = "北京公交旅游网"; //你自己的主页名称 
    window.external.AddFavorite(window.location.href,title);
}

/************************************************************************************
图片轮播 begin
*************************************************************************************/

function Mea(value){
	n=value;
	setBg(value);
	plays(value);
	cons(value);
}

function setBg(value){
    //alert(showNum.getElementsByTagName("td").length)
    var iCount=showNum.getElementsByTagName("td").length;//0
	for(var i=0;i<iCount;i++)	
    if(value==i){
		showNum.getElementsByTagName("td")[i].className='bigon';
	} 
	else
	{	
		showNum.getElementsByTagName("td")[i].className='bigoff';
	}  
} 

function plays(value){
	try
	{
		with (fc)
		{
			filters[0].Apply();
			var iCount=children.length;//0
			for(i=0;i<iCount;i++)i==value?children[i].style.display="block":children[i].style.display="none"; 
			filters[0].play(); 
		}
	}
	catch(e)
	{
		var divlist = document.getElementById("fc").getElementsByTagName("span");		
		for(i=0;i<divlist.length;i++)
		{
			i==value?divlist[i].style.display="block":divlist[i].style.display="none";
		}
	}	
}

function cons(value){
	try
	{
	    //var iCount=showNum.getElementsByTagName("td").length;
		with (con)
		{
		    var iCount=children.length;//0
			for(i=0;i<iCount;i++)i==value?children[i].style.display="block":children[i].style.display="none"; 		
		}
	}
	catch(e)
	{
		var divlist = document.getElementById("con").getElementsByTagName("span");//0
		for(i=1;i<divlist.length;i++)
		{
			i==value?divlist[i].style.display="block":divlist[i].style.display="none";
		}		
	}
}

function clearAuto(){clearInterval(autoStart)}

function setAuto(){    
    n=0;
    showNum = document.getElementById("num");    
    autoStart=setInterval("auto(n)", 3000)//5000
}

function auto(){
    var iCount=showNum.getElementsByTagName("td").length;
	n++;
	if(n>iCount-1)n=0;
	Mea(n);
}
 
function sub(){
    var iCount=showNum.getElementsByTagName("td").length;
	n--;
	if(n<0)n=iCount-1;
	Mea(n);
}
/************************************************************************************
图片轮播 end
*************************************************************************************/


//首页资讯排行
function paihang(title_ctrl, box_ctrl, num) 
{ 
	document.getElementById(title_ctrl+"_0").className = "linecompetition_noactive";
	document.getElementById(title_ctrl+"_1").className = "linecompetition_noactive";
	document.getElementById(title_ctrl+"_"+num).className = "linecompetition_active"   
	for(i=0 ; i<2; i++){
		document.getElementById(box_ctrl+"_"+i).style.display = "none";
	} 
	document.getElementById(box_ctrl+"_"+num).style.display = "block";
}

/*记录首页广告点击来源*/
function recordAdHitLog(fromUrl,userIP)
{
	f54u.BLL.AppModule.BL_Utility.InsertOperateLogByAjax("120", "精心堂广告" , fromUrl, userIP);
	window.open("http://www.jingxintang.com","_blank");//http://www.17u.cn/index1143634.html
}


