	
function authDraw(){
	document.write(
	'<style>\
#authTable td.main { }\
#authTable td.main .rel span.close { position:absolute; font-size:11px; right:-30px; _right:10px; top:-15px; cursor:hand; cursor:pointer; }\
#authTable table {  }\
#authTable table td { padding:5px; font-style:italic; }\
#authTable .submit { width:100px; height:27px; font-size:14px; font-weight:bold; }\
#authTable .border { border-bottom:solid #777777 1px; margin:7px 0 12px 0; }\
</style>\
<div \
	id="authDiv"\
	style="position:fixed; background:black; opacity:0.65; filter:alpha(opacity=\'65\');  _position:absolute; left:0; top:0; width:100%; height:100%; z-index:10001; visibility:hidden; _top:expression(tmp=document.body.scrollTop+\'px\';); "\
></div>\
<table\
	id="authTable"\
	style="position:fixed; _position:absolute; left:0; top:0; _top:expression( tmp=document.body.scrollTop+\'px\'; ); width:100%; height:100%; z-index:10002; visibility:hidden;"\
> <tr><td colspan="3" onclick="hideAuth();" >&nbsp;</td></tr>\
		<tr><td onclick="hideAuth();" >&nbsp;</td>\
		<td class="main" style="width:250px; _width:270px; height:200px; background:#f6f6f6; padding:20px 40px; text-align:center;">\
			<div class="rel"><span class="close" onclick="hideAuth();">Закрыть</span></div>\
			<h2>Авторизация</h2>\
			<form action="/authorize/" method="post" name="fAuth" id="fAuth">\
			<table>\
				<tr>\
					<td>№ договора:</td>\
					<td><input type="Text" name="login"></td>\
				</tr>\
				<tr>\
					<td>Пароль:</td>\
					<td><input type="Password" name="password"></td>\
				</tr>\
			</table>\
			<div class="border"></div>\
			<input class="submit" type="Submit" value="Войти">\
			</form>\
		</td>\
		<td onclick="hideAuth();" >&nbsp;</td></tr><tr><td colspan="3" onclick="hideAuth();" >&nbsp;</td></tr></table>	\
	');
}

function showAuth(redir){
	document.all['fAuth'].action='/authorize/?redir='+redir;
	if( typeof(jQuery) != 'undefined' ){
		$('#authDiv').css({ opacity:'0', visibility:'visible' });
		$('#authTable').css({ opacity:'0', visibility:'visible' });
		$('#authDiv').animate({ opacity:'0.7' }, 250).queue(function(){
			$('#authTable').css({ opacity:'1', visibility:'visible' });
			$(this).dequeue();
		}); 
	} else {
		document.all['authDiv'].style.visibility = 'visible';
		document.all['authTable'].style.visibility = 'visible';
	}
	return false;
}

function hideAuth(){
	if( typeof(jQuery) != 'undefined' ){
		$('#authTable').css({ visibility:'hidden' });
		$('#authDiv').animate({ opacity:'0' }, 250).queue(function(){
			$(this).css({ visibility:'hidden' });
			$('#authTable').css({ visibility:'hidden' });
			$(this).dequeue();
		}); ; 
	} else {
		document.all['authDiv'].style.visibility = 'hidden';
		document.all['authTable'].style.visibility = 'hidden';		
	}
	return false;
}
