function addBookmark(title,url)
{
	if (window.sidebar)
		{
		window.sidebar.addPanel(title, url,"");
		}
		else if( document.all )
		{
			window.external.AddFavorite( url, title);
		}
		else if( window.opera && window.print )
		{return true;}
}

function changedj(idx)
{
	djcount=12;
	for (var i=1;i<=djcount;i++)
	{
		document.getElementById("dj"+i).className="djshow_listitem";
	}
	document.getElementById("dj"+idx).className="djshow_listitem_selected";		
	document.getElementById("djshow_detail").innerHTML=document.getElementById("djshow_content"+idx).innerHTML;
}

// global settings


// fundamental
id = function(o) { return document.getElementById(o); }

function pixelToNum(str) 
{
		if(str.slice(str.length - 2) == "px")
			{return parseInt(str.slice(0, (str.length - 2)));} 
		else
			{return str;}
}


//flash inject in
function swf(ur,w,h){
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'"> ');
	document.write('<param name="movie" value="' + ur + '">');
	document.write('<param name="quality" value="high"> ');
	// transparent mode will cause IME failure in flash player 9 or 10. 

	//document.write('<param name="wmode" value="transparent">');
	//document.write('<embed src="' + ur + '" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed> ');
	document.write('<embed src="' + ur + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed> ');
	document.write('</object> ');
}


// footer drop list URL go
function go(idx)
{
	if (idx!="")
	{
		var win=window.open(idx);
	}
}


// index dj roller
function GetObj(objName){if(document.getElementById){return eval('document.getElementById("'+objName+'")')}else{return eval('document.all.'+objName)}} 
function AutoPlay(){ //自动滚动 
 clearInterval(AutoPlayObj); 
 AutoPlayObj = setInterval('ISL_GoDown();ISL_StopDown();',5000); //间隔时间 
} 
function ISL_GoUp(){ //上翻开始 
 if(MoveLock) return; 
 clearInterval(AutoPlayObj); 
 MoveLock = true; 
 MoveTimeObj = setInterval('ISL_ScrUp();',Speed); 
} 
function ISL_StopUp(){ //上翻停止 
 clearInterval(MoveTimeObj); 
 if(GetObj('ISL_Cont').scrollLeft % PageWidth - fill != 0){ 
  Comp = fill - (GetObj('ISL_Cont').scrollLeft % PageWidth); 
  CompScr(); 
 }else{ 
  MoveLock = false; 
 } 
 AutoPlay(); 
} 
function ISL_ScrUp(){ //上翻动作 
 if(GetObj('ISL_Cont').scrollLeft <= 0){GetObj('ISL_Cont').scrollLeft = GetObj('ISL_Cont').scrollLeft + GetObj('List1').offsetWidth} 
 GetObj('ISL_Cont').scrollLeft -= Space ; 
} 
function ISL_GoDown(){ //下翻 
 clearInterval(MoveTimeObj); 
 if(MoveLock) return; 
 clearInterval(AutoPlayObj); 
 MoveLock = true; 
 ISL_ScrDown(); 
 MoveTimeObj = setInterval('ISL_ScrDown()',Speed); 
} 
function ISL_StopDown(){ //下翻停止 
 clearInterval(MoveTimeObj); 
 if(GetObj('ISL_Cont').scrollLeft % PageWidth - fill != 0 ){ 
  Comp = PageWidth - GetObj('ISL_Cont').scrollLeft % PageWidth + fill; 
  CompScr(); 
 }else{ 
  MoveLock = false; 
 } 
 AutoPlay(); 
} 
function ISL_ScrDown(){ //下翻动作 
 if(GetObj('ISL_Cont').scrollLeft >= GetObj('List1').scrollWidth){GetObj('ISL_Cont').scrollLeft = GetObj('ISL_Cont').scrollLeft - GetObj('List1').scrollWidth;} 
 GetObj('ISL_Cont').scrollLeft += Space ; 
} 
function CompScr(){ 
 var num; 
 if(Comp == 0){MoveLock = false;return;} 
 if(Comp < 0){ //上翻 
  if(Comp < -Space){ 
   Comp += Space; 
   num = Space; 
  }else{ 
   num = -Comp; 
   Comp = 0; 
  } 
  GetObj('ISL_Cont').scrollLeft -= num; 
  setTimeout('CompScr()',Speed); 
 }else{ //下翻 
  if(Comp > Space){ 
   Comp -= Space; 
   num = Space; 
  }else{ 
   num = Comp; 
   Comp = 0; 
  } 
  GetObj('ISL_Cont').scrollLeft += num; 
  setTimeout('CompScr()',Speed); 
 } 
}


