// Get the HTTP Object
function getHTTPObject(){
   if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
   else if (window.XMLHttpRequest) return new XMLHttpRequest();
   else {
      alert("Your browser does not support AJAX.");
      return null;
   }
}   

// Change the value of the outputText field
function setOutput(){
   if(httpObject.readyState == 4){
      document.getElementById('pingtest').innerHTML = httpObject.responseText;
   }
}

// Implement business logic
function loadSite(){
   httpObject = getHTTPObject();
   if (httpObject != null) {
      httpObject.open("GET", "content.php", true);
      httpObject.send(null);
      httpObject.onreadystatechange = setOutput;
   }
}
 
var httpObject = null;



window.focus();

function copymyip(text) {
 if (window.clipboardData) {
  window.clipboardData.setData('Text', text);
  alert("Ihre IP-Adresse \""+text+"\" befindet sich jetzt in der Zwischenablage.");
 }
 else {
  alert("Sie verwenden Netscape/Mozilla/Firefox bitte per Copy&Paste in die Zwischenablage kopieren.");
 }
}


function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
else
countfield.value = maxlimit - field.value.length;
}

//Smilie POPUP START:
var gibmemysmiliewindow_x = 480;
var gibmemysmiliewindow_y = 260;

function open_gibmemysmilie_window(x_width, y_width, wysiwyg, forumid)
{
		window.open("comments_smilies.php", "Smilies", "statusbar=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,width=" + x_width + ",height=" + y_width);
}
//Smilie POPUP END:


//BBCodes POPUP START:
var bbcodeswindow_x = 340;
var bbcodeswindow_y = 340;

function open_bbcodes_window(x_width, y_width, wysiwyg, forumid)
{
		window.open("comments_bbcodes.php", "BBCodes", "statusbar=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,width=" + x_width + ",height=" + y_width);
}
//BBCodes POPUP END:


//NICHTS ÄNDERN AB HIER!
var userAgent = navigator.userAgent.toLowerCase();
var is_opera  = (userAgent.indexOf('opera') != -1);
var is_saf    = ((userAgent.indexOf('applewebkit') != -1) || (navigator.vendor == "Apple Computer, Inc."));
var is_webtv  = (userAgent.indexOf('webtv') != -1);
var is_ie     = ((userAgent.indexOf('msie') != -1) && (!is_opera) && (!is_saf) && (!is_webtv));
var is_ie4    = ((is_ie) && (userAgent.indexOf("msie 4.") != -1));
var is_moz    = ((navigator.product == 'Gecko') && (!is_saf));
var is_kon    = (userAgent.indexOf('konqueror') != -1);
var is_ns     = ((userAgent.indexOf('compatible') == -1) && (userAgent.indexOf('mozilla') != -1) && (!is_opera) && (!is_webtv) && (!is_saf));
var is_ns4    = ((is_ns) && (parseInt(navigator.appVersion) == 4));
var is_regexp = (window.RegExp) ? true : false;



function getActiveText()
{
	setfocus();
	if ((is_ie && !document.selection) || !document.selection)
	{
		return false;
	}

	var sel = document.selection;
	var rng = sel.createRange();

	if (rng != null && (sel.type == "Text" || sel.type == "None"))
	{
		text = rng.text;
	}
	if (rng != null && theform.textout.createTextRange)
	{
		theform.textout.caretPos = rng.duplicate();
	}
	return true;
}


function gibmemysmilie(thesmilie)
{
	getActiveText();
	var AddSmilie = " " + thesmilie + " ";
	AddText(AddSmilie);
}


function AddText(NewCode)
{
	if (typeof(theform.textout.createTextRange) != "undefined" && theform.textout.caretPos)
	{
		var caretPos = theform.textout.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? NewCode + ' ' : NewCode;
		caretPos.select();
	}
	else if (theform.textout.selectionStart || theform.textout.selectionStart == '0')
	{ // its mozilla and we'll need to re-write entire text
		var start_selection = theform.textout.selectionStart;
		var end_selection = theform.textout.selectionEnd;

		// fetch everything from start of text area to selection start
		var start = (theform.textout.value).substring(0, start_selection);
		// fetch everything from start of selection to end of selection
		var middle = NewCode;
		// fetch everything from end of selection to end of text area
		var end = (theform.textout.value).substring(end_selection, theform.textout.textLength);

		theform.textout.value = start + middle + end;
		setfocus();
		theform.textout.selectionStart = end_selection + middle.length;
		theform.textout.selectionEnd = start_selection + middle.length;
		getActiveText();
		AddTxt = "";
		return;
	}
	else
	{
		theform.textout.value += NewCode;
	}
	setfocus();
	getActiveText();
	AddTxt = "";
}


function setfocus()
{
	theform.textout.focus();
}

function emoticon(smiliecode)
{
document.messageform.message.value += smiliecode;
}


function selectAll() {
	theForm = document.getElementById("deleteForm")
	for (i = 0; i < theForm.elements.length; i++) {
		theForm.elements[i].checked = checkAll
	}
	checkAll = (checkAll) ? false : true
}


function checkAll() {
for (var j = 1; j <= 14; j++) {
box = eval("document.checkboxform.delmsg[]"); 
if (box.checked == false) box.checked = true;
   }
}

function uncheckAll() {
for (var j = 1; j <= 14; j++) {
box = eval("document.checkboxform.delmsg[]"); 
if (box.checked == true) box.checked = false;
   }
}

function getfromsys(id) {
	if(confirm('Update Ihrer Metatags starten?\nDieser Vorgang kann bis zu einer Minute dauern!\nLassen sie die Seite bitte zu ende laden!')){
	location.href='partner-metatags.php?show=getfromsys';
	}
}