var xmlHttp=createXmlHttpRequestObject();function createXmlHttpRequestObject()
{var xmlHttp;try
{xmlHttp=new XMLHttpRequest();}
catch(e)
{var XmlHttpVersions=new Array('MSXML2.XMLHTTP.6.0','MSXML2.XMLHTTP.5.0','MSXML2.XMLHTTP.4.0','MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP');for(var i=0;i<XmlHttpVersions.length&&!xmlHttp;i++)
{try
{xmlHttp=new ActiveXObject(XmlHttpVersions[i]);}
catch(e){};}}
if(!xmlHttp)
{alert("Error creating the XMLHTTPRequest object.");}
else
return xmlHttp;}
function pot(x,y)
{var i,z=1;for(i=1;i<=y;i++)
z*=x;return z;}
function geoDistance(b1,l1,b2,l2)
{var f=0.003352811;var a=6378.14
var F=(b1+b2)/2;F=Math.PI/180*F;var G=(b1-b2)/2;G=Math.PI/180*G;var l=(l1-l2)/2;l=Math.PI/180*l;var S=pot(Math.sin(G),2)*pot(Math.cos(l),2)+pot(Math.cos(F),2)*pot(Math.sin(l),2);var C=pot(Math.cos(G),2)*pot(Math.cos(l),2)+pot(Math.sin(F),2)*pot(Math.sin(l),2);var w=Math.atan(Math.sqrt(S/C));var D=2*w*a;var R=Math.sqrt(S*C)/w;var H1=(3*R-1)/(2*C);var H2=(3*R+1)/(2*S);var s=D*(1+f*H1*pot(Math.sin(F),2)*pot(Math.cos(G),2)-f*H2*pot(Math.cos(F),2)*pot(Math.sin(G),2))
return s;}
function mergeMarks(lt,lg,kmDist)
{var avlat=new Array;var avlng=new Array;var clusterCodes=new Array;var taken=new Array;var countItems=new Array;var li=0;for(ind=0;ind<lt.length;ind++)
{taken[ind]=0;}
var dsor=1;for(i=lt.length-1;i>=0;i--)
{countItems[li]=0;if(taken[i]==1)
{continue;}
else
{if(i-20>=0)
{j=i-20;}
else
{j=0;}
for(j;j<i+1;j++)
{if(taken[j]==1)
{continue;}
else
{var l1=lt[i]*1;var b1=lg[i]*1;var l2=lt[j]*1;var b2=lg[j]*1;var distance=geoDistance(l1,b1,l2,b2);if(distance<kmDist||(lt[i]==lt[j]&&lg[i]==lg[j]))
{taken[j]=1;if(dsor==1)
{countItems[li]++;dsor++;avlat[li]=((l1+l2)/dsor)*1;avlng[li]=((b1+b2)/dsor)*1;clusterCodes[li]=createClustercodes(j);}
else
{countItems[li]++;dsor++;avlat[li]=Math.sqrt(pot((-avlat[li]+(avlat[li]-l2)/dsor),2));avlng[li]=Math.sqrt(pot((-avlng[li]+(avlng[li]-b2)/dsor),2));clusterCodes[li]=clusterCodes[li]+createClustercodes(j);}}}}}
dsor=1;li++;}
var batch=new Array;batch=setM(avlat,avlng,clusterCodes,countItems);return batch;}
function sC(url)
{i=new Image();i.src=url;}
function dC(url,delay)
{uri=url
setTimeout("sC(uri)",delay*1000);}
function randomToN(maxVal,floatVal)
{var randVal=Math.random()*maxVal;return typeof floatVal=='undefined'?Math.round(randVal):randVal.toFixed(floatVal);}
function jump(obj)
{if(obj.selectedIndex!=0)
{window.location=obj.options[obj.selectedIndex].value;}}
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 writeCookie(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=/";}
function ampCh(strng)
{strng=strng.replace(/amp23/g,'&amp;');return strng;}
function html_entity_decode(str)
{var ta=document.createElement("textarea");ta.innerHTML=str.replace(/</g,"&lt;").replace(/>/g,"&gt;");toReturn=ta.value;ta=null;return toReturn}
function implodeAd(query)
{var pureAd=query;impAd=encodeURI(pureAd);return impAd;}
function encodeUTF8(string)
{string=string.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<string.length;n++)
{var c=string.charCodeAt(n);if(c<128)
{utftext+=String.fromCharCode(c);}
else if((c>127)&&(c<2048))
{utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128);}
else
{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128);}}
return utftext;}
function decodeUTF8(utftext)
{var string="";var i=0;var c=c1=c2=0;while(i<utftext.length)
{c=utftext.charCodeAt(i);if(c<128)
{string+=String.fromCharCode(c);i++;}
else if((c>191)&&(c<224))
{c2=utftext.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;}
else
{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}
return string;}
function startList()
{if(document.all&&document.getElementById)
{navRoot=document.getElementById("nav");for(i=0;i<navRoot.childNodes.length;i++)
{node=navRoot.childNodes[i];if(node.nodeName=="LI")
{node.onmouseover=function()
{this.className+=" over";}
node.onmouseout=function()
{this.className=this.className.replace(" over","");}}}}}
function selVal()
{gettingBrandsCategory($F('kategorien'));}
var URLpath="http://www.outlet-agent.de/";var iditem=new Array;var brand=new Array;var brandi=new Array;var tit=new Array;var category=new Array;var latitude=new Array;var longitude=new Array;var street=new Array;var postal=new Array;var city=new Array;var tinyIcon=new GIcon();tinyIcon.image="http://www.outlet-agent.de/imgz/iconz/smallStar.png";tinyIcon.shadow="http://www.outlet-agent.de/imgz/iconz/shadow-smallStar.png";tinyIcon.iconSize=new GSize(18,17);tinyIcon.shadowSize=new GSize(27,17);tinyIcon.iconAnchor=new GPoint(9,17);tinyIcon.infoWindowAnchor=new GPoint(5,1);var clusterIcon=new GIcon();clusterIcon.image="http://www.outlet-agent.de/imgz/iconz/bigStar.png";clusterIcon.shadow="http://www.outlet-agent.de/imgz/iconz/shadow-bigStar.png";clusterIcon.iconSize=new GSize(29,30);clusterIcon.shadowSize=new GSize(45,29);clusterIcon.iconAnchor=new GPoint(14,30);clusterIcon.infoWindowAnchor=new GPoint(9,2);function setupfrontMap()
{if(GBrowserIsCompatible())
{map=new GMap2(document.getElementById("map"));map.addControl(new GLargeMapControl());map.addControl(new GMapTypeControl());map.enableScrollWheelZoom();map.enableDoubleClickZoom();map.setMapType(G_HYBRID_MAP);map.setCenter(new GLatLng(51.00,10.00),5);mgr=new MarkerManager(map);processCats();}}
function startAddress()
{if(xmlHttp.readyState==4||xmlHttp.readyState==0)
{query=document.getElementById('ad_in').value;query=implodeAd(query);xmlHttp.open("GET",URLpath+"func/getGeo.php?q="+query,true);xmlHttp.onreadystatechange=handleServerResponse;xmlHttp.send(null);}
else
{setTimeout('startAddress()',100);}}
function handleServerResponse(){if(xmlHttp.readyState==4)
{if(xmlHttp.status==200)
{xmlResponse=xmlHttp.responseXML;xmlLng=xmlResponse.getElementsByTagName("longitude");xmlLat=xmlResponse.getElementsByTagName("latitude");for(var loop=0;loop<xmlLng.length;loop++)
{xmlFirst=xmlLng[loop];longi=xmlFirst.firstChild.nodeValue;}
for(var loop=0;loop<xmlLat.length;loop++)
{xmlFirst=xmlLat[loop];lati=xmlFirst.firstChild.nodeValue;}
setDirections(lati+","+longi,destination,locale);}
else
{alert("Problem accessing Server: "+xmlHttp.statusText);}}}
var map;var gdir;var geocoder=null;var addressMarker;locale="de";function setDirections(fromAddress,toAddress,locale)
{GEvent.addListener(gdir,"error",handleErrors);gdir.load("from: "+fromAddress+" to: "+toAddress,{"locale":locale});}
function setupMap()
{if(GBrowserIsCompatible())
{map=new GMap2(document.getElementById("map"));map.addControl(new GLargeMapControl());map.addControl(new GMapTypeControl());map.enableScrollWheelZoom();map.setMapType(G_HYBRID_MAP);map.setCenter(new GLatLng(51.00,10.00),5);gdir=new GDirections(map,document.getElementById("directions"));setOrigMarker();}}
function setOrigMarker()
{var htmlCode=createInfoWindowHtmlCode();var point=new GLatLng(lat,lng);mark=createMark(point,htmlCode);map.addOverlay(mark);}
function createInfoWindowHtmlCode()
{htmlCode='<h1>'+ampCh(name)+'</h1>'+html_entity_decode(street.replace(/&#38;/g,"&"))+'<br>'+postal+' '+html_entity_decode(city.replace(/&#38;/g,"&"))+'<br><a href="'+link+'">Weitere Infos</a>';return htmlCode;}
function handleErrors(){if(gdir.getStatus().code==G_GEO_UNKNOWN_ADDRESS)
alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: "+gdir.getStatus().code);else if(gdir.getStatus().code==G_GEO_SERVER_ERROR)
alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: "+gdir.getStatus().code);else if(gdir.getStatus().code==G_GEO_MISSING_QUERY)
alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: "+gdir.getStatus().code);else if(gdir.getStatus().code==G_GEO_BAD_KEY)
alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: "+gdir.getStatus().code);else if(gdir.getStatus().code==G_GEO_BAD_REQUEST)
alert("A directions request could not be successfully parsed.\n Error code: "+gdir.getStatus().code);else alert("An unknown error occurred.");}
function processCats()
{if(xmlHttp.readyState==4||xmlHttp.readyState==0)
{xmlHttp.open("GET",URLpath+"func/getCats.php",true);xmlHttp.onreadystatechange=handleCats;xmlHttp.send(null);}
else
{setTimeout('processCats()',100);}}
function handleCats()
{if(xmlHttp.readyState==4)
{if(xmlHttp.status==200)
{xmlResponse=xmlHttp.responseXML;xmlID=xmlResponse.getElementsByTagName("IDitem");xmlTit=xmlResponse.getElementsByTagName("title");xmlCat=xmlResponse.getElementsByTagName("category");xmlBrand=xmlResponse.getElementsByTagName("brand");xmlLat=xmlResponse.getElementsByTagName("latitude");xmlLng=xmlResponse.getElementsByTagName("longitude");xmlStreet=xmlResponse.getElementsByTagName("street");xmlPostal=xmlResponse.getElementsByTagName("postal");xmlCity=xmlResponse.getElementsByTagName("city");for(var loop=0;loop<xmlID.length;loop++)
{xmlFirst=xmlID[loop];iditem[loop]=xmlFirst.firstChild.nodeValue;}
for(var loop=0;loop<xmlTit.length;loop++)
{xmlFirst=xmlTit[loop];tit[loop]=xmlFirst.firstChild.nodeValue;}
for(var loop=0;loop<xmlCat.length;loop++)
{xmlFirst=xmlCat[loop];category[loop]=xmlFirst.firstChild.nodeValue;}
for(var loop=0;loop<xmlBrand.length;loop++)
{xmlFirst=xmlBrand[loop];brand[loop]=xmlFirst.firstChild.nodeValue;}
for(var loop=0;loop<xmlStreet.length;loop++)
{xmlFirst=xmlStreet[loop];street[loop]=xmlFirst.firstChild.nodeValue;}
for(var loop=0;loop<xmlPostal.length;loop++)
{xmlFirst=xmlPostal[loop];postal[loop]=xmlFirst.firstChild.nodeValue;}
for(var loop=0;loop<xmlCity.length;loop++)
{xmlFirst=xmlCity[loop];city[loop]=xmlFirst.firstChild.nodeValue;}
for(var loop=0;loop<xmlLat.length;loop++)
{xmlFirst=xmlLat[loop];latitude[loop]=xmlFirst.firstChild.nodeValue;}
for(var loop=0;loop<xmlLng.length;loop++)
{xmlFirst=xmlLng[loop];longitude[loop]=xmlFirst.firstChild.nodeValue;}
mgr.clearMarkers();callMarkermanager();}
else
{alert("Problem accessing Server: "+xmlHttp.statusText);}}}
function callMarkermanager()
{var gmarkers0=new Array;gmarkers0=mergeMarks(latitude,longitude,500);var gmarkers3=new Array;gmarkers3=mergeMarks(latitude,longitude,40);var gmarkers6=new Array;gmarkers6=mergeMarks(latitude,longitude,10);var gmarkers10=new Array;gmarkers10=mergeMarks(latitude,longitude,1);var gmarkers19=new Array;gmarkers19=mergeMarks(latitude,longitude,0);mgr.addMarkers(gmarkers0,0,2);mgr.addMarkers(gmarkers3,3,5);mgr.addMarkers(gmarkers6,6,9);mgr.addMarkers(gmarkers10,10,15);mgr.addMarkers(gmarkers19,16);mgr.refresh();$('loader').hide();}
function setM(avlat,avlng,clusterCodes,countItems)
{var batch=new Array;for(var i=0;i<avlat.length;i++)
{var lat=avlat[i];var lng=avlng[i];var point=new GLatLng(lat,lng);batch[i]=createM(point,clusterCodes[i],countItems[i]);}
return batch;}
function createM(point,clusterCodes,countItems)
{if(countItems<2)
{markerOptions={icon:tinyIcon};}
else
{markerOptions={icon:clusterIcon};}
var mark=new GMarker(point,markerOptions);GEvent.addListener(mark,"click",function(){mark.openInfoWindowHtml('<div class="infoWindow"'+clusterCodes+'<div>');});return mark;}
function createClustercodes(i)
{htmlCode='<h1>'+ampCh(tit[i])+'</h1><span style="color: #c4d739; font-weight: bold; ">'+ampCh(brand[i])+'</span><br>'+html_entity_decode(street[i].replace(/&#38;/g,"&"))+'<br>'+postal[i]+' '+html_entity_decode(city[i].replace(/&#38;/g,"&"))+'<br><a href="'+URLpath+category[i].replace(/ /g,"+")+'/'+brand[i].replace(/ /g,"+")+'/'+tit[i].replace(/ /g,"+")+'/'+iditem[i]+'" title="Details zu '+ampCh(tit[i])+'">Weitere Infos</a><br>___________________________';return htmlCode;}
function setMarkers()
{for(var i=0;i<latitude.length;i++)
{var lat=latitude[i];var lng=longitude[i];var htmlCode=createIWHC(i);var point=new GLatLng(lat,lng);var mark=new Array;mark[i]=createMark(point,htmlCode);map.addOverlay(mark[i]);}}
function createMark(point,htmlCode)
{var mark=new GMarker(point);GEvent.addListener(mark,"click",function(){mark.openInfoWindowHtml(htmlCode,{maxWidth:10})});return mark;}
function createIWHC(i)
{htmlCode='<h1>'+tit[i]+'</h1>'+street[i]+'<br>'+postal[i]+' '+city[i]+'<br><a href="'+URLpath+category[i].replace(/ /g,"+")+'/'+brand[i].replace(/ /g,"+")+'/'+tit[i].replace(/ /g,"+")+'/'+iditem[i]+'">Weitere Infos</a>';return htmlCode;}
function checkAll(nCats)
{for(var cnt=0;cnt<nCats;cnt++)
{if(document.getElementById('cat'+cnt))
{if(document.getElementById('cat'+cnt).checked==false)
{document.getElementById('cat'+cnt).checked=true;}}
else
{break;}}
renewMarks(cnt);}
function checkAllBrands(nCats)
{for(var cnt=0;cnt<nCats;cnt++)
{if(document.getElementById('cat'+cnt))
{if(document.getElementById('cat'+cnt).checked==false)
{document.getElementById('cat'+cnt).checked=true;}}
else
{break;}}
renewBMarks(cnt);}
function uncheckAll(nCats)
{for(var cnt=0;cnt<nCats;cnt++)
{if(document.getElementById('cat'+cnt))
{if(document.getElementById('cat'+cnt).checked==true)
{document.getElementById('cat'+cnt).checked=false;}}
else
{break;}}
map.clearOverlays();}
function renewMarks(cntCat)
{catArray=new Array();for(var cnt=0;cnt<cntCat;cnt++)
{if(document.getElementById('cat'+cnt).checked==true)
{catArray.push(document.getElementById('cat'+cnt).value);}}
map.clearOverlays();iditem.length=0;tit.length=0;category.length=0;latitude.length=0;longitude.length=0;brand.length=0;street.length=0;postal.length=0;city.length=0;if(catArray.length>0)
{processMarks(catArray);}}
function processMarks(catArray)
{var phpPar='';for(var cnt=0;cnt<catArray.length;cnt++)
{phpPar=phpPar+'_'+encodeUTF8(catArray[cnt]);}
if(xmlHttp.readyState==4||xmlHttp.readyState==0)
{xmlHttp.open("GET",URLpath+"func/getCats.php?cats="+phpPar,true);xmlHttp.onreadystatechange=handleCats;xmlHttp.send(null);}
else
{setTimeout('processMarks(catArray)',100);}}
function renewBMarks(cntCat)
{catArray=new Array();for(var cnt=0;cnt<cntCat;cnt++)
{if(document.getElementById('cat'+cnt).checked==true)
{catArray.push(document.getElementById('cat'+cnt).value);}}
mgr.clearMarkers();iditem.length=0;tit.length=0;category.length=0;latitude.length=0;longitude.length=0;brand.length=0;street.length=0;postal.length=0;city.length=0;if(catArray.length>0)
{processBMarks(catArray);}}
function processBMarks(catArray)
{var phpPar='';for(var cnt=0;cnt<catArray.length;cnt++)
{phpPar=phpPar+'_'+encodeUTF8(catArray[cnt]);}
if(xmlHttp.readyState==4||xmlHttp.readyState==0)
{xmlHttp.open("GET",URLpath+'func/getBrands.php?cats='+phpPar,true);xmlHttp.onreadystatechange=handleCats;xmlHttp.send(null);}
else
{setTimeout('processBMarks(catArray)',100);}}
function handleBrands()
{if(xmlHttp.readyState==4)
{if(xmlHttp.status==200)
{xmlResponse=xmlHttp.responseXML;xmlID=xmlResponse.getElementsByTagName("IDitem");xmlTit=xmlResponse.getElementsByTagName("title");xmlCat=xmlResponse.getElementsByTagName("category");xmlBrand=xmlResponse.getElementsByTagName("brand");xmlLat=xmlResponse.getElementsByTagName("latitude");xmlLng=xmlResponse.getElementsByTagName("longitude");xmlStreet=xmlResponse.getElementsByTagName("street");xmlPostal=xmlResponse.getElementsByTagName("postal");xmlCity=xmlResponse.getElementsByTagName("city");for(var loop=0;loop<xmlID.length;loop++)
{xmlFirst=xmlID[loop];iditem[loop]=xmlFirst.firstChild.nodeValue;}
for(var loop=0;loop<xmlTit.length;loop++)
{xmlFirst=xmlTit[loop];tit[loop]=xmlFirst.firstChild.nodeValue;}
for(var loop=0;loop<xmlCat.length;loop++)
{xmlFirst=xmlCat[loop];category[loop]=xmlFirst.firstChild.nodeValue;}
for(var loop=0;loop<xmlBrand.length;loop++)
{xmlFirst=xmlBrand[loop];brand[loop]=xmlFirst.firstChild.nodeValue;}
for(var loop=0;loop<xmlStreet.length;loop++)
{xmlFirst=xmlStreet[loop];street[loop]=xmlFirst.firstChild.nodeValue;}
for(var loop=0;loop<xmlPostal.length;loop++)
{xmlFirst=xmlPostal[loop];postal[loop]=xmlFirst.firstChild.nodeValue;}
for(var loop=0;loop<xmlCity.length;loop++)
{xmlFirst=xmlCity[loop];city[loop]=xmlFirst.firstChild.nodeValue;}
for(var loop=0;loop<xmlLat.length;loop++)
{xmlFirst=xmlLat[loop];latitude[loop]=xmlFirst.firstChild.nodeValue;}
for(var loop=0;loop<xmlLng.length;loop++)
{xmlFirst=xmlLng[loop];longitude[loop]=xmlFirst.firstChild.nodeValue;}
var brandslice=brand.slice();brandslice.sort();var co=0;for(i=0;i<brandslice.length;i++)
{if(brandslice[i]!=brandslice[i+1])
{brandi[co]=brandslice[i];co++;}}
j=0;var htmlForm='<form id="catform"  name="catform"  onsubmit="return false;"><table>';for(i=0;i<brandi.length;i++)
{if(j==0)
{htmlForm=htmlForm+'<tr><td width="130"><input id="cat'+i+'" name="'+brandi[i]+'" value="'+brandi[i]+'" type="checkbox" checked="checked" onClick="renewBMarks('+brandi.length+');">'+ampCh(brandi[i])+'</td>';j++;}
else if(j<3)
{htmlForm=htmlForm+'<td width="130"><input id="cat'+i+'" name="'+brandi[i]+'" value="'+brandi[i]+'" type="checkbox" checked="checked" onClick="renewBMarks('+brandi.length+');">'+ampCh(brandi[i])+'</td>';j++;}
else
{htmlForm=htmlForm+'<td width="130"><input id="cat'+i+'" name="'+brandi[i]+'" value="'+brandi[i]+'" type="checkbox" checked="checked" onClick="renewBMarks('+brandi.length+');">'+ampCh(brandi[i])+'</td></tr>';j=0;}}
htmlForm+='</table></form>';$('massa').update(htmlForm);mgr.clearMarkers();callMarkermanager();}
else
{alert("Problem accessing Server: "+xmlHttp.statusText);}}}
function gettingBrandsCategory(catEgory)
{iditem.length=0;tit.length=0;category.length=0;latitude.length=0;longitude.length=0;brand.length=0;street.length=0;postal.length=0;city.length=0;brandi.length=0;var phpPar='_'+encodeUTF8(catEgory);if(xmlHttp.readyState==4||xmlHttp.readyState==0)
{xmlHttp.open("GET",URLpath+"func/getCats.php?cats="+phpPar,true);xmlHttp.onreadystatechange=handleBrands;xmlHttp.send(null);}
else
{setTimeout('gettingBrandsCategory(catEgory)',100);}}
function clicker(url,title)
{uripath=URLpath+'func/clicker/clicker.php';var request=new Ajax.Request(uripath,{method:'post',parameters:{urlIdent:url,pageTitle:title}});}
function submitComment(sId)
{if(xmlHttp.readyState==4||xmlHttp.readyState==0)
{var pathurl=URLpath+"func/comments/comments.php";var param="sid="+sId+"&commentName="+$F('commentName')+"&email="+$F('email')+"&home="+$F('homeBlog')+"&msg="+$F('message');xmlHttp.open("POST",pathurl,true);xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlHttp.onreadystatechange=unpackComments;xmlHttp.send(param);}
else
{setTimeout('submitComment(sId)',100);}}
function unpackComments()
{if(xmlHttp.readyState==4)
{if(xmlHttp.status==200)
{xmlResponse=xmlHttp.responseXML;xmlName=xmlResponse.getElementsByTagName('comName');xmlMail=xmlResponse.getElementsByTagName('comMail');xmlHome=xmlResponse.getElementsByTagName('comHome');xmlTime=xmlResponse.getElementsByTagName('comTime');xmlMsg=xmlResponse.getElementsByTagName('comMsg');var comName;for(var loop=0;loop<xmlName.length;loop++)
{xmlFirst=xmlName[loop];comName=xmlFirst.firstChild.nodeValue;}
var comMail;for(var loop=0;loop<xmlMail.length;loop++)
{xmlFirst=xmlMail[loop];comMail=xmlFirst.firstChild.nodeValue;}
var comHome;for(var loop=0;loop<xmlHome.length;loop++)
{xmlFirst=xmlHome[loop];comHome=xmlFirst.firstChild.nodeValue;}
var comTime;for(var loop=0;loop<xmlTime.length;loop++)
{xmlFirst=xmlTime[loop];comTime=xmlFirst.firstChild.nodeValue;}
var comMsg;for(var loop=0;loop<xmlMsg.length;loop++)
{xmlFirst=xmlMsg[loop];comMsg=xmlFirst.firstChild.nodeValue;}
console.log(comTime[2]);displayComments(comName,comMail,comHome,comTime,comMsg);}
else
{alert("Problem accessing Server: "+xmlHttp.statusText);}}}
function displayComments(comName,comMail,comHome,comTime,comMsg)
{var comHtml='';for(i=1;i<comName.length;i++)
{var homepage='';if(comHome[i]!='none')
{homepage='<tr><td><span style="font-weight: bold;">Homepage:</span></td><td>'+comHome[i]+'</td></tr>';}
comHtml=comHtml+'<div class="dbox"><table><tr><td><span style="font-weight: bold;">Name:</span></td><td>'+comName[i]+'</td></tr>'+homepage+'<tr><td><span style="font-weight: bold;">Datum:</span></td><td>'+comTime[i]+'</td></tr><tr><td><span style="font-weight: bold;">Nachricht:</span></td><td>'+comMsg[i]+'</td></tr></table></div><br>';}
$('comcontainer').update(comHtml);}
var emptyStar=new Image();emptyStar.src=URLpath+"func/rater/imgz/smallemptystar.png";var fullStar=new Image();fullStar.src=URLpath+"func/rater/imgz/smallstargreen.png";function swapRatingStar(idStar)
{var numId=idStar.substr(4,1);for(i=1;i<6;i++)
{idOther='star'+i;if(numId>=i)
{srcImg=URLpath+"func/rater/imgz/smallstargreen.png";}
else
{srcImg=URLpath+"func/rater/imgz/smallemptystar.png";}
$(idOther).src=srcImg;}}
function clearStars(exRate)
{for(i=1;i<6;i++)
{idOther='star'+i;if(i<=exRate)
{srcImg=URLpath+"func/rater/imgz/smallstargreen.png";}
else
{srcImg=URLpath+"func/rater/imgz/smallemptystar.png";}
$(idOther).src=srcImg;}}
function updateRating(idUpdate,sId)
{if(xmlHttp.readyState==4||xmlHttp.readyState==0)
{var pathurl=URLpath+"func/rater/rater.php";var ratingValue=idUpdate.substr(4,1);var param="sid="+sId+"&rate="+ratingValue;xmlHttp.open("POST",pathurl,true);xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlHttp.onreadystatechange=fireNewRating;xmlHttp.send(param);}
else
{setTimeout('updateRating(idUpdate,sId)',100);}}
function fireNewRating(transport)
{if(xmlHttp.readyState==4)
{if(xmlHttp.status==200)
{xmlResponse=xmlHttp.responseXML;xmlRate=xmlResponse.getElementsByTagName('newAverage');xmlCount=xmlResponse.getElementsByTagName('newCount');var newRate;for(var loop=0;loop<xmlRate.length;loop++)
{xmlFirst=xmlRate[loop];newRate=xmlFirst.firstChild.nodeValue;}
var newCount;for(var loop=0;loop<xmlCount.length;loop++)
{xmlFirst=xmlCount[loop];newCount=xmlFirst.firstChild.nodeValue;}
createNewStars(newRate,newCount);}
else
{alert("Problem accessing Server: "+xmlHttp.statusText);}}}
function createNewStars(newRate,newCount)
{roundedAvg=Math.round(newRate);rateHtml='';for(i=1;i<6;i++)
{if(i<=roundedAvg)
{img=URLpath+"func/rater/imgz/smallstargreen.png";}
else
{img=URLpath+"func/rater/imgz/smallemptystar.png";}
rateHtml=rateHtml+'<img id="star'+i+'" src="'+img+'" width="30" height="29"/>';}
rateHtml=rateHtml+'<br>&#160;&#160;Durchschnittliche Bewertung: '+newRate;if(newCount>2)
{rateHtml=rateHtml+'<br />&#160;&#160;('+newCount+' Stimmen)';}
$('rate').update(rateHtml);}