var squidSubOpen = 0;
var avtmSubOpen = 0;
function toggleselection(elemid) {
    if (navigator.appName == 'Microsoft Internet Explorer') {
	if (document.getElementById(elemid).style.display == "block") {
	    document.getElementById(elemid).style.display = "none";
	} else {
	    document.getElementById(elemid).style.display = "block";
	}
    } else {
	if (document.getElementById(elemid).style.display == "table-row") {
	    document.getElementById(elemid).style.display = "none";
	} else {
	    document.getElementById(elemid).style.display = "table-row";
	}
    }
}
function toggleall() {
    toggleselection('proxies');
    toggleselection('proxies1');
    toggleselection('proxies2');
}
$(document).ready(function(){
    $('#norman-vivat').click(function () {
	window.location = 'http://www.norman-vivat.ru';
    });
    $('#gismeteo').click(function () {
	window.location = 'http://gismeteo.ru/';
    });
    $('#bob').click(function () {
	window.location = 'http://www.bobresto.ru';
    });
    $('#newaccount').click(function () {
	window.location = 'http://mail.norma.perm.ru/cgi-bin/newmailaccount.cgi';
    });
    $('#recoverpass').click(function () {
	window.location = 'http://mail.norma.perm.ru/cgi-bin/recovermailboxpass.cgi';
    });
    $('#cyrmbstats').click(function () {
	window.location = 'http://mail.norma.perm.ru/cgi-bin/cyrmbstats';
    });
    $('#webmail').click(function () {
	window.location = 'http://webmail.norman-vivat.ru/';
    });
    $('#kontur').click(function () {
	window.location = '/kontur/reg.html';
    });
    
    $("#avtm").mouseover(function () {
	$("#avtm img:first-child").attr('src', 'images/menubracket-focused.gif');
    });
    $("#avtm").mouseout(function (e) {
	$("#avtm img:first-child").attr('src', 'images/menubracket-unfocused.gif');
    });
    
    $('#hqtm').live('click', function () {
	window.location = 'https://hq-tm.norma.com:4343/officescan/';
    });
    
    $('#nbdc').live('click', function () {
	window.location = 'https://nb-dc.norma.com:4343/officescan/';
    });
    
    $('#samtm').live('click', function () {
	window.location = 'https://sam-tm.norma.com:4343/officescan/';
    });
    
    $('#spbtm').live('click', function () {
	window.location = 'https://spb-dc.norma.com:4343/officescan/';
    });
    
    $('#avtm').click(function () {
    
	if (avtmSubOpen == 0) {
	    $('#avtm').stop(true, true);
	    $('.footer').add('<div class="submenu" id="avtmsub"><div class="subentry" id="hqtm">Космонавтов, 65</div><div class="subentry" id="nbdc">Хасана, 98</div><div class="subentry" id="samtm">Самара</div><div class="subentry" id="spbtm">СПб</div></div>').appendTo(document.body);
	    $('#avtmsub').css('top', $('#avtm').offset().top - 1);
	    if (BrowserDetect.browser == 'Explorer'){
		$('#avtmsub').css('left', $('#avtm').position().left);
	    } else {
		$('#avtmsub').css('left', $('#avtm').position().left + $('#squidaccounting').width() + 5);
	    }
	    avtmSubOpen = 1;
	    $('#avtm').addClass('triggered');
	    $('#avtmsub').slideDown();
	} else {
	    $('#avtmsub').slideUp('fast');
	    $('#avtm').removeClass('triggered');
	    avtmSubOpen = 0;
	}
	
    });$('#oscanless').click(function () {
	window.location = '/oscan/oscan.html';
    });
    $('#rrdtool').click(function () {
	window.location = '/rrdtool';
    });
    $('#netflow').click(function () {
	window.location = 'http://flowstat.norman-vivat.ru/devel/';
    });
    $('#awstats').click(function () {
	window.location = 'http://stats.bobresto.ru';
    });
    $('#handbook').click(function () {
	window.location = '/handbook/';
    });
    $('#jabber').click(function () {
	window.location = 'http://jabber.norma.perm.ru/';
    });
    $('#nagios').click(function () {
	window.location = 'http://nagios.norma.perm.ru/';
    });
    $('#topex').click(function () {
	window.location = 'http://topex.norma.perm.ru/';
    });
    $('#milter-callback').click(function () {
	window.location = 'http://tech.hq.norma.perm.ru/milter-callback/';
    });
    $('#sparkweb').click(function () {
	window.location = 'http://sparkweb.norma.perm.ru/';
    });
    $('#kb958644').click(function () {
	window.location = '/kb958644/';
    });
    $('#tmfixtool').click(function () {
	window.location = '/tmfixtool/';
    });
    $('#genciscoconf').click(function () {
	window.location = '/genciscoconf/';
    });
    $('#dialup').click(function () {
	window.location = 'http://37.hq.norma.perm.ru/cgi-bin/dial-up.pl';
    });
    $('#cups').click(function () {
	window.location = 'http://cups.hq.norma.perm.ru:631/';
    });
    $('#snoopy').click(function () {
	window.location = '/cgi-bin/snoopy';
    });
    $('#proxy1').live('click', function () {
	window.location = 'http://tech.hq.norma.perm.ru/squid-accounting/kamtelecom/';
    });
    $('#proxy2').live('click', function () {
	window.location = 'http://tech.norma.perm.ru/squid/';
    });
    $('#proxy3').live('click', function () {
	window.location = 'http://samara.norma.perm.ru/squid/';
    });
    $('#proxy4').live('click', function () {
	window.location = 'http://tech.norman-neva.spb.ru/squid/';
    });
    $('#proxy5').live('click', function () {
	window.location = 'http://crystal.norma.perm.ru/squid/';
    });
    $('#proxy6').live('click', function () {
	window.location = 'http://moscow.norma.perm.ru/squid/';
    });
    $("#squidaccounting").mouseover(function () {
	$("#squidaccounting img:first-child").attr('src', 'images/menubracket-focused.gif');
    });
    $("#squidaccounting").mouseout(function (e) {
	$("#squidaccounting img:first-child").attr('src', 'images/menubracket-unfocused.gif');
    });
    
    $('#squidaccounting').click(function() {
	if (squidSubOpen == 0) {
	    $('#squidaccounting').stop(true, true);
	    $('.footer').add('<div class="submenu" id="squidsub"><div class="subentry" id="proxy6">Москва</div><div class="subentry" id="proxy1">Космонавтов, 65</div><div class="subentry" id="proxy2">Хасана, 98</div><div class="subentry" id="proxy3">Самара</div><div class="subentry" id="proxy4">СПб</div><div class="subentry" id="proxy5">Уральская, 85</div></div>').appendTo(document.body);
	    $('#squidsub').css('top', $('#squidaccounting').offset().top - 1);
	    if (BrowserDetect.browser == 'Explorer'){
		$('#squidsub').css('left', $('#squidaccounting').position().left);
	    } else {
		$('#squidsub').css('left', $('#squidaccounting').position().left + $('#squidaccounting').width() + 5);
	    }
	    squidSubOpen = 1;
	    $('#squidaccounting').addClass('triggered');
	    $('#squidsub').slideDown();
	} else {
	    $('#squidsub').slideUp('fast');
	    $('#squidaccounting').removeClass('triggered');
	    squidSubOpen = 0;
	}
    });
    
    $("#rrdtool").mouseover(function () {
	$("#rrdtool img:first-child").attr('src', 'images/menubracket-focused.gif');
    });
    $("#rrdtool").mouseout(function () {
	$("#rrdtool img:first-child").attr('src', 'images/menubracket-unfocused.gif');
    });
});

