
<!--
function jumpMenu(formName,popupName,target){ 
	var popup = document[formName].elements[popupName];
	if(popup.options[popup.selectedIndex].value != ""){
		window.open(popup.options[popup.selectedIndex].value,target);
		popup.selectedIndex = 0;

	}	
}
//-->

		var search_action_array=['http://sou.ifeng.com/hlftiweb/search.action?q=&c=5','http://sou.ifeng.com/hlftiweb/search.action?q=&c=1','http://sou.ifeng.com/bsearch/bsearch.do?q='];
	var search_array=['ra0','ra1','ra2'];
	var search_index=1;
	function switch_search(index)
	{
		$('c').value = index==0?5:1;
		$('searchForm').action=search_action_array[index];
	}
	function init_search()
	{
		switch_search(search_index);
		V.addListener(search_array,'click',
			function(e,obj)
			{
				var tmp=0;
				for(var i=0;i!=search_array.length;i++)
				{
					if(obj.id==search_array[i])
					{
						tmp=i;break;
					}
				}
				switch_search(tmp);
			}
		)
		V.addListener('searchbutton','click',function(e,obj){$('searchForm').submit();})
		$('searchForm').q.focus();
		$('searchForm').q.value=PH_HOTWORDS[1];
	}
	
function clickLoginSelect(){
	if($("loginFldselectop").style.display == "block"){
		$("loginFldselectop").style.display = "none";
	}else{
		$("loginFldselectop").style.display = "block";
		selectlist();
	}
}

function myclick(obj)
{
	$("loginUl").innerHTML = obj.innerHTML;
	$("loginFldselectop").style.display = "none";
}
function selectlist(){
var liObj = $("loginFldselectop").getElementsByTagName("li");
for (var j=0;j<liObj.length;j++){
liObj[j].onmouseover=function(){
	this.style.background="#B4777A";
	this.getElementsByTagName("a")[0].style.color="white";
	
}
liObj[j].onmouseout=function(){
	this.style.background="white";
	this.getElementsByTagName("a")[0].style.color="black";
}
liObj[j].onclick=function(){
	$("loginFldselectop").style.display == "none";
}
}
}
function getHotwords()
{
	var PH_HOTWORDS_TRAGET='http://gsearch.ifeng.com/gsearch/gsearch.jsp?q=', __s='';
	for(var i=1;i<5;i++){__s+='<a href="'+PH_HOTWORDS_TRAGET+encodeURIComponent(PH_HOTWORDS[i])+'" target="_blank">'+PH_HOTWORDS[i]+'</a>&nbsp;&nbsp;';}
	return __s;
}
function clear_text(){
var t = document.getElementById("q");
t.value="";
}

function scrollnews(){
var htext = document.getElementsByTagName("h1"); 
var text_holder = document.getElementById("newscommend");
var p = ["博报","财经","论坛","军事","读书","汽车","文化","传媒","历史","佛教","时尚","体育","娱乐","台湾"];
var purl = ["http://blog.ifeng.com","http://finance.ifeng.com","http://bbs.ifeng.com","http://news.ifeng.com/mil","http://book.ifeng.com","http://auto.ifeng.com","http://culture.ifeng.com/","http://media.ifeng.com/","http://news.ifeng.com/history","http://fo.ifeng.com/","http://fashion.ifeng.com","http://news.ifeng.com/sports/","http://ent.ifeng.com","http://news.ifeng.com/taiwan"];
var oFrag = document.createDocumentFragment();
oFrag.innerHTML="";
for(var i=0;i<htext.length;i++){
	oFrag.innerHTML+="<strong>[<a href="+purl[i]+" target=_blank>"+p[i]+"</a>]</strong> "+htext[i].innerHTML+"&nbsp;&nbsp;";
	if((i>0 && i%2==1) || (i==htext.length-1 && i%2==0)){
		oFrag.innerHTML+="<br/>";
	}
}
text_holder.innerHTML=oFrag.innerHTML;
}

