

function fixPNG(myImage,style)
{
}

function showFieldChange(idd)
{
	if ($(idd).className == "hide")
	{
		$(idd).className = 'show';
	}
	else
	{
		$(idd).className = 'hide';
	}
	return false;
}

function switchProfileTab(index)
{
	$('tab1').className = "";
	$('tab2').className = "";
	
	$('tab1_content').className = "hide";
	$('tab2_content').className = "hide";
	
	$('tab'+index).className = "active";
	$('tab'+index+'_content').className = "show";

	$('tab').value = index;
	if ($('tabSbm')) {
		$('tabSbm').value = "tab" + index;
	}
	if ($('msg')) {
		$('msg').innerHTML = '';
		$('msg').setStyle("display", "none");
	}  
	
	return false;
}

function enable4Sq()
{
	if ($('4sq').checked)
	{
		$('4sq_user').disabled = false; 
		$('4sq_pwd').disabled = false;
	}
	else
	{
		$('4sq_user').disabled = true; 
		$('4sq_pwd').disabled = true;
	}
}

window.addEvent('domready', function() {   
	if ($('4sq'))
	{
		$('4sq').addEvent("change", enable4Sq);
	}

	FB.init("83fe65ea6870f8cccd35edd7d0400ae8", "/typo3conf/ext/fbconnect/res/xd_receiver.htm", { appId: '145398585484895', status: true, cookie: true, xfbml: true });

	Shadowbox.init();

});


function fb_share(title,txt,u)
{
	if (! u)
		u = document.location.href;

	window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent(u) + '&t=' + encodeURIComponent(txt) + '&d=' + encodeURIComponent(title), 'sharer', 'toolbar=0,status=0,width=626,height=436'); return false;
}
function tw_share(txt)
{
	window.open("http://twitter.com/home?status="+encodeURIComponent("Lese jetzt "+txt),'sharer','toolbar=0,status=0,width=626,height=436');
	//window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;
}

function onlogout(key, url) {
	alert('cook');
	delete_cookie(key + '_user');
	delete_cookie(key + '_ss');
	delete_cookie(key + '_session_key');
	delete_cookie(key + '_expires');
	delete_cookie('fbsetting_' + key);
	
}

function delete_cookie(cookie_name) {
	var cookie_date = new Date();  // current date & time
	cookie_date.setTime(cookie_date.getTime() - 1);
	document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
}

function facebook_perm()
{
	var url = "https://graph.facebook.com/oauth/authorize?client_id=";
	url += "145398585484895";
	url += "&scope=publish_stream,offline_access&redirect_uri=";
	url += encodeURIComponent("http://www.gutschein-king.at/mein-profil/");
	url += "&display=popup";

	window.open($('fb-link').href, 'fb', 'width=500px,height=400px;');

	/*FB.Connect.showPermissionDialog("read_stream,publish_stream,offline_access", function (perms) {
		if (!perms) {
			alert('No');
			//continue_without_permission();
		} else {
			debugger;
			alert('Yes');
			//save_session();
		}
	});*/
}