// index flipper
function flipper(str)
{
	var flipper_count=6;
	var obj,obj1;
	if (str=="left")
	{
		flipper_current--;
		if (flipper_current<1)
		{
			flipper_current=flipper_count;
		}
	}

	if (str=="right")
	{
		flipper_current++;
		if (flipper_current>flipper_count)
		{
			flipper_current=1;
		}
	}

	if (str!="left"&&str!="right"&&str<=flipper_count&&str>=1)
	{
		flipper_current=str;
	}

	obj=id("flipper_content"+flipper_current);
	obj1=id("box1");
	obj1.innerHTML=obj.innerHTML;
}


// top10 flip
function top10(idx)
{
	var obj1=id("top10_1");
	var obj2=id("top10_2");
	var obj3=id("top10_3");	
	var act="close";

	if ((idx==1&&top10_menu1==false)||(idx==2&&top10_menu2==false)||(idx==3&&top10_menu3==false))
	{
		act="open";
	}

	if (act=="open"&&idx==1)
	{
		obj1.style.height="";
		obj2.style.height="33px";
		obj3.style.height="";
		top10_menu1=true;
		top10_menu2=false;
		top10_menu3=true;
		id("top10_title1").style.backgroundPosition="0 0";
		id("top10_title2").style.backgroundPosition="0 -43px";
		id("top10_title3").style.backgroundPosition="0 0";

	}

	if (act=="open"&&idx==2)
	{
		obj1.style.height="";
		obj2.style.height="";
		obj3.style.height="33px";
		top10_menu1=true;
		top10_menu2=true;
		top10_menu3=false;
		id("top10_title1").style.backgroundPosition="0 0";
		id("top10_title2").style.backgroundPosition="0 0";
		id("top10_title3").style.backgroundPosition="0 -43px";
	}


	if (act=="open"&&idx==3)
	{
		obj1.style.height="";
		obj2.style.height="33px";
		obj3.style.height="";
		top10_menu1=true;
		top10_menu2=false;
		top10_menu3=true;
		id("top10_title1").style.backgroundPosition="0 0";
		id("top10_title2").style.backgroundPosition="0 -43px";
		id("top10_title3").style.backgroundPosition="0 0";
	}

	if (act=="close"&&idx==1)
	{
		obj1.style.height="33px";
		obj2.style.height="";
		obj3.style.height="";
		top10_menu1=false;
		top10_menu2=true;
		top10_menu3=true;
		id("top10_title1").style.backgroundPosition="0 -43px";
		id("top10_title2").style.backgroundPosition="0 0";
		id("top10_title3").style.backgroundPosition="0 0";
	}

	if (act=="close"&&idx==2)
	{
		obj1.style.height="";
		obj2.style.height="33px";
		obj3.style.height="";
		top10_menu1=true;
		top10_menu2=false;
		top10_menu3=true;
		id("top10_title1").style.backgroundPosition="0 0";
		id("top10_title2").style.backgroundPosition="0 -43px";
		id("top10_title3").style.backgroundPosition="0 0";
	}


	if (act=="close"&&idx==3)
	{
		obj1.style.height="";
		obj2.style.height="";
		obj3.style.height="33px";
		top10_menu1=true;
		top10_menu2=true;
		top10_menu3=false;
		id("top10_title1").style.backgroundPosition="0 0";
		id("top10_title2").style.backgroundPosition="0 0";
		id("top10_title3").style.backgroundPosition="0 -43px";
	}
}
