﻿var __sto=window.setTimeout
window.setTimeout = function(callback,timeout,param)
{
	
	var args = Array.prototype.slice.call(arguments,2)
	var _cb = function(){
		callback.apply(null,args);
	}
	return __sto(_cb,timeout)
	 
}


//头部对象
function Top()
{
	var he=Ming.px($('div_1').style.height)//高

	//显示
	function ShowMusicDiv(){
		if(he<95){
			he+=5
			$('div_1').style.height=he+"px"
			setTimeout(ShowMusicDiv,12);
		}
		if(he>=95){
			$('showtextbox_btn').style.display='none';		
		}
	}

	//隐藏
	function HidMusicDiv(){
		if(he>5){
			he-=5
			$('div_1').style.height=he+"px"
			setTimeout(HidMusicDiv,12);
		}
		if(he<=5){
			$('showtextbox_btn').style.display='block';
		}
	}
	
	Ming.AddEvent('hidtextbox_div','click',HidMusicDiv)
	Ming.AddEvent('showtextbox_btn','click',ShowMusicDiv)
	
}

//每个图标的对象
function Ico(m)
{
	var CurrentPlace=1//当前位置
	var CurrentIco=$('ico1')
	var md=m
	var lmm;
	Next(0)
	//下一个
	function Next(T){
		if(T>=1)
		{
			
			++CurrentPlace;
			if(CurrentPlace<=8)
			{
				$('ico'+(CurrentPlace-1)).className=''
				$('ico'+CurrentPlace).className="vis"
				md.Alpha((CurrentPlace-1),CurrentPlace)
				
			}else
			{
				CurrentPlace=1
				$('ico8').className=''
				$('ico'+1).className='vis'
				md.Alpha(8,1)
			}
		}
		++T
		lmm=setTimeout(Next,5000,T)
	}

	//获取焦点
	function SetVis(e)
	{
			$('ico1').className="";
			$('ico2').className="";
			$('ico3').className="";
			$('ico4').className="";
			$('ico5').className="";
			$('ico6').className="";
			$('ico7').className="";
			$('ico8').className="";
			Ming.GetEventObject(e).className="vis";	
	}

	//鼠标移进
	function onmouse(e)
	{
		clearTimeout(lmm)
		md.SetCurrentAlpha(100,CurrentPlace)
		SetVis(e)
		oldCurrentPlace=CurrentPlace
		CurrentIco=Ming.GetEventObject(e)
		CurrentPlace=CurrentIco.id.substring(3)
		md.Alpha(oldCurrentPlace,CurrentPlace)
	}
	//鼠标移出
	function onmouseout(e)
	{
		m.Stop()
		SetVis(e)
		CurrentIco=Ming.GetEventObject(e)
		CurrentPlace=CurrentIco.id.substring(3)
		md.SetCurrentAlpha(100,CurrentPlace)
		Next(0)
		
	}


	Ming.AddEvent('ico1','mouseover',onmouse)
	Ming.AddEvent('ico1','mouseout',onmouseout)
	Ming.AddEvent('ico2','mouseover',onmouse)
	Ming.AddEvent('ico2','mouseout',onmouseout)
	Ming.AddEvent('ico3','mouseover',onmouse)
	Ming.AddEvent('ico3','mouseout',onmouseout)
	Ming.AddEvent('ico4','mouseover',onmouse)
	Ming.AddEvent('ico4','mouseout',onmouseout)
	Ming.AddEvent('ico5','mouseover',onmouse)
	Ming.AddEvent('ico5','mouseout',onmouseout)
	Ming.AddEvent('ico6','mouseover',onmouse)
	Ming.AddEvent('ico6','mouseout',onmouseout)
	Ming.AddEvent('ico7','mouseover',onmouse)
	Ming.AddEvent('ico7','mouseout',onmouseout)
	Ming.AddEvent('ico8','mouseover',onmouse)
	Ming.AddEvent('ico8','mouseout',onmouseout)
}


//中间
function Middle(node)
{
	var h3=new Array('','1.本土新闻','2.免费影视','3.虎揪游戏','4.音乐随心听','5.时尚杂志','6.电信服务','7.院线速递','8.网址导航');
	var p=new Array('','囊括最新最全的热点资讯，无论是国内、国际新闻还是热点民生问题一点尽现。',
					'为您提供最新最劲爆的影视剧和福建宽带电视十八家电视台的在线直播，让您目不暇接。',
					'为您提供各种游戏，无论是flash游戏或进入虎揪游戏平台同其他玩家进行游戏对战任您选择。',
					'提供最新最全的上榜彩铃金曲，随时随地倾听音符，让您的耳朵从此爱上音乐。',
					'您还在为不菲的费用而对心仪的杂志望而却步吗？您还在不停寻找自己喜爱的杂志吗？快来乐享免费杂志吧！',
					'您想轻松查、缴话费么？您想了解电信最新优惠资讯么？电信服务将是您的贴心助手。',
					'轻松一点，近期上映电影精彩片花和福州各大影院排期信息即刻呈现，电影达人不再是梦想。',
					'本地互联网各类资讯信息、最便利的日常生活查询和各类促销活动信息让您一网打尽。')
	var currentAlpha=100
	var b='down'
	
	var lmm=1
	this.node=node //当前对象
	//this.CurrentAlpha=Ming.GetAlpha(this.node)//当前透明度

	//透明渐变
	this.Alpha=function(oldCurrentPlace,currentICO)
	{	
	
		b='down'
		mainAlpha(this.node,oldCurrentPlace,currentICO)
	}
	
	this.SetCurrentAlpha=function(value,currentICO)
	{
		clearTimeout(lmm)
		b='stop'
		currentAlpha=value

		Ming.SetAlpha($('pic'+currentICO),currentAlpha)//对图的变化
		Ming.SetAlpha($('div_text'),currentAlpha)//对层文字的变
		SetText(currentICO,currentICO)	//设置中间的文本
		
	}
	
	this.Stop=function()
	{
		clearTimeout(lmm)
	}
	
	function mainAlpha(node,oldCurrentPlace,currentICO)
	{
		speen=50
		if(b=='down'){
			currentAlpha-=10
			if(currentAlpha<=0){
				b='top'
			}
			Ming.SetAlpha($('pic'+oldCurrentPlace),currentAlpha)
			Ming.SetAlpha($('div_text'),currentAlpha)//对层文字的变化
			lmm=setTimeout(mainAlpha,speen,node,oldCurrentPlace,currentICO);
		}else if(b=='top'){
			SetText(oldCurrentPlace,currentICO)
			currentAlpha+=10
			if(currentAlpha>=100){
				b='stop'
			}
			Ming.SetAlpha($('pic'+currentICO),currentAlpha)
			Ming.SetAlpha($('div_text'),currentAlpha)//对层文字的变化
			lmm=setTimeout(mainAlpha,speen,node,oldCurrentPlace,currentICO)
		}

	}
	
	
	//设置中间的文本
	function SetText(oldCurrentPlace,currentICO)
	{
		$('MiddleText_h3').innerHTML=h3[currentICO]
		$('MiddleText_p').innerHTML=p[currentICO]
		$('pic1').style.display="none";
		$('pic2').style.display="none";
		$('pic3').style.display="none";
		$('pic4').style.display="none";
		$('pic5').style.display="none";
		$('pic6').style.display="none";
		$('pic7').style.display="none";
		$('pic8').style.display="none";
		$('pic'+currentICO).style.display="";
	}
}




function load()
{
	var b=new Top();
	var dd =new Middle($('layout_b'));
	var ic=new Ico(dd)
}
Ming.AddEvent(window,'load',load)

