function showIBcenter(html,fun){
	inputbox={};
	var fon=document.getElementById('inputbox_fon');
	var div=document.getElementById('inputbox_div');
	fon.className='ib_fon_show';
	div.className='ib_show';
	div.innerHTML=html;
	
	width=div.clientWidth;
	height=div.clientHeight;
	
	fon.style.width=width;
	fon.style.height=height;

	ib_left=parseInt(screen.width/2-width/2)+30;
	ib_top=parseInt(screen.height/2-height/2)-100+document.body.scrollTop;
	div.style.left=ib_left;
	div.style.top=ib_top;
	fon.style.left=ib_left;
	fon.style.top=ib_top;

	var table = '<TABLE cellpadding=0 cellspacing=0 border=0 class=t_shadow style="width:100%;height:100%">'
	+'<TR height=14>'
		+'<TD width=14 class=t0></div></TD>'
		+'<TD class=t0></TD>'
		+'<TD width=14 class=t5></TD>'
	+'</TR>'
	+'<TR>'
		+'<TD class=t0></TD>'
		+'<TD class=t_main >&nbsp;</TD>'
		+'<TD class=t4></TD>'
	+'</TR>'
	+'<TR height=14>'
		+'<TD class=t1></TD>'
		+'<TD class=t2></TD>'
		+'<TD class=t3></TD>'
	+'</TR>'
	+'</TABLE><br>';
	rl_str='<div class=ib_red_line style="width:'+(width-30)+'"><img src= width=1 height=1></div>';
	rl=document.getElementById('rl_div');
	rl.innerHTML=rl_str;
	rl.style.backgroundColor='#ff0';

	rl.style.top=ib_top
	rl.style.left=ib_left

	fon.innerHTML=table;



	inputbox.div=div;
	inputbox.fon=fon;
	inputbox.rl=rl;
	
	if(arguments.length>1){
		inputbox.action=fun;	
	}else{
		inputbox.action=function(){};
	}


	inputbox.hide=function(){
		this.div.innerHTML='';
		this.div.className='ib_hid';
		this.fon.className='ib_fon_hid';
		this.rl.innerHTML='';
	}
	
	inputbox.submit=function(){
		this.action();
		this.hide();
	}

	return false;

}

function getOffsetLeft(o){
	var n=0;
	while(o.nodeName!='HTML'){
		n+=o.offsetLeft;
		o=o.parentNode;
	}
	return n;	
}

function showInputbox(html,left,top,fun){
	inputbox={};
	var fon=document.getElementById('inputbox_fon');
	var div=document.getElementById('inputbox_div');
	fon.className='ib_fon_show';
	div.className='ib_show';
	div.innerHTML=html;
	fon.style.width=div.clientWidth;
	fon.style.height=div.clientHeight;
	div.style.left=left;
	div.style.top=top;
	fon.style.left=left;
	fon.style.top=top;

	inputbox.div=div;
	inputbox.fon=fon;
	
	if(arguments.length>3){
		inputbox.action=fun;	
	}else{
		inputbox.action=function(){};
	}


	inputbox.hide=function(){
		this.div.innerHTML='';
		this.div.className='ib_hid';
		this.fon.className='ib_fon_hid';		
	}
	
	inputbox.submit=function(){
		this.action();
		this.hide();
	}

	return false;

}

function getOffsetLeft(o){
	var n=0;
	while(o.nodeName!='HTML'){
		n+=o.offsetLeft;
		o=o.parentNode;
	}
	return n;
}

function getOffsetTop(o){
	var n=0;

	while(o.nodeName!='HTML'){

		if(o.nodeName!='TR'){
			n+=o.offsetTop;
		}
		o=o.parentNode;
	}

	return n;
}

