var title="Random Pop - "+navigator.appName;
var titlecolor='#2080FF';
var titletextcolor='#FFFFFF';
var bordercolor='#2080FF';
var bgcolor='#FFFFFF';
var scrollcolor='#FFFFFF';
var shadowcolor='#6DBAF3';
var showTitle=true;
var dom=(document.getElementById)? true: false;
var ie5=(dom && document.all)? true : false;
var moveNow=null;
var xOfs=0, yOfs=0;
var resizeXOfs=0, resizeYOfs=0;
var resizeNow=null;
var zIndex=10,mouseX=0,mouseY=0;
var d=document;
d.gId=d.getElementById;
var inX=screen.width,inY=screen.height;
function defineClientArea(){
if(typeof(window.innerWidth)=='number'){
// Non-IE
inX=window.innerWidth;
inY=window.innerHeight;
}else{
if(document.readyState!='complete'){ //wait!
setTimeout('defineClientArea()',10);
return;
}
if(document.documentElement &&
(document.documentElement.clientWidth || document.documentElement.clientHeight)){
// IE 6+
inX=parent.parent.document.documentElement.clientWidth;
inY=parent.parent.document.documentElement.clientHeight;
}else{
if(document.body && ( document.body.clientWidth || document.body.clientHeight)){
// IE 4+
inX=document.body.clientWidth;
inY=document.body.clientHeight;
} // if
}
}
}
function defPosXClient(typ,x,resized){
if(typ=='tl') return 0;
if(typ=='bl') return 0;
if(typ=='c') return (inX-x)/2;
corr=8;
if(typ=='tr') return (inX-x)-corr;
if(typ=='br') return (inX-x)-corr;
}
function defPosYClient(typ,y,resized){
if(typ=='tl') return 0;
if(typ=='tr') return 0;
if(typ=='c') return (inY-y)/2;
corr=4;
if(!ie5)corr+=6;
if(typ=='bl') return (inY-y)-corr;
if(typ=='br') return (inY-y)-corr;
}
function showDhtmlPopup(url,winPos,width,height,resized,scroll,hidetitle){
x=defPosXClient(winPos,width,resized);
y=defPosYClient(winPos,height,resized);
if(d.gId('popDhtml_border')){
d.body.removeChild(d.gId('popDhtml_border'));
d.body.removeChild(d.gId('popDhtml_shadow'));
}
popUpDhtml(x,y,parseInt(width),parseInt(height),url,resized,scroll,!hidetitle);
}
function hideWin(){
d.gId('popDhtml_border').style.display='none';
d.gId('popDhtml_shadow').style.display='none';
}
function minimize(){
d.gId("popDhtml_border").style.height=(ie5)? '33px':'29px';
d.gId("popDhtml_shadow").style.height='33px';
d.gId("popDhtml_content").style.display='none';
d.gId("popDhtml_resize").style.display='none';
d.gId("popDhtml_min").src='http://www.aismarketing.com/rpop/images/dis_min.jpeg';
d.gId("popDhtml_max").src='http://www.aismarketing.com/rpop/images/max.jpeg';
}
function restore(){
d.gId("popDhtml_border").style.height=this.winHeight+'px';
d.gId("popDhtml_shadow").style.height=(ie5)? this.winHeight+'px':this.winHeight+5+'px';
d.gId("popDhtml_content").style.display='block';
d.gId("popDhtml_resize").style.display='block';
d.gId("popDhtml_min").src='http://www.aismarketing.com/rpop/images/min.jpeg';
d.gId("popDhtml_max").src='http://www.aismarketing.com/rpop/images/dis_max.jpeg';
}
function catchMouseEvents(evt){
mouseX=(ie5)?event.clientX+d.body.scrollLeft:evt.pageX;
mouseY=(ie5)?event.clientY+d.body.scrollTop:evt.pageY;
movepopup();
if((moveNow!=null)||(resizeNow!=null))return false;
}
function movepopup(){
//movement?
if((moveNow!=null)&&dom){
var x=mouseX+xOfs;
var y=mouseY+yOfs;
d.gId("popDhtml_border").style.left=x+'px';
d.gId("popDhtml_shadow").style.left=x+3+'px';
d.gId("popDhtml_border").style.top=y+'px';
d.gId("popDhtml_shadow").style.top=y+3+'px';
}
//resize?
if((resizeNow!=null)&&dom){
var rx=mouseX+resizeXOfs;
var ry=mouseY+resizeYOfs;
d.gId("popDhtml_fixResize").style.display="block";
d.gId("popDhtml_resize").style.left=Math.max(rx,((ie5)?88:92))+'px';
d.gId("popDhtml_resize").style.top=Math.max(ry,((ie5)?68:72))+'px';
d.gId("popDhtml_border").style.width=Math.max(rx+((ie5)?12:8),100)+'px';
d.gId("popDhtml_border").style.height=Math.max(ry+((ie5)?12:8),80)+'px';
d.gId("popDhtml_shadow").style.width=Math.max(rx+12,((ie5)?100:104))+'px';
d.gId("popDhtml_shadow").style.height=Math.max(ry+((ie5)?12:13),((ie5)?80:84))+'px';
if(showTitle){
d.gId("popDhtml_title").style.width=Math.max(rx+((ie5)?4:3),92)+'px';
d.gId("popDhtml_btt").style.left=parseInt(d.gId("popDhtml_title").style.width)-63+'px';
d.gId("popDhtml_max").winHeight=parseInt(d.gId("popDhtml_border").style.height);
d.gId("popDhtml_content").style.height=Math.max(ry-((ie5)?24:24),(ie5)?44:49)+'px';
}else{
d.gId("popDhtml_content").style.height=Math.max(ry-((ie5)?-3:-3),(ie5)?71:76)+'px';
}
d.gId("popDhtml_content").style.width=Math.max(rx-((ie5)?-3:-3),((ie5)?92:95))+'px';
}
return false;
}
function stopResize(){
resizeNow=null;
d.gId("popDhtml_fixResize").style.display="none";
}
function startResize(evt){
var eventX=(ie5)?event.clientX+d.body.scrollLeft:evt.pageX;
var eventY=(ie5)?event.clientY+d.body.scrollTop:evt.pageY;
resizeXOfs=parseInt(this.style.left)-eventX;
resizeYOfs=parseInt(this.style.top)-eventY;
resizeNow=this;
return false;
}
function changeWin(v){
var divH=(v!=null)?v:this;
if(showTitle)d.gId("popDhtml_title").style.backgroundColor=divH.activecolor;
d.gId("popDhtml_shadow").style.zIndex=++zIndex;
divH.style.zIndex=++zIndex;
d.gId("popDhtml_resize").style.zIndex=++zIndex;
}
function endMove(){ moveNow=null;}
function startMove(evt){
var eventX=(ie5)?event.clientX+d.body.scrollLeft:evt.pageX;
var eventY=(ie5)?event.clientY+d.body.scrollTop:evt.pageY;
xOfs=parseInt(d.gId("popDhtml_border").style.left)-eventX;
yOfs=parseInt(d.gId("popDhtml_border").style.top)-eventY;
moveNow=d.gId("popDhtml_border");
return false;
}
function genDiv(x,y,w,h,bgc,id){
var v=d.createElement('div');
v.setAttribute('id',id);
v.style.position='absolute';
v.style.left=x+'px';
v.style.top=y+'px';
v.style.width=w+'px';
v.style.height=h+'px';
v.style.backgroundColor=bgc;
v.style.visibility='visible';
v.style.padding='0px';
return v;
}
function popUpDhtml(x,y,w,h,url,resizeable,scroll,showTitle){
top.showTitle=showTitle;
if(dom){
var resizeDiv=new genDiv(w-((ie5)?12:8),h-((ie5)?12:8),7,7,'','popDhtml_resize');
if(resizeable){
resizeDiv.innerHTML='
';
resizeDiv.style.cursor='move';
}
var divW=(ie5)?w:w+4;
var divH=(ie5)?h:h+6;
var shadow=new genDiv(x+3,y+3,divW,divH,shadowcolor,'popDhtml_shadow');
if(ie5)shadow.style.filter="alpha(opacity=50)";
else shadow.style.MozOpacity=.5;
shadow.style.zIndex=++zIndex;
var divWin=new genDiv(x,y,w,h,bordercolor,'popDhtml_border');
divWin.style.borderStyle="outset";
divWin.style.borderWidth="2px";
divWin.style.borderColor=bordercolor;
divWin.style.zIndex=++zIndex;
if(showTitle){
divW=(ie5)?w-8:w-5;
divH=(ie5)?h+4:h-4;
var titlebar=new genDiv(2,2,divW,25,titlecolor,'popDhtml_title');
titlebar.style.overflow="hidden";
titlebar.style.cursor="default";
var tmp=(resizeable)?'![]()
':'';
titlebar.innerHTML='