function sendMessg( theForm )
{
  $( "#msgsub" ).attr( "disabled", "yes" );
  vdest = theForm.msgdst.value;
  vsubj = theForm.msgsbj.value;
  vmesg = theForm.msgmsg.value;
  vfrom = theForm.msgfrom.value;
  vemailfrom = theForm.emailfrom.value;
  vcaptcha = theForm.ocaptcha.value;
  vsubcaptcha = theForm.subcaptcha.value;
  hide_box=1;
$.get( "/cgi-bin/portfolio/art/email/send-artist-mail.cgi", {dest: vdest, login: vdest, from: vfrom, subj: vsubj, mesg: vmesg, subcaptcha: vsubcaptcha, ocaptcha: vcaptcha, emailfrom: vemailfrom}, function( xml ){
    $( "#msgsub" ).removeAttr( "disabled" );
    eval( xml );
    if( hide_box ){ $( "#msgdiv" ).hide( "slow" ); } 
});
  return false;
}

var thePopup;

function findPos( obj )
{
  var curleft = 0;
  var curtop = 0;
  if( obj.offsetParent )
  {
    curleft = obj.offsetLeft;
    curtop = obj.offsetTop;
    while( obj = obj.offsetParent )
    {
      curleft += obj.offsetLeft;
      curtop += obj.offsetTop;
    }
 }
 return [curleft, curtop];
}

function showPopupMsg( prefix, name, ufname )
{
  $( "#msgdst" ).val( name );
  $( "#msgfnm" ).val( ufname );
  $( "#msgsbj" ).val( "" );
  $( "#msgmsg" ).val( "" );
  $( "#msgdiv" ).appendTo( "#" + prefix + name ).show( "slow" );

  return false;
}

function hidePopupMsg()
{
  if( thePopup == -1 )
  {
    thePopup = 0;
    setTimeout( "hidePopupMsg();", 10 );
    return;
  }
  if( thePopup == 1 )
  {
    return; 
  }
  var popup = document.getElementById( "msgdiv" );
  popup.style.display = "none";
}


