// JavaScript Document
function g(o){return document.getElementById(o);}
//本网公告
function HoverLibwzg(n){
//如果有N个标签,就将i<=N;
//本功能非常OK,兼容IE7,FF,IE6
for(var i=1;i<=4;i++)
{
	g('tb1_'+i).className='normaltab';
	g('tb1_0'+i).className='undis';
}
	g('tb1_0'+n).className='dis';
	g('tb1_'+n).className='hovertab';
}
//行情评论
function HoverLicom(n){
//如果有N个标签,就将i<=N;
//本功能非常OK,兼容IE7,FF,IE6
for(var i=1;i<=3;i++)
{
	g('tb2_'+i).className='normaltab';
	g('tb2_0'+i).className='undis';
}
	g('tb2_0'+n).className='dis';
	g('tb2_'+n).className='hovertab';
}
//研究分析
function HoverLire(n){
//如果有N个标签,就将i<=N;
//本功能非常OK,兼容IE7,FF,IE6
for(var i=1;i<=2;i++)
{
	g('tb3_'+i).className='normaltab';
	g('tb3_0'+i).className='undis';
}
	g('tb3_0'+n).className='dis';
	g('tb3_'+n).className='hovertab';
}
//行情
function HoverLimarket(n){
//如果有N个标签,就将i<=N;
//本功能非常OK,兼容IE7,FF,IE6
for(var i=1;i<=2;i++)
{
	g('mb_'+i).className='normaltab1';
	g('mb_0'+i).className='undis1';
}
	g('mb_0'+n).className='dis1';
	g('mb_'+n).className='hovertab1';
}
//二级行情
function HoverLimarket1(n){
//如果有N个标签,就将i<=N;
//本功能非常OK,兼容IE7,FF,IE6
for(var i=1;i<=3;i++)
{
	g('ab_'+i).className='normaltab1';
	g('ab_0'+i).className='undis1';
}
	g('ab_0'+n).className='dis1';
	g('ab_'+n).className='hovertab1';
}
//国内
function HoverLiguonei(n){
//如果有N个标签,就将i<=N;
//本功能非常OK,兼容IE7,FF,IE6
for(var i=1;i<=2;i++)
{
	g('ib_'+i).className='normaltab2';
	g('ib_0'+i).className='undis2';
}
	g('ib_0'+n).className='dis2';
	g('ib_'+n).className='hovertab2';
}
//国内
function HoverLiguowai(n){
//如果有N个标签,就将i<=N;
//本功能非常OK,兼容IE7,FF,IE6
for(var i=1;i<=2;i++)
{
	g('gb_'+i).className='normaltab2';
	g('gb_0'+i).className='undis2';
}
	g('gb_0'+n).className='dis2';
	g('gb_'+n).className='hovertab2';
}
//如果要做成点击后再转到请将<li>中的onmouseover 改成 onclick;
//]]>

var DDSPEED = 10;
var DDTIMER = 15;
// main function to handle the mouse events //
function ddMenu(id,d){
  var h = document.getElementById(id + '-ddheader');
  var c = document.getElementById(id + '-ddcontent');
  clearInterval(c.timer);
  if(d == 1){
    clearTimeout(h.timer);
    if(c.maxh && c.maxh <= c.offsetHeight){return}
    else if(!c.maxh){
      c.style.display = 'block';
      c.style.height = 'auto';
      c.maxh = c.offsetHeight;
      c.style.height = '0px';
    }
    c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
  }else{
    h.timer = setTimeout(function(){ddCollapse(c)},50);
  }
}

// collapse the menu //
function ddCollapse(c){
  c.timer = setInterval(function(){ddSlide(c,-1)},DDTIMER);
}

// cancel the collapse if a user rolls over the dropdown //
function cancelHide(id){
  var h = document.getElementById(id + '-ddheader');
  var c = document.getElementById(id + '-ddcontent');
  clearTimeout(h.timer);
  clearInterval(c.timer);
  if(c.offsetHeight < c.maxh){
    c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
  }
}

// incrementally expand/contract the dropdown and change the opacity //
function ddSlide(c,d){
  var currh = c.offsetHeight;
  var dist;
  if(d == 1){
    dist = (Math.round((c.maxh - currh) / DDSPEED));
  }else{
    dist = (Math.round(currh / DDSPEED));
  }
  if(dist <= 1 && d == 1){
    dist = 1;
  }
  c.style.height = currh + (dist * d) + 'px';
  c.style.opacity = currh / c.maxh;
  c.style.filter = 'alpha(opacity=' + (currh * 100 / c.maxh) + ')';
  if((currh < 2 && d != 1) || (currh > (c.maxh - 2) && d == 1)){
    clearInterval(c.timer);
  }
}

//查看调查信息
function setVoteUrl() {
	var voteForm = document.getElementById("webvote");
	var url = "?voteid=" + voteForm.voteid.value;
	window.open("webVoteInfoAction!show.action" + url, "_VoteWin", "width=400px,height=200px,top=200,left=300");
	return false;
}
//调查
function checkVote(){
	var vote_num=$j('input[name=contentid]').length;
	if(vote_num==0){
		alert("\u5bf9\u4e0d\u8d77\uff0c\u6682\u65f6\u65e0\u6cd5\u8fdb\u884c\u6295\u7968\uff01");
		return false;
	}else{
		var result='?';
		var chks=$j('input[name=contentid]:checked');
		var $_chks=$j(chks);
		$_chks.each(function(ind){
				result=result+'contentid='+$j(this).val()+'&';
		});

		if(result=='?'){
			alert("\u8bf7\u9009\u62e9\u4f60\u8981\u6295\u7968\u7684\u9009\u9879\uff01");
			return false;
		}else{
			result=result.substring(0,result.length-1);
			window.open("webVoteInfoAction!save.action" + result, "_VoteWin", "width=400px,height=200px,top=200,left=300");
		}
	}
	return false;
}

