document.write('')

agt=navigator.userAgent.toLowerCase();

ie=(document.all) ? 1:0
	ie4=(agt.indexOf('msie 4')!=-1) ? 1:0
	ie5=(agt.indexOf('msie 5')!=-1) ? 1:0
	ns4=(document.layers && parseInt(navigator.appVersion)>=4) ? 1:0

latest=(document.getElementById) ? 1:0
	opera=(agt.indexOf("opera")!=-1) ? 1:0
	gecko=(agt.indexOf("gecko")!=-1) ? 1:0
   ie55=(agt.indexOf("msie 5.5")!=-1) ? 1:0
   ie6=(agt.indexOf("msie 6")!=-1) ? 1:0

	win=( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) )
	mac=(agt.indexOf("mac")!=-1);
   imgs=(document.images) ? 1:0

//browser vars
ie = ie4 || ie5 || ie6;
ns = (ns4)?1:0
best=(latest)?1:0

//browser size
function brw_size(what) {
if (ns || gecko) {
    width = innerWidth
    height = innerHeight
    } else {
    width = document.body.clientWidth
    height = document.body.clientHeight
}
if (what == "w") return width
if (what == "h") return height
}

//check form
function check_arch_form(){
    if (document.arch_form.months.value != "none"){
        location.href = document.arch_form.script.value+"_arch_"+document.arch_form.months.value+".html"
    } else {return false}
}

function check_search_form(){
if (document.search_form.search_text.value == "") {alert('Поле поиска не может быть пустым!');return false}
}

function check_forum_login_form(){
if ((document.forum.login.value == "") ||(document.forum.pwd.value == "") || (document.forum.pwd.value != document.forum.pwd_copy.value)) {alert('Проверьте правильность заполнения полей!');return false}
}

function check_subscribe_form(){
if ((new String(document.subscribe_form.mail.value)).indexOf('@') == -1) {alert('Не корректный e-mail!');return false}
}

function check_feedback_form(){
if ((new String(document.feedback_form.mail.value)).indexOf('@') == -1) {alert('Не корректный e-mail!');return false}
if ((new String(document.feedback_form.name.value)) == '') {alert('Введите Ваше имя!');return false}
if ((new String(document.feedback_form.message.value)) == '') {alert('Поле сообщения не может быть пустым!');return false}
}

//topic
function get_topic(str_topic,str_num){
    return '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td><img src="images/topic_right_'+str_num+'.gif" alt="" width="11" height="35" border="0"></td><td background="images/back_topic.gif" width="100%"><img src="images/topic_'+str_topic+'.gif" alt="" height="35" border="0"></td></tr></table>'
}

//query string
function get_menu_pos(){
search = new String(location.search.substr(1))
pos = search.indexOf('topic=')
if (pos == -1) {res = 0} else {
    res1 = search.charAt(pos+6)
    res2 = search.charAt(pos+7)
    if (isNaN(parseInt(res1))){res1 = 0;res = 0}
    if (!isNaN(parseInt(res2))){res = res1+res2} else {res = res1}
    if (search.substring(pos+6,pos+12) == 'mailok'){res = 'mailok'}
}
return res
}

//print version
print_ver = false
function page_print(){
    if (print_ver == true){
        str = location.href.substring(0,location.href.length-1)
        pos_end = str.lastIndexOf('.htm')
        filespec = str.substring(0,pos_end)+'_print.html'
        location.href = filespec
    } else {return false}
}
