
function toggle_menu(element) 
{
	if(element.getNext('ul'))
	{
		if(element.getNext('ul').hasClass('hide')) {
			element.getNext('ul').removeClass('hide');
		} else {
			element.getNext('ul').addClass('hide');
		}
	}
	else {
		url = element.get('href');
		window.location = url;
	}

}


function send_form(form, dest, url)
{
   $(form).elements['ajax_method'].value = 'yes';
	$(form).set('send', {
      onRequest: function() {},
      onTimeout: function() {alert('Ajax timeout.');},
	  onComplete: function(response) {
         $(dest).set('html', response);
         if ($('reCaptcha')) {createRecaptcha();}
      }
	});
   $(form).send(url);
}

function createRecaptcha() {
    Recaptcha.create("6LeIS80SAAAAAJhMO2zEp8b-kn6qhUAscxydkiJT",
        "reCaptcha",
        {
          theme: "red",
          callback: Recaptcha.focus_response_field
        }
    );
}


function print_data(data) {
 top.wRef=window.open('','myconsole',
  'width=980,height=450,left=10,top=10'
   +',menubar=1'
   +',toolbar=0'
   +',status=1'
   +',scrollbars=1'
   +',resizable=1')
 top.wRef.document.writeln(
  '<html><head><title>Debug</title></head>'
 +'<body style="font-family: Verdana; font-size: 13px;" onLoad="self.focus()">');
 top.wRef.document.writeln(data+'</body></html>')
 top.wRef.document.close()
}

