// JavaScript Document
var i = 0;
var s;
// tab1

function tab_sub(name,id,n){
	for(var i=1; i<=n; i++)
	{
		var tab=document.getElementById(name+i);
		var cont=document.getElementById("con"+"_"+name+"_"+i);
         tab.className=id==i?"checked":"";
		 cont.style.display=id==i?"block":"none";
	}
}
// tab2
function tab_sub_1(name,id,n){
	for(var i=1; i<=n; i++)
	{
		var tab=document.getElementById(name+i);
		var cont=document.getElementById("con"+"_"+name+"_"+i);
         tab.className=id==i?"checked":"";
		 cont.style.display=id==i?"block":"none";
	}
}
// tab3
function tab_sub_2(name,id,n,cls){
	for(var i=1; i<=n; i++)
	{
		var tab=document.getElementById(name+i);
		var cont=document.getElementById("con"+"_"+name+"_"+i);
         tab.className=id==i?cls:"";
		 cont.style.display=id==i?"block":"none";
	}
}

function Flash(id,url,w,h,bg,t){
document.write("\
<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width="+w+" height="+h+" id="+id+">\
<param name='movie' value="+url+" />\
<param name='wmode' value="+t+" />\
<param name='bgcolor' value="+bg+" />\
<param name='allowScriptAccess' value='sameDomain' />\
<param name='quality' value='high' />\
<param name='menu' value='false' />\
<embed src="+url+" wmode="+t+" width="+w+" height="+h+" name="+id+" bgcolor="+bg+" allowScriptAccess='sameDomain' quality='high' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />\
</object>\
");
}

function Flashlow(id,url,w,h,bg,t){
document.write("\
<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width="+w+" height="+h+" id="+id+">\
<param name='movie' value="+url+" />\
<param name='wmode' value="+t+" />\
<param name='bgcolor' value="+bg+" />\
<param name='allowScriptAccess' value='sameDomain' />\
<param name='quality' value='low' />\
<param name='menu' value='false' />\
<embed src="+url+" wmode="+t+" width="+w+" height="+h+" name="+id+" bgcolor="+bg+" allowScriptAccess='sameDomain' quality='high' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />\
</object>\
");
}


//control div display or hide gradually 

function   DivShow(divid)   {
  var obj = document.getElementById(divid);
  //obj.style.visibility = "visible";
  obj.style.filter = "Alpha(Opacity=100)"; //透明度逐渐变小
  obj.style.opacity = 100; //兼容FireFox
}
//shortcut for getElementById
function $(d){return document.getElementById(d);}

//渐变显示首页div的
function show(x){
   if(s){clearInterval(s);}
   $(x).style.display="block";
   s = setInterval(change_show,1);
}
function change_show(){
   var obj = $("home_botminfo");
   i=i+5; //逐渐显示速度
   obj.style.filter = "Alpha(Opacity=" + i + ")"; //透明度逐渐变小
   obj.style.opacity = i/100; //兼容FireFox
   if(i>=100){
    clearInterval(s);
    i=0;
   }
}

//to know which browser
function GetBrowser() 
{ 
    var OsObject = ""; 
   if(navigator.userAgent.indexOf("MSIE")>0) { 
        return "MSIE"; 
   } 
   if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){ 
        return "Firefox"; 
   } 
   if(isSafari=navigator.userAgent.indexOf("Safari")>0) { 
        return "Safari"; 
   }  
} 


function changebg(divid,imgurl)
{
	var obj = document.getElementById(divid);
	obj.style.background = "url("+imgurl+")";
	obj.style.backgroundRepeat="repeat-x";
  	obj.style.backgroundPosition="left top";   
}


function openwindow(url,width,height)
{
	window.open(url,'newwindow','toolbar=0,scrollbars=1,statusbar=0,menubar=0,resizable=1,width='+width+',height='+height);
}
function setimgurl(s_divid,s_imgid,imgurl)
{
  
    var a =  imgurl.substring(0, imgurl.lastIndexOf("/")+1);
    var b =  imgurl.substring(imgurl.lastIndexOf("/")+1);
    var c =  b.substring(5);
    imgurl = a + c ;
	var obj = $(s_divid);
	obj.style.display = "block";
	var img = $(s_imgid);
	img.setAttribute("src",imgurl);	
}

function resetimgurl(s_divid,s_imgid)
{
	var obj = $(s_divid);
	obj.style.display = "none";
	var img = $(s_imgid);
	img.setAttribute("src","");	
}
function expend(divid)
{
	var obj = $(divid);
	if(obj.style.display=="block")
	{
		obj.style.display = "none";	
	}
	else
	{
		obj.style.display = "block";	
	}
}