function getDownloadUrl(productName) {
			var random = parseInt(Math.random()*100);
			var temp = 0;

			for(var i = 0; i < productName.length && random > temp; i++) {
				temp += parseInt(productName[i].percent);
			}
			i = (random == 0 ? 0 : i - 1);

			return "<a href=\"" + productName[i].url + "\">" + productName[i].name + "</a>";
}
function switchTab(identify,index,count) {
    for(i=0;i<count;i++) {
		var CurTabObj = document.getElementById("Tab_"+identify+"_"+i) ;
		var CurListObj = document.getElementById("List_"+identify+"_"+i) ;
		if (i != index) {
			fRemoveClass(CurTabObj , "upH3") ;
			fRemoveClass(CurListObj , "upBox") ;
		}
	}
	fAddClass(document.getElementById("Tab_"+identify+"_"+index),"upH3") ;
	fAddClass(document.getElementById("List_"+identify+"_"+index),"upBox") ;
}

function switchSideTab(identify,index,count) {
	for(i=0;i<count;i++) {
		var CurTabObj = document.getElementById("Tab_"+identify+"_"+i) ;
		var CurListObj = document.getElementById("List_"+identify+"_"+i) ;
		if (i != index) {
			fRemoveClass(CurTabObj , "upH3") ;
			fRemoveClass(CurListObj , "upUL") ;
		}
	}
	fAddClass(document.getElementById("Tab_"+identify+"_"+index),"upH3") ;
	fAddClass(document.getElementById("List_"+identify+"_"+index),"upUL") ;
}

function fAddClass(XEle, XClass)
{/* shawl.qiu code, void return */
  if(!XClass) throw new Error("XClass 不能为空!");
  if(XEle.className!="")
  {
    var Re = new RegExp("\\b"+XClass+"\\b\\s*", "");
    XEle.className = XEle.className.replace(Re, "");
	var OldClassName = XEle.className.replace(/^\s+|\s+$/g,"") ;
	if (OldClassName == "" ) {
		 XEle.className = XClass;
	}
	else {
		XEle.className = OldClassName + " " + XClass;
	}

  }
  else XEle.className = XClass;
}/* end function fAddClass(XEle, XClass) */

function fRemoveClass(XEle, XClass)
{/* shawl.qiu code, void return */
  if(!XClass) throw new Error("XClass 不能为空!");
  var OldClassName = XEle.className.replace(/^\s+|\s+$/g,"") ;
  if(OldClassName!="")
  {

    var Re = new RegExp("\\b"+XClass+"\\b\\s*", "");
    XEle.className = OldClassName.replace(Re, "");
  }
}/* function fRemoveClass(XEle, XClass) */
function switchPic(screen, title_posit, stitle_posit, show_num, style, pic_width, pic_heigh, j) {
	if (screen > j) {
		screen = 1 ;
	}
    document.getElementById("h").href = Switcher[screen]['href'];
    document.getElementById("pic").src = Switcher[screen]['src'];
    document.getElementById("pic").alt = Switcher[screen]['alt'];
	/*for (i=1;i<=j;i++) {
        document.getElementById("Switch_"+i).style.display = "none" ;
	}
	document.getElementById("Switch_"+screen).style.display = '' ;*/

    showSwitchNav(screen, show_num);
    showSwitchTitle(screen, title_posit, stitle_posit);
    showEffect(Switcher[screen]['src'],screen,Switcher[screen]['effect'],style);
	//Effect.Appear("Switch_"+screen);

	//switchLittlePic(screen);
	//showSwitchTitles(screen);
	CurScreen = screen  ;
}
function showSwitchNav(screen, show_num) {
	var NavStr = "" ;

    if (show_num == "0") {
        for (i=1;i<=j;i++) {
		if (i == screen) {
			NavStr += '<li onmouseover="pauseSwitch();" onmouseout="goonSwitch();" style="background:#D80F12; border-left:1px solid #fff;"><a href="javascript://" target="_self" class="sel" style="color:#8c8c8c;text-align:middle;color:#FFF;">'+i+'</a></li>' ;
		}
		else {
			NavStr += '<li onmouseover="pauseSwitch();" onmouseout="goonSwitch();" onclick="goManSwitch('+i+');" style="border-left:1px solid #fff;"><a href="javascript://" target="_self" style="text-align:middle;color:#FFF;">'+i+'</a></li>' ;
		}

	}

    document.getElementById("SwitchNav").innerHTML = NavStr ;
    }
}
function showSwitchTitle(screen, title_posit, stitle_posit) {
	var titlestr = "" ;
    var stitlestr = "";
    var message = "";
    //alert(bgcolor.substr(0,1));
    if(bgcolor.substr(0,1) == '#'){
        bgcolor = bgcolor.substr(1);
    }
    /*if(bgcolor == '' || bgcolor.length ==0){
        bgcolor = '619BE5';
    }*/
    if(fontcolor.substr(0,1) == '#'){
      fontcolor = fontcolor.substr(1);
    }
    titlestr = '<div style="height:'+pic_heigh+'px;width:'+pic_width+'px;background:#'+bgcolor+'; filter:Alpha(opacity=50);opacity:0.5; -moz-opacity:0.5;"></div>' ;
    if(Switcher[screen]['title'] != '' && Switcher[screen]['stitle'] == ''){
        message = '<table height='+pic_heigh+' width='+pic_width+'><tr><td class="title" style="color:#'+fontcolor+'; font-size:'+fontsize+'px; font-weight:bold;">'+Switcher[screen]['title']+'</td></tr></table>'
    }else if(Switcher[screen]['title'] == '' && Switcher[screen]['stitle'] != ''){
        message = '<table height='+pic_heigh+' width='+pic_width+'><tr><td class="content_1" style="color:#'+fontcolor+'; font-size:'+textsize+'px;">'+Switcher[screen]['stitle']+'</td></tr></table>';
    }else {
      message = '<table height='+pic_heigh+' width='+pic_width+'><tr><td class="content" style="color:#'+fontcolor+'; font-size:'+fontsize+'px; font-weight:bold;">'+Switcher[screen]['title']+'</td></tr><tr><td class="content_1" style="color:#'+fontcolor+'; font-size:'+textsize+'px;">'+Switcher[screen]['stitle']+'</td></tr></table>';
    }    
    //stitlestr ='<div style="text-align:left;"><a style="font-size:12px" href="'+Switcher[screen]['link']+'" target="_blank">'+Switcher[screen]['stitle']+'</a></div>';
    if (title_posit == "SwitchTitleNone") {
        document.getElementById(title_posit).innerHTML = "";
        document.getElementById(stitle_posit).innerHTML = "";
    } else {
        if(title_posit == "SwitchTitleDown"){
         document.getElementById(title_posit).innerHTML = titlestr ;
         document.getElementById("message").innerHTML = message;
        }else{
           document.getElementById(stitle_posit).innerHTML = message;
        }
        if (stitle_posit == "SwitchTitleNone") {
            document.getElementById(stitle_posit).innerHTML = "";
        } 
    }
}
function reSwitchPic() {
	refreshSwitchTimer = null;
	switchPic(CurScreen+1, title_posit, stitle_posit, show_num,style,pic_width, pic_heigh, j);
	refreshSwitchTimer = setTimeout('reSwitchPic();', 3000);
}
function pauseSwitch() {
	clearTimeout(refreshSwitchTimer);
}
function goonSwitch() {
	clearTimeout(refreshSwitchTimer);
	refreshSwitchTimer = setTimeout('reSwitchPic();', 3000);
}
function goManSwitch(index) {
	clearTimeout(refreshSwitchTimer);

	CurScreen = index - 1 ;
	reSwitchPic();
}
function floatAdMove() {
	try{BigAd = document.getElementById("BigAd")}catch(e){}
	if (BigAd.style.display != "none") {
		if (document.ns) {
			BigAd.style.top=bdy.scrollTop+bdy.clientHeight-imgheight_close -360;
			BigAd.style.left=bdy.offsetWidth/2-bdy.scrollLeft-300;
		}
		else {
			BigAd_style_left=bdy.offsetWidth/2-bdy.scrollLeft-300;
			BigAd_style_top = 200 ;
			BigAd.style.top=BigAd_style_top + "px";
			BigAd.style.left=BigAd_style_left + "px";
		}
	}
	setTimeout("floatAdMove();",50) ;
 }

