$(document).ready(function() {

/*
$("ul#topnav").hover(function() { 
	document.getElementById("b2").style.zIndex='219900';
});

$("ul#topnav").out(function() { 
	document.getElementById("b2").style.zIndex='19900';
});
*/

$("ul#topnav li").hover(function() { 
	$(this).find("span").show();
	document.getElementById("b2").style.zIndex='219900';
} , function() {
	$(this).css({ 'background' : 'none'}); 
	$(this).find("span").hide();
	document.getElementById("b2").style.zIndex='19900';
});


$("a#v2ln").click(function() { 

	var state = document.getElementById("xv3").name;
	if (state == 0) {
	document.getElementById("xv3").style.visibility = "hidden";
	document.getElementById("xv3").name = 1;
	}
	else {
	document.getElementById("xv3").style.visibility = "visible";
	document.getElementById("xv3").name = 0;
	}
	
});

$("a#v2lni").click(function() { 

	var state = document.getElementById("xv3").name;
	if (state == 0) {
	document.getElementById("xv3").style.visibility = "hidden";
	document.getElementById("xv3").name = 1;
	}
	else {
	document.getElementById("xv3").style.visibility = "visible";
	document.getElementById("xv3").name = 0;
	}
	
});


$("a#v2lnp").click(function() { 

	var state = document.getElementById("xv31").name;
	if (state == 0) {
	document.getElementById("xv31").style.visibility = "hidden";
	document.getElementById("xv31").name = 1;
	}
	else {
	document.getElementById("xv31").style.visibility = "visible";
	document.getElementById("xv31").name = 0;
	}
	
});

$("a#v2lnip").click(function() { 

	var state = document.getElementById("xv31").name;
	if (state == 0) {
	document.getElementById("xv31").style.visibility = "hidden";
	document.getElementById("xv31").name = 1;
	}
	else {
	document.getElementById("xv31").style.visibility = "visible";
	document.getElementById("xv31").name = 0;
	}
	
});


$("a#v3ln").click(function() { 

	var state = document.getElementById("xv4").name;
	if (state == 0) {
	document.getElementById("xv4").style.visibility = "hidden";
	document.getElementById("xv4").name = 1;
	}
	else {
	document.getElementById("xv4").style.visibility = "visible";
	document.getElementById("xv4").name = 0;
	}
	
});

$("a#v4ln").click(function() { 

	var state = document.getElementById("xv4").name;
	if (state == 0) {
	document.getElementById("xv4").style.visibility = "hidden";
	document.getElementById("xv4").name = 1;
	}
	else {
	document.getElementById("xv4").style.visibility = "visible";
	document.getElementById("xv4").name = 0;
	}
	
});

/* Del*/
$("a#ash").click(function() { 

	var state = document.getElementById("amap").title;
	if (state == 0) {
  	document.getElementById("amap").style.backgroundImage = "url(/i/map42.jpg)";
	document.getElementById("amap").title = 1;
	jQuery('a#ash').html('Скрыть возможности');
	document.getElementById("dsh").style.width="236px";
	}
	else {
  	document.getElementById("amap").style.backgroundImage = "url(/i/map4.jpg)";
	document.getElementById("amap").title = 0;
	jQuery('a#ash').html('Показать возможности');
	document.getElementById("dsh").style.width="254px";
	}
	
});
/* Del*/

$("#bs").click(function() { 

				var cod = '<img src=/i/loader.gif border=0>';
				$("#onlineone").html(cod);
				var ur=showLoc();
				var xx1= 'http://' + ur + '/cgi-bin/check.cgi';					
				$.ajax({
					type: "POST",
					url: xx1,
					data: "is="+$("#is").val(),
					success: function(html){
						$("#onlineone").html(html);
				   	}
				});
				return false;
	
});

/*
$("a#showtransport").click(function() { 

				var cod = '<img src=/i/loader.gif border=0>';
				$("#onlineone").html(cod);
				var ur=showLoc();
				var xx1= 'http://' + ur + '/cgi-bin/check.cgi';					

				$.ajax({
					type: "POST",
					url: xx1,
					data: "is=",
					success: function(html){
						$("#onlineone").html(html);
				   	}
				});
				return false;
	
});	
*/

$("a#showocher").click(function() { 

				var cod = '<img src=/i/loader.gif border=0>';
				$("#ocher").html(cod);
				var ur=showLoc();
				var xx1= 'http://' + ur + '/cgi-bin/pto.cgi';				

				$.ajax({
					type: "POST",
					url: xx1,
					data: "is=",
					success: function(html){
						$("#ocher").html(html);
				   	}
				});
				return false;
	
});	

$("a#showetap").click(function() { 



				var cod = '<img src=/i/loader.gif border=0>';
				$("#etap").html(cod);
				var ur=showLoc();
				var xx1= 'http://' + ur + '/cgi-bin/pto06529/item.cgi';
								
				$.ajax({
					type: "POST",
					url: xx1,
					data: "is=",
					success: function(html){
						$("#etap").html(html);
				   	}
				});
				return false;
	
});	


$("input#SendO3").click(function() { 

				var outstr = '';
				var pdata = "d1="+$("#Szdvopros").val()+"\&d2="+$("#Szdvoprosi").val();
				var cod = '<img src=/i/loader.gif border=0>';
				$("#zdvsh").html(cod);
				var ur=showLoc();
				var Surl= 'http://' + ur + '/cgi-bin/post.cgi';					
				$.ajax({
					type: "POST",
					url: Surl,
					data: pdata,
					success: function(html){
						$("#zdvsh").html(html);
						$("#Szdvopros").val(outstr);
				   	}
				});

return false;
});

ShowTam();
ShowOcher();
ShowFiz();
ShowEtap();
ShowSTO();
ShowTrans();
ShowProc();

});



function ShowTam() {

				var cod = '<img src=/i/loader.gif border=0>';
				$("#onlineone").html(cod);
				var ur=showLoc();
				var xx1= 'http://' + ur + '/cgi-bin/check7.cgi';
				$.ajax({
					type: "POST",
					url: xx1,
					data: "is=1",
					success: function(html){
						$("#onlineone").html(html);
				   	}
				});
				return false;
}


function ShowOcher() {

				var cod = '<img src=/i/loader.gif border=0>';
				$("#ocher").html(cod);
				var ur=showLoc();
				var xx1= 'http://' + ur + '/cgi-bin/pto.cgi';
				$.ajax({
					type: "POST",
					url: xx1,
					data: "is=1",
					success: function(html){
						$("#ocher").html(html);
				   	}
				});
				return false;
}

function ShowEtap() {

				var cod = '<img src=/i/loader.gif border=0>';
				$("#etap").html(cod);
				var ur=showLoc();
				var xx1= 'http://' + ur + '/cgi-bin/pto06529/item.cgi';
				$.ajax({
					type: "POST",
					url: xx1,
					data: "is=1",
					success: function(html){
						$("#etap").html(html);
				   	}
				});
				return false;
}

function ShowSTO() {

				var cod = '<img src=/i/loader.gif border=0> Загрузка данных...';
				$("#avrem").html(cod);
				var ur=showLoc();
				var xx1= 'http://' + ur + '/cgi-bin/sto/sto.cgi';
				$.ajax({
					type: "POST",
					url: xx1,
					data: "is=1",
					success: function(html){
						$("#avrem").html(html);
				   	}
				});
				return false;
}

function ShowTrans() {

				var cod = '<img src=/i/loader.gif border=0> Загрузка данных...';
				$("#svtra").html(cod);
				var ur=showLoc();
				var xx1= 'http://' + ur + '/cgi-bin/transport/out.cgi';
				$.ajax({
					type: "POST",
					url: xx1,
					data: "is=1",
					success: function(html){
						$("#svtra").html(html);
				   	}
				});
				return false;
}

function ShowFiz() {

				var cod = '<img src=/i/loader.gif border=0> Загрузка данных...';
				$("#fizlic").html(cod);
				var ur=showLoc();
				var xx1= 'http://' + ur + '/cgi-bin/avtofizlic/out.cgi';
				$.ajax({
					type: "POST",
					url: xx1,
					data: "is=1",
					success: function(html){
						$("#fizlic").html(html);
				   	}
				});
				return false;
}

function ShowProc() {

				var ur=showLoc();
				var xx1= 'http://' + ur + '/cgi-bin/sto/z.cgi';
				$.ajax({
					type: "POST",
					url: xx1,
					data: "is=1",
					success: function(html){
						if (html == 100) { document.getElementById('znakzn').style.cssText='padding:36px 0px 36px 0px;' } 
						var hy=document.getElementById('znakzn').style.cssText;

						$("#proc").html(html);
						$("#znakzn").html(html);
				   	}
				});
				return false;
}



function showLoc() {
   var x = window.location;
   var t = ['Property - Typeof - Value', 'window.location - ' + (typeof x) + ' - ' + x ];
   for (var prop in x){
    t.push(prop + ' - ' + (typeof x[prop]) + ' - ' +  (x[prop] || 'n/a'));
	if(prop == 'hostname') {var dd=x[prop]}
   }

	return (dd);
}