function coolIB_(html,fun){
	if(arguments.length==1){
		ok='<div sytle="width:100%;text-align:center;padding:10 0 20 0"><input type=button value="Закрыть" onclick="inputbox.submit()"></div>';
	}else{
		$ok='';
	}
	str=
	'<TABLE cellpadding=0 cellspacing=0 border=0 class=t_shadow>'
	+'<TR height=14>'
		+'<TD width=14 class=t0><div class=red_line_1>&nbsp;</div></TD>'
		+'<TD class=t0><div class=red_line_2></div></TD>'
		+'<td class=t0 width=14></td>'
		+'<TD width=14 class=t5></TD>'
	+'</TR>'
	+'<TR height=100>'
		+'<TD width=14 class=t0></TD>'
		+'<TD class=t_main >'+html+ok+'</TD>'
		+'<td class=t0 width=14></td>'
		+'<TD class=t4 width=14></TD>'
	+'</TR>'
	+'<TR height=12>'
		+'<TD class=t1 width=14></TD>'
		+'<TD class=t2 colspan=2></TD>'
		+'<TD class=t3 width=14></TD>'
	+'</TR>'
	+'</TABLE>'
	if(arguments.length>1){
		showIBcenter(str,fun)
	}else{
		showIBcenter(str)
	}


}


function cool_box_(){
var str=
'<TABLE cellpadding=0 cellspacing=0 border=0 class=t_shadow>'
+'<TR height=6>'
	+'<TD width=12 class=t_red_1 height=6></TD>'
	+'<TD class=t_red_2 height=6></TD>'
	+'<td class=t0 width=12 height=6></td>'
	+'<TD width=12 class=t5 rowspan=2></TD>'
+'</TR>'
+'<TR height=6>'
	+'<TD width=12 height=6 class=t0></TD>'
	+'<TD class=t0 height=6></TD>'
	+'<td class=t0 width=12 height=6></td>'
+'</TR>'
+'<TR height=100>'
	+'<TD class=t0>&nbsp;</TD>'
	+'<TD class=t_main width=250 onclick=\'inputbox.submit()\'> Основное содержание </TD>'
	+'<td class=t0 width=12>&nbsp;</td>'
	+'<TD class=t4>&nbsp;</TD>'
+'</TR>'
+'<TR height=12>'
	+'<TD class=t1>&nbsp;</TD>'
	+'<TD class=t2>&nbsp;</TD>'
	+'<td class=t2 width=12>&nbsp;</td>'
	+'<TD class=t3>&nbsp;</TD>'
+'</TR>'
+'</TABLE>'

showIBcenter(str)

}


function coolIB(html,fun){

	str=
	'<TABLE cellpadding=0 cellspacing=0 border=0 class=t_shadow>'
	+'<TR height=14>'
		+'<TD width=14 class=t0></div></TD>'
		+'<TD class=t0></TD>'
		+'<TD width=14 class=t5></TD>'
	+'</TR>'
	+'<TR>'
		+'<TD class=t0></TD>'
		+'<TD class=t_main >&nbsp;</TD>'
		+'<TD class=t4></TD>'
	+'</TR>'
	+'<TR height=14>'
		+'<TD class=t1></TD>'
		+'<TD class=t2></TD>'
		+'<TD class=t3></TD>'
	+'</TR>'
	+'</TABLE>';
	if(arguments.length>1){
		showIBcenter(str,fun)
	}else{
		showIBcenter(str)
	}


}

function MyMsgBox(msg){
	var title;
	if(arguments.length>1) title=arguments[1];
	else title='Сообщение с сайта';
	var str='<div style="padding:0 20 10 20;width:400">'
	+'<div style="font-size:110%;font-weight:bold;padding:0 0 10 0">'+title+'</div>'
	+'<div>'+msg+'</div>'
	+'<div style="text-align:center;width:100%;padding-top:20"><input type=button onclick="inputbox.hide()" value="OK" style="width:3cm"></div>'
	+'</div>';
	showIBcenter(str);
}

function MyErrBox(msg){
	var title;
	if(arguments.length>1) title=arguments[1];
	else title='Ошибка';
	var str='<div style="padding:0 20 10 20;width:400">'
	+'<div style="color:#f00;font-size:110%;font-weight:bold;padding:0 0 10 0">'+title+'</div>'
	+'<div>'+msg+'</div>'
	+'<div style="text-align:center;width:100%;padding-top:20"><input type=button onclick="inputbox.hide()" value="OK" style="width:3cm"></div>'
	+'</div>';
	showIBcenter(str);
}