function mailto(domain,user) 
{ 
document.location.href = "mailto:" + user + "@" + domain;
}

function show_popup(width,height,url,data){
    if(!$('#screen_mask').length>0){
        $('body').append('<div id="screen_mask">&nbsp;</div>');
    }
    if(!$('#dialog').length>0){
        $('body').append('<div id="dialog"><div class="boxtop"><a class="closer" href="#" onclick="return hide_popup();">close</a></div><div id="dialog_content">&nbsp;</div></div>');
    }

	$('#screen_mask').css('opacity',0.5).height($(document).height()).show();
    var scroll_amt=$(document).scrollTop()+50;
	dialog_height=height=='auto'?'auto':(height+45)+'px';
	dialog_content_height=height=='auto'?'auto':height+'px';
    $('#dialog').css({'top':scroll_amt,'width':(width+20)+'px','height':dialog_height,marginLeft:'-'+Math.round(width/2)+'px'}).show();
	$('#dialog #dialog_content').css({'height':dialog_content_height,'width':width+'px'}).load(url,data);
	$(document).bind('keypress',popup_keypress);
	if(typeof($('#dialog').draggable)!='undefined'){
		$('#dialog').draggable({'handle':'.boxtop'});
	}
    return false;
}

function popup_keypress(e){
	var kC  = (window.event) ?    // MSIE or Firefox?
			  event.keyCode : e.keyCode;
	if(kC==27)
		hide_popup();
}

function fade_popup(){
	$(document).unbind('keypress');
	setTimeout(function(){
	    $('#screen_mask').fadeTo(200,0,function(){$('#screen_mask').hide();});
    	$('#dialog').fadeTo(800,0,function(){
	        $('#dialog #dialog_content').html('');
			$('#dialog').hide().css('opacity',1);
    	});
	},800);
    return false;
}

function hide_popup(){
	$(document).unbind('keypress');
    $('#screen_mask').hide();
    $('#dialog #dialog_content').html('');
	$('#dialog').hide();
    return false;
}