function ScrollText(content,btnPrevious,btnNext,autoStart,timeout,isSmoothScroll)
{
    this.Speed = 10;
    this.Timeout = timeout;
	this.stopscroll =false;//是否停止滚动的标志位
	this.isSmoothScroll= isSmoothScroll;//是否平滑连续滚动
    this.LineHeight = 20;//默认高度。可以在外部根据需要设置
    this.NextButton = this.$(btnNext);
    this.PreviousButton = this.$(btnPrevious);
    this.ScrollContent = this.$(content);
    this.ScrollContent.innerHTML += this.ScrollContent.innerHTML;//为了平滑滚动再加一遍

	if(this.PreviousButton)

	{
		this.PreviousButton.onclick = this.GetFunction(this,"Previous"); 
		this.PreviousButton.onmouseover = this.GetFunction(this,"MouseOver");
		this.PreviousButton.onmouseout = this.GetFunction(this,"MouseOut");
	}
	if(this.NextButton){
		this.NextButton.onclick = this.GetFunction(this,"Next");
		this.NextButton.onmouseover = this.GetFunction(this,"MouseOver");
		this.NextButton.onmouseout = this.GetFunction(this,"MouseOut");
    }
    this.ScrollContent.onmouseover = this.GetFunction(this,"MouseOver");
    this.ScrollContent.onmouseout = this.GetFunction(this,"MouseOut");

    if(autoStart)
    {
        this.Start();
    }
}

ScrollText.prototype = {

	$:function(element)
	{
		return document.getElementById(element);
	},
	Previous:function()
	{
		this.stopscroll = true;
		this.Scroll("up");
	},
	Next:function()
	{
		this.stopscroll = true;
		this.Scroll("down");
	},
	Start:function()
	{
		if(this.isSmoothScroll)
		{
			this.AutoScrollTimer = setInterval(this.GetFunction(this,"SmoothScroll"), this.Timeout);
		}
		else
		{		
			this.AutoScrollTimer = setInterval(this.GetFunction(this,"AutoScroll"), this.Timeout);
		}
	},
	Stop:function()
	{
		clearTimeout(this.AutoScrollTimer);
		this.DelayTimerStop = 0;
	},
	MouseOver:function()
	{	
		this.stopscroll = true;
	},
	MouseOut:function()
	{
		this.stopscroll = false;
	},
	AutoScroll:function()
	{
		if(this.stopscroll) 
		{
			return;
		}
		this.ScrollContent.scrollTop++;
		if(parseInt(this.ScrollContent.scrollTop) % this.LineHeight != 0)
		{
			this.ScrollTimer = setTimeout(this.GetFunction(this,"AutoScroll"), this.Speed);
		}
		else
		{
			if(parseInt(this.ScrollContent.scrollTop) >= parseInt(this.ScrollContent.scrollHeight) / 2)
			{
				this.ScrollContent.scrollTop = 0;
			}
			clearTimeout(this.ScrollTimer);
			//this.AutoScrollTimer = setTimeout(this.GetFunction(this,"AutoScroll"), this.Timeout);
		}
	},
	SmoothScroll:function()
	{
		if(this.stopscroll) 
		{
			return;
		}
		this.ScrollContent.scrollTop++;
		if(parseInt(this.ScrollContent.scrollTop) >= parseInt(this.ScrollContent.scrollHeight) / 2)
		{
			this.ScrollContent.scrollTop = 0;
		}
	},
	Scroll:function(direction)
	{

		if(direction=="up")
		{
			this.ScrollContent.scrollTop--;
		}
		else
		{
			this.ScrollContent.scrollTop++;
		}
		if(parseInt(this.ScrollContent.scrollTop) >= parseInt(this.ScrollContent.scrollHeight) / 2)
		{
			this.ScrollContent.scrollTop = 0;
		}
		else if(parseInt(this.ScrollContent.scrollTop)<=0)
		{
			this.ScrollContent.scrollTop = parseInt(this.ScrollContent.scrollHeight) / 2;
		}
		
		if(parseInt(this.ScrollContent.scrollTop) % this.LineHeight != 0)
		{
			this.ScrollTimer = setTimeout(this.GetFunction(this,"Scroll",direction), this.Speed);
		}
	},
	GetFunction:function(variable,method,param)
	{
		return function()
		{
			variable[method](param);
		}
	}
}

function ignoreError() {
  return true;
}
window.onerror = ignoreError; 