
//flash player add by riana 2009.10.19

function playFlash(iWmode,iWidth,iHeight){
	var pic_width=489; 
	var pic_height=266;
	if(iWidth!=null)
	pic_width=iWidth;
	if(iHeight!=null)
	pic_height=iHeight;
	var button_pos=4;
	var stop_time=6000;
	var show_text=1; 
	var txtcolor="000000";
	var bgcolor="000000";
	var imag=new Array();
	var _link=new Array();
	var flink=new Array();
	var text=new Array();
	
	var textTop=new Array();
	var content=new Array();
	var textNote=new Array();
	
	var flashUrl = 'http://images.bbgsite.com/www/images/flash_7.swf';
	

imag[1]="http://images.bbgsite.com/www/contest/07/pf_300x200.jpg";
_link[1]="http://forum.bbgsite.com/topics/502/201007/04/197,1.html";
flink[1]="1111111111";
text[1]="My Summer in Pet Forest! ";
textTop[1]="My Summer in Pet Forest!";
content[1]="To thank all Pet Forest players and BBG site users that are interested in Pet Forest, PlayOMG has joined hands with BBG Site to hold this Pet Forest screenshot contest!";
textNote[1]=" ";

imag[2]="http://images.bbgsite.com/www/contest/lord_300x200.jpg";
_link[2]="http://contest.bbgsite.com/giveaway/lord_of_ultima/";
flink[2]="1111111111";
text[2]="Lord of Ultima Gift Package Activation Code Giveaway Phase 2 ";
textTop[2]="Lord of Ultima Gift Package Activation Code Giveaway Phase 2";
content[2]="EA is giving away purse of 100 diamonds, which can be used to get special items and to enjoy your first Lord of Ultima game experience. So start the game now, redeem the key received from BBGsite and enjoy!";
textNote[2]=" ";

imag[4]="http://images.bbgsite.com/www/contest/ming_300x200.jpg ";
_link[4]="http://contest.bbgsite.com/giveaway/ming_dynasty/";
flink[4]="1111111111";
text[4]="Ming Dynasty Gift Package Code Giveaway ";
textTop[4]="Ming Dynasty Gift Package Code Giveaway ";
content[4]="China Ming Dynasty is the hottest webgame in 2010, a perfect combination of RPG, strategy, adventure and various modes. Based on history of the Ming Dynasty, the entire game features vintage... ";
textNote[4]=" ";

imag[3]="http://images.bbgsite.com/www/flash/kingory3_300x200.jpg";
_link[3]="http://contest.bbgsite.com/giveaway/kingory3/";
flink[3]="1111111111";
text[3]="Kingory's Facebook APP version $88.88 Gift Key Giveaway";
textTop[3]="Kingory's Facebook APP version $88.88 Gift Key Giveaway";
content[3]="To celebrate the grand launch of Kingory’s Facebook APP version, BBGsite and Kingory (http://apps.facebook.com/official-kingory) are proud to announce a fantastic new event for anyone who enjoys a game...";
textNote[3]=" ";






	var swf_height=show_text==1?pic_height+0:pic_height;
	var pics="", _links="", texts="" , tops="", contents="", notes="",links="";
	//alert(imag.length);
	for(var i=1; i<imag.length; i++){
		pics=pics+("|"+imag[i]);
		_links=_links+("|"+_link[i]);
		links=links+("|"+flink[i]);
		texts=texts+("|"+text[i]);
		tops = tops+("|"+textTop[i]);
		contents = contents+("|"+content[i]);
		notes = notes+("|"+textNote[i]);
	}
	pics=pics.substring(1);
	_links=_links.substring(1);
	links=links.substring(1);
	texts=texts.substring(1);
	tops=tops.substring(1);
	contents=contents.substring(1);
	notes=notes.substring(1);
	
	
	
	var flash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ pic_width +'" height="' + pic_height +'" />';
	flash = flash + '<param name="wmode" value="transparent">'; 
	flash = flash + '<param name="movie" value="'+ flashUrl +'" />';
	flash = flash + '<param name="quality" value="high" />';
	flash = flash + '<param name="menu" value="false" />';
	flash = flash + '<param name="FlashVars" value="pics='+pics+'&links='+_links+'&texts='+texts+'&tops='+tops+'&contents='+contents+'&notes='+notes+'&pic_width='+pic_width+'&pic_height='+pic_height+'&show_text='+show_text+'&txtcolor='+txtcolor+'&bgcolor='+bgcolor+'&button_pos='+button_pos+'&stop_time='+stop_time+'">';
	flash = flash + '<embed wmode="transparent" src="' + flashUrl + '" FlashVars="pics='+pics+'&links='+_links+'&texts='+texts+'&tops='+tops+'&contents='+contents+'&notes='+notes+'&pic_width='+pic_width+'&pic_height='+pic_height+'&show_text='+show_text+'&txtcolor='+txtcolor+'&bgcolor='+bgcolor+'&button_pos='+button_pos+'&stop_time='+stop_time+'" quality="high" width="'+ pic_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
    flash = flash + '</object>';
	document.writeln(flash); 
	
	//alert(flinks);
}

