function open_error_win(error_msg) {
var my_win = window.open("","error_win","width=500px,height=200px,resizable=no,scrollbars=no");
my_win.moveTo(screen.width/2-250,screen.height/2-100);
my_win.document.open();
my_win.document.write("
Warning");
my_win.document.write("");
my_win.document.write("");
my_win.document.write("");
my_win.document.write("");
my_win.document.write(" Warning ! ");
my_win.document.write(error_msg);
my_win.document.write(" ");
my_win.document.write("");
my_win.document.write(" |
");
my_win.document.write("");
my_win.document.close();
my_win.focus();
}
function clipp(obgname) {
value = document.getElementById(obgname).style.clip;
var res = value.match(/rect\((\d+)px[,]?[ ]+(\d+)px[,]?[ ]+(\d+)px[,]?[ ]+(\d+)px\)/i);
if (!res) return [0,100,100,0];
return [parseInt(res[1]), parseInt(res[2]), parseInt(res[3]), parseInt(res[4])];
}
var timerId=Array();
function toggle_floating(obgname,state,timer,width,height,cliptop,clipright,clipbottom,clipleft,clipstep) {
clipar = clipp(obgname);
cur_cliptop = clipar[0];
cur_clipleft = clipar[3];
cur_clipbottom = clipar[2];
cur_clipright = clipar[1];
if(state==1) {
if(cur_cliptop > 0) {
cur_cliptop=cur_cliptop-clipstep;
if(cur_cliptop < 0) cur_cliptop=0;
}
if(cur_clipleft > 0) {
cur_clipleft=cur_clipleft-clipstep;
if(cur_clipleft < 0) cur_clipleft=0;
}
if(cur_clipbottom < height) {
cur_clipbottom=cur_clipbottom+clipstep;
if(cur_clipbottom > height) cur_clipbottom=height;
}
if(cur_clipright < width) {
cur_clipright=cur_clipright+clipstep;
if(cur_clipright > width) cur_clipright=width;
}
} else {
if(cur_cliptop < cliptop) {
cur_cliptop=cur_cliptop+clipstep;
if(cur_cliptop > cliptop) cur_cliptop=cliptop;
}
if(cur_clipleft < clipleft) {
cur_clipleft=cur_clipleft+clipstep;
if(cur_clipleft > clipleft) cur_clipleft=clipleft;
}
if(cur_clipbottom > clipbottom) {
cur_clipbottom=cur_clipbottom-clipstep;
if(cur_clipbottom < clipbottom) cur_clipbottom=clipbottom;
}
if(cur_clipright > clipright) {
cur_clipright=cur_clipright-clipstep;
if(cur_clipright < clipright) cur_clipright=clipright;
}
}
document.getElementById(obgname).style.clip = "rect("+cur_cliptop+"px,"+cur_clipright+"px,"+cur_clipbottom+"px,"+cur_clipleft+"px)";
if(state==1) {
if(cur_cliptop==0 && cur_clipleft==0 && cur_clipbottom==height && cur_clipright==width) { return }
} else {
if(cur_cliptop==cliptop && cur_clipleft==clipleft && cur_clipbottom==clipbottom && cur_clipright==clipright) { return }
}
timerId[obgname] = setTimeout('toggle_floating(\"'+obgname+'\",'+state+','+timer+','+width+','+height+','+cliptop+','+clipright+','+clipbottom+','+clipleft+','+clipstep+')',timer);
}
function toggle_floating_banner(obgname,state,timer,width,height,cliptop,clipright,clipbottom,clipleft,clipstep) {
try {
clearTimeout(timerId[obgname]);
} catch(e) {}
timerId[obgname] = setTimeout('toggle_floating(\"'+obgname+'\",'+state+','+timer+','+width+','+height+','+cliptop+','+clipright+','+clipbottom+','+clipleft+','+clipstep+')',timer);
}