/////////////////////////////////////////////////////////////
// Filename: windiw.js
// Purpose:  CAMS popup window dialog messages.
// Vertion:  1.0
// Author:	 Cards Aqua Ltd. - http://www.cardsaqua.com
//
// Copyright 2003, All right reserved
/////////////////////////////////////////////////////////////

isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=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 ddN4(whatDog){
  if (!isN4) return;
  N4=eval(whatDog);
  N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
  N4.onmousedown=function(e){
    N4.captureEvents(Event.MOUSEMOVE);
    N4x=e.x;
    N4y=e.y;
  }
  N4.onmousemove=function(e){
    if (isHot){
      N4.moveBy(e.x-N4x,e.y-N4y);
      return false;
    }
  }
  N4.onmouseup=function(){
    N4.releaseEvents(Event.MOUSEMOVE);
  }
}

function hideMe(){
  if (isIE||isNN) whichDog.style.visibility="hidden";
  else if (isN4) document.theLayer.visibility="hide";
}

function showMe(html_txt, html_title, jswin){  
  
  var mytext = html_txt;
  var mytitle = html_title;
  var mywindow = jswin;
 
  if (isIE) {
     pText.innerHTML=mytext;
     pTitle.innerHTML=mytitle;
  }
  else if (isNN||isN4) {
     showBox(html_txt, html_title, jswin); 
  }
  if (isIE) whichDog.style.visibility="visible";
  //if (isIE||isNN) whichDog.style.visibility="visible";
  //else if (isN4) document.theLayer.visibility="show";
}

function mOver() {
     captionImage = new Image();
	 captionImage.src = "img/closebtn_over.gif";
	 closebtn.src = captionImage.src;
	 return true;
}


function showBox(html_txt, html_title, jswin){  
     var mytext = html_txt;
     var mytitle = html_title;
     var mywindow = jswin;
	 
	 // upload image
	 captionImage = new Image();
	 captionImage.src = "img/closebtn_over.gif";
	 
	 myWindow = window.open("www.cardsaqua.com", "myWindow", mywindow);
     myWindow.self.focus();
	 // html portion
	 myCSSLink = '<link href="css/ca.css" rel="stylesheet" type="text/css">';
	 myTitle = '<html><head><title>&nbsp;' + mytitle + '&nbsp;&nbsp;&nbsp;</title></head><body bgcolor="#ffffff" bottommargin="3" topmargin="2" leftmargin="2" rightmargin="0">';  //F2F3F7
	 myFontStart = '<center><font face="Verdana" size="-1" color="#000084">'; // color="#000080"
	 myFontEnd = '</font></center>';
	 EndOfMsg = '</body></html>';
	 
	 // table of popup box and close button
	 myTbl =  '<table height="108" width="100%" border="0" cellpadding="0" cellspacing="0" class="blue" align="center">';
	 myTbl += '<tr><td align="center" valign="top">' + mytext + '</td></tr>';
	 myTbl += '<tr><td align="center" width="100%" valign="bottom">';
	 myTbl += '       <table border="0" width="100%" cellpadding="0" cellspacing="0">'; // close btn
	 myTbl += '       <tr>';
	 myTbl += '          <td bgcolor="#ffffff" align="right" height="18" class="grey" valign="bottom">';
	 myTbl += '              <font color="#3C4F77"><div align="right">Close</font> &nbsp;'; 
	 myTbl += '              <a href="javascript:window.close()" onmouseover="clsbtn.src=\'img/closebtn_over.gif\'" onmouseout="clsbtn.src=\'img/closebtn.gif\'"><img name="clsbtn" src="img/closebtn.gif" border="0"></a>';
	 myTbl += '              <img src="img/clear.gif" width="1" height="18" border="0"></div>';
	 myTbl += '          </td>';
	 myTbl += '       </tr>';
	 myTbl += '       </table>';
	 myTbl += '</td></tr></table>';
	 
	 MsgBox = myTitle + myCSSLink + myFontStart + myTbl + myFontEnd + EndOfMsg;
	 myWindow.document.write(MsgBox);
	 myWindow.document.close();
}

document.onmousedown=ddInit;
document.onmouseup=Function("ddEnabled=false");




