//Get ID.
function $id(id){
 return document.getElementById(id);
 }
function ShowMsg(){
 document.writeln("<div id=\"msgdiv\" style=\"position:absolute;display:none;\" class=\"frame\"><\/div>");
 document.writeln("<div id=\"overdiv\" style=\"position:absolute;display:none;\">");
 document.writeln("<\/div>");
 //Call back function.
 this.ok_callback=function(){};
 this.cancel_callback=function(){};
 this.msgobjname=""
 this.show=function(msgtitle,msgcontent,selecttype){
  var tempobj1=$id("msgdiv");
  var tempobj2=$id("overdiv");
  var msgobj=this.msgobjname;
    tempobj2.style.filter="alpha(opacity=1)";
    tempobj2.style.MozOpacity = 1/100;
    tempobj2.style.backgroundColor = "#000000";
    tempobj2.style.display = '';
     tempobj2.style.zIndex= 100;
     tempobj2.style.height= document.body.clientHeight+"px";
     tempobj2.style.width= document.body.clientWidth+"px";
   tempobj2.style.left=0;
   tempobj2.style.top=0;
   tempobj1.style.display="none";
     tempobj1.style.left= (document.body.clientWidth)/3+"px";
     tempobj1.style.top= (document.documentElement.scrollTop+(document.documentElement.clientHeight)/3)+"px";
     tempobj1.style.display= '';
     tempobj1.style.width=349+"px";
     //tempobj1.style.height=135+"px";
     tempobj1.style.zIndex= 200;
    // tempobj1.style.backgroundColor = "aliceblue";
     var OutStr;
     OutStr="<div class=\"overlay\"><div class=\"msg_movediv\">";
      OutStr=OutStr+"<table cellpadding=\"0\" cellspacing=\"0\" class=\"msg_table\">";
      OutStr=OutStr+"<tr><td valign=\"top\" class=\"msg_divtop msg_canmove\" canmove=\"true\" forid=\"msgdiv\"></td></tr>";
      OutStr=OutStr+"<tr><td align=\"center\"><div class=\"msg_divcontent msg_canmove\" canmove=\"true\" forid=\"msgdiv\" onselectstart=\"return false \"  onselect=\"document.selection.empty()\"><table border=\"0\" align=\"center\"><tr><td align=\"center\" class=\"msg_body\"   canmove=\"true\" forid=\"msgdiv\" onselectstart=\"return false \"  onselect=\"document.selection.empty()\">";
      OutStr=OutStr+"<span class=\"msg_title msg_canmove\"  canmove=\"true\" forid=\"msgdiv\" onselectstart=\"return false \"  onselect=\"document.selection.empty()\">"+msgtitle+"</span><br /><br />";
      OutStr=OutStr+"<span class=\"msg_content msg_canmove\"  canmove=\"true\" forid=\"msgdiv\" onselectstart=\"return false \"  onselect=\"document.selection.empty()\">"+msgcontent+"</span>";
      OutStr=OutStr+"</td></tr></table></div></td></tr><tr><td valign=\"bottom\" class=\"msg_divbottom msg_canmove\" canmove=\"true\" forid=\"msgdiv\" onselectstart=\"return false \"  onselect=\"document.selection.empty()\">";
     //OutStr=OutStr+"<div><div class=\"header\">"+msgtitle+"</div>"
     //OutStr=OutStr+"<div  class=\"body\"><div style=\"float:left;\"><img id=\"imgAlert\" alt=\"\" width=\"50\" height=\"50\" src=\"Images\\Index\\alert.gif\"></img></div><div class=\"contentstyle\" >"+msgcontent+"</div></div>"
    if(selecttype==1){
        OutStr=OutStr+"<div style=\"text-align:center;font-size:12px;\"  class=\"footer msg_canmove\" canmove=\"true\" forid=\"msgdiv\" ><input type=\"button\" value=\"OK\" class=\"commandBtn\" onclick=\""+msgobj+".ok()\">    <input type=\"button\" value=\"Cancel\" class=\"commandBtn\" onclick=\""+msgobj+".cancel()\"></div>"
    }
    else{
        OutStr=OutStr+"<div style=\"text-align:center;font-size:12px;\"  class=\"footer msg_canmove\" canmove=\"true\" forid=\"msgdiv\" ><input type=\"button\" value=\"OK\" class=\"commandBtn\" onclick=\""+msgobj+".ok()\"></div></div>"
    }
     
     OutStr=OutStr+"</td></tr></table></div>";
     //OutStr=OutStr+"<div class=\"underlay\" id=\"under\"></div>";
     tempobj1.innerHTML=OutStr;
     var md=false,mobj,ox,oy
      document.onmousedown=function(ev)
      {
   var ev=ev||window.event;
   var evt=ev.srcElement||ev.target;
          if(typeof(evt.getAttribute("canmove"))=="undefined")
          {
              return;
          }
          if(evt.getAttribute("canmove"))
          {
              md = true;
              mobj = document.getElementById(evt.getAttribute("forid"));
              ox = mobj.offsetLeft - ev.clientX;
              oy = mobj.offsetTop - ev.clientY;
          }
      }
      document.onmouseup= function(){md=false;}
      document.onmousemove= function(ev)
      {
   var ev=ev||window.event;
          if(md)
          {
              mobj.style.left= (ev.clientX + ox)+"px";
              mobj.style.top= (ev.clientY + oy)+"px";
          }
      }
      
        //var theUnder=$id("under");
        //theUnder.style.MozOpacity = 12/100;
        //var alertimg=$id("imgAlert");
        //if(selecttype==1){
            //alertimg.src='';
        //}
        //else if(selecttype==2){        
            //alertimg.src='';
        //}
        //else{
            //alertimg.src='';
        //}
  }
  this.ok = function()
  {
   $id('msgdiv').style.display='none';
   $id('overdiv').style.display='none';
   this.ok_callback();
  }
  this.cancel=function(){
   $id('msgdiv').style.display='none';
   $id('overdiv').style.display='none';
   this.cancel_callback();
  }
 }
 
 
 
//Example:
var ShowMsgo=new ShowMsg();
//Object name
ShowMsgo.msgobjname="ShowMsgo";
//Set callback function
ShowMsgo.ok_callback=function(){

 }
ShowMsgo.cancel_callback=function(){

 }