var zIndexMax=6;
var popupWindowColl=new Array();
function _C(tag,id){
var v=document.createElement(tag);
v.id=id;
return v;
}
function getzIndexMax(){
return zIndexMax;
}
function setzIndexMax(value){
zIndexMax=value;
}
function newxWin(width,height,left,top,title,content,frame_id,isParentWindow,zIndex,isShowShadow,isFlashShow,xPosition,yPosition){
this.cL=0;
this.cT=0;
this.cW=0;
this.cH=0;
this.isShow=0;
this.sL=0;
this.sT=0;
this.sW=0;
this.sH=0;
this.isParent=isParentWindow;
this.isFlashShow=isNaN(isFlashShow)?true:isFlashShow;
this.isShowShadow=isShowShadow;
if(isParentWindow=="true"&&!isNaN(top)){
top=window.parent.document.body.scrollTop+top;
}else if(!isNaN(top)){
top=document.body.scrollTop+top;
}
this.xBeginPosition=isNaN(xPosition)?0:parseInt(xPosition);
this.yBeginPosition=isNaN(yPosition)?0:parseInt(yPosition);
this._isFix=isNaN(xPosition)?false:true;
this.width=isNaN(width)?642:parseInt(width);
this.height=isNaN(height)?400:parseInt(height);
this.left=isNaN(left)?150:parseInt(left);
this.top=isNaN(top)?100:parseInt(top);
this.title=title?title:"×Ö µä";
this.zIndex=isNaN(zIndex)?2:parseInt(zIndex);
this.content="";
this._isshow=true;
if(frame_id){
  this.frame_id= frame_id;
}else {
    this.frame_id = 1 ;
}
this.cl_win_Shadow="#CACFD7";
this.frameHtml='<iframe src="'+this.content+'" id="innerFrame'+this.frame_id+'" style="width:100%; height:100%;" frameBorder=0></iframe>';
return this.build();
}
newxWin.prototype={
_canmove:false,
_fix:this._isFix,
_state:"default",
_maxwidth:0,
_maxheight:0,
_x0:0,
_y0:0,
_x1:0,
_y1:0,
backgroundimg:"/newjxhd/smmail/images/sysimg/top.gif",
global:window.document,
parentGlobal:window.parent.document,
title:this.title,
checkIExWin:function(){
if(window.navigator.userAgent.indexOf("MSIE")>=1){
return"IE";
}else if(window.navigator.userAgent.indexOf("Firefox")>=1){
return"MOZILLA";
}else{
return"MOZILLA";
}
},
setCurrentSize:function(){
if(this.checkIExWin()=="IE"){
this.xWin.style.border="2px groove #94999A";
this.xWin.style.width=this.width;
this.xWin.style.height=this.height;
}else{
this.xWin.style.border="1px solid #6A908C";
this.xWin.style.width=this.width-4;
this.xWin.style.height=this.height-4;
}
this.xWin.style.left=this.left;
this.xWin.style.top=this.top;
this.xShadow.style.width=this.width;
this.xShadow.style.height=this.height;
this.xShadow.style.left=this.left+5;
this.xShadow.style.top=this.top+5;
this.client.style.width=this.width-6;
this.client.style.height=this.height-28-6;
this.titlebar.style.width=this.width-4;
this.img.style.width=this.width-4;
this.titlecontent.style.width=this.width-4;
if(this.isParent=="true"){
}else{
this.iframebody.style.width=this.width-6;
this.iframebody.style.height=this.height-28-6;
this.iframebody.style.width=this.width-6;
this.iframebody.style.height=this.height-28-6;
}
},
setxDivSize:function(){
this.cL=parseInt(this.xWin.style.left.replace("px",""));
this.cT=parseInt(this.xWin.style.top.replace("px",""));
this.cW=parseInt(this.xWin.style.width.replace("px",""));
this.cH=parseInt(this.xWin.style.height.replace("px",""));
},
setxDivZero:function(){
this.cL=document.body.scrollLeft+this.xBeginPosition;
this.cT=document.body.scrollTop+this.yBeginPosition;
this.cW=0;
this.cH=0;
},
setxDivGoup:function(){
this.sL=parseInt((this.xWin.style.left.replace("px","")-document.body.scrollLeft-this.xBeginPosition)/20);
this.sT=parseInt((this.xWin.style.top.replace("px","")-document.body.scrollTop-this.yBeginPosition)/20);
this.sW=parseInt(this.xWin.style.width.replace("px","")/20);
this.sH=parseInt(this.xWin.style.height.replace("px","")/20);
},
show:function(){
if(this._isshow==true){
}else{
try{
this.setCurrentSize();
this._fix=false;
this._isshow=true;
this._state="default";
this.xDiv.style.display="";
this.setxDivZero();
this.setxDivGoup();
if(this.isFlashShow){this.extend(1);}else{
this.xWin.style.visibility="";
}
}catch(E){
alert(E);
}
}
},
close:function(){
if(this.isParent=="true"){
this.xWin.style.visibility="hidden";
this.xShadow.style.visibility="hidden";
this._isshow=false;
this.content="";
}else{
this.xWin.style.visibility="hidden";
this.xShadow.style.visibility="hidden";
this._isshow=false;
this.content="";
}
this.setxDivGoup();
this.xDiv.style.display="";
this.isShow=0;
if(this.isFlashShow){this.extend(-1);}
try{
if(historyxWin){
if(historyxWin.style.left==this.xWin.style.left){
historyxWin.style.display="none";
}
}
if(this.frame_id) {
if(document.getElementById("MESSAGE_"+this.frame_id)){
document.getElementById("MESSAGE_"+this.frame_id).innerHTML = "" ;
}
if(window.frames("innerFrame"+this.frame_id)){
    this.iframebody.src = "" ;
    //alert(window.frames("innerFrame"+this.frame_id).document.body.innerHTML);
    //window.frames("innerFrame"+this.frame_id).document.body.innerHTML = "" ;
}
this.client.innerHTML= "" ;//Çå¿Õframe
}
if(this.frame_id=="main") {
if(document.getElementById("ContentDivForAlbum")){
document.getElementById("ContentDivForAlbum").innerHTML = "" ;
}
}
}
catch(e){
return;
}
return;
},
max:function(){
if(this.isParent=="true"){
documentObj=window.parent.document;
return false;
}else{
documentObj=window.document;
}
if(this._state=="default"){
this._maxwidth=documentObj.body.clientWidth;
this._maxheight=documentObj.body.clientHeight;
if(this.checkIExWin()=="IE"){
this.xWin.style.width=this._maxwidth;
this.xWin.style.height=this._maxheight;
}else{
this.xWin.style.width=this._maxwidth-4;
this.xWin.style.height=this._maxheight-4;
}
this.xWin.style.left=0;
this.xWin.style.top=0;
this.titlebar.style.width=this._maxwidth-4;
this.img.style.width=this._maxwidth-4;
this.titlecontent.style.width=this._maxwidth-4;
this.iframebody.style.width=this._maxwidth-6;
this.iframebody.style.height=this._maxheight-28-6;
this._fix=true;
this._state="max";
}
else if(this._state=="max"){
if(this.checkIExWin()=="IE"){
this.xWin.style.width=this.width;
this.xWin.style.height=this.height;
}else{
this.xWin.style.width=this.width-4;
this.xWin.style.height=this.height-4;
}
this.xWin.style.left=this.left;
this.xWin.style.top=this.top;
this.xShadow.style.left=this.left+5;
this.xShadow.style.top=this.top+5;
this.titlebar.style.width=this.width-4;
this.img.style.width=this.width-4;
this.titlecontent.style.width=this.width-4;
this.iframebody.style.width=this.width-6;
this.iframebody.style.height=this.height-28-6;
this._fix=false;
this._state="default";
}
},
build:function(){
if(this.isParent=="true"){
documentObj=window.parent.document;
}else{
documentObj=window.document;
}
var xDiv=documentObj.createElement("DIV");
this.xDiv=xDiv;
with(xDiv.style){
position="absolute";
border="1px solid #000000";
overflow="hidden";
}
if(this.isParent=="true"){
this.parentGlobal.body.appendChild(xDiv);
}else{
this.global.body.appendChild(xDiv);
}
var xWin=documentObj.createElement("DIV");
this.xWin=xWin;
with(xWin.style){
if(this.checkIExWin()=="IE"){
border="2px groove #94999A";
width=this.width;
height=this.height;
}else{
border="1px solid #6A908C";
width=this.width-4;
height=this.height-4;
}
top=this.top;
left=this.left;
background="#F3F3F3";
position="absolute";
zIndex=this.zIndex;
}
if(this.isParent=="true"){
this.parentGlobal.body.appendChild(xWin);
}else{
this.global.body.appendChild(xWin);
}
var titlebar=documentObj.createElement("DIV");
this.titlebar=titlebar;
with(titlebar.style){
position="absolute";
width=this.width-4;
height=28;
zIndex=this.zIndex;
left=0;
top=0;
}
xWin.appendChild(titlebar);
var img=documentObj.createElement("img");
this.img=img;
with(img){
src=this.backgroundimg;
}
with(img.style){
width=this.width-4;
height=28;
}
titlebar.appendChild(img);
var titlecontent=documentObj.createElement("DIV");
this.titlecontent=titlecontent;
with(titlecontent.style){
position="absolute";
width=this.width-4;
height=28;
zIndex=this.zIndex+2;
left=0;
top=0;
}
titlebar.appendChild(titlecontent);
var titletable=documentObj.createElement("TABLE");
with(titletable){
cellspacing=0;
cellpadding=0;
}
with(titletable.style){
width="100%";
height="100%";
border="0px groove red";
}
var tbody=documentObj.createElement("TBODY");
with(tbody){
width="100%";
height="100%";
}
titletable.insertBefore(tbody,null);
var titletr=documentObj.createElement("tr");
this.titletr=titletr;
var col01=documentObj.createElement("td");
with(col01.style){
width=5;
}
titletr.insertBefore(col01,null);
var col03=documentObj.createElement("td");
this.col03=col03;
with(col03.style){
color="#FFFFFF";
fontSize="12px";
fontFamily="ËÎÌå";
cursor="default";
}
col03.innerHTML=this.title;
titletr.appendChild(col03);
var col04=documentObj.createElement("td");
with(col04.style){
width=16;
}
var tdimgmin=documentObj.createElement("img");
tdimgmin.src="/newjxhd/smmail/images/sysimg/min.gif";
with(tdimgmin.style){
width=15;
height=15;
position="relative";
top=-3;
border=0;
display="none";
}
col04.appendChild(tdimgmin);
titletr.appendChild(col04);
var col05=documentObj.createElement("td");
with(col05.style){
width=16;
}
var tdimgmax=documentObj.createElement("img");
this.tdimgmax=tdimgmax;
tdimgmax.src="/newjxhd/smmail/images/sysimg/max.gif";
with(tdimgmax.style){
width=15;
height=15;
position="relative";
top=-3;
border=0;
display="none";
}
col05.appendChild(tdimgmax);
titletr.appendChild(col05);
var col06=documentObj.createElement("td");
with(col06.style){
width=16;
}
var tdimgclose=documentObj.createElement("img");
this.tdimgclose=tdimgclose;
tdimgclose.src="/newjxhd/smmail/images/sysimg/close.gif";
with(tdimgclose.style){
width=32;
height=15;
position="relative";
top=-3;
border=0;
}
col06.appendChild(tdimgclose);
titletr.appendChild(col06);
tbody.appendChild(titletr);
titlecontent.appendChild(titletable);
client=documentObj.createElement("DIV");
this.client=client;
this.align="center";
with(client.style){
width=this.width-6;
height=this.height-28-6;
top=28;
left=1;
position="absolute";
border="0px groove red";
overflow="auto";
}
xWin.appendChild(client);
if(this.isParent=="true"){
client.innerHTML=this.content;
}else{
client.innerHTML=this.frameHtml;
iframebody=documentObj.getElementById("innerFrame"+this.frame_id);
this.iframebody=iframebody;
with(iframebody.style){
width=this.width-6;
height=this.height-28-6;
top=28;
left=1;
}
}
var xShadow=documentObj.createElement("DIV");
this.xShadow=xShadow;
with(xShadow.style){
zIndex=this.zIndex-1;
position="absolute";
width=this.width;
height=this.height;
left=this.left+5;
top=this.top+5;
background=this.cl_win_Shadow;
display="none";
}
if(this.isParent=="true"){
this.parentGlobal.body.appendChild(xShadow);
}else{
this.global.body.appendChild(xShadow);
}
var oThis=this;
tdimgclose.onmouseover=function(){
tdimgclose.src="/newjxhd/smmail/images/sysimg/close_mouseover.gif";
};
tdimgclose.onmouseout=function(){
tdimgclose.src="/newjxhd/smmail/images/sysimg/close.gif";
};
tdimgmax.onclick=function(){
oThis.max();
};
tdimgmax.onmouseover=function(){
tdimgmax.src="/newjxhd/smmail/images/sysimg/max_mouseover.gif";
};
tdimgmax.onmouseout=function(){
tdimgmax.src="/newjxhd/smmail/images/sysimg/max.gif";
};
titlebar.onmousedown=function(event){
oThis.startDrag(event,titlebar);
};
titlebar.onmousemove=function(event){
oThis.drag(event);
};
titlebar.onmouseup=function(event){
oThis.stopDrag(event,titlebar);
};
titlebar.ondblclick=function(){
};
tdimgclose.onmousedown=function(){
event.cancelBubble = true ;
 return false;
};
tdimgclose.onmouseup=function(){
event.cancelBubble = true ;
 return false;
};
tdimgclose.onclick=function(){
//event.cancelBubble = true ;
oThis.close();
};
titlebar.onclick=function(){
oThis.setFocus(getzIndexMax());
};
client.onclick=function(){
oThis.setFocus(getzIndexMax());
};
},
startDrag:function(event,obj){
this._fix=this._isFix;
var scrollTop=0;
var scrollLeft=0;
if(this.isParent=="true"){
var oEvent=window.parent.event?window.parent.event:event;
scrollTop=window.parent.document.body.scrollTop;
scrollLeft=window.parent.document.body.scrollLeft;
}else{
documentObj=window.document;
var oEvent=window.event?window.event:event;
scrollTop=document.body.scrollTop;
scrollLeft=document.body.scrollLeft;
}
if(this._fix==false){
obj.setCapture?obj.setCapture():function(){
};
this._x0=oEvent.clientX;
this._y0=oEvent.clientY;
this._x1=parseInt(this.xWin.style.left);
this._y1=parseInt(this.xWin.style.top);
this._canmove=true;
}else{
}
},
drag:function(event){
if(this.isParent=="true"){
documentObj=window.parent.document;
var oEvent=window.parent.event?window.parent.event:event;
}else{
documentObj=window.document;
var oEvent=window.event?window.event:event;
}
if(this._canmove==true){
var x=this._x1+oEvent.clientX-this._x0;
var y=this._y1+oEvent.clientY-this._y0;
x=x<5?5:x;
y=y<5?5:y;
if(this.checkIExWin()=="IE"){
x=x>documentObj.body.offsetWidth-this.width-30?documentObj.body.offsetWidth-this.width-30:x;
}
try{
if (historyxWin) {     //ÎÞÐè
if (historyxWin.style.left == this.xWin.style.left) {
historyxWin.style.left = x ;
historyxWin.style.top = y + this.height ;
}
}
}catch(e){}
this.xWin.style.left=x;
this.xWin.style.top=y;
this.xShadow.style.left=x+5;
this.xShadow.style.top=y+5;

}
},
stopDrag:function(event,obj){
if(this._fix==false){
obj.releaseCapture?obj.releaseCapture():function(){
};
this._canmove=false;
this.setxDivSize();
}
},
getisShow:function(){
return this._isshow;
},
getLeftPosition:function(){
var l=this.xWin.style.left;
return l.replace("px","");
},
getTopPosition:function(){
var t=this.xWin.style.top;
return t.replace("px","");
},
setPosition:function(leftnew,topnew){
var scrollTop=0;
if(this.isParent=="true"){
scrollTop=window.parent.document.body.scrollTop;
}else{
scrollTop=document.body.scrollTop;
}
this.xWin.style.left=parseInt(leftnew);
this.xWin.style.top=scrollTop+parseInt(topnew);
this.left=parseInt(leftnew);
this.top=scrollTop+parseInt(topnew);
this.xDiv.style.display="none";
},
setSize:function(widthnew,heightnew){
this.width=widthnew;
this.height=heightnew;
this.setCurrentSize();
this.setxDivSize();
},
setBeginPosition:function(x,y){
this.xBeginPosition=x;
this.yBeginPosition=y;
this.setCurrentSize();
this.setxDivSize();
},
getFrameId:function(){
return"innerFrame"+this.frame_id;
},
getzIndex:function(){
return this.xWin.style.zIndex;
},
setzIndex:function(zIndexNum){
this.xWin.style.zIndex=zIndexNum;
this.xShadow.style.zIndex=zIndexNum-1;
},
setFocus:function(zIndexNum){
this.setzIndex(zIndexNum+2);
setzIndexMax(zIndexNum+2);
},
setTitle:function(sTitle,bText){
this.title=sTitle;
this.col03.innerHTML=sTitle;
},
setClientByObject:function(obj){
this.client.innerHTML="";
this.client.appendChild(obj);
},
setContentStr:function(str,leftPadding,topPadding){
if(!leftPadding){leftPadding="10px";}
if(!topPadding){topPadding="10px";}
this.client.style.paddingTop=topPadding;
this.client.style.paddingLeft=leftPadding;
this.client.innerHTML=str;
},
setcontent:function(obj){
if(this.isParent=="true"){
documentObj=window.parent.document;
this.client.innerHTML=obj;
}else{
documentObj=window.document;
}
try{
this.client.innerHTML=this.frameHtml;
iframebody=documentObj.getElementById("innerFrame"+this.frame_id);
this.iframebody=iframebody;
try{iframebody.src=obj;}catch(e){}
with(iframebody.style){
width=this.width-6;
height=this.height-28-6;
top=28;
left=1;
}
if(this._isshow==false){
}
}catch(E){
}
},
free:function(){
with(this){
tdimgclose.onmouseup =null;
tdimgclose.onmousedown=null;
tdimgclose.onmouseover=null;
tdimgclose.onmouseout=null;
tdimgmax.onclick=null;
tdimgmax.onmouseover=null;
tdimgmax.onmouseout=null;
titlebar.onmousedown=null;
titlebar.onmousemove=null;
titlebar.onmouseup=null;
titlebar.ondblclick=null;
titlebar.onclick=null;
client.onclick=null;
tdimgclose.onclick=null;
titletr=null;
width=null;
height=null;
left=null;
top=null;
xWin=null;
col03=null;
xShadow=null;
}
},
extend:function(fg){
if(this.isShow==1){
return;
}
try{
with(this){
cL+=sL*fg;
cT+=sT*fg;
cW+=sW*fg;
cH+=sH*fg;
}
with(this.xDiv.style){
if(this.cL>=this.xBeginPosition&&this.cT>=this.yBeginPosition&&this.cW>=0&&this.cH>=0){
left=this.cL+"px";
top=this.cT+"px";
width=this.cW+"px";
height=this.cH+"px";
}
}
if(fg>0){
var xWinWidth=this.xWin.style.width.replace("px","");
if(this.cW<xWinWidth){
try{
var oThis=this;
setTimeout(function(){oThis.extend(10)},5);
}catch(e){
alert(e);
}
}else{
this.isShow=1;
this.xDiv.style.display="none";
this.xWin.style.visibility="";
if(this.isShowShadow==true){
this.xShadow.style.display="";
}else{
this.xShadow.style.display="none";
}
return true;
}
}else{
if(this.cL>this.xBeginPosition||this.cW>0){try{var oThis=this;setTimeout(function(){oThis.extend(-10)},5);}catch(e){alert(e);}}else{
this.xDiv.style.display="none";
this.setxDivZero();
}
}
}catch(e){
alert(e);
return true;
}
}
}
function do_close_xwin(obj){
if(obj){
obj.close();
}else{
mywin_main.close();
}
}