//add by riana 09.08.03
function myOver(obj){
		obj.getElementsByTagName('div')[0].style.display='block';
		obj.className='on';
	}
function myOut(obj){
		obj.getElementsByTagName('div')[0].style.display='none';
		obj.className='';
	}
	


//�����
function openLayer(objId,conId){
var arrayPageSize   = getPageSize();//����getPageSize()����
var arrayPageScroll = getPageScroll();//����getPageScroll()����
if (!document.getElementById("popupAddr")){
//�����������ݲ�
var popupDiv = document.createElement("div");
//�����Ԫ��������������ʽ
popupDiv.setAttribute("id","popupAddr")
popupDiv.style.position = "absolute";
popupDiv.style.zIndex = 9999;
//�����������
var bodyBack = document.createElement("div");
bodyBack.setAttribute("id","bodybg")
bodyBack.style.position = "absolute";
bodyBack.style.width = "100%";
bodyBack.style.height = (arrayPageSize[1] + 35 + 'px');
bodyBack.style.zIndex = 98;
bodyBack.style.top = 0;
bodyBack.style.left = 0;
bodyBack.style.filter = "alpha(opacity=70)";
bodyBack.style.opacity = 0.7;
bodyBack.style.background = "#000";
//ʵ�ֵ���(���뵽Ŀ��Ԫ��֮��)
var mybody = document.getElementById(objId);
insertAfter(popupDiv,mybody);//ִ�к���insertAfter()
insertAfter(bodyBack,mybody);//ִ�к���insertAfter()
}
//��ʾ������
document.getElementById("bodybg").style.display = "";
//��ʾ���ݲ�
var popObj=document.getElementById("popupAddr")
popObj.innerHTML = document.getElementById(conId).innerHTML;
popObj.style.display = "";

//�õ������ҳ���д�ֱ���Ҿ���(ͳһ)
// popObj.style.width  = "600px";
// popObj.style.height = "400px";
// popObj.style.top  = arrayPageScroll[1] + (arrayPageSize[3] - 35 - 400) / 2 + 'px';
// popObj.style.left = (arrayPageSize[0] - 20 - 600) / 2 + 'px';
//�õ������ҳ���д�ֱ���Ҿ���(����)
var arrayConSize=getConSize(conId)
popObj.style.top  = arrayPageScroll[1] + (arrayPageSize[3] - arrayConSize[1]) / 2-50 + 'px';
popObj.style.left = (arrayPageSize[0] - arrayConSize[0]) / 2 -30 + 'px';
}
//��ȡ���ݲ�����ԭʼ�ߴ�
function getConSize(conId){
var conObj=document.getElementById(conId)
conObj.style.position = "absolute";
conObj.style.left=-1000+"px";
conObj.style.display="";
var arrayConSize=[conObj.offsetWidth,conObj.offsetHeight]
conObj.style.display="none";
return arrayConSize;
}
function insertAfter(newElement,targetElement){//����
var parent = targetElement.parentNode;
if(parent.lastChild == targetElement){
parent.appendChild(newElement);
}
else{
parent.insertBefore(newElement,targetElement.nextSibling);
}
}
//��ȡ����ĸ߶�
function getPageScroll(){
var yScroll;
if (self.pageYOffset) {
yScroll = self.pageYOffset;
} else if (document.documentElement  &&  document.documentElement.scrollTop){
yScroll = document.documentElement.scrollTop;
} else if (document.body) {
yScroll = document.body.scrollTop;
}
arrayPageScroll = new Array('',yScroll)
return arrayPageScroll;
}
//��ȡҳ��ʵ�ʴ�С
function getPageSize(){
var xScroll,yScroll;
if (window.innerHeight  &&  window.scrollMaxY){
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){
sScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else {
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth,windowHeight;
//var pageHeight,pageWidth;
if (self.innerHeight) {
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
} else if (document.documentElement  &&  document.documentElement.clientHeight) {
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) {
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
var pageWidth,pageHeight
if(yScroll < windowHeight){
pageHeight = windowHeight;
} else {
pageHeight = yScroll;
}
if(xScroll < windowWidth) {
pageWidth = windowWidth;
} else {
pageWidth = xScroll;
}
arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;
}
//�رյ����
function closeLayer(){
document.getElementById("popupAddr").style.display = "none";
document.getElementById("bodybg").style.display = "none";
return false;
}


/*change link*/
function setTab(m,n){
var tli=document.getElementById("popupAddr").getElementsByTagName("li");
var mli=document.getElementById("popupAddr").getElementsByTagName("ol");
for(i=0;i<tli.length;i++){

   try { mli[i].style.display= i==n?"block":"none";} catch(err) { }

   tli[i].className= i==n?'on':'none';
   
  
}
}

/**
 *Filename:      ue_tab.js
 *Version:       1.0.0(2009-03-02)
 *Website:       http://
 *Author:        S.S.L
 *Modify:        2009-07-17
**/

function ue_tab( tab_menu,tab_main,cur_tab,mouse,time ){
	var pre_no;
	var timer,autoplay_timer;
	var tab;
	
	function $( id ){ return document.getElementById( id );}
	
	function run( no ){
		if( no != null ){
			if( timer != null )clearInterval( timer );
			timer = setInterval( function(){
				doChange(no);
			},200 );
		}
	}
	
	function addEvent(){
		for( var i = 0; i < tab.length; i++ ){
			tab[i].cur_no = i;
			if( mouse == null ){
				tab[i].onclick = function(){ 
					run( this.cur_no );
					return false;
				}
			} else {
				tab[i].onmouseover = tab[i].onmouseout= function(){
					run( this.cur_no );
					return false;
				}
			}
		}
	}
	
	function doChange( k ){
		if( tab[pre_no] != null && $(tab_main+(pre_no+1)) != null ){
			tab[pre_no].className = "off";
			$(tab_main+(pre_no+1)).style.display = "none";
		}
		
		if( tab[k] != null && $(tab_main+(k+1)) != null ){
			tab[k].className = "on";
			$(tab_main+(k+1)).style.display = "block";
		}
		
		pre_no = k;
		
		if( timer != null )clearInterval( timer );
	}
	
	function autoplay(){
		if( pre_no < tab.length ){
			doChange( pre_no+1 );
		} else {
			pre_no = tab.length-1;
			doChange( 0 );
		}
	}
	
	function init(){
		if( tab_menu == null || tab_main == null ) return;
		
		var tabs = tab_menu.split(" ");
		
		if( tabs[0] == null || tabs[1] == null || $( tabs[0] ) == null ) return;
		
		tab = $( tabs[0] ).getElementsByTagName( tabs[1] );

		pre_no = ( cur_tab == null ) ? 0:(cur_tab-1);
		
		doChange( pre_no );
		addEvent();
		
		if( time != null && time > 0 )
			autoplay_timer = setInterval( autoplay,time );
	}
	
	init();

}



