function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=")
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1 
    c_end=document.cookie.indexOf(";",c_start)
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
    } 
  }
return null
}

function chkallboxes() {
                if (document.forms['mails'].delall.checked == true) {
			for (var i=0; i<document.forms['mails'].elements.length; i++) {
				document.forms['mails'].elements[i].checked = true
			}
		}
		else {
			for (var i=0; i<document.forms['mails'].elements.length; i++) {
				document.forms['mails'].elements[i].checked = false
		}
	}
}

function getprofil(nick)
{
var sess = getCookie('PHPSESSID');
window.open('profil.php?id=' + nick + '&PHPSESSID=' + sess,1,"width=640,height=700,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes,top=5,left=5");
}

function getgb(nick)
{
var sess = getCookie('PHPSESSID');
window.open('profil.php?action=guestbook&id=' + nick + '&PHPSESSID=' + sess,1,"width=640,height=800,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes,top=5,left=5");
}

function activemail()
{
    // var sess = getCookie('PHPSESSID');
    window.open('activemail.php','activemail',"width=640,height=600,status=yes,location=no,menubar=no,resizable=yes,scrollbars=yes,top=5,left=5");
}

function refresh(Url,Field,frame)
{
    if(frame == 'pa') {
        Field = parent.document.getElementById(Field);
    } else if(frame != null) {
        Field = parent.frames[frame].document.getElementById(Field);
    } else {
        Field = document.getElementById(Field);
    }
	if(Field != null){
		if(window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		} else if(window.ActiveXObject) {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} else {
			return false;
		}
		xmlhttp.open("GET", Url, true);

		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState == 4) {
					Field.innerHTML = xmlhttp.responseText;
			}
		}
		xmlhttp.send(null);
	}
}

function Smileys(feld)
{
	document.getElementbyId(feld).innerHTML = "test";
}

function chat(user) {
    window.open('chat.php?user='+user,user+'1',"width=300,height=400,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes,top=5,left=5");
}

function xmlhttpPost(strURL, postdata) {
        var xmlHttpReq = false;
        var self = this;
        // Mozilla/Safari
        if (window.XMLHttpRequest) {
            self.xmlHttpReq = new XMLHttpRequest();
        }
        // IE
        else if (window.ActiveXObject) {
            self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
        }
        self.xmlHttpReq.open('POST', strURL, true);
        self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        self.xmlHttpReq.onreadystatechange = function() {
            if (self.xmlHttpReq.readyState == 4) {
                return self.xmlHttpReq.responseText;
            }
        }
        self.xmlHttpReq.send(postdata);
}

function getquerystring() {
    var form     = document.forms['fastsearch'];
    var word = form.domainname.value;
    qstr = 'domain=' + escape(word);  // NOTE: no '?' before querystring
    return qstr;
}



