function newWin(){
	win = window.open("", "display", "width=550, height=600, scrollbars=yes, left=10, top=10");
}
var browserName=navigator.appName;var browserVer=parseInt(navigator.appVersion);var version="";var msie4=(browserName=="Microsoft Internet Explorer"&&browserVer>=4);if((browserName=="Netscape"&&browserVer>=3)||msie4||browserName=="Konqueror"||browserName=="Opera"){version="n3";}else{version="n2";}
function blurLink(theObject){theObject.blur();}
function decryptCharcode(n,start,end,offset){n=n+offset;if(offset>0&&n>end){n=start+(n-end-1);}else if(offset<0&&n<start){n=end-(start-n-1);}
return String.fromCharCode(n);}
function decryptString(enc,offset){var dec="";var len=enc.length;for(var i=0;i<len;i++){var n=enc.charCodeAt(i);if(n>=0x2B&&n<=0x3A){dec+=decryptCharcode(n,0x2B,0x3A,offset);}else if(n>=0x40&&n<=0x5A){dec+=decryptCharcode(n,0x40,0x5A,offset);}else if(n>=0x61&&n<=0x7A){dec+=decryptCharcode(n,0x61,0x7A,offset);}else{dec+=enc.charAt(i);}}
return dec;}
function linkTo_UnCryptMailto(s){location.href=decryptString(s,-2);}

$(document).ready(function() {
	if($('.news_single').length) {
		var title = $('.news_single > h2').text();
		var desc 	= $('.news_single > h3').text();
		var p 		= escape(document.URL);
		var pt		= p;
		var a 		= '<p style="margin: 5px 0px;"><b>Social Networks:</b></p>';
		
		$('head').append('<meta name="title" content="'+title+'" />');
		$('head').append('<meta name="description" content="'+desc+'" />');
		
		title = _utf8_encode(title);
		
		$.ajax({
			type: 'POST',
	  	async: false,
  		url: 'fileadmin/scripts/curl_isgd.php',
	  	data: 'longurl='+p,
  		success: function(data) {
				if(data != '') 
					pt = data;
  		}
		});

		a += '<ul id="sn">';
		a += '<li><a href="http://de.facebook.com/sharer.php?u='+p+'&amp;t='+title+'" target="_blank" title="Facebook"><img src="fileadmin/tpl/img/icons/social_network/facebook_16.png" alt="Facebook" height="16" width="16"></a></li>';
		a += '<li><a href="http://twitter.com/home?status='+pt+'" target="_blank" title="Twitter"><img src="fileadmin/tpl/img/icons/social_network/twitter_16.png" alt="Twitter" height="16" width="16"></a></li>';
		a += '<li><a href="http://www.myspace.com/index.cfm?fuseaction=postto&amp;u='+p+'&amp;t='+title+'" target="_blank" title="MySpace"><img src="fileadmin/tpl/img/icons/social_network/myspace_16.png" alt="MySpace" height="16" width="16"></a></li>';
		a += '</ul>';

		$('.news_single').append(a);
	}
})

function _utf8_encode(string) {
	string = string.replace(/\r\n/g,"\n");
	var utftext = "";

	for (var n = 0; n < string.length; n++) {

		var c = string.charCodeAt(n);

		if (c < 128) {
			utftext += String.fromCharCode(c);
		}
		else if((c > 127) && (c < 2048)) {
			utftext += String.fromCharCode((c >> 6) | 192);
			utftext += String.fromCharCode((c & 63) | 128);
		}
		else {
			utftext += String.fromCharCode((c >> 12) | 224);
			utftext += String.fromCharCode(((c >> 6) & 63) | 128);
			utftext += String.fromCharCode((c & 63) | 128);
		}

	}

	return utftext;
}
	
function _utf8_decode(utftext) {
	var string = "";
	var i = 0;
	var c = c1 = c2 = 0;

	while ( i < utftext.length ) {

		c = utftext.charCodeAt(i);

		if (c < 128) {
			string += String.fromCharCode(c);
			i++;
		}
		else if((c > 191) && (c < 224)) {
			c2 = utftext.charCodeAt(i+1);
			string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
			i += 2;
		}
		else {
			c2 = utftext.charCodeAt(i+1);
			c3 = utftext.charCodeAt(i+2);
			string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
			i += 3;
		}

	}

	return string;
}
