	function send_test(el){
	
	if(el!='start')
		$("#"+el).addClass("active");
	else
		$("#"+el).addClass("active2");
			
			$.post("danetka.php", { is_ajax: "1", a0: $("#"+el).attr('value'), current: $("#current").attr('value'), answers: $("#answers").attr('value')
			}, 
	function(data){
		if(data.match('0')) {
		$('form#test').remove();
		$('#danetka').append(data);
		}
		else {}
		if(el!='start')
			$("#"+el).removeClass("active");
		else
			$("#"+el).removeClass("active2");
	}, 
	'text'
	);
		$('#danetka').removeClass('about');
		$('#danetka').removeClass('result');
		$('#danetka').removeClass('question');
		if($('#current').attr('value')=='5')
			$('#danetka').addClass('result');
		else
			$('#danetka').addClass('question');
	
		}//f
		
	function $get(id) {
  if (typeof id == "string") {
    return document.getElementById(id)
  }
  return id
}

function initTest(){
	var a_true=$get('true');
	a_true.href="<?php bloginfo('url') ?>/?test=<?php echo $hash ?>#";
	a_true.onclick = function () { var form_true=$get('form_true'); form_true.submit(); return false;}
	var a_false=$get('false');
	a_false.href="<?php bloginfo('url') ?>/?test=<?php echo $hash ?>#";
	a_false.onclick = function () { document.form_false.submit(); return false;}
	codes
	document.getElementById('codes').onclick = function () {document.getElementById('codes').style.display='none'; return false;}
}

function addLoadEvent(func)
{	
	var oldonload = window.onload;
	if (typeof window.onload != 'function'){
    	window.onload = func;
	} else {
		window.onload = function(){
		oldonload();
		func();
		}
	}

}

addLoadEvent(initTest);


