var IE='\v'=='v';
var out=0;
var time_out;
var sel_out = 0;
var arOnLoad = new Array();

function getBrowserInfo() {
    var t,v = undefined;

    if (window.chrome) t = 'Chrome';
    else if (window.opera) t = 'Opera';
    else if (document.all) {
        t = 'IE';
        var nv = navigator.appVersion;
        var s = nv.indexOf('MSIE')+5;
        v = nv.substring(s,s+1);
    }
    else if (navigator.appName) t = 'Netscape';

    return {type:t,version:v};
}

function bookmark(a){
    var url = window.document.location;
    var title = window.document.title;
    var b = getBrowserInfo();

    if (b.type == 'IE' && 8 >= b.version && b.version >= 4) window.external.AddFavorite(url,title);
    else if (b.type == 'Opera') {
        a.href = url;
        a.rel = "sidebar";
        a.title = url+','+title;
        return true;
    }
    else if (b.type == "Netscape") window.sidebar.addPanel(title,url,"");
    else alert("Нажмите CTRL-D, чтобы добавить страницу в закладки.");
    return false;
}


function on_Focus(v,t)
{
	if(v.value==t) {
		v.value='';
	}
	v.className='activ';
	v.style.background = '#fff';
}

function on_Blur(v,t)
{
	if(v.value=='') {
		v.value=t;
		v.className='';
	}
}

function get(id)
{
	return document.getElementById(id);
}

function reloadNospam(id)
{
	get('imgnum').innerHTML = '<img src="/scripts/nospam/image.jpg?id='+id+'&amp;rl='+Math.random()+'" alt="Контрольное число">';
}


function ShowAlert(n,t)
{
	var htm='';
	htm += '<table id="dialog_tb">';
	htm += '<tr><td id="dialog_top"></td></tr>';
	htm += '<tr><td id="dialog_title">'+n+'</td></tr>';
	htm += '<tr><td id="dialog_text">'+t+'</td></tr>';
	htm += '<tr><td id="dialog_close"><a href="/" onclick="CloseDialog(); return false;">Закрыть сообщение</a></td></tr>';
	htm += '<tr><td id="dialog_bottom"></td></tr>';
	htm += '</table>';
	showDialog(htm,464, 300);
}


function showDialog(html,w,h)
{

	var wt = getClientWidth();
	var ht = getClientHeight();
	var L = Math.ceil((wt-w)/2);
	var T = Math.ceil((ht-h)/2)+eval(document.documentElement.scrollTop||document.body.scrollTop);

	var htm='';
	htm += '<div id="place_dialog"></div>';
	htm += '<div id="dialog">' + html + '</div>';

	parent.get('place_point').innerHTML = htm;

	get('place_dialog').style.width = wt + 'px';
	get('place_dialog').style.height = eval(document.documentElement.scrollHeight||document.body.scrollHeight) + 'px';
	get('dialog').style.left = L + 'px';
	get('dialog').style.top = T + 'px';
}

function getClientHeight()
{
  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
}

function getClientWidth()
{
  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
}

function CloseDialog()
{
	parent.get('place_point').innerHTML = '';
}


