
//--------------------------------------------------------------------------

	function xmlhttpPost(strURL) {
    	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) {
    	        updatepage(self.xmlHttpReq.responseText);
        	}
	    }
    	self.xmlHttpReq.send(getquerystring());
	}

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

	function updatepage(str){
    	document.getElementById("result").innerHTML = str;
	}

//--------------------------------------------------------------------------

	function getStream(username,albumid,imageid) {
    	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', "/tools/ext_stream.pl", true);
	    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    	self.xmlHttpReq.onreadystatechange = function() {
	        if (self.xmlHttpReq.readyState == 4) {
    	        updatepage2(self.xmlHttpReq.responseText);
        	}
	    }
    	self.xmlHttpReq.send(getquerystring2(username,albumid,imageid));
	}

	function getquerystring2(username,albumid,imageid) {
    	qstr = 'imageid='+imageid+'&albumid='+albumid+'&profile='+username;  // NOTE: no '?' before querystring
	    return qstr;
	}

	function updatepage2(str){
    	document.getElementById("stream").innerHTML = str;
	}


//--------------------------------------------------------------------------

	function getCompleteStream(username,albumid,imageid) {
    	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', "/tools/ext_stream.pl", true);
	    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    	self.xmlHttpReq.onreadystatechange = function() {
	        if (self.xmlHttpReq.readyState == 4) {
    	        updatepage3(self.xmlHttpReq.responseText);
        	}
	    }
    	self.xmlHttpReq.send(getquerystring3(username,albumid,imageid));
	}

	function getquerystring3(username,albumid,imageid) {
    	qstr = 'imageid='+imageid+'&albumid='+albumid+'&profile='+username+'&mode=complete';  // NOTE: no '?' before querystring
	    return qstr;
	}

	function updatepage3(str){
    	document.getElementById("completestream").innerHTML = str;
	}




//JavaScript:xmlhttpPost("/tools/ajax.pl")


function popUp2(URL) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=540,height=570,left = 475,top = 345');");
}

function PopUp(URL) {
    popUp(URL);
}

function popUp(URL) {
    day = new Date();
    id = day.getTime();
    ok = window.open(URL, id , 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=710,height=490,left = 300,top = 150');
    //return false;
    //if (ok) return false;
  //else return true;

}


function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/; domain=deinmaterial.de";
}

function eraseCookie(name)
{
	createCookie(name,"",-1);
}

function articleNavMenu(itemid,owner)
{
	document.writeln('<div style="width:148px;"> ');
	document.writeln('<div style="float:right;width:30px;">');
	document.writeln(' <form action=\"/tools/basket\" style=\"margin-bottom:0;\" onclick=\"return add2Basket(this);\"  method=\"post\">');
	document.writeln(' <INPUT TYPE=\"IMAGE\" SRC=\"/images/shoppingcart16dg.gif\" alt=\"in den Warenkorb\" title=\"in den Warenkorb\"> <input type=hidden name=\"idowner\" value=\"'+owner+'\"> <input type=hidden name=\"id\" value=\"'+itemid+'\"> <input type=\"hidden\" name=\"amount\" value=\"1\"> <input type=\"hidden\" name=\"buttonpos\" value=\"p1\"> <input type=\"hidden\" name=\"buttonvar\" value=\"p1\">');
	document.writeln('</form> ');
	document.writeln('</div>');
	document.writeln('<div style="float:right;width:30px;"><a href="/tools/favorites.pl?id='+itemid+'"><img border="0" src="/images/top_hplusgray.png" alt="Als Liebling merken" title="Als Liebling merken"></a></div>');
	document.writeln('<div style="clear:both;"></div>');
	document.writeln('</div> ');
}

function welcomeUser(extrahtml)
{
	document.writeln('<div style=\"margin-bottom:3px;width:100%;background-color:#D9E6FF;border:1px dotted #A3E8FF;padding:4px;font-size:22px;font-weight:bold;\"> Hallo Besucher von Google!<br>Hier findest du &uuml;ber 25.000 handgemachte Artikel  '+extrahtml);
	document.writeln('</div> ');
}

function doSpellCheck()
{


if (document.getSelection) {
    var str = document.getSelection();
  } else if (document.selection && document.selection.createRange) {
    var range = document.selection.createRange();
    var str = range.text;
  } else {
    var str = "Sorry, this is not possible with your browser.";
  }
    if (str != ""){
        if (confirm("Folgenden Text ausbessern und melden?\n-------------\n"+str+"\n-------------\nBitte um Verstaendnis, dass Fehler in Artikeltexten nicht ausgebessert werden.") == 1){
            var spellform = '<form name="spellform" id="spellform" method="post" action="/tools/crowd_spellreport.pl"><input type=hidden name="intext" value="'+str+'"> <input type=hidden name="mode" value="3"> <input type=hidden name="pageurl" value="'+document.location.href+'"> <input type=hidden name="subject" value="Rechtschreibfehler-Meldung"></form>';
				document.getElementById('spellcheckform').innerHTML = spellform;
//            document.spellform.submit();
			document.getElementById('spellform').submit();
        }
    }else{
        alert("Bitte Wort / Bereich vorher markieren den du melden willst");
    }
	return false;
}