function FloatCtrlMove() {
	try{FloatCtrl = document.getElementById("FloatCtrl")}catch(e){}
	if (FloatCtrl.style.display != "none") {
		if (document.ns) {
			FloatCtrl.style.top=bdy.scrollTop+bdy.clientHeight-imgheight_close;
			FloatCtrl.style.left=bdy.scrollLeft+bdy.offsetWidth-150;
		}
		else {
			FloatCtrl_style_left=bdy.scrollLeft+bdy.offsetWidth-150;
			FloatCtrl_style_top = 500 ;
			FloatCtrl.style.top=FloatCtrl_style_top + "px";
			FloatCtrl.style.left=FloatCtrl_style_left + "px";
		}
	}
	setTimeout("FloatCtrlMove();",50) ;
}

function showFloatAd() {
	cleanTimer();
	try{floatbig = document.getElementById("floatbig")}catch(e){}
	if (floatbig.innerHTML != "") {
		BigAdStartTimer = setTimeout("Effect.Appear('BigAd');",500);
		BigAdEndTimer = setTimeout("hiddenFloatAd();",6000);
		hiddenFloatCtrl();
	}
}

 function hiddenFloatAd() {
	cleanTimer();
	Effect.Fade('BigAd');
	showFloatCtrl();
 }

 function showFloatCtrl() {
	try {FloatCtrl = getElementById("FloatCtrl")} catch(e){}
	FloatCtrl.style.display = "block" ;
 }
 function hiddenFloatCtrl() {
	try {FloatCtrl = getElementById("FloatCtrl")} catch(e){}
	FloatCtrl.style.display = "none" ;
 }
 function cleanTimer() {
	clearTimeout(BigAdStartTimer) ;
	clearTimeout(BigAdEndTimer);
 }

function showEffect(s,screen,effect,style){
    var Sys = {};
	var ua = navigator.userAgent.toLowerCase();
	if (window.ActiveXObject)
	Sys.ie = ua.match(/msie ([\d.]+)/)[1]
	else if (document.getBoxObjectFor)
	Sys.firefox = ua.match(/firefox\/([\d.]+)/)[1]
	else if (window.MessageEvent && !document.getBoxObjectFor)
	Sys.chrome = ua.match(/chrome\/([\d.]+)/)[1]
	else if (window.opera)
	Sys.opera = ua.match(/opera.([\d.]+)/)[1]
	else if (window.openDatabase)
	Sys.safari = ua.match(/version\/([\d.]+)/)[1];
    obj = eval("pic"); //若图像标记的ID号改变，请修改括号中的字符串值。
    if(Sys.ie) {
       if(effect != ''){
        obj.filters.item(0).transition =effect;
       }else{
        obj.filters.item(0).transition = style;
       }
        obj.filters.item(0).Apply();
        obj.src = s;
        obj.filters.item(0).Play();
    }
   }

