function show_recaptcha(element) 
{
	Recaptcha.destroy();
  	Recaptcha.create("6LfkUgkAAAAAAIUyuDsjKTirFdb0yyWkFSXHYyAJ", element, {
        theme: 'custom',
        tabindex: 0,
        custom_theme_widget: 'recaptcha'
  	});
}

function show_progress()
{
	$('#loader').css('visibility', 'visible');
}

// Intros auf der Startseite oben
function show_intro(id)
	{
	var ids = new Array('software', 'customers', 'iphone', 'fax-letter-sms', 'howto');
	var i;
	
	for (i = 0; i < ids.length; i++)
		{
		if (id == ids[i])
			{
			$('#intro-' + ids[i]).attr('class', 'on');
			$('#function-' + ids[i]).attr('class', 'on');
			}
		else
			{
			$('#intro-' + ids[i]).attr('class', '');
			$('#function-' + ids[i]).attr('class', '');
			}
		}
	}

// Tabs unter So funktionierts
function show_tab(id)
	{
	var ids = new Array('fax', 'letter', 'sms');
	var i;
	
	for (i = 0; i < ids.length; i++)
		{
		if (id == ids[i])
			{
			$('#tab-' + ids[i]).addClass('on');
			$('#test-form-' + ids[i]).show();
			}
		else
			{
			$('#tab-' + ids[i]).removeClass('on');
			$('#test-form-' + ids[i]).hide();
			}
		}
	}

// Features unter So funktionierts
function show_feature(id)
	{
	if($('#feature-'+id).hasClass('on')==false) {
		$('.elemente').hide();
		$('.elemente').removeClass('on');
		$('#feature-'+id).show();
		$('#feature-'+id).addClass('on');	
		$('#switch-'+id).addClass('on');
	}	
	
	else {
			$('#feature-'+id).hide();
			$('#feature-'+id).removeClass('on');
			$('#switch-'+id).removeClass('on');
		}
	}
	
function add_facebook_script(locale_code)
{
	(function() {
		var s = document.createElement('script');
		var root = document.getElementById('share-box');

		window.fbAsyncInit = function() {
			FB.init({status: true, cookie: true, xfbml: true});
			root.removeChild(s);
		};

		s.async = true;
		s.src = document.location.protocol + '//connect.facebook.net/' + locale_code + '/all.js';
		root.appendChild(s);
	}());
}

function show_faxde_facebook_like_box()
{
	$('#faxde-facebook-like').append('<fb:like-box href="http://www.facebook.com/pages/FAXde-GmbH/135457006519872" width="255" show_faces="false" stream="false" header="false"></fb:like-box>');
}

function show_pcfaxcom_facebook_like_box()
{
	$('#pcfaxcom-facebook-like').append('<fb:like-box href="http://www.facebook.com/pages/PC-FAXcom/194536757242442" width="255" show_faces="false" stream="false" header="false"></fb:like-box>');
}

function show_rechnungde_facebook_like_box()
{
	$('#rechnungde-facebook-like').append('<fb:like-box href="http://www.facebook.com/pages/Rechnungde/195445167141403" width="255" show_faces="false" stream="false" header="false"></fb:like-box>');
}

function show_hqs_facebook_like_box()
{
	$('#hqs-facebook-like').append('<fb:like-box href="http://www.facebook.com/pages/HQS-GmbH/202481756434785" width="255" show_faces="false" stream="false" header="false"></fb:like-box>');
}

function e_decode(mystring)
{
	outstring = '';
	encr = 'ngopmfqkrcslbjtauzvweixhdy(';
	base = 'abcdefghijklmnopqrstuvwxyz@';
	
	for (i=0; i<=mystring.length; i++) {
		c = mystring.substring(i, i + 1);

		for (j=0; j<=base.length; j++) {
			if (encr.substring(j, j + 1) == c) {
				c = base.substring(j, j + 1);
				break;
			}
		}

		outstring += c;
	}
	
	m1 = 'm';
	m2 = 'ail';
	m3 = 'to:';
	
	document.writeln('<a href="' + m1 + m2 + m3 + outstring + '">' + outstring + '</a>');
}

function get_xmlhttp()
{
	var xmlHttp

	try {
		xmlHttp = new XMLHttpRequest();
	} catch(e) {
		try {
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {
				alert("Your browser does not support AJAX!")
				return false;
			}
		}
	}
	
	return xmlHttp;
}

function make_ajax_request(method, page, params, async, type, response_function)
{
	var xmlHttp = get_xmlhttp();
 
	xmlHttp.onreadystatechange = function() {
		if (xmlHttp.readyState == 4) {
			if (type == 'xml') {
				if (response_function)
					response_function(xmlHttp.responseXML);
				else {
					if (handle_response)
						handle_response(xmlHttp.responseXML);
				}
			} else {
				if (response_function)
					response_function(xmlHttp.responseText);
				else {
					if (handle_response)
						handle_response(xmlHttp.responseText);
				}
			}
		}
	}
	
	if (method == 'POST') {
		xmlHttp.open(method, page, async);
		
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-length", params.length);
		xmlHttp.setRequestHeader("Connection", "close");

		xmlHttp.send(params);	
	} else {
		xmlHttp.open(method, page + '?' + params, async);
		xmlHttp.send(null);	
	}
}
