//Служебная библиотека Лаборатории Ватсона;
//Можете даже не пионерить, тут нет ничего гениального;
//Двумя первыми Интернеты набиты чуть более, чем полностью;
//Остальное написано мною по-нубски)))

function toggle_show(id)
{
document.getElementById(id).style.display = document.getElementById(id).style.display == 'none' ? 'block' : 'none';
}

function toggle_show_inline(id)
{
	document.getElementById(id).style.display=document.getElementById(id).style.display=='none'?'inline':'none';
}

function pause(ms)
{
	setTimeout(";",ms);
}

var smheights={},stostack=[];

getsmhide=function(object,height,step,delay,curr){return function(){smhide(object,height,step,delay,curr);};}

getsmshow=function(object,height,step,delay,curr){return function(){smshow(object,height,step,delay,curr);};}

function smhide(object,height,step,delay,curr){
	object.style.overflow="hidden";
	var curr,step,delay;
	if(!delay){delay=1;}
	if(!curr){curr=object.style.height.slice(0,object.style.height.indexOf('px'));}
	if(!step){step=1;}
	if(curr>0){
		curr-=step;
		object.style.height=curr+'px';
		setTimeout(getsmhide(object,height,step,delay,curr),delay);
	}else{
		object.style.display="none";
		for(var sto_i=0;sto_i<stostack.length;sto_i++){if(stostack[sto_i]==object.id) stostack[sto_i]=null;}
	}
}

function smshow(object,height,step,delay,curr){
	object.style.display="";
	var curr,step,delay;
	if(!curr){curr=0;}
	if(!step){step=1;}
	if(!delay){delay=1;}
	if(curr<height){
		curr+=step;
		object.style.height=curr+'px';
		setTimeout(getsmshow(object,height,step,delay,curr),delay);
	}else{
		object.style.overflow="";
		for(var sto_i=0;sto_i<stostack.length;sto_i++){if(stostack[sto_i]==object.id) stostack[sto_i]=null;}
	}
}

function smtoggle(id,height,step,delay)
{
	for(var sto_i=0;sto_i<stostack.length;sto_i++){if(stostack[sto_i]==id) return false;}
	stostack.push(id);
	var object,height,step,delay;
	object=document.getElementById(id);
	if(!height){
		if(smheights[id]){height=smheights[id];
		}else{
			height=object.style.height.slice(0,object.style.height.indexOf('px'));}}
	if(object.style.height=="0px"){
		smshow(object,height,step,delay);
	}else{
		smheights[id]=object.style.height.slice(0,object.style.height.indexOf('px'));
		smhide(object,height,step,delay);}
}

function writeerr(error)
{
	document.write("<font color=red><h5><b>JFastScript(v. "+JFastScript_version+") Error:<br>"+error+"</b></h5></font>");
}

isChild=function(t,v){
if(t&&v){
var list=v.getElementsByTagName('*');
for(var i=0,e;e=list[i];i++){if(t==e){return true;}}}
return false;}

function pollsubmit(id)
{
	wgpaobj.xmlhttpconnect('/poll/','POST',document.getElementById('id'),pollcallback);
}

function pollcallback(a)
{
	var b=a.responseHTML;
	switch(b)
	{
		case 0:
			alert('Ваш голос засчитан.');
			break;
		case 1:
			alert('Ошибка: неверный ID опроса.');
			break;
		case 2:
			alert('Ошибка: вы уже голосовали в этом опросе.');
			break;
		case 3:
			alert('Ошибка: ответ не входит в допустимые границы.');
			break;
		case 4:
			alert('Ваш голос изменён.');
			break;
	}
}