/* Replacement for German characters in javascript
	Chr	Replacement
	ä	\344
	ö	\366
	ü	\374
	Ä	\304
	Ö	\326
	Ü	\334
	ß	\337
*/
imgsrc='http://www.guestbook24.eu/i/';
forumcodesrc='http://www.guestbook24.eu/';

// function for UBB code
if (navigator.appName.indexOf("Microsoft")!=-1 && navigator.userAgent.indexOf("Opera") ==-1)
	ie=true;
else
	ie=false;
var isSelected=false;
var toinsertObj='';

function TagButtons(){
	outputtxt='&nbsp;<input class="wmfc" type="button" value="[B]" onclick="insertTag(\'[B]\',\'[/B]\')"> ';
	outputtxt+='<input class="wmfc" type="button" value="[I]" onclick="insertTag(\'[I]\',\'[/I]\')"> ';
	outputtxt+='<input class="wmfc" type="button" value="[IMG]" onclick="insertTag(\'[IMG]\',\'[/IMG]\')"> ';
	outputtxt+='<input class="wmfc" type="button" value="[URL]" onclick="insertTag(\'[URL]\',\'[/URL]\')"> ';
	outputtxt+='<input class="wmfc" type="button" value="[LIST]" onclick="insertTag(\'[LIST]\',\'[/LIST]\')"> ';
	outputtxt+='<input class="wmfc" type="button" value="[*]" onclick="insertTag(\'[*]\',\'\')"> ';
	outputtxt+='<input class="wmfc" type="button" value="[QUOTE]" onclick="insertTag(\'[QUOTE]\',\'[/QUOTE]\')"> ';
	outputtxt+='<input class="wmfc" type="button" value="[CODE]" onclick="insertTag(\'[CODE]\',\'[/CODE]\')"><br />';
	document.write(outputtxt);
	outputtxt='';
}

function write_emoticon(e) {
	output='<tr><td class="wmalright">Post Icons:</td><td><table border="0" cellspacing="0" cellpadding="3"><tr>';
	alt=new Array("Laugh","Disappoint","Anger","Evil","Important","Haehhh??","Winking","Thanks!","Info!","Idea!");
	for (i=1;i<=10;i++){
		output=output+'<td class="wmalcent"><input type="radio" name="em" value="'+i+'"';
		if (e==i)
			output=output+' checked="checked"';
		output=output+' /><br /><img src="'+imgsrc+i+'.gif" hspace="2" alt="'+alt[i-1]+'" /></td>';
	}
	output=output+'<td class="wmalcent wmaltop"><input type="radio" name="em" value="0"';
	if (e==0)
		output=output+' checked="checked"';
	output=output+' /><br />&nbsp;K.A.</td></tr></table></td></tr>';	
	document.write(output);
}


function markSelection(thistextObj){
	if (toinsertObj!=thistextObj)
		toinsertObj=thistextObj
	if(typeof document.selection != 'undefined')
		thisSelection=document.selection.createRange();
}

function insertTag(tvs,tve){
	if (toinsertObj=='')
		return
	toinsertObj.focus();
	if(typeof document.selection != 'undefined'){
		range_text_length = thisSelection.text.length;
		thisSelection.text = tvs+thisSelection.text+tve;
		if (range_text_length==0)
			thisSelection.move('character', -tve.length);
		thisSelection.select();
	}
	else if(typeof toinsertObj.selectionStart != 'undefined'){
		sec_start = toinsertObj.selectionStart;
		sec_end = toinsertObj.selectionEnd;
		sec_insText = toinsertObj.value.substring(sec_start,sec_end);
		toinsertObj.value = toinsertObj.value.substr(0, sec_start) + tvs + sec_insText + tve + toinsertObj.value.substr(sec_end);
		new_pos=0;
		if (sec_insText.length==0)
			new_pos = sec_start + tvs.length;
		else
			new_pos = sec_start+tvs.length+sec_insText.length+tve.length;
		toinsertObj.selectionStart=new_pos;
		toinsertObj.selectionEnd=new_pos;
	}
	else{
		toinsertObj.value+=tvs + tve;
	}
}

function DoSmilie(addSmile) 
{
	var revisedMessage;
	var currentMessage = document.f1.message.value;
	revisedMessage = currentMessage+addSmile;
	document.f1.message.value=revisedMessage;
	document.f1.message.focus();
}

