isIE = document.all;
isNN = !document.all&&document.getElementById;
isN4 = document.layers;
isHot = false;
document.onmousedown = ddInit;
document.onmouseup = Function("ddEnabled=false");
function ddInit(e) {
topDog = isIE ? "BODY" : "HTML";
whichDog = isIE ? document.all.theLayer : document.getElementById("theLayer");
hotDog = isIE ? event.srcElement : e.target;
while(hotDog.id != "titleBar"&&hotDog.tagName != topDog) {
hotDog = isIE ? hotDog.parentElement : hotDog.parentNode;
}
if(hotDog.id == "titleBar") {
offsetx = isIE ? event.clientX : e.clientX;
offsety = isIE ? event.clientY : e.clientY;
nowX = parseInt(whichDog.style.left);
nowY = parseInt(whichDog.style.top);
ddEnabled = true;
document.onmousemove = dd;
}
}
function dd(e) {
if(!ddEnabled) return;
whichDog.style.left = isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx;
whichDog.style.top = isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
return false;
}
function mousePageXY(e) {
var x = 0, y = 0;
if(e.pageX || e.pageY) {
x = e.pageX;
y = e.pageY;
} else if (e.clientX || e.clientY) {
x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
}
return {"x":x, "y":y};
}
var win = {
winc:{},
wsdr:null,
scor:{},
openw:function(id, title, text, date, type, style) {
if($('#win_'+id).attr('id') == undefined) {
this.add(id, title, text, date, type, 1, '');
}
},
WstartDrag:function(id) {
$('#wupbox').css({'display':'block', 'cursor':'move'});
this.wsdr = id;
$('.w1').css({'z-index':1102});
$('#win_'+id).css({'z-index':1103});
delete cm;
},
WmoveDrag:function(e) {
var x = mousePageXY(e)['x'], y = mousePageXY(e)['y'];
if(this.scor.x == undefined) {
this.scor.x = x;
this.scor.y = y;
this.scor.x2 = unpx($('#win_'+this.wsdr).css('left'));
this.scor.y2 = unpx($('#win_'+this.wsdr).css('top'));
}
x = x-this.scor.x;
y = y-this.scor.y;
x += this.scor.x2;
y += this.scor.y2;
if(x < 9) { x = 9; }
if(x + $('#win_'+this.wsdr).width() > $(window).width() - 9) {
x = $(window).width() - 9 - $('#win_'+this.wsdr).width();
}
if(y < 35) { y = 35; }
if(y + $('#win_'+this.wsdr).height() > $(window).height() - 35) {
y = $(window).height() - 35 - $('#win_'+this.wsdr).height();
}
$('#win_'+this.wsdr).css({'top':y+'px','left':x+'px'});
},
WstopDrag:function() {
$('#wupbox').css({'display':'none', 'cursor':'move'});
this.wsdr = null;
this.scor = {};
},
add:function(id, title, text, date, type, style, css) {
var nw = '';
if($('#win_'+id).attr('id') == undefined) {
var acts = {};
if(date.usewin != undefined){
acts[0] = 'onmouseup="'+date.usewin+'"';
}
if(date.n != undefined){
text += '
'+date.n+'
';
}
var kyps = ['', ''];
if(type == 0) {
nw = text;
} else if(type == 1) {
nw = text;
} else if(type == 2) {
nw = ''+text+'
';
kyps[0] = ''+date.a1+';win.closew(\\\''+id+'\\\');win.addaction(0,\\\'\\\');';
} else if(type == 3) {
nw = ''+text+' |
|
';
kyps[0] = ''+date.a1+';win.closew(\\\''+id+'\\\');win.addaction(0,\\\'\\\');';
} else if(type == 4) {
nw = text[0];
}
if(date.d != undefined) {
nw = nw+date.d;
}
nw = ''+nw+'
';
if(title != '') {
nw = ''+
'
'+
''+
''+title+' | '+
' | '+
'
'+
'
'+
'
'+nw;
}
nw = ''+
''+
' | '+
' | '+
' | '+
'
'+
''+
' | '+
''+nw+' | '+
' | '+
'
'+
''+
' | '+
' | '+
' | '+
'
'+
'
';
nw = ''+nw+'
';
$('#windows').html($('#windows').html()+nw);
$('#win_'+id).center();
if(type == 2 || type == 3) {
if(type == 2) {
$('#winyesbtnfox'+id).focus();
}
}
}
delete nw;
},
addaction:function(nm, vl) {
key_actions[nm] = vl;
if(nm != 2) {
key_actions[2] = 1;
}
},
closew:function(id) {
$('#win_'+id).html('');
$('#win_'+id).remove();
}
}
function hideMe() {
if (isIE||isNN) {
whichDog.style.visibility = "hidden";
} else if (isN4) {
document.theLayer.visibility = "hide";
}
}
function showForm(title, text, input_name, input_value, hidden_name, hidden_value, action) {
document.getElementById('ftitle').innerHTML = title;
document.getElementById('ftext').innerHTML = text;
document.getElementById('finput').name = input_name;
document.getElementById('finput').value = input_value;
document.getElementById('fhinput').name = hidden_name;
document.getElementById('fhinput').value = hidden_value;
if(action != ""){
document.getElementById('fuse').action = action;
}
whichDog.style.left = (document.body.clientWidth - 240)/2;
if(isIE||isNN) {
whichDog.style.visibility = "visible";
} else if (isN4) {
document.theLayer.visibility = "show";
}
document.getElementById('finput').focus();
}