MaJiG_BOX=function(HTML)
{this.content=document.createElement('div');this.canvas=document.createElement('div');this.majig_box=document.createElement('div');this.majig_box_controls=document.createElement('div');this.majig_box_controls_close=document.createElement('img');this.content_HTML=HTML;this._set_Content=function(HTML)
{this.content_HTML=(HTML)?HTML:this.content_HTML;this.content.innerHTML=this.content_HTML;this._create_Canvas();this._create_majig_box();}

this._get_browser=function()
{switch(true)
{case(navigator.appName.indexOf("Netscape")!=-1):this.browser=1;break;case(navigator.appName.indexOf("Microsoft")!=-1):this.browser=2;break;default:this.browser=3;break;}}
this._getPageScroll=function()
{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;}
this.window_yScroll=yScroll;}
this._get_window_size=function()
{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){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
var windowWidth,windowHeight;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;}
if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
if(xScroll<windowWidth){pageWidth=windowWidth;}else{pageWidth=xScroll;}
this.window_width=windowWidth;this.page_width=pageWidth;this.window_height=windowHeight;this.page_height=pageHeight;}
this._create_Canvas=function()
{try
{this._get_browser();this._get_window_size();this.canvas.id="MaJiG_BOX_canvas";this.canvas.style.position="absolute";this.canvas.style.top="0px";this.canvas.style.left="0px";this.canvas.style.backgroundColor="#000000";this.canvas.style.zIndex="997";this.canvas.style.width=this.window_width+"px";this.canvas.style.height=this.page_height+"px";this.canvas.onclick=this._close;switch(this.browser)
{case 1:this.canvas.style.MozOpacity=.6;this.canvas.style.opacity=.6;break;case 2:this.canvas.style.filter="alpha(opacity=60);";break;default:this.canvas.style.opacity=.6;break;}
_frame_tools_frame_tool_hide_window_controls();document.getElementsByTagName("body").item(0).appendChild(this.canvas);}
catch(e)
{alert("file : "+e.fileName+" <br >on line :"+e.lineNumber+"<br>"+e.message);}}
this._resize_check=function()
{this._get_browser();this._get_window_size();this._getPageScroll();if(((this.window_height/2)-(this.majig_box.offsetHeight/2))+this.window_yScroll<0){this.majig_box.style.top="0px";}
this.canvas.style.width=this.window_width+"px";this.canvas.style.height=this.page_height+"px";}
this._create_majig_box=function()
{this._get_browser();this._get_window_size();this._getPageScroll();this.majig_box_controls.style.position="absolute";this.majig_box_controls.id="MaJiG_BOX_Controls";this.majig_box_controls.style.zIndex="998";this.majig_box_controls.style.top="2px";this.majig_box_controls.style.right="2px";this.majig_box_controls_close.src=MUFFIN_SHARED_URL+"images/_lib/frame_box/close.png";this.majig_box_controls_close.onclick=this._close;this.majig_box_controls_close.style.cursor="hand";this.majig_box_controls.appendChild(this.majig_box_controls_close);this.majig_box.id="MaJiG_BOX";this.majig_box.style.zIndex="1000";this.majig_box.appendChild(this.majig_box_controls);this.majig_box.appendChild(this.content);this.majig_box.style.position="absolute";this.majig_box.style.border="solid 2px #333333";this.majig_box.style.paddingTop="12px";this.majig_box.style.paddingBottom="5px";this.majig_box.style.paddingLeft="5px";this.majig_box.style.paddingRight="5px";this.majig_box.style.backgroundColor="#ffffff";document.getElementsByTagName("body").item(0).appendChild(this.majig_box);
//if(BrowserDetect.browser == "Explorer" && BrowserDetect.version == "9"){
//    this.majig_box.style.left=(this.window_width/2)-(this.majig_box.offsetWidth/2)+"px";
//    this.majig_box.style.top=((this.window_height/2)-(this.majig_box.offsetHeight/2))+this.window_yScroll+"px";this._resize_check();
//}else{
    this.majig_box.style.left=(this.window_width/2)-(this.majig_box.offsetWidth/2)+"px";
    this.majig_box.style.top=((this.window_height/2)-(this.majig_box.offsetHeight/2))+this.window_yScroll+"px";this._resize_check();
//}
}
this._close=function()
{_frame_tools_remove_Node("MaJiG_BOX");_frame_tools_remove_Node("MaJiG_BOX_canvas");_frame_tools_show_window_controls();}
this._set_Content();}
_frame_tools_show_window_controls=function(tag)
{selects=document.getElementsByTagName("select");for(i=0;i!=selects.length;i++){selects[i].style.visibility="visible";}}
_frame_tools_frame_tool_hide_window_controls=function(tag)
{selects=document.getElementsByTagName("select");for(i=0;i!=selects.length;i++)
{if(selects[i].id!='title')
selects[i].style.visibility="hidden";}}
_frame_tools_remove_Node=function(id)
{document.getElementById(id).parentNode.removeChild(document.getElementById(id));}
var g_iMouseX=0;var g_iMouseY=0;var g_oTipHandle=null;function NewURLWindow(URL)
{if(screen.width)
{window.open(URL,"","width="+screen.width+",height="+screen.height+",toolbar=1,menubar=1,location=1,resizable=1,scrollbars=1");}
else
{window.open(URL);}}
function explodeArray(delimiter,item){tempArray=new Array(1);var Count=0;var tempString=new String(item);while(tempString.indexOf(delimiter)>0){tempArray[Count]=tempString.substr(0,tempString.indexOf(delimiter));tempString=tempString.substr(tempString.indexOf(delimiter)+1,tempString.length-tempString.indexOf(delimiter)+1);Count=Count+1}
tempArray[Count]=tempString;return tempArray;}
