﻿// JavaScript Document

/*显示城市切换效果,ID作为隐藏层的城市列表,i值控制是否显示*/
function showhidden(id,i){ 
	if(i==1){
		document.getElementById(id).style.display="block";
	}else{
		document.getElementById(id).style.display="none";
		}
}

/*导航图片的鼠标移动切换*/
/*cid为当前层的ID值，i为切换变量 1为当前显示，2为高亮显示*/
function bannerAlt(cid,i){
	var temp = document.getElementById(cid).src;
	if(i==1){
	temp = temp.replace("A","B");
	}
	if(i==2){
		temp = temp.replace("B","A");
	}
	document.getElementById(cid).src = temp;
	}

/*产品模块层的背景及字体颜色的切换*/
function productAlt(i){
	if(i==1){
	this.className = "product_model_red";
	alert("aaaa"+this.className);
	}
	if(i==2){
	this.className = "product_model";
	alert("aaaa"+this.className);
	}
	}
//公告滚动展示效果
		var count=0
		var index = 0;
		var t;
		var tDelay;
		var textScroll = '';
		var links = '';
		var scrollList = new Array();

		function timedCount()
		{
			if(index == links.length) index = 0;

		textScroll = scrollList[index];
		objScroller = document.getElementById('scrollAnchor');
		objScroller.innerHTML = textScroll.substring(0,count);
		objScroller.href = links[index].href ;
		 try{	
		  	hbxName = links[index].name;
			hbxName = hbxName.substring(hbxName.indexOf('=')+1,hbxName.length);
		 }
		catch(e){hbxName = '';}
		hbxName = 'javascript:_hbLink("'+hbxName+'");';
		//if(index == 2)
		   // hbxName += links[index].href.replace("javascript:","") + 'return false;';
		objScroller.onclick =  new Function(hbxName);

		count=count+1;
		if(count > textScroll.length+1)
		{
		  	
			waitTime(2);
			count = 0;
			
			if( index > scrollList.length-1)
			index = 0;
			tDelay = setTimeout("cancelDelay()",1000)
			return;
			
		}
		t=setTimeout("timedCount()",50);
		}

		function sNext()
		{
			stopCount();
			index++;
			if( index > scrollList.length-1)
				index = 0; 
			count = 0;
			timedCount();
		}
		function sPrevious()
		{
			stopCount();
			index--;
			if( index == -1)
				index = scrollList.length-1;
			count = 0;
			timedCount();
		}
		var date;
		function waitTime(mills)
		{
			stopCount();
			date = new Date();
			date.setMinutes(mills + date.getMinutes());
	
		}
		function cancelDelay()
		{
			var curDate = new Date();
			if(curDate <= date)
			{
				clearTimeout(tDelay);
				t=setTimeout("timedCount()",50);
				index = index +1;
			}
			else
			{
				tDelay = setTimeout("cancelDelay()",1000)
			}
		}

		function stopCount()
		{
		    clearTimeout(t);
		    clearTimeout(tDelay);
		}

		function pausePlay()
		{
			stopCount();
  			/*pauseButton = document.getElementById('pauseplay');
     
 			   if(pauseButton.src.indexOf('publish_pause') != -1)
 			   {
			        stopCount();
			        timedCount();
			        pauseButton.src = pauseButton.src.replace('f','pause');
        
			    }
			    else
			    {
				    stopCount();
				    pauseButton.src = pauseButton.src.replace('pause','f');
				}*/
		}

		
		//scrollList = document.getElementById('txt').value.split('#');
		function startScroller()
		{
		    links = document.getElementById('scrollerLinks').getElementsByTagName('a');
		    for(var i = 0;i < links.length ;i++)
		    {
		        scrollList[scrollList.length] = links[i].innerHTML;
		    }
	
		    if(scrollList.length > 0)
		        timedCount();
		}


		function seturl()
		{
			var obj = document.getElementById('verizon_prods')
			_hbLink(obj.options[obj.selectedIndex].getAttribute('hbx'));
			document.location.href = obj.options[obj.selectedIndex].getAttribute('url')

		}
/* 快捷服务的展开特效 */

function producecloseall() {
	document.getElementById("index_cheapandprom").style.display = "none";
	document.getElementById("index_hotsell").style.display = "none";
	document.getElementById("index_tyterminal").style.display = "none";
	document.getElementById("index_lovemusic").style.display = "none";

}
function produceshow(pid) {
	producecloseall();
	document.getElementById(pid).style.display = '';
}
function tshow(tid) {
	document.getElementById('t1').className = 'index_promotions_title_nohover';
	document.getElementById('t2').className = 'index_promotions_title_nohover';
	document.getElementById('t3').className = 'index_promotions_title_nohover';
	document.getElementById('t4').className = 'index_promotions_title_nohover';
	document.getElementById(tid).className = 'index_promotions_title_hover';
}




//业务列表的JS效果
function g(o){return document.getElementById(o);}
function hoverLi(n){
//如果有N个标签,就将i<=N;
for(var i=1;i<=5;i++){
	g('tb_'+i).className='product_list_nohover floatLeft';
	g('tbc_'+i).style.display='none';
	g('tbd_'+i).style.display='none';
	g('tba_'+i).className='index_titletext1';
	}
	g('tbc_'+n).style.display='block';
	g('tbd_'+n).style.display='block';
	g('tb_'+n).className='product_list_hover floatLeft';
	g('tba_'+n).className='index_titletext1_over';
}

function outLi(){
//如果有N个标签,就将i<=N;
for(var i=1;i<=5;i++){
	g('tb_'+i).className='product_list_nohover floatLeft';
	g('tbc_'+i).style.display='none';
	g('tbd_'+i).style.display='none';
	g('tba_'+i).className='index_titletext1';
	}
}