function BlockSub(name)
{
	try {
		var bl = document.getElementById(name);
		var bls = document.getElementById(name + '-sub');
		
		bl.className = (bl.className == '') ? 'active' : '';
		bls.className = (bls.className == '') ? 'dn' : '';
	}
	catch(e) { }
}


//project logos
var currentImg = 0; 
//scroll none blocked
var scroll = 0;

function mail(user,domain,subject)
{
  if (subject == '')
  {
    loc = "mailto:" + user + "@" + domain;
  }
  else
  {
    loc = "mailto:" + user + "@" + domain + "?subject=" + subject + "";
  }
  
  window.location = loc;
}

function confirmation(text, loc)
{
	if (confirm(text)) {
		location.replace(loc)
	}
}

function diving(div_id)
{
  if (document.getElementById(div_id).style.display == "none")
  {
    document.getElementById(div_id).style.display="block";
  }
  else
  {
    document.getElementById(div_id).style.display="none";
  }
}



function ScrollStart(dir)
{
  scroll = 0;
  ScrollDiv(dir);
}
function ScrollStop()
{
  scroll = 1;
}

function ScrollDiv(dir)
{ 
   if (dir == "up")
   { 
     currentImg--; 
   } 
   else if (dir == "down")
   { 
     currentImg++; 
   } 
   
   if (currentImg < 0) currentImg=0;

   var div = document.getElementById("logos"); 
   div.scrollTop = (currentImg * 5); 
   
   if (scroll != 1)
   {
     setTimeout("ScrollDiv('"+dir+"')", 100);
   }
} 




function Drobilki(dr)
{
	var d = document.getElementById('d-' + dr);
	var template = /small/;
	
	if (!template.test(d.src)) {
		d.src=d.src.replace(/big/, 'small');
	}
	else {
		d.src=d.src.replace(/small/, 'big');
	}
}


function ActivateSelect(el, selects)
{
	if (el.checked) {
		$('#' + selects).attr('disabled', '');
	}
	else {
		$('#' + selects).attr('disabled', 'disabled');
	}
}

var timer1 = 0;
var timer2 = 0;
var timer3 = 0;
var timer4 = 0;
var timer5 = 0;

var timering=500;

var selected_vid = 1;
function VidShow(aid)
{
	clearTimeout(timer1);
	clearTimeout(timer2);
	clearTimeout(timer3);
	clearTimeout(timer4);
	clearTimeout(timer5);
	
	if (aid == selected_vid) {
		return(false);
	}

	timer1 = setTimeout(function(){$('#vid-' + aid).slideDown('fast');}, timering);
	if (selected_vid > 0) {
		timer2 = setTimeout(function(){$('#vid-' + selected_vid).slideUp('fast');}, timering);
	}
	
	timer5 = setTimeout(function(){$('#vid-t-' + selected_vid).removeClass('items');}, timering);
	timer4 = setTimeout(function(){$('#vid-t-' + aid).addClass('items');}, timering);
	timer3 = setTimeout(function(){selected_vid = aid;}, timering);
}

var selected_art = 1;
function ArtShow(aid)
{
	clearTimeout(timer1);
	clearTimeout(timer2);
	clearTimeout(timer3);
	clearTimeout(timer4);
	clearTimeout(timer5);
	
	if (aid == selected_art) {
		return(false);
	}
	
	timer1 = setTimeout(function(){$('#art-' + aid).slideDown('fast');}, timering);
	if (selected_art > 0) {
		timer2 = setTimeout(function(){$('#art-' + selected_art).slideUp('fast');}, timering);
		
	}
	
	timer5 = setTimeout(function(){$('#art-t-' + selected_art).removeClass('items');}, timering);
	timer4 = setTimeout(function(){$('#art-t-' + aid).addClass('items');}, timering);
	timer3 = setTimeout(function(){selected_art = aid;}, timering);
}

var selected_hu = 1;
function HuShow(aid)
{
	clearTimeout(timer1);
	clearTimeout(timer2);
	clearTimeout(timer3);
	clearTimeout(timer4);
	clearTimeout(timer5);
	
	if (aid == selected_hu) {
		return(false);
	}
	
	timer1 = setTimeout(function(){$('#hu-' + aid).slideDown('fast');}, timering);
	if (selected_hu > 0) {
		timer2 = setTimeout(function(){$('#hu-' + selected_hu).slideUp('fast');}, timering);
	}
	
	timer5 = setTimeout(function(){$('#hu-t-' + selected_hu).removeClass('items');}, timering);
	timer4 = setTimeout(function(){$('#hu-t-' + aid).addClass('items');}, timering);
	timer3 = setTimeout(function(){selected_hu = aid;}, timering);
}


function ShowVideo(vid)
{
	window.open('/video/kit_video0' + vid + '.html', 'video', 'resizable=yes,scrollbars=yes,width=630,height=480,top=0');
	return(false);
}
