var siteUrl = "";
function doShow(div,inner){
 $(div).innerHTML=inner;
}
function $(id)
{
   return document.getElementById(id);
}
function showtool()
{
$('toolscon').style.display = $('toolscon').style.display=="none"?"block":"none";
}

function initb2b()
{
	var url = siteUrl+"/api/readb2b.php";
	var params = "";
	doAjax("post",url,params,"doShow('b2bLoading','请求失败')","doShow('b2bLoading','<img src=\"./images/loading.gif\"/>正在读取，请稍候')","showb2b(ajax.responseText)");
}
function showb2b(text)
{
	$('b2b').innerHTML = text;
	$('b2bLoading').style.display = "none";
}
function showweather(text)
{
	$('weather').innerHTML = text;
	$('weatherLoading').style.display = "none";
}
function initweather()
{
	var url = siteUrl+"/api/weather1.php";
	var params = "";
	doAjax("post",url,params,"doShow('weatherLoading','请求失败')","doShow('weatherLoading','<img src=\"./images/loading.gif\"/>正在读取，请稍候')","showweather(ajax.responseText)");
}

var anndelay = 3000;
var anncount = 0;
var annheight = 20;
var annst = 0;
function announcementScroll()
{
   if( ! annst)
   {
      $('announcementbody').innerHTML += '<br style="clear: both" />' + $('announcementbody').innerHTML;
      $('announcementbody').scrollTop = 0;
      if($('announcementbody').scrollHeight > annheight * 3)
      {
         annst = setTimeout('announcementScroll()', anndelay);
      }
      else
      {
         $('announcement').onmouseover = $('announcement').onmouseout = null;
      }
      return;
   }
   if(anncount == annheight)
   {
      if($('announcementbody').scrollHeight - annheight <= $('announcementbody').scrollTop)
      {
         $('announcementbody').scrollTop = $('announcementbody').scrollHeight / 2 - annheight;
      }
      anncount = 0;
      annst = setTimeout('announcementScroll()', anndelay);
   }
   else
   {
      $('announcementbody').scrollTop ++ ;
      anncount ++ ;
      annst = setTimeout('announcementScroll()', 10);
   }
}
var exdelay = 3000;
var excount = 0;
var exheight = 20;
var exnst = 0;
function exchangeScroll()
{
   if( ! exnst)
   {
      $('exchangebody').innerHTML += '<br style="clear: both" />' + $('exchangebody').innerHTML;
      $('exchangebody').scrollTop = 0;
      if($('exchangebody').scrollHeight > exheight * 3)
      {
         exnst = setTimeout('exchangeScroll()', exdelay);
      }
      else
      {
         $('exchange').onmouseover = $('exchange').onmouseout = null;
      }
      return;
   }
   if(excount == exheight)
   {
      if($('exchangebody').scrollHeight - exheight <= $('exchangebody').scrollTop)
      {
         $('exchangebody').scrollTop = $('exchangebody').scrollHeight / 2 - exheight;
      }
      excount = 0;
      exnst = setTimeout('exchangeScroll()', exdelay);
   }
   else
   {
      $('exchangebody').scrollTop ++ ;
      excount ++ ;
      exnst = setTimeout('exchangeScroll()', 10);
   }
}
function showfinance()
{		
        document.write("<div id=announcement onMouseOver=\"if(!anncount) {clearTimeout(annst);annst = 0}\" onMouseOut=\"if(!annst) annst = setTimeout('announcementScroll()', anndelay);\"><DIV id=announcementbody style='height:20px;line-height:20px'><ul>");
	for(var i=0;i<v_top_info.length;i++){
if(i==3 || i==4){continue;}
        document.write("<li>" + v_top_info[i][1] + "<span style='width:5px'></span>" + v_top_info[i][4]);
		var num1 = parseInt(v_top_info[i][5]);
		if(num1<0){
			document.write("<span style='color:green;margin-left:15px'>" + v_top_info[i][5] + "</span></li>");
		}
		else{
			document.write("<span style='color:green;margin-left:15px'>" + v_top_info[i][5] + "</span></li>");
		}
	}
	document.write("</ul></div></div>");
}
function initfinance()
{
	showfinance();
}
function showexchange(text)
{
	$('exchange').innerHTML = text;
	$('exchangeLoading').style.display = "none";
	exchangeScroll();
}
function initexchange()
{
	var url = siteUrl+"/api/exchange1.php";
	var params = "";
	doAjax("post",url,params,"doShow('exchangeLoading','请求失败')","doShow('exchangeLoading','<img src=\"{S_URL}/images/loading.gif\"/>正在读取，请稍候')","showexchange(ajax.responseText)");
}


function gocenter()  
{if(screen.width   ==   1024)   
	{   
            var iMove = (document.body.scrollWidth-document.body.offsetWidth)/2   
	   window.scrollTo(iMove,0)   
	}   
}   


function $(str){
	return document.getElementById(str);
}

function shownews(k,n){
var i;
for (i = 1; i <= k; i++){
B1= "middle_news_"+i;
B2="middle_news_"+n;
L1="link_"+i;
L2="link_"+n;
In1="news_content_"+i;
In2="news_content_"+n;

$(B1).className='';
$(B2).className='on';
$(L1).className='news_link';
$(L2).className='news_link_on';
$(In1).style.display='none';
$(In2).style.display='';


}
}

function googlesearch () {
var wq=document.getElementsByName("ysgoogle")[0].value;
var link="http://www.google.com/search?domains=www.aunew.com&sitesearch=www.aunew.com&q="+wq;
window.open(link); }
function getSvalue(){
var wq=document.getElementsByName("ysgoogle")[0].value;
wq="http://www.google.com/search?domains=www.aunew.com&sitesearch=www.aunew.com&q=" + wq;
wq=" " +wq +" target=_blank"
return wq;
}

function changesearch(obj)
{
	$("sbi").value = obj;
	document.googlefrm.submit();
}