function chk_len(){
	ev=document.f1.message.value;
	ev=ev.replace(/^\s+/g,'').replace(/\s+$/g,'');
	postlen=ev.length;
	alert('Your message is '+postlen+' characters long.');
}

function write_smilies(paid,code){
output='<table class="wmtbl"><tr><td class="wmalright"></td></tr>';
	if(paid && code){
		output=output+'<tr><td class="wmalright"><a href="javascript: DoSmilie(\' :) \');"><img src="'+imgsrc+'1.gif" hspace="5" vspace="3" border="0" alt="Smile" /></a><a href="javascript: DoSmilie(\' :( \');"><img src="'+imgsrc+'2.gif" hspace="5" vspace="3" border="0" alt="Disappoint" /></a><a href="javascript: DoSmilie(\' :mad: \');"><img src="'+imgsrc+'4.gif" hspace="5" vspace="3" border="0" alt="Evil" /></a><br /><a href="javascript: DoSmilie(\' ;) \');"><img src="'+imgsrc+'7.gif" hspace="5" vspace="3" border="0" alt="Winking" /></a><a href="javascript: DoSmilie(\' :D \');"><img src="'+imgsrc+'11.gif" hspace="5" vspace="3" border="0" alt="Cheeeese" /></a><a href="javascript: DoSmilie(\' :o \');"><img src="'+imgsrc+'12.gif" hspace="5" vspace="3" border="0" alt="Surprise" /></a></td></tr>';
	}
	else
		output=output+'<tr><td><br /><br /><br /><br /><br /><br /></td></tr>';
	output=output+'<tr><td class="wmalright">';
	if (code){
		output=output+'<a href="'+forumcodesrc+'fc2_a.htm" target="_blank">Forum-Code</a><br />'
	}
	output=output+'<a href="javascript:chk_len();">Post length</a></td></tr></table>';
	document.write(output);
}

google_ad_client = 'pub-4454927567272798';
google_ad_channel = '5537623243';
google_ad_output = 'js';
google_max_num_ads = '6';
google_ad_type = 'text';
google_image_size = '728x90';
google_feedback = 'on';

function google_ad_request_done(google_ads) {
	var i;
	if (google_ads.length == 0) {
		return;
	}
	if (google_ads[0].type == "html") {
		s += google_ads[0].snippet;
	}
	else {
		s1 += '<div class="wmhrbox"><hr class="wmhr"></div><div class="wmentrybox"><div align="right"><a href="' + google_info.feedback_url + '">Sponsored Links</a></div>';
		s2=s1;
		s3=s1;
		for(i = 0; i < google_ads.length; ++i) {
			if (i<2) {	
				s1 += '<div><a href="' +
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\' ' +
				google_ads[i].visible_url + '\';return true"><b>' +
				google_ads[i].line1 + '</b></a></div><div>' +
				google_ads[i].line2 + ' ' + 
				google_ads[i].line3 + '</div><div style="margin-bottom:10px;"><a href="' +
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\' ' +
				google_ads[i].visible_url + '\';return true">' +
				google_ads[i].visible_url + '</a></div>';
			}
			else if (i<4) {
				s2 += '<div><a href="' +
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\' ' +
				google_ads[i].visible_url + '\';return true"><b>' +
				google_ads[i].line1 + '</b></a></div><div>' +
				google_ads[i].line2 + ' ' + 
				google_ads[i].line3 + '</div><div style="margin-bottom:10px;"><a href="' +
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\' ' +
				google_ads[i].visible_url + '\';return true">' +
				google_ads[i].visible_url + '</a></div>';
			}
			else if (i>3) {
				s3 += '<div><a href="' +
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\' ' +
				google_ads[i].visible_url + '\';return true"><b>' +
				google_ads[i].line1 + '</b></a></div><div>' +
				google_ads[i].line2 + ' ' + 
				google_ads[i].line3 + '</div><div style="margin-bottom:10px;"><a href="' +
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\' ' +
				google_ads[i].visible_url + '\';return true">' +
				google_ads[i].visible_url + '</a></div>';
			}
		}
	s1=s1+'</div>';
	s2=s2+'</div>';
	s3=s3+'</div>';
	}
    return;
}