function showhide(id, status) {
  if(status == 1){
    document.getElementById('v' + id).className = 'notshown';
    document.getElementById('s' + id).className = 'shownelemnt';	
  }else{
    document.getElementById('v' + id).className = 'shownelemnt';
    document.getElementById('s' + id).className = 'notshown';
  }
}

function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit){
		field.value = field.value.substring(0, maxlimit);
	}else{
		countfield.value = maxlimit - field.value.length;
	}
}

var search_url = "http://"+ window.location.hostname +"/includes/setdata.php";
var http = getHTTPObject();

function getHTTPObject() { 
  var xmlhttp;
    /*@cc_on 
  @if (@_jscript_version >= 5) 
    try { 
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
    } catch (e) { 
      try { 
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
      } catch (E) { 
        xmlhttp = false; 
      } 
    } 
  @else 
  xmlhttp = false; 
  @end @*/ 
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { 
    try { 
      xmlhttp = new XMLHttpRequest(); 
    } catch (e) { 
      xmlhttp = false; 
    } 
  } 
  return xmlhttp; 
} 

function saveData(elem) { 
	document.getElementById(elem).style.display = "block";
	document.getElementById(elem).innerHTML = "<img src='http://"+ window.location.hostname +"/images/loading.gif' style='width:16px; height:16px;' alt='wird geladen' />"; 
  var http = null;
  var http = getHTTPObject();
  http.open("GET", search_url + '?shoutname=' + escape(document.shoutform.shoutname.value)+'&shoutmessage='+escape(document.shoutform.shoutmessage.value)+'&txtCode='+document.shoutform.txtCode.value+'&codeb='+document.shoutform.codeb.value, true);
  http.onreadystatechange = function() {
	  if (http.readyState == 4 && http.status == 200) {
		results = http.responseText;
		if(results!= ""){	
		document.getElementById(elem).innerHTML = results; 
		}else{
		document.getElementById(elem).style.display = "none";	
		}
	 }
  }
  http.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
  http.send(null); 
} 

function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit){
		field.value = field.value.substring(0, maxlimit);
	}else{
		countfield.value = maxlimit - field.value.length;
	}
}

function openWindow(url,width,height)
{
window.open(url, "Smith", "toolbar=no, location=no, menubar=no, scrollbars=no, width=" + width + ", height=" + height + ", resizeable=yes, status=no");
}