var gb_msgBox_locale = {'alertMsg_title':'提示','alertMsg_close':'關閉','myBoxList_title':'馬上前往'};

function gb_msgBox()
{
	this.id_alertMsg = 'msg_alert';
	this.id_boxList = 'box_list';
	
	this._baseObj = function(){
						if(document.getElementById('container'))
							return document.getElementById('container');
						else
							return false;
					 };
	this.alertMsg = function(msg){								
							this.alertMsgClose();
							if(this.obj_base)
							{
								
								close_js = 'document.getElementById(\''+this.id_alertMsg+'\').style.visibility  = \'hidden\'';
								div_tag = 	'<h5 id="top">'+gb_msgBox_locale.alertMsg_title+'</h5>'+
											'<div id="body"><div class="content">'+msg+'<a href="javascript:;" onClick="'+close_js+'" class="close replace">'+gb_msgBox_locale.alertMsg_close+'</a></div></div>'+
											'<div id="bottom"></div>';
							
								cDiv = document.createElement('DIV');
								cDiv.id = this.id_alertMsg;
								cDiv.style.position = 'fixed';
								cDiv.innerHTML = div_tag;	
								this.obj_base.appendChild(cDiv);																
							}
							else
							{
								alert(msg);
							}
						};
	this.alertMsgClose = function(){							
								if(this.obj_base && document.getElementById(this.id_alertMsg))
								{
									remove = document.getElementById(this.id_alertMsg);
									this.obj_base.removeChild(remove);														
								}							
						};	
	this.myBoxList = function(){
							if(this.obj_base && document.getElementById(this.id_boxList))
								this.myBoxListClose();
							else
								this.myBoxListOpen();
							};	
	this.myBoxListOpen = function(){
								this.myBoxListClose();
								if(this.obj_base)
								{
									no = parseInt(Math.random() * 3) + 1;
									sideN = no > 1 ? 'side'+no : 'side';
									url = 'http://'+sideN+'.gogobox.com.tw:8040/app/n_my_fav_list.cgi';

									div_tag =  '<h5 id="top">'+gb_msgBox_locale.myBoxList_title+'</h5>'+
											   '<div id="body"><div class="content">'+
											   '<iframe src="'+url+'" width="200" height="150"  frameborder="0"></iframe>'+
											   '</div></div><div id="bottom"></div>';
									var cDiv = document.createElement('DIV');
									cDiv.id = this.id_boxList;
									cDiv.innerHTML = div_tag ;
									this.obj_base.appendChild(cDiv);
									
									cDiv.onmouseover = function(){
														cDiv.onmouseout = function(){
																			if(document.all)
																				document.body.onmousedown = function(){obj_msgBox = new gb_msgBox();obj_msgBox.myBoxListClose();};
																			else
																				window.onmousedown = function(){obj_msgBox = new gb_msgBox();obj_msgBox.myBoxListClose();};
																		};
														
														};
								}
						};
						
	this.myBoxListClose = function(){
								if(this.obj_base && document.getElementById(this.id_boxList))
								{
									remove = document.getElementById(this.id_boxList);
									this.obj_base.removeChild(remove);
									if(document.all)
										document.body.onmousedown  = null;
									else
										window.onmousedown  = null;
								}
						};
						
					
	this.obj_base = this._baseObj();
}