function feedOnLoad()
	{
	if (document.getElementById('list_found').innerHTML) window.feedObjOffsetHeight= document.getElementById('list_found').firstChild.offsetHeight
	else window.feedObjOffsetHeight= 127
	if (sfrc) return
	addBalloons2users()
	if (window.justAddZkatter)
		document.getElementById('justAddZkatterIframe').src= '_ajax/?afterStatus=' + window.justAddZkatter
	if (!window.latestFeedZkatter && document.getElementById('list_found').innerHTML != '')
		{
		window.latestFeedZkatter= document.getElementById('list_found').firstChild.id.substr(1)
		if(scrpt==_Gp_channel||scrpt==_Gp_home)
			simple_ajax(_Gp_jlive+'?s=' + scrpt + '&lzk=' + window.latestFeedZkatter,'goLive')
		}
	if (rC('activeFeedPage') && rC('activeFeedMode'))
		{
		refreshFeed(rC('activeFeedPage'),rC('activeFeedMode'))
		dC('activeFeedPage')
		dC('activeFeedMode')
		return
		}
	if (substr_count(location.href,'#prf')) sa_spfrPr(1,0)	
	if (substr_count(location.href,'#media')) refreshFeed(1,'media')
	}

function refreshFeed(page,mode)
	{
	window.liveSepFlag= false
	if (document.getElementById('mapAll')) myMapOff()
	window.gsPageN= page
	window.activeFeedPage= page
	if (mode) window.activeFeedMode= mode
	pageCall= ''	
	if (window.activeFeedMode == 'media')
		{
		rXp= 20
		pageCall= '&tXp=' + rXp
		}
	dateCall= ''
	if (window.sa_time != '') dateCall= '&sa_time=' + window.sa_time
	shieldUp()
	if (window.activeFeedObj) zMenuReset()
	$.scrollTo('#top',500)
	var arr= new Array(page,sa_time)
	$('#list_found').fadeTo('fast', 0.20, function() {
	if (scrpt == _Gp_searchresults) gSearch_sa_mainsearch()
	else simple_ajax(FeedAjax + '?page=' + page + pageCall + dateCall, 'refreshFeedDone', 0, arr)} )
	}

function refreshFeedDone (rsp, arr) // STELIOS PLEASE SEE THE CHANGES IF THEY ARE OK FOR THE SEARCH LOGIC - not to corrupt other;)
	{
	page= arr[0]
	saTime= arr[1]
	dateCall= ''
	if (saTime)
		{
		dateCall= '&sa_time=' + saTime
		pageCache= []
		}
	rows= rsp.split("\n");
	firstrow=rows[0].split("\t");
	window.totalEntries= parseInt(firstrow[0]);
	if(isNaN(window.totalEntries))window.totalEntries=0;
	document.getElementById('list_found').innerHTML= '';
	if(scrpt == _Gp_searchresults&&firstrow[1]!=gsClickedlink&&window.totalEntries)
		{
		document.getElementById('list_found').appendChild(feedEmpty('Finding results for "' + gsSearch + '"!'))
		shieldDown()
		return
		}
	if (!window.totalEntries)
			document.getElementById('list_found').appendChild(feedEmpty('Wow! Nobody\'s made a zkattering about ' + gsSearch + '<br/>Show the word you are a pioneer and add a zkattering about this now!'))
	else
		{
		if (window.activeFeedMode == 'media')
			{
			document.getElementById('list_found').style.padding= '0 0 0 2px'
			for (r=1; r<rows.length; r++) document.getElementById('list_found').appendChild(feedMedia(rows[r]))
			}
		if (window.activeFeedMode == 'list')
			{
			document.getElementById('list_found').style.padding= ''
			for (r=1; r<rows.length; r++) document.getElementById('list_found').appendChild(feedEntry(rows[r]))
			}
		if (page == 1 && !saTime)
			{
			window.latestFeedZkatter= document.getElementById('list_found').firstChild.id.substr(1)
			hideLive()
			}
		addBalloons2users()
		}
	shieldDown()
	showpages(page,window.totalEntries,rXp,5,'refreshFeed',1)
	$('#list_found').fadeTo('fast', 1)
	if (window.liveUpdOff) setTimeout("window.liveUpdOff= false",11000)
	}

function addBalloons2users()
	{
	hrefs= document.getElementById('list_found').getElementsByTagName("a")
	for (var f=0; f<hrefs.length; f++)
		{
		if (!hrefs[f].onmouseover)
			{
			if (hrefs[f].className == 'rg') hrefs[f].setAttribute('onmouseover',"usn=this.innerHTML.substr(1);balloon.showTooltip(event,'url:_ajax/?usn=' + usn)")
			if (hrefs[f].className == 'ur') hrefs[f].setAttribute('onmouseover',"usn=this.innerHTML.substr(1);balloon.showTooltip(event,'<b>' + usn + '</b> is not register on Zkatter!<br>Click to claim it :-)')")
			}
		}
	}

function navigationDone(rsp)
	{
	document.getElementById('navigation').style.display= 'block'
	document.getElementById('navigation').innerHTML= rsp
	}

function shieldUp()
	{
	if (document.getElementById('shield')) return
	feedObj= document.getElementById('list_found')
	html= '<div class="shield" style="top:-' + feedObj.offsetHeight + 'px;width:' + feedObj.offsetWidth + 'px;height:' + feedObj.offsetHeight + 'px"></div>'
	shield= document.createElement('div')
	shield.id= 'shield'
	shield.className= 'absolutePoint'
	shield.innerHTML= html
	insertAfter(shield,feedObj)
	}

function shieldDown()
	{
	if (document.getElementById('shield'))
		document.getElementById('shield').parentNode.removeChild(document.getElementById('shield'))
	}

function forceCloseAllTabs()
	{
	feedDivs= document.getElementById('list_found').getElementsByTagName('div') 
	for (f=0; f<feedDivs.length; f++) if (feedDivs[f].className == 'zTab' && feedDivs[f].style.display == 'block') feedDivs[f].style.display= 'none'
	}

function hideAllFeedPages(exept)
	{
	feedDivs= document.getElementById('list_found').getElementsByTagName('div')
	for (f=0; f<feedDivs.length; f++) if (feedDivs[f].className == 'feedPage') feedDivs[f].style.display= 'none'
	}

function entryFavAddRemove(obj)
	{
	if (obj.favorite) return 'Remove from'
	return 'Add to'
	}

function entryMadeFrom(obj)
	{
	switch(obj.device)
		{
		case 0: msg= 'web (location cannot be verified as accurate)'; break;
		case 1: msg= 'mobile with NokiaN95'; break;
		case 2: msg= 'mobile with iPhone'; break;
		case 3: msg= 'mobile with Android'; break;
		}
	return msg
	}

function closeActiveTab()
	{
	window.monitorAnimatedcollapse4close= window.activeFeedObj.alt
	$('#t' + window.activeFeedObj.alt).animate({'height':'0px'},'slow')
	linkSpanObj.innerHTML= activeLinkSpanObj.alt
	zMenuReset()
	}

function entryIsVideo(obj)
	{
	if (obj.isvideo) return 'v'
	return ''
	}

function entryFavLink(obj)
	{
	ocl= "this.style.backgroundImage='url(_img/star/2.png)';simple_ajax('_ajax/?fav=" + obj.zid + "','doFavorite',0,this)"
	omo= "balloon.showTooltip(event,'" + entryFavAddRemove(obj) + " favorites')"
	html= '<a onfocus="this.blur()" href="javascript://" class="s2" style="background-image: url(_img/star/' + obj.favorite + '.png);" onclick="' + ocl + '" onmouseover="' + omo +'"></a>'
	return html
	}

function entryAbuseBallon(obj)
	{
	if (obj.abuse) return 'Report this content'
	return 'You have already reported this zkattering.<br>We are checking it very soon. Thanks!'
	}

function entryMapMedia(obj)
	{
	rsp= obj.lat + "\t" + obj.lng
	if (obj.mapmed) atrbtsMap= 'onclick="zClick(this,[' + obj.lat + ',' + obj.lng + '])"', atrbtsMed= 'onclick="zClick(this)"'
	else atrbtsMap= 'class="dsbl"', atrbtsMed= 'class="dsbl"'
	html= '<a onfocus="this.blur()" href="javascript://" onmouseover="setBalloon(this);balloon.showTooltip(event,helpMsg)" ' + atrbtsMap + '>&raquo; <span>map</span></a>'
	html+= '<a onfocus="this.blur()" href="javascript://" onmouseover="setBalloon(this);balloon.showTooltip(event,helpMsg)" ' + atrbtsMed + '>&raquo; <span>media</span></a>'
	return html
	}

function entryResp(obj)
	{
	atrbts= ''
	if (obj.myz)
		{
		if (obj.respcnt) rspcnt= ' (' + obj.respcnt + ')', atrbts= 'onclick="zClick(this)"'
		else rspcnt= '', atrbts= 'class="dsbl"'
		html= '<a href="javascript://" onfocus="this.blur()" onmouseover="setBalloon(this);balloon.showTooltip(event,helpMsg)" ' + atrbts + '>&raquo; <span>responses' + rspcnt + '</span></a>'
		}
	else
		{
		if (obj.respond) atrbts= 'onclick="zClick(this)"'
		else atrbts= 'class="dsbl"'
		html= '<a href="javascript://" onfocus="this.blur()" onmouseover="setBalloon(this);balloon.showTooltip(event,helpMsg)" ' + atrbts + '>&raquo; <span>respond</span></a>'
		}
	return html
	}

function entryMyFriend(obj)
	{
	atrbts= 'class="dsbl"'
	if (idid && obj.myfriend == 0) atrbts= 'onclick="addFriend(this)"'
	html= '<a href="javascript://" onfocus="this.blur()" onmouseover="setBalloon(this,1);balloon.showTooltip(event,helpMsg)" ' + atrbts + '>&raquo; <span>add as friend</span></a>'
	return html
	}

function entryShare()
	{
	if (idid)atrbts= 'onclick="zClick(this)"'
	else atrbts= 'class="dsbl"'
	html= '<a href="javascript://" onfocus="this.blur()" onmouseover="setBalloon(this);balloon.showTooltip(event,helpMsg)" ' + atrbts + '>&raquo; <span>share</span></a>'
	return html
	}

function entryRel2usr(obj)
	{
	if (idid == obj.uid) return 'm'
	if (obj.myfriend) return 'f'
	return 'n'
	}

function entryNearby(obj)
	{
	html= '<div class="absolutePoint" id="nearbyArrCnt">'
	html+= '<span onmouseover="balloon.showTooltip(event,\'View on map\')" onclick="zkatter2map(' + obj.zid + ',' + obj.lat + ',' + obj.lng + ')" class="nearbyArr">'
	html+= '<img src="_img/misc/nearby.png" />'
	html+= '<span>(' + obj.dist + ' meters)</span>'
	html+= '</span>'
	html+= '</div>'
	return html
	}

function row2obj(row)
	{
	rowEx= row.split("\t")
	if (rowEx[1] == window.idid) myzkatter= true
	else myzkatter= false
	obj= {
		myz:myzkatter,
		zid:rowEx[0],
		uid:rowEx[1],
		lat:rowEx[2],
		lng:rowEx[3],
		favorite:parseInt(rowEx[4]),
		favcount:parseInt(rowEx[5]),
		abuse:parseInt(rowEx[6]),
		lastz:parseInt(rowEx[7]),
		respcnt:parseInt(rowEx[8]),
		media:rowEx[9],
		device:parseInt(rowEx[10]),
		mapmed:parseInt(rowEx[11]),
		respond:parseInt(rowEx[12]),
		myfriend:parseInt(rowEx[13]),
		responses:parseInt(rowEx[14]),
		share:parseInt(rowEx[15]),
		views:parseInt(rowEx[16]),
		scrname:rowEx[17],
		stmp:rowEx[18],
		when:rowEx[19],
		where:'',
		what:rowEx[20],
		dist:rowEx[21]}
	return obj
	}

function feedMedia(row)
	{
	obj= row2obj(row)
	//status= obj.scrname + ' <span class="when" id="' + obj.stmp + '">' + obj.when + '</span> @ ' + obj.where + ' ' + obj.what
	status= obj.scrname + ' [/x]' + obj.when + '[/y]:' + obj.what
	status= status.replace(/(<([^>]+)>)/ig,"")
	status= str_replace('[/x]','<span class="when" id="' + obj.stmp + '">',status)
	status= str_replace('[/y]','</span>',status)
	html= '<img src="_img/pix.gif" class="imgCnt" style="background-image: url(_img/?p=' + obj.uid + ',' + obj.zid + ',4)" />'
	html+= '<span class="absolutePoint" style="visibility:hidden">'
	if (obj.media == 'v') attribute= ' class="vidPrvLoad"'
	else attribute= ''
	html+= '<div' + attribute + '></div>'
	html+= '<div id="vidPrv"></div>'
	html+= '<img src="_img/med/' + obj.media + '.png" class="zMedType" />'
	html+= '<div class="zMedStatBack">' + unescape(status) + '</div>'
	html+= '<div class="zMedStatFront">' + unescape(status) + '</div>'
	html+= '<div class="zMedViewsBack">Views: ' + obj.views + '</div>'
	html+= '<div class="zMedViewsFront">Views: ' + obj.views + '</div>'
	html+= '<div class="vidPrvOnTop"></div>'
	html+= '</span>'
	entryObj= document.createElement('span')
	entryObj.id= 'c' + obj.zid
	entryObj.innerHTML= html
	entryObj.setAttribute('onmouseover',"feedMediaHover(this,event," + obj.uid + ")")
	entryObj.setAttribute('onmouseout',"feedMediaHover(this,event)")
	entryObj.setAttribute('onclick','mClick(this)')
	return entryObj	
	}

function feedMediaHover(obj,e,uid)
	{
	if (e.type == 'mouseover')
		{
		obj.lastChild.style.visibility= 'visible'
		if (obj.childNodes[1].childNodes[2].src.match(/[\/|\\]([^\\\/]+)$/)[1].substr(0,1) == 'v') obj.childNodes[1].childNodes[1].appendChild(feedMediaVideoPrv(obj,uid))
		}
	else
		{
		obj.childNodes[1].childNodes[1].innerHTML= ''
		obj.lastChild.style.visibility= 'hidden'
		}
	}

function feedMediaVideoPrv(obj,uid)
	{
	flv= 'buffer=5&buffershowbg=0&buffercolor=000000&loop=1&margin=0&showplayer=never&autoplay=1&buffermessage=&flv=' + site_absolute_path + '_img/?p=' + uid + ',' + obj.id.substr(1) + ',0,1'
	html= '<param name="movie" value="_swf/player_flv_maxi.swf" />'
	html= '<param name="wmode" value="transparent" />'
	html+= '<param name="FlashVars" value="' + flv + '" />'
	html+= '<embed src="_swf/player_flv_maxi.swf" FlashVars="' + flv + '" wmode="transparent" height="200" width="200" />'
	vidObj= document.createElement('object')
	//vidObj.setAttribute('type','application/x-shockwave-flash')
	vidObj.setAttribute('height','200')
	vidObj.setAttribute('width','200')
	vidObj.innerHTML= html
	return vidObj
	}

function feedEntry(row)
	{
	obj= row2obj(row)
	if (obj.myz) myClass= 'My'
	else myClass= ''
	html= '<div class="absolutePoint">'
	html+= '<div style="visibility: hidden;" class="sMenu">'
	if (obj.myz) html+= '<a class="s1" onmouseover="balloon.showTooltip(event,\'elete your zkattering\')" style="background-image: url(images/close20px.png)" onclick="doDelete(this)" href="javascript://" onfocus="this.blur()"></a>'
	else html+= '<a onfocus="this.blur()" href="' + obj.scrname + '" class="s1" style="background-image: url(_img/tv.png)" onmouseover="balloon.showTooltip(event,\'View ' + obj.scrname + '\&rsquo;s channel\')"></a>'
	html+= '<a onfocus="this.blur()" href="javascript://" class="s2" style="background-image: url(_img/star/' + obj.favorite + '.png)" onclick="this.style.backgroundImage=\'url(_img/star/2.png)\';simple_ajax(\'_ajax/?fav=' + obj.zid + '\',\'doFavorite\',0,this)" onmouseover="balloon.showTooltip(event,\'' + entryFavAddRemove(obj) + ' favorites\')"><span>' + obj.favcount + '</span></a>'
	html+= '<a href="javascript://" onclick="this.style.opacity= \'.5\'; simple_ajax(\'_ajax/?abuse=' + obj.zid +'\',\'abuseMark\',0,this)" class="s3" onmouseover="balloon.showTooltip(event,\'' + entryAbuseBallon(obj) + '\')" style="background-image: url(_img/abuse.png)" onfocus="this.blur()"></a>'
	html+= '</div>'
	html+= '<img style="background-image: url(_img/?p=' + obj.uid + ',' + obj.zid + ',3);" src="_img/med/' + obj.media + '.png" id="zTumb" border="0">'
	html+= '<table id="zInf" cellpadding="0" cellspacing="0"><tr><td>'
	if (gsClickedlink == 'nearby') html+= entryNearby(obj)
	html+= '<div class="status">'
	html+= '<a onfocus="this.blur()" href="' + obj.scrname + '" target="_top" class="who">' + obj.scrname + '</a> '
	html+= '<span class="when" id="' + obj.stmp + '">' + obj.when + '</span>'
	if (obj.where)
		{
		html+= ' <span class="at">@</span> '
		html+= '<a onfocus="this.blur()" href="javascript://" class="where" onclick="zClick(this)">' + unescape(obj.where) + '</a>'
		}
	else html+= ':'
	html+= ' <span class="what">' + unescape(obj.what) + '</span>'
	html+= '</div>'
	html+= '<div class="device">Made from ' + entryMadeFrom(obj) + '</div>'
	html+= '</td></tr></tbody></table>'
	html+= '</div>'
	html+= '<div class="zMenu" id="' + entryRel2usr(obj) + '">'
	html+= entryMapMedia(obj)
	html+= entryResp(obj)
	if (!obj.myfriend) html+= entryMyFriend(obj)
	html+= entryShare()
	html+= '</div>'
	html+= '<div id="t' + obj.zid + '" class="zTab">' + tabLoader() + '</div>'
	entryObj= document.createElement('div')
	entryObj.id= 'c' + obj.zid
	entryObj.className= 'zFeedCnt' + myClass
	entryObj.innerHTML= html
	entryObj.setAttribute('onmouseover','omoZkatter(this)')
	entryObj.setAttribute('onmouseout','omuZkatter(this)')
	return entryObj
	}

function feedEmpty(message)
	{
	if (!message) message= 'No Zkatterings here! Sorry...'
	entryObj= document.createElement('div')
	entryObj.id= 'c0'
	entryObj.className= 'zFeedCnt'
	entryObj.innerHTML= '<div class="absolutePoint"><img src="_img/misc/zq.png" /><h2>' + message + '</h2></div>'
	entryObj.setAttribute('onmouseover','omoZkatter(this)')
	entryObj.setAttribute('onmouseout','omuZkatter(this)')
	return entryObj
	}

function addFeedEmpty()
	{
	obj= feedEmpty()
	obj.style.height= '0px'
	document.getElementById('list_found').appendChild(obj)
	$('#c0').animate({'height':'260px'},1500)
	}

function setBalloon(obj,extra)
	{
	rel= obj.parentNode.id
	lnk= reqStr(obj.lastChild.innerHTML)
	if (obj.className == 'dsbl') dsbl= true
	else dsbl= false
	if (lnk == 'map')
		if (dsbl) msg= 'disable'
		else
			if (rel == 'f') msg= 'friend\'s location'
			else msg= 'view location'
	if (lnk == 'media')
		if (dsbl) msg= 'disable'
		else
			{
			if (rel == 'm') msg= 'your experience'
			if (rel == 'f') msg= 'your friend\'s experience'
			if (rel == 'n') msg= 'view experience'
			}
	if (lnk == 'respond')
		if (dsbl)
			if (rel == 'f') msg= 'only for user\'s latest zkattering'; else msg= 'disbale'
		else msg= 'arrange to meet'
	if (lnk == 'responses')
		if (dsbl) msg= 'disable'
		else msg= 'view your responses'
	if (lnk == 'add_as_friend')	msg= 'send request'
	if (lnk == 'share')	
		if (dsbl) msg= 'disabled'
		else msg= 'share with friends'
	if (lnk == 'minimize')
		msg= 'close'
	window.helpMsg= msg
	}

function getStatus()
	{
	childs= document.getElementById(activeFeedObj.id).getElementsByTagName('div')
	for (f=0; f<childs.length; f++)
		if (childs[f].className == 'status') return childs[f].innerHTML
	}

function omoZkatter(obj)
	{
	if (!window.activeFeedObj || obj.id != window.activeFeedObj.id)
		{	
		obj.className= obj.className + 'Omo'
		innerDivs= obj.getElementsByTagName('div')
		for (var f=0; f<innerDivs.length; f++)
			{
			if (innerDivs[f].className == 'sMenu') innerDivs[f].style.visibility= 'visible'
			if (innerDivs[f].className == 'zMenu') innerDivs[f].style.visibility= 'visible'
			if (innerDivs[f].id == 'nearbyArrCnt') innerDivs[f].firstChild.style.display= 'block'
			}
		}
	}

function omuZkatter(obj,exception)
	{
	if (!window.activeFeedObj || obj.id != window.activeFeedObj.id || exception)
		{
		obj.className= str_replace('Omo','',obj.className)
		innerDivs= obj.getElementsByTagName('div')
		for (var f=0; f<innerDivs.length; f++)
			{
			if (innerDivs[f].className == 'sMenu') innerDivs[f].style.visibility= 'hidden'
			if (innerDivs[f].className == 'zMenu') innerDivs[f].style.visibility= 'hidden'
			if (innerDivs[f].id == 'nearbyArrCnt') innerDivs[f].firstChild.style.display= 'none'
			}
		}
	}

function doFavorite (rsp, obj)
	{
	if (!suid)
		{
		sa_displayfrlogindiv()
		return false
		}	
	rsp= rsp.split("\t")
	count= rsp[0]
	flg= rsp[1]
	obj.removeAttribute('onmouseover')
	obj.style.backgroundImage= 'url(_img/star/' + flg + '.png)'
	if (flg == '1') omo= 'Remove from'
	else omo= 'Add to'
	if (scrpt == _Gp_viewmedia) obj.innerHTML= omo + ' favorites'
	else obj.setAttribute('onmouseover', "balloon.showTooltip(event,'" + omo + " favorites')")
	obj.firstChild.innerHTML= count
	if (scrpt == _Gp_favorites && flg == '0') removeEntry(obj)
	}

function doDelete(obj)
	{
	zid= obj.parentNode.parentNode.parentNode.id.substr(1)
	displaydivheight= '375px'
	displaydivwidth= '702px'
	displaydivmLeft= '-351px'
	displaydivmTop= '-185px'
	simple_ajax('delzkat.php?zid=' + zid, 'displaydiv')
	}

function deleteZkatterDone(rsp,zid2remove)
	{
	if (rsp != '1')
		{
		rspEx= rsp.split("\t")
		blnSpans= document.getElementById('topBalloon').getElementsByTagName('span')
		for (var f=0; f<blnSpans.length; f++)
			{
			if (blnSpans[f].className == 'when') blnSpans[f].innerHTML= rspEx[19], blnSpans[f].id= rspEx[18]
			if (blnSpans[f].className == 'what') blnSpans[f].innerHTML= rspEx[20]
			}
		}
	removeEntry(document.getElementById('c' + zid2remove))
	}

function abuseMark(rsp, obj)
	{
	obj.style.opacity= '1'
	obj.removeAttribute('onclick')
	obj.removeAttribute('onmouseover')
	obj.setAttribute('onmouseover',"balloon.showTooltip(event,'You have already reported this zkattering.<br>We are checking it very soon. Thanks!')")
	abuseReasonPop(obj)
	}

function abuseReasonPop(obj)
	{
	if (document.getElementById('rspPop')) document.getElementById('rspPop').parentNode.removeChild(document.getElementById('rspPop'))
	html= '<div id="respPopup" style="top:-150px;left:350px">'
	html+= '<div id="top"></div>'
	html+= '<div id="bottom"></div>'
	html+= '<div id="title" style="font-size:15px">Thank you for flagging this content. Please give additional details:</div>'
	html+= '<a href="javascript://" onclick="killRespPop()"><img src="images/close20px.png" id="closep"></a>'
	html+= '<div id="respArea">'
	html+= boxRfStart
	html+= '<textarea id="rsp" onkeyup="txtLength(this)" onkeydown="escapeEnterCheck(event)"></textarea>'
	html+= boxRfEnd
	html+= '</div>'
	html+= '<div id="snddone">'
	html+= boxRfStart
	html+= '<div id="doneText">'
	html+= '<strong>You report has submited.<br>Thank you.</strong>'
	html+= '</div>'
	html+= boxRfEnd
	html+= '</div>'
	html+= '<div id="chrLeft"><img src="_img/_btn/send.png" onclick="sending(); abuseReasonAjx(' + obj.parentNode.parentNode.parentNode.id.substr(1) + ')" id="send">Characters left: <strong id="charleft">255</strong></div>'
	html+= '<input type="hidden" id="to_friend_id" value="" />'
	html+= '<input type="hidden" id="to_zid" value="" />'
	html+= '</div>'
	relPop= document.createElement('div')
	relPop.className= 'absolutePoint'
	relPop.id= 'rspPop'
	relPop.innerHTML= html
	insertAfter(relPop,obj.parentNode.parentNode.parentNode)
	document.getElementById('rsp').focus()
	}

function abuseReasonAjx(zid)
	{
	simple_ajax('_ajax/?abuseReason=' + zid + '&reason=' + escape(document.getElementById('rsp').value), 'abuseReasonAjxDone')
	}

function abuseReasonAjxDone()
	{
	killRespPop()
	}

function removeEntry(obj,dontadd)
	{
	if (obj.id.substr(0,1) == 'c') feed4rmObj= obj
	else feed4rmObj= obj.parentNode.parentNode.parentNode
	$('#' + feed4rmObj.id).animate({'height':'0px','opacity':'0'}, 1500, function(){killEntry(feed4rmObj,dontadd)})
	}

function killEntry(feed4rmObj,dontadd)
	{
	if (dontadd) add= false
	else add= true
	if (window.activeFeedObj) if (window.activeFeedObj.id == feed4rmObj.id) zMenuReset()
	feed4rmObj.parentNode.removeChild(feed4rmObj)
	if (window.latestFeedZkatter == feed4rmObj.id.substr(1))
		window.latestFeedZkatter= document.getElementById('list_found').firstChild.id.substr(1)
	if (add) simple_ajax(_Gp_jz_feed + '?page=' + (window.activeFeedPage * window.rXp) + '&tXp=1', 'addEntry')
	}

function addEntry(rsp)
	{
	rows= rsp.split("\n")
	window.totalEntries= parseInt(rows[0])
	if (rows[1])
		{
		newObj= feedEntry(rows[1])
		document.getElementById('list_found').appendChild(newObj)
		addBalloons2users()
		}
	else
		if (document.getElementById('list_found').innerHTML == '')
			if (window.activeFeedPage == 1) addFeedEmpty()
			else refreshFeed(window.activeFeedPage - 1)
	}

function zMenuReset()
	{
	killRespPopup()
	if (window.activeLinkSpanObj)
		{
		window.activeLinkSpanObj.innerHTML= window.activeLinkSpanObj.alt
		window.activeLinkSpanObj= null
		window.activeFeedObj= null
		}
	}

function reqStr(str)
	{
	if (str.indexOf('(') > -1) str= str.substr(0,str.indexOf('(')-1)
	str= str_replace(' ', '_', str)
	return str
	}

function setTabHeight(obj)
	{
	if (substr_count(obj.parentNode.parentNode.parentNode.childNodes[0].childNodes[1].src,'_img/med/v.png')) video= true
	else video= false
	req= reqStr(obj.innerHTML)
	if (req == 'map') return 520
	if (req == 'share') return 350
	if (req == 'respond') return 350
	if (req == 'media')
		if (video) return 500
		else return 380
	if (req == 'responses')
		{
		h= 97 * parseInt(obj.innerHTML.substr(obj.innerHTML.indexOf('(') + 1, obj.innerHTML.indexOf(')') - (obj.innerHTML.indexOf('(') + 1))) - 1
		if (h > 291) h = 290
		return h + 40
		}
	return 520
	}

function mClick(obj)
	{
	cC('activeFeedMode',activeFeedMode)
	cC('activeFeedPage',activeFeedPage)
	location.href= _Gp_viewmedia + '?zid=' + obj.id.substr(1) + '&ref=' + scrpt
	}

function zClick(linkObj,latlng)
	{
	if (linkObj.className == 'where') linkObj= linkObj.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.childNodes[1].firstChild
	feedObj= linkObj.parentNode.parentNode
	feedObj.alt= feedObj.id.substr(1)
	linkSpanObj= linkObj.lastChild
	if (linkSpanObj.innerHTML != 'minimize')
		{
		reqTabHeight= setTabHeight(linkSpanObj) + 'px'
		reqAjx= 'z_' + reqStr(linkSpanObj.innerHTML)
		if (window.activeFeedObj) window.activeFeedObj.lastChild.innerHTML= tabLoader()
		if (!window.activeFeedObj) $('#t' + feedObj.alt).animate({'height':reqTabHeight},'slow', function() { if (!previewMode) $.scrollTo('#c' + feedObj.alt, 'slow') })
		else
			if (feedObj.id != window.activeFeedObj.id)
				{
				document.getElementById('t' + window.activeFeedObj.alt).innerHTML= tabLoader()
				omuZkatter(window.activeFeedObj,true)
				$('#t' + window.activeFeedObj.alt).animate({'height':'0px'},'slow')
				$('#t' + feedObj.alt).animate({'height':reqTabHeight},'slow', function() { if (!previewMode) $.scrollTo('#c' + feedObj.alt, 'slow') })
				}
			else $('#t' + feedObj.alt).animate({'height':reqTabHeight},'slow', function() { if (!previewMode) $.scrollTo('#c' + feedObj.alt, 'slow') })
		zMenuReset()
		linkSpanObj.alt= linkSpanObj.innerHTML
		window.activeLinkSpanObj= linkSpanObj
		window.activeFeedObj= feedObj
		linkSpanObj.innerHTML= 'minimize'
		if (window.activeFeedObj.className.substr(8,2) == 'My') window.zcolor= 'red'
		else window.zcolor= 'green'
		if (latlng)
			{
			rspFake= latlng[0] + "\t" + latlng[1]
			zClickRsp(rspFake,reqAjx)
			}
		else simple_ajax('_ajax/?z=' + feedObj.alt + '&zTab=' + reqAjx,'zClickRsp',0,reqAjx)
		}
	else
		{
		omuZkatter(window.activeFeedObj,true)
		$('#t' + feedObj.alt).animate({'height':'0px'},'slow', function() { document.getElementById('t' + feedObj.alt).innerHTML= tabLoader() })
		linkSpanObj.innerHTML= activeLinkSpanObj.alt
		zMenuReset()		
		}
	}

function zClickRsp(rsp,func)
	{
	activeTab= document.getElementById('t' + window.activeFeedObj.alt)
	if (rsp != '')
		{
		activeTab.innerHTML= window[func + '_cnt'](rsp)
		window[func + '_init'](rsp)
		}
	else activeTab.innerHTML= tabLoader()
	}

function tabLoader()
	{
	return '<div class="zLoaderIn"></div>'
	}

function addFriend(obj)
	{
	zid= obj.parentNode.parentNode.id.substr(1)
	if (suid == '') sa_display_pop('pjs_signin_001', 'ph_signin_001', '&form_action=?action=login&zid='+zid+'&btn_X=self.parent.tb_remove();')
	else
		{
		displaydivheight= '375px'
		displaydivwidth= '702px'
		displaydivmLeft= '-351px'
		displaydivmTop= '-185px'
		simple_ajax('addasfr.php?zid=' + zid, 'displaydiv')
		}
	}

function updateFeed(rsp)
	{
	rows= rsp.split("\n")
	firstObj= document.getElementById('list_found').firstChild
	newObj= feedEntry(rows[1])
	rspEx= rsp.split("\t")
	if (rspEx[1] == idid)
		{
		blnSpans= document.getElementById('topBalloon').getElementsByTagName('span')
		for (var f=0; f<blnSpans.length; f++)
			{
			if (blnSpans[f].className == 'when') blnSpans[f].innerHTML= rspEx[19], blnSpans[f].id= rspEx[18]
			if (blnSpans[f].className == 'what') blnSpans[f].innerHTML= rspEx[20]
			}
		}
	if (!liveSepFlag)
		{
		liveSep= 'border-bottom:3px solid silver;'
		window.liveSepFlag= true
		}
	else liveSep= ''
	newObj.setAttribute('style','height:0;opacity:0;background-color:#FFFFE1;' + liveSep)
	document.getElementById('list_found').insertBefore(newObj,firstObj)
	$('#' + newObj.id).animate({'height':feedObjOffsetHeight+'px','opacity':'1'}, 1000, function()
		{
		addBalloons2users()
		$('#' + newObj.id).animate({backgroundColor:'#FFFFFF'}, 1000, function()
			{
			newObj.style.height= 'auto'
			newObj.style.backgroundColor= ''
			})
		})
	removeEntry(document.getElementById('list_found').lastChild,true)
	}

function ago()
	{
	spans= document.getElementById('list_found').getElementsByTagName('span')
	for (var f=0; f<spans.length; f++)
		if (spans[f].className == 'when') 
			{
			dif= srvtmstmp - parseInt(spans[f].id)
			if (dif < 3000) spans[f].innerHTML= echoAgo(dif)
			}
	spans= document.getElementById('topBalloon').getElementsByTagName('span')
	for (var f=0; f<spans.length; f++)
		if (spans[f].className == 'when') 
			{
			dif= srvtmstmp - parseInt(spans[f].id)
			if (dif < 3000) spans[f].innerHTML= echoAgo(dif)
			}
	}

function echoAgo(dif)
	{
	if (dif < 25) return dif + ' seconds ago'
	if (dif < 50) return 'half a minute ago'
	if (dif < 90) return 'one minute ago'
	return  Math.round(dif/60) + ' minutes ago'
	}

/* MAP TAB ************************************************************/

function z_map_cnt(rsp)
	{
	//applyBalloonSkin()
	html= '<div id="mapCont"><div id="fMap"></div></div>'
	return html
	}

function z_map_init(rsp)
	{
	rspEx= rsp.split("\t")
	tabMapInit(window.activeFeedObj.alt,rspEx[0],rspEx[1])
	}

function tabMapInit(zid,lat,lng)
	{
	if (GBrowserIsCompatible()) 
		{
		//alert(window.activeFeedObj.className)
		if (window.activeFeedObj.className.substr(8,2) == 'My') uskn= 'red'
		else uskn= 'green'
		var zIco= new GIcon()
			zIco.image= '_img/z/' + uskn + '.png'
			zIco.iconSize= new GSize(30,33)
			zIco.iconAnchor= new GPoint(2,33)
			zIco.infoWindowAnchor= new GPoint(31,2)
		var fdMrkObj= {icon:zIco,draggable:false}	
		var fdMrk= new GMarker(new GLatLng(lat,lng),fdMrkObj)
		var fdMapStr= new GStreetviewOverlay()
		var fdMap= new GMap2(document.getElementById('fMap'))
			fdMap.setCenter(new GLatLng(lat,lng),16)
			fdMap.addControl(new GLargeMapControl())
			fdMap.addControl(new GMapTypeControl())		
			fdMap.enableScrollWheelZoom()
			//fdMap.addOverlay(fdMapStr)
			fdMap.addOverlay(fdMrk)			
		fdMrk.openExtInfoWindow(fdMap,'custom_info_window_red','',{beakOffset:3,ajaxUrl:'_ajax/feedballon.php?z=' + zid})
		GEvent.addListener(fdMrk,'click',function()
			{
			fdMrk.openExtInfoWindow(fdMap,'custom_info_window_red','',{beakOffset:3,ajaxUrl:'_ajax/feedballon.php?z=' + zid}) 
			})
		GEvent.addDomListener(fdMap,'extinfowindowupdate',function()
			{
			tabs= new Array(document.getElementById('tab0'),document.getElementById('tab1'),document.getElementById('tab2'))
			tabContentsArray= new Array(tabs.length)
			for (i=0; i<3; i++)
				{
				tabContentsArray[i]= document.getElementById('tab' + i + '_content')
				if(i > 0) hide(tabContentsArray[i])
				tabs[i].setAttribute('name', i.toString())
				if (i == 2) initFeedStreet(lat,lng)
				GEvent.addDomListener(tabs[i],'click',function()
					{
					tabIndex= this.getAttribute('name')
					for (tabContentIndex=0; tabContentIndex<3; tabContentIndex++)
						{
						if (tabContentIndex == tabIndex) show(tabContentsArray[tabContentIndex])
						else hide(tabContentsArray[tabContentIndex])
						fdMap.getExtInfoWindow().resize()
						}
					})
				}
			})		
		}
	}

function removeLocationClick()
	{
	hrefs= document.getElementById('full').getElementsByTagName('a') 
	for (f=0; f<hrefs.length; f++) if (hrefs[f].className == 'where') hrefs[f].onclick= ''	
	}

function removeExtraPanos()
	{
	document.getElementById('pano').firstChild.style.display= 'block'
	myPanos= document.getElementById('pano').getElementsByTagName('object')
	for (f=0; f<myPanos.length; f++) if (f) myPanos[f].parentNode.removeChild(myPanos[f])	
	}

function initFeedStreet(lat,lng) 
	{
	document.getElementById('feedBalloonPano').innerHTML= ''
	searchBalloonPanoObj= new GStreetviewPanorama(document.getElementById('feedBalloonPano'))
	place= new GLatLng(lat,lng)
	myPOV= {yaw:370.64659986187695,pitch:-20}
	searchBalloonPanoObj.setLocationAndPOV(place, myPOV)
	GEvent.addListener(searchBalloonPanoObj,'error',function(){if (document.getElementById('tab2')) document.getElementById('tab2').style.display='none'})
	setTimeout("if (document.getElementById('tab2')) document.getElementById('tab2').style.visibility= 'visible'",500)
	}

function applyBalloonSkin()
	{
	links= document.getElementsByTagName('body')[0].getElementsByTagName('link')
	for (f=0; f<links.length; f++) 
		if (substr_count(links[f].href,'InfoWindowTabs.css')) 
			links[f].parentNode.removeChild(links[f])
	newLink= document.createElement('link')
	newLink.href= '_css/_' + window.zcolor + 'InfoWindowTabs.css'
	newLink.rel= 'stylesheet'
	newLink.type= 'text/css'
	document.getElementsByTagName('body')[0].appendChild(newLink)
	}

/* MEDIA TAB ************************************************************/

function z_media_cnt(rsp)
	{
	rspEx= rsp.split("\t")
	html= '<table id="mediaTbl"><tr><td id="mediaTd" align="center">'
	html+= '<div class="videoViewCount">Views: ' + rspEx[1] + '</div>'
	//html+= '<div class="absolutePoint"><div class="videoViewCount">Views: ' + rspEx[1] + '</div></div>'
	if (rspEx[2] == '0') html+= '<img src="_img/?p=' + rspEx[0] + ',' + window.activeFeedObj.alt + ',5"/ style=" height:270px;width:360px">'
	else html+= mediaPlayer(rspEx[0], window.activeFeedObj.alt, rspEx[2])
	html+= linkEmbed(rspEx[0],window.activeFeedObj.alt)
	html+= '</td></tr></table>'
	return html
	}

function linkEmbed(uid,zid)
	{
	html= '<table cellpadding="0" cellspacing="0" style="margin-top:20px">'
	html+= '<tr>'
	html+= '<td><strong>link&nbsp;<span class="uArr">&raquo;</span>&nbsp;</strong></td>'
	html+= '<td><div>'
	html+= boxRfStart
	html+= '<input type="text" value="' + site_absolute_path + zk_url_folder + window.activeFeedObj.alt + '" onClick="copy4paste(this)" style="border:0;width:250px;font-size:.8em" />'
	html+= boxRfEnd
	html+= '</div></td>'
	html+= '<td><strong style="margin-left:20px">embed&nbsp;<span class="uArr">&raquo;</span>&nbsp;</strong></td>'
	html+= '<td><div>'
	html+= boxRfStart
	html+= '<input type="text" value=\'' + zBadge(uid,zid) + '\' onClick="copy4paste(this)" style="border:0;width:250px;font-size:.8em" />'
	html+= boxRfEnd
	html+= '</div><div class="absolutePoint"><img src="_img/pix.gif" id="s_share_3" onmouseover="balloon.showTooltip(event,notavail)"></div></td>'
	html+= '</tr>'
	html+= '</table>'
	return html
	}

function zBadge(uid,zid)
	{
	html= '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" height="186" width="338">'
	html+= '<param name="movie" value="' + site_absolute_path + 'widget.swf">'
	html+= '<param name="quality" value="high">'
	html+= '<param name="wmode" value="transparent">'
	html+= '<param name="flashVars" value="userid=' + uid + '&pin_id=' + zid + '">'
	html+= '<embed src="' + site_absolute_path + 'widget.swf" wmode="transparent" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" flashvars="userid=' + uid + '&pin_id=' + zid + '" height="186" width="338">'
	html+= '</object>'
	return html
	}

function mediaPlayer(uid,zid,flv)
	{
	html= '<div style="width:500px;height:375px">'
	html+= '<object type="application/x-shockwave-flash" data="_swf/player_flv_maxi.swf" width="500" height="375">'
	html+= '<param name="wmode" value="transparent" />'
	html+= '<param name="movie" value="_swf/player_flv_maxi.swf" />'
	html+= '<param name="allowFullScreen" value="true" />'
	html+= '<param name="FlashVars" value="flv=' + site_absolute_path + 'uploads/zkatter/' + uid + '/' + flv + '.flv&configxml=_swf/player_flv_maxi.xml.php?z=' + zid + '|' + isPrfLook + '" />'
	html+= '</object>'
	html+= '</div>'
	return html
	}

/* RESPOND TAB ************************************************************/

function z_respond_cnt(rsp)
	{
	rspEx= rsp.split("\t")
	html= '<div class="respondCnt">'
	html+= '<div id="center">'
	//if (rspEx[1]=='0') html+= respondSimple(rspEx[0])
	html+= respondSimple(rspEx[0])
	//else html+= respondMobile(rspEx[0],rspEx[1])
	html+= '</div>'
	html+= '</div>'
	return html
	}

function respondSimple(scrName)
	{
	html= '<div id="title"><span>' + scrName + '</span> is currently zkattered here</div>'
	html+= '<div id="text">'
	html+= boxRfStart
	html+= '<textarea id="msgidr" name="msgid" style="border:0px none;overflow:hidden" onkeyup="txtLength(this)"></textarea>'
	html+= boxRfEnd
	html+= '</div>'
	html+= '<div id="snddone">'
	html+= boxRfStart
	html+= '<div id="doneText">'
	html+= '<strong>Zkatdroid has successfully delivered<br>your message to <em id="tooo"></em>.</strong>'
	html+= '</div>'
	html+= boxRfEnd
	html+= '</div>'
	html+= '<div id="left">Characters available: <span id="charleft">255</span></div>'
	html+= '<img id="send" src="_img/_btn/send_lrg.png" onclick="sendMsg(0)">'
	html+= '<div id="friends">'
	html+= '<span>Respond to:</span>'
	html+= '<div id="input" onclick="">'
	html+= '<div id="active">' + scrName + '</div>'
	html+= '<div id="options"></div>'
	html+= '</div>'
	html+= '<span style="left: 600px;">now!</span>'
	return html
	}

function respondMobile(scrName,mblNumber)
	{
	html= '<div id="title"><span>' + scrName + '</span> made this zkattering via mobile device</div>'
	html+= '<div class="txt pos1">You must either call or sms message <span>' + scrName + '</span> if you wish to communicate.</div>'
	if (mblNumber == '*') html+= '<div class="txt pos2"><span>' + scrName + '</span> has no number available to call to.</div>'
	else
		{
		html+= '<div class="txt pos2"><span>' + scrName + '</span> registered to Zkatter using the following number:</div>'
		html+= '<div id="mobNumb"><span>' + mblNumber + '</span></div>'
		html+= '<div class="txt pos3">You\'ve been allowed to see the number if you wish to make contact.</div>'
		}
	html+= '<img id="close" src="_img/_btn/close.png" onclick="closeActiveTab()">'
	return html
	}

function resizeMe(id)
	{
	parent.document.getElementById(id).height= '100px'
	}

function resizeMe(id)
	{
	parent.document.getElementById(id).height= '100px'
	}

function sendMsg(oldmsgid)
	{
	document.getElementById('msgidr').style.backgroundImage= 'url(images/loader_big.gif)'
	document.getElementById('send').style.visibility= 'hidden'
	document.getElementById('msgidr').setAttribute('disabled','disabled')
	document.getElementById('msgidr').style.backgroundColor= 'white'
	var xmlHttp=ajax()
	xmlHttp.open('get','ajax/send_msg.php?zkatterid=' + window.activeFeedObj.alt + '&oldmsgid=' + oldmsgid + '&msg=' + escape(document.getElementById('msgidr').value))
	xmlHttp.onreadystatechange= function() 
		{
		if (xmlHttp.readyState == 4)
			{
			document.getElementById('title').innerHTML= 'Delivery confirmation'
			document.getElementById('friends').style.display= 'none'
			document.getElementById('left').style.display= 'none'
			document.getElementById('text').style.display= 'none'
			document.getElementById('tooo').innerHTML= document.getElementById('active').innerHTML
			document.getElementById('snddone').style.display= 'block'
			setTimeout('closeActiveTab()',2000)
			}
		}
	xmlHttp.send(null)
	}

/* RESPONCES TAB ************************************************************/

function z_responses_cnt(rsp)
	{
	rows= rsp.split("\n")
	h= rows.length * 97 - 1
	if (h > 291) h= 290
	html= '<div style="height:20px"></div><div id="respCnt" style="height:' + h + 'px"><center>'
	for (r=0; r<rows.length; r++) html+= inboxEntry(rows[r])
	html+= '</center></div>'
	return html
	}

function z_responses_init(rsp)
	{
	document.getElementById('respCnt').firstChild.lastChild.style.borderBottom= 0
	tb_init('a.thickbox, area.thickbox, input.thickbox')
	}

function inboxEntry(row)
	{
	rowEx= row.split("\t")
	html= '<div class="messgCnt" id="y' + rowEx[0] + '">'
	html+= '<table class="respItem" style="width:100%" id="m' + rowEx[0] + '" cellpadding="0" cellspacing="0">'
	html+= '<tr class="sr_container" onmouseover="msgHover(this)" onmouseout="msgHover(this)">'
	html+= '<td style="width:20px"><img src="_img/pix.gif" style="width:20px" /></td>'
	html+= '<td class="thumb"><img src="_img/?p=' + rowEx[1] + ',0,3"></td>'
	html+= '<td>'
	html+= '<table class="info" border="0" cellpadding="0" cellspacing="0">'
	html+= '<tr>'
	html+= '<td rowspan="2" class="from">'
	html+= '<div class="absolutePoint" style="display:none" id="hvr">'
	html+= '<a target="_top" id="msglink_' + rowEx[0] + '" class="linkiframe" href="' + site_absolute_path + zk_url_folder + window.activeFeedObj.alt + '" onmouseover="setTheStatus();balloon.showTooltip(event,theStatus)">'
	html+= '<img src="images/response_icon10x14.png" style="position:absolute;left:0px;top:60px">'
	html+= '</a>'
	html+= '<a class="linkiframe" href="javascript://" onclick="replyPop(' + rowEx[0] + ',\'' + rowEx[3] + '\')" onmouseover="balloon.showTooltip(event,\'Click to reply...\')">'
	html+= '<img src="_img/misc/reply.png" style="position:absolute;left:25px;top:58px">'
	html+= '</a>'
	html+= '</div>'
	html+= '<strong>' + unescape(rowEx[4]) + ' <a href="' + unescape(rowEx[3]) + '" target="_top">(' + unescape(rowEx[3]) + ')</a></strong><br />'
	if (rowEx[2] == '0') html+= '<span style="color:#9f0000">(NEW)</span>'
	html+= '</td>'
	html+= '</tr>'
	html+= '<tr>'
	html+= '<td colspan="2" class="message">' + unescape(rowEx[5]) + '</td>'
	html+= '</tr>'
	html+= '</table>'
	html+= '</td>'
	html+= '<td class="del">'
	html+= '<a href="popups/delete_msgf.php?id=' + rowEx[0] + '&inb=1&keepThis=true&TB_iframe=true&height=380&width=707&modal=true" class="thickbox" onmouseover="balloon.showTooltip(event,\'Delete this message\');"><img src="images/close20px.png"></a>'
	html+= '</td>'
	html+= '<td style="width:20px"><img src="_img/pix.gif" style="width:20px" /></td>'
	html+= '</tr>'
	html+= '</table>'
	html+= '</div>'
	return html
	}

function setTheStatus()
	{
	window.theStatus= window.activeFeedObj.firstChild.lastChild.firstChild.firstChild.firstChild.firstChild.innerHTML
	}

function replyPop(mid,srcName)
	{
	killRespPopup()
	html= '<div id="respPopup" style="left:300px;top:-10px">'
	html+= '<div id="top"></div>'
	html+= '<div id="bottom"></div>'
	html+= '<div id="title">Reply to ' + srcName + ':</div>'
	html+= '<a href="javascript://" onclick="killRespPop()"><img src="images/close20px.png" id="closep"></a>'
	html+= '<div id="respArea">'
	html+= boxRfStart
	html+= '<textarea id="rsp" onkeyup="txtLength(this)" onkeydown="escapeEnterCheck(event)"></textarea>'
	html+= boxRfEnd
	html+= '</div>'
	html+= '<div id="snddone">'
	html+= boxRfStart
	html+= '<div id="doneText">'
	html+= '<strong>Zkatdroid has successfully delivered<br>your message to <em>' + srcName + '</em>.</strong>'
	html+= '</div>'
	html+= boxRfEnd
	html+= '</div>'
	html+= '<div id="chrLeft"><img src="_img/_btn/send.png" onclick="sending(); sendReply(' + mid + ')" id="send">Characters left: <strong id="charleft">255</strong></div>'
	html+= '</div>'
	relPop= document.createElement('div')
	relPop.className= 'absolutePoint'
	relPop.id= 'rspPop'
	relPop.innerHTML= html
	window.activeFeedObj.insertBefore(relPop,window.activeFeedObj.lastChild)
	document.getElementById('rsp').focus()
	}

function killRespPopup()
	{
	if (document.getElementById('rspPop')) document.getElementById('rspPop').parentNode.removeChild(document.getElementById('rspPop'))
	}

function sendReply(r2mid)
	{
	simple_ajax(site_absolute_path + 'ajax/send_msg.php?r2mid=' + r2mid + '&msg=' + escape(document.getElementById('rsp').value), 'sendReplyDone')
	}

function sendReplyDone()
	{
	document.getElementById('chrLeft').style.visibility= 'hidden'
	document.getElementById('snddone').style.display= 'block'
	setTimeout('killRespPopFade()',2000)
	}

function msgHover(obj)
	{
	msgId= obj.parentNode.parentNode.id.substr(0,1)
	if (obj.className=='sr_container')
		{
		obj.className= 'sr_container_hover'
		obj.getElementsByTagName('div')[0].style.display= 'block'
		}
	else
		{
		obj.className= 'sr_container'
		obj.getElementsByTagName('div')[0].style.display= 'none'
		}
	}

function removeRespond(id)
	{
	childsBeforeDelete= document.getElementById('y' + id).parentNode.childNodes.length
	activeLength= document.getElementById('respCnt').firstChild.childNodes.length
	respCntH= document.getElementById('respCnt').firstChild.offsetHeight
	zTabH= document.getElementById('t' + window.activeFeedObj.alt).offsetHeight
	itm2delH= document.getElementById('y' + id).offsetHeight
	
	if (activeLength < 4) 
		{
		$('#respCnt').animate({'height':(respCntH - itm2delH)}, 1500)
		$('#t' + window.activeFeedObj.alt).animate({'height':(zTabH - itm2delH)}, 1500)
		}
	$('#y' + id).animate({'height':'0px','opacity':'0','width':'90%'}, 1500, function()
		{
		document.getElementById('y' + id).parentNode.removeChild(document.getElementById('y' + id))
		if (childsBeforeDelete > 1) window.activeLinkSpanObj.alt= str_replace('(' + childsBeforeDelete + ')','(' + (childsBeforeDelete - 1) + ')',window.activeLinkSpanObj.alt)
		else
			{
			window.activeLinkSpanObj.alt= window.activeLinkSpanObj.alt.substr(0,9)
			window.activeLinkSpanObj.parentNode.className= 'dsbl'
			closeActiveTab()
			}
		})
	}

/* SHARE TAB ************************************************************/

function z_share_init(rsp)
	{
	FB.init(FACEBOOK_API_KEY, site_absolute_path + 'ext/')
	}

function z_share_cnt(rsp)
	{
	if (rsp) window.rspEx= rsp.split("\t")
	window.zkatterId= window.activeFeedObj.alt
	window.zkatterPlace= unescape(rspEx[4])
	window.zkatterDate= rspEx[2]
	window.zkatterText= unescape(rspEx[5])
	window.zkatterOwner= unescape(rspEx[3])
	window.zkatterOwnerId= rspEx[0]
	window.zkatterZhareCount= rspEx[6]
	html= '<table id="shareTbl"><tr><td id="shareTd" align="center">'
	html+= '<div class="absolutePoint"><div id="shareStatus"></div></div>'
	html+= '<br />'
	html+= '<div style="width:470px;height:130px">'
	html+= boxRfStart
	html+= '<center>'
	html+= '<a onfocus="this.blur()" href="javascript://" class="sBtn" onclick="shareZkatter()"><img src="_img/misc/zshare.png"><span class="absolutePoint"><span class="zsharecnt">' + window.zkatterZhareCount + '</span></span></a>'
	//html+= '<a onfocus="this.blur()" href="javascript://" class="sBtn" id="twSh" ' + shareTwitterAttr(rspEx[1]) + '><img src="_img/pix.gif" style="width: 60px; height: 60px; background-image: url(_img/_btn/share_t.png);" id="twShImg"></a>'
	html+= '<a onfocus="this.blur()" href="javascript://" class="sBtn TWs">'
	html+= tweetmeme(window.activeFeedObj.alt)
	html+= '</a>'	
	//html+= '<a onfocus="this.blur()" href="javascript://" class="sBtn" onclick="FB_shareZ()"><img src="_img/pix.gif" style="width: 60px; height: 60px; background-image: url(_img/_btn/share_f.png);" id="twShImg"></a>'
	html+= '<span class="sBtn FBs">'
	html+= '<table cellpadding="0" cellspacing="0"><tr><td>'
	html+= '<fb:share-button href="' + site_absolute_path + zk_url_folder + window.activeFeedObj.alt + '" type="box_count">'
	html+= '</fb:share-button>'
	html+= '</td></tr></table>'	
	html+= '</span>'
	html+= '<a onfocus="this.blur()" href="javascript://" class="sBtn DGs">'
	html+= diggIt()
	html+= '</a>'
	//html+= '<a onfocus="this.blur()" href="javascript://" class="sBtn"><img src="_img/_btn/share_ms.png"></a>'
	html+= '<span class="absolutePoint"><img src="_img/pix.gif" id="s_share_1" onmouseover="balloon.showTooltip(event,notavail)"></span>'
	html+= '</center>'
	html+= boxRfEnd
	html+= '</div>'
	html+= '<br /><br />'
	html+= '<table cellpadding="0" cellspacing="0">'
	html+= '<tr>'
	html+= '<td><strong style="margin-right: 5px;">Link&nbsp;<span class="uArr">&raquo;</span></strong></td>'
	html+= '<td><div>'
	html+= boxRfStart
	html+= '<input value="' + site_absolute_path + zk_url_folder + window.activeFeedObj.alt + '" onclick="copy4paste(this)" style="border: 0pt none ; width: 250px;" type="text">'
	html+= boxRfEnd
	html+= '</div></td>'
	html+= '<td><strong style="margin-left: 15px; margin-right: 5px;">Embed&nbsp;<span class="uArr">&raquo;</span></strong></td>'
	html+= '<td><div>'
	html+= boxRfStart
	html+= '<input value=\'' + zBadge(rspEx[0],window.activeFeedObj.alt) + '\' onclick="copy4paste(this)" style="border:0pt none;width:250px" type="text">'
	html+= boxRfEnd
	html+= '</div></td>'
	html+= '</tr>'
	html+= '</table>'
	html+= '<br /><span class="absolutePoint"><img src="_img/pix.gif" id="s_share_2" onmouseover="balloon.showTooltip(event,notavail)"></span>'
	html+= '</td></tr></table>'
	return html	
	}

function z_share_cnt_OFFLINE(rsp)
	{
	if (rsp) window.rspEx= rsp.split("\t")
	window.zkatterId= window.activeFeedObj.alt
	window.zkatterPlace= unescape(rspEx[4])
	window.zkatterDate= rspEx[2]
	window.zkatterText= unescape(rspEx[5])
	window.zkatterOwner= unescape(rspEx[3])
	window.zkatterOwnerId= rspEx[0]
	html= '<table id="shareTbl"><tr><td id="shareTd" align="center">'
	html+= '<div class="absolutePoint"><div id="shareStatus"></div></div>'
	html+= '<br />'
	html+= '<a onfocus="this.blur()" href="javascript://" class="sBtn" onclick="shareZkatter()"><img src="_img/misc/zshare.png"></a>'
	//html+= '<a onfocus="this.blur()" href="javascript://" class="sBtn" id="twSh" ' + shareTwitterAttr(rspEx[1]) + '><img src="_img/pix.gif" style="width: 60px; height: 60px; background-image: url(_img/_btn/share_t.png);" id="twShImg"></a>'
	html+= '<a onfocus="this.blur()" href="javascript://" class="sBtn TWs">'
	html+= tweetmeme(window.activeFeedObj.alt)
	html+= '</a>'	
	//html+= '<a onfocus="this.blur()" href="javascript://" class="sBtn" onclick="FB_shareZ()"><img src="_img/pix.gif" style="width: 60px; height: 60px; background-image: url(_img/_btn/share_f.png);" id="twShImg"></a>'
	html+= '<span class="sBtn FBs">'
	html+= '<table cellpadding="0" cellspacing="0"><tr><td>'
	html+= '<fb:share-button href="' + site_absolute_path + zk_url_folder + window.activeFeedObj.alt + '" type="box_count">'
	html+= '</fb:share-button>'
	html+= '</td></tr></table>'	
	html+= '</span>'
	html+= '<a onfocus="this.blur()" href="javascript://" class="sBtn DGs">'
	html+= diggIt()
	html+= '</a>'
	//html+= '<a onfocus="this.blur()" href="javascript://" class="sBtn"><img src="_img/_btn/share_ms.png"></a>'
	html+= '<br /><br />'
	html+= '<table cellpadding="0" cellspacing="0">'
	html+= '<tr>'
	html+= '<td><strong style="margin-right: 5px;">Link&nbsp;<span class="uArr">&raquo;</span></strong></td>'
	html+= '<td><div>'
	html+= boxRfStart
	html+= '<input value="' + site_absolute_path + zk_url_folder + window.activeFeedObj.alt + '" onclick="copy4paste(this)" style="border: 0pt none ; width: 250px;" type="text">'
	html+= boxRfEnd
	html+= '</div></td>'
	html+= '<td><strong style="margin-left: 15px; margin-right: 5px;">Embed&nbsp;<span class="uArr">&raquo;</span></strong></td>'
	html+= '<td><div>'
	html+= boxRfStart
	html+= '<input value=\'' + zBadge(rspEx[0],window.activeFeedObj.alt) + '\' onclick="copy4paste(this)" style="border:0pt none;width:250px" type="text">'
	html+= boxRfEnd
	html+= '</div></td>'
	html+= '</tr>'
	html+= '</table>'
	html+= '</td></tr></table>'
	return html	
	}

function tweetmeme(zid)
	{
	var tweetmeme_url=site_absolute_path+zk_url_folder+zid
	var tweetmeme_service='bit.ly'
	var _url=window.location.href
	var _url=_url.replace(/((?:\?|&)?fbc_receiver=.+)?(?:#.*)?$/,"")
	var url=escape((typeof tweetmeme_url=="string")?tweetmeme_url:((typeof TWEETMEME_URL=="string")?TWEETMEME_URL:_url)).replace(/\+/g,"%2b")
	var source=(typeof tweetmeme_source=="string")?escape(tweetmeme_source):((typeof TWEETMEME_SOURCE=="string")?escape(TWEETMEME_SOURCE):false)
	var style=(typeof tweetmeme_style=="string")?escape(tweetmeme_style):((typeof TWEETMEME_STYLE=="string")?escape(TWEETMEME_STYLE):"normal")
	var service=(typeof tweetmeme_service=="string")?escape(tweetmeme_service):((typeof TWEETMEME_SERVICE=="string")?escape(TWEETMEME_SERVICE):false)
	var service_api=(typeof tweetmeme_service_api=="string")?escape(tweetmeme_service_api):((typeof TWEETMEME_SERVICE_API=="string")?escape(TWEETMEME_SERVICE_API):false)
	var alias=(typeof tweetmeme_alias=="string")?escape(tweetmeme_alias):((typeof TWEETMEME_ALIAS=="string")?escape(TWEETMEME_ALIAS):false)
	var src="http://api.tweetmeme.com/button.js"
	switch(style)
		{
		case"compact":var h=20;var w=90;break
		case"rednose":var h=61;var w=50;break
		default:var h=61;var w=50;break
		}
	src+="?url="+url;src+="&style="+style
	if(source!=false){src+="&source="+source}
	if(service){src+="&service="+service}
	if(service_api){src+="&service_api="+service_api}
	if(alias){src+="&alias="+alias}return('<iframe src="'+src+'" height="'+h+'" width="'+w+'" frameborder="0" scrolling="no"></iframe>')
	tweetmeme_url=null
	TWEETMEME_URL=null
	tweetmeme_source=null
	TWEETMEME_SOURCE=null
	tweetmeme_service=null
	TWEETMEME_SERVICE=null
	tweetmeme_service_api=null
	TWEETMEME_SERVICE_API=null
	tweetmeme_style=null
	TWEETMEME_STYLE=null
	}

function diggIt() 
	{
	digg_url= site_absolute_path + zk_url_folder + window.activeFeedObj.alt
	o = new Object();
	var du  = escape(o.d_url ? o.d_url : (typeof digg_url == 'string') ? digg_url : ((typeof DIGG_URL == 'string') ? DIGG_URL : window.location.href)).replace(/\+/g, '%2b');
	var h=80, w=52;
	var ds  = o.d_skin     ? '&s=' + escape(o.d_skin)     : (typeof digg_skin     == 'string') ? '&s=' + escape(digg_skin)     : '';
	var dt  = o.d_title    ? '&t=' + escape(o.d_title)    : (typeof digg_title    == 'string') ? '&t=' + escape(digg_title)    : '&t=' + escape(document.title);
	var dw  = o.d_window   ? '&w=' + escape(o.d_window)   : (typeof digg_window   == 'string') ? '&w=' + escape(digg_window)   : '';
	var dbt = o.d_bodytext ? '&b=' + escape(o.d_bodytext) : (typeof digg_bodytext == 'string') ? '&b=' + escape(digg_bodytext) : '';
	var dm  = o.d_media    ? '&m=' + escape(o.d_media)    : (typeof digg_media    == 'string') ? '&m=' + escape(digg_media)    : '';
	var dc  = o.d_topic    ? '&c=' + escape(o.d_topic)    : (typeof digg_topic    == 'string') ? '&c=' + escape(digg_topic)    : '';
	var dbg = o.d_bgcolor  ? '&k=' + escape(o.d_bgcolor)  : (typeof digg_bgcolor  == 'string') ? '&k=' + escape(digg_bgcolor)  : '';
	if (ds == '&s=compact')   { h=18; w=120; }
	else if (ds == '&s=icon') { h=16; w=16; }
	return "<iframe src=\"http://digg.com/tools/diggthis.php?u=" + du + ds + dt + dw + dbt + dm + dc + dbg + "\" height='" + h + "' width='" + w + "' frameborder='0' scrolling='no'></iframe>";
	}

function shareTwitterAttr(flg)
	{
	window.turnOffTwitLink= false
	omo= "balloon.showTooltip(event,'You are not sync with <b>twitter</b>. Click to sync!')"
	ocl= 'twitPop(5)'
	if (twitter_screen_name)
		{
		omo= "balloon.showTooltip(event,'Click me to share this zkatter on <b>twitter</b> (" + twitter_screen_name + ").')"
		ocl= 'shareThisZkatter()'		
		}
	if (twitter_screen_name && flg == '1')
		{
		omo= "balloon.showTooltip(event,'You have allready share this Zkattering<br>with <b>twitter</b> (" + twitter_screen_name + ")')"
		ocl= false
		}
	attributes= 'onmouseover="' + omo +  '"'
	if (ocl) attributes+= ' onclick="' + ocl + '"'
	return attributes
	}

function shareZkatter()
	{
	$('#t' + window.activeFeedObj.alt).animate({'height':'500px'},'slow')
	html= '<div class="absolutePoint" id="szap">'
	html+= '<div id="shareZkCnt">'
	html+= '<div id="title">Share this Zkattering with:</div>'
	html+= '<div id="selectedT">Share this Zkattering with:</div>'
	html+= '<div id="messageT">Message:</div>'
	html+= '<img src="images/share-friends-area.png" id="listBorder" />'
	html+= '<img src="images/pix.gif" class="Xc" onmouseover="this.className=\'XcX\'" onmouseout="this.className=\'Xc\'" onclick="clickX(this)" title="Clear search field">'
	html+= '<input class="friend" id="friend" onclick="document.getElementById(this.id).className=\'friendX\'" onblur="checkBG(this.value)" onchange="checkBG(this.value)" onkeyup="filterList(this.value)" autocomplete="off" type="text">'
	html+= '<div id="theFriends"></div>'
	html+= '<img src="images/share-to-area.png" class="toAreaBG">'
	//html+= '<div class="tosf" id="tosf"><strong>Click to select friend(s) to share this zkatter with: </strong></div>'
	html+= '<div class="tosf" id="tosf"></div>'
	html+= '<img src="images/share-text-area.png" class="textAreaBG">'
	html+= '<textarea id="msgidsf" onfocus="textAreaFocus(this)" onblur="textAreaBlur(this)" onkeypress="textAreaCheck(this)">Take a look at this zkattering...</textarea>'
	html+= '<div class="charleft"><span class="txt">Characters:</span> <span id="charleft">255</span></div>'
	html+= '<img src="images/share-button.png" class="btnsf" onclick="zhareZkatterNow()">'
	html+= '<div style="position: absolute; left: 420px; top: 445px; font-size: 1.4em;">'
	html+= '<a href="javascript://" onclick="$(\'#t\' + window.activeFeedObj.alt).animate({\'height\':\'350px\'},\'slow\');document.getElementById(\'t\' + window.activeFeedObj.alt).innerHTML= z_share_cnt()">Back to Share options &raquo;</a>'
	html+= '</div>'
	html+= '</div>'
	html+= '</div>'
	html+= '</div>'
	document.getElementById('t' + window.activeFeedObj.alt).innerHTML= html
	if (!friends) simple_ajax('_ajax/?friends=1', 'theFriends')
	else buildList()
	}

function textAreaFocus(obj)
	{
	if (!window.shareDefaultText) window.shareDefaultText= obj.value
	if (obj.value == window.shareDefaultText) obj.value= ''
	}

function textAreaBlur(obj)
	{
	if (obj.value == '') obj.value= window.shareDefaultText
	}

function textAreaCheck(obj)
	{
	if (obj.value.length>255) obj.value= obj.value.substr(0,255)
	document.getElementById('charleft').innerHTML= 255 - obj.value.length
	}

function zhareZkatterNow()
	{
	window.ajaxShareDone= false
	shareFriends= ''
	for (f=0; f<friends.length; f++) if (document.getElementById('f' + friends[f].id).className) shareFriends+= friends[f].id + '|'
	if (shareFriends)
		{
		simple_ajax('_ajax/?shareZonZ=' + window.activeFeedObj.alt + '&with=' + shareFriends.substr(0,shareFriends.length-1) + '&msg=' + escape(document.getElementById('msgidsf').value), 'shareZkatterOnZkatterDone')
		$('#t' + window.activeFeedObj.alt).animate({'height':'350px','opacity':0},'fast',function()
			{
			document.getElementById('t' + window.activeFeedObj.alt).innerHTML= zhareZkatterAjaxing()
			$('#t' + window.activeFeedObj.alt).animate({'opacity':1},'fast')
			})
		}
	}

function zhareZkatterAjaxing()
	{
	if (window.ajaxShareDone) a= 'Sharing Completed!', b= 'none', c= 'block'
	else a= 'Sharing...', b= 'block', c= 'none'
	html= '<div class="respondCnt">'
	html+= '<div id="center">'
	html+= '<div id="title">' + a + '</div>'
	html+= '<div id="snddone" style="display:block">'
	html+= boxRfStart
	html+= '<div id="doneAjax" style="display:' + b + '"></div>'
	html+= '<div id="doneText" style="display:' + c + '"><strong>Zkatdroid has successfully shared<br/>this Zkattering.</strong></div>'
	html+= boxRfEnd
	html+= '</div>'
	html+= '</div>'
	html+= '</div>'
	return html
	}

function shareZkatterOnZkatterDone(rsp)
	{
	window.ajaxShareDone= true
	if (document.getElementById('doneAjax'))
		{
		document.getElementById('doneAjax').style.display= 'none'
		document.getElementById('doneText').style.display= 'block'
		document.getElementById('title').innerHTML= 'Share Completed'
		}
	setTimeout("closeActiveTab()",2000)
	}

function theFriends(rsp)
	{
	var frnds= new Array()
	rows= rsp.split("\n")
	for (r=0; r<rows.length; r++)
		{
		cols= rows[r].split("\t")
		frnds[r]= {id:cols[0],sc:cols[1],nm:cols[2]}
		}
	window.friends= frnds
	buildList()
	}

function aFriend(row)
	{
	theName= unescape(row.nm) + ' (' + unescape(row.sc) + ')'
	if (theName.length > 30) theName= theName.substr(0,27) + '<span>&hellip;</span>'
	html= '<img src="_img/?p=' + row.id + ',0,2" />'
	html+= '<span>' + theName + '</span>'
	A= document.createElement('a')
	A.href= 'javascript://'
	A.id= 'f' + row.id
	A.innerHTML= html
	A.alt= row.id
	A.setAttribute('onclick','selectFriend(this)')
	A.setAttribute('onfocus','this.blur()')
	A.style.display= 'block'
	return A
	}

function allFriends()
	{
	html= '<img src="_img/pix.gif" />'
	html+= '<span>Check all</span>'
	A= document.createElement('a')
	A.href= 'javascript://'
	A.id= 'f0'
	A.innerHTML= html
	A.setAttribute('onclick','checkAllFriends(this)')
	A.setAttribute('onfocus','this.blur()')
	A.style.display= 'block'
	return A
	}

function filterList(inp,cls)
	{
	if (friends)
		{
		for (f=0; f<friends.length; f++)
			{
			href= document.getElementById('f' + friends[f].id)
			href.lastChild.innerHTML= strip_tags(href.lastChild.innerHTML)
			if (friends[f].nm.toLowerCase().indexOf(inp.toLowerCase()) >= 0 || friends[f].sc.toLowerCase().indexOf(inp.toLowerCase()) >= 0)
				{
				for (var i=0; i<href.lastChild.innerHTML.length; i++)
					{
					if (inp == href.lastChild.innerHTML.substr(i,inp.length)) {} // things must happen here to highlight the selected area
					}
				href.style.display= 'block'
				}
			else href.style.display= 'none'
			}
		}
	}

function buildList()
	{
	toObj= document.getElementById('tosf')
	if (friends)
		{
		document.getElementById('theFriends').appendChild(allFriends())
		for (var f=0; f<friends.length; f++)
			{
			document.getElementById('theFriends').appendChild(aFriend(friends[f]))
			toObj.innerHTML= toObj.innerHTML + '<a onfocus="this.blur()" title="Remove ' + friends[f].sc + ' from your sharing list" href="javascript://" class="rm" id="r' + friends[f].id + '" onfocus="this.blur()" style="display:none" onclick="uncheckFriend(this)">' + friends[f].sc + '</a> '
			}
		}
	toObj.innerHTML= toObj.innerHTML + '<a href="javascript://" onclick="uncheckAllFriends()" class="rm" onfocus="this.blur()" id="allc" style="display:none">uncheck all</a>'
	}

function uncheckFriend(obj)
	{
	document.getElementById('f0').removeAttribute('class')
	obj.style.display= 'none'
	document.getElementById('f' + obj.id.substr(1)).removeAttribute('class')
	checkFriendsStyles()
	}

function checkAllFriends(obj)
	{
	if (obj.className) uncheckAllFriends()
	else
		{
		obj.setAttribute('class','selected')
		fr2= document.getElementById('tosf').getElementsByTagName('a')
		for (var f=0; f<fr2.length; f++)
			{
			fid= fr2[f].id.substr(1)
			if (fr2[f].id.substr(0,1) == 'r')
				{
				fr2[f].style.display= 'inline'
				document.getElementById('f' + fid).setAttribute('class','selected')
				}
			}
		checkFriendsStyles()
		}
	}

function uncheckAllFriends()
	{
	document.getElementById('f0').removeAttribute('class')
	fr2= document.getElementById('tosf').getElementsByTagName('a')
	for (var f=0; f<fr2.length; f++)
		{
		fid= fr2[f].id.substr(1)
		if (fr2[f].id.substr(0,1) == 'r')
			{
			fr2[f].style.display= 'none'
			if (document.getElementById('f' + fid).className) document.getElementById('f' + fid).removeAttribute('class')
			}
		}
	checkFriendsStyles()
	}

function checkFriendsStyles()
	{
	cc= 0
	hrefs= document.getElementById('tosf').getElementsByTagName('a')
	for (var f=0; f<hrefs.length; f++) if (hrefs[f].id != 'allc' && hrefs[f].style.display == 'inline') cc++
	if (cc > 1) document.getElementById('allc').style.display= 'inline'
	else document.getElementById('allc').style.display= 'none'
	}

function selectFriend(obj)
	{
	if (obj.className)
		{
		obj.removeAttribute('class')
		document.getElementById('r' + obj.alt).style.display= 'none'
		document.getElementById('f0').removeAttribute('class')
		}
	else
		{
		obj.setAttribute('class','selected')
		document.getElementById('r' + obj.alt).style.display= 'inline'
		}
	checkFriendsStyles()
	}

function clickX(obj)
	{
	document.getElementById('friend').value= ''
	document.getElementById('friend').className= 'friend'
	filterList('')
	}

function showpages(curp,tot,rXp,rangepages,nextpbypage,fl){
	curp= parseInt(curp)
	if (scrpt == _Gp_searchresults) gSearch_header(tot)
	alertd(" curp="+curp+" tot="+tot+" rXp="+rXp+" rangepages="+rangepages+" nextpbypage="+nextpbypage+" fl="+fl, "showpages begins", "008800", 1);
	rXp=parseInt(rXp);
	if(tot<rXp) {
		if (document.getElementById('list_nav_top')) document.getElementById('list_nav_top').innerHTML='&nbsp;';
		return;
	}
	retStr='';
	curres=parseInt((curp-1)*rXp+1);
	if(curp>1&&fl){
		retStr+='<a href="javascript://" onclick="'+nextpbypage+'(1)" class="navFirst">&nbsp;First&nbsp;</a><span class="navSep"></span>';
	}
	page=1;
	pageres=1;
	totres=tot;
	lastp=ceil(totres/rXp);
	if(curp>rangepages){
		pBEcase=1;
		pagesbegin=curp-rangepages;
		pagesend=curp+rangepages;
	}else if(curp>lastp-rangepages){
		pBEcase=2;
		pagesbegin=curp-rangepages;
		pagesend=lastp;
	}else{
		pBEcase=3;
		pagesbegin=1;
		pagesend=curp+rangepages;
	}
	alertd(" lastp="+lastp+" pBEcase="+pBEcase+" pagesbegin="+pagesbegin+" pagesend="+pagesend, "", "", 1);

	if(curp>1){
		retStr+='<a href="javascript://" onclick="'+nextpbypage+'('+(curp-1)+')" class="navPrv">&nbsp;Previous&nbsp;</a><span class="navSep"></span>';
	}

	while(totres>0){
		totres-=rXp;
		if(page<pagesbegin||page>pagesend){
			pageres+=rXp;
			page++;
			continue;
		}
		if(page!=curp){
			retStr+='<a href="javascript://" onclick="'+nextpbypage+'('+page+')" class="navPage">&nbsp;'+page+'&nbsp;</a>';
			retStr+=((totres>=1&&page<pagesend)?' <span class="navSep"></span> ':' ');
		}else{
			retStr+=' <span class="navPageAct">&nbsp;'+page+'&nbsp;</span> '+((totres>=1&&page<pagesend)?'<span class="navSep"></span>':' ');
		}
		pageres+=rXp;
		page++;
	}
	totres=tot;
	if(curres+rXp<=totres&&fl){
		retStr+='<span class="navSep"></span><a href="javascript://" onclick="'+nextpbypage+'('+((curp+1<page-1)?curp+1:page-1)+')" class="navNxt">&nbsp;Next&nbsp;</a>';
		retStr+='<span class="navSep"></span><a href="javascript://" onclick="'+nextpbypage+'('+(page-1)+')" class="navLast">&nbsp;Last&nbsp;</a>';
	}
	alertd(" retStr="+retStr, "showpages ends", "008800", 1);
	if (document.getElementById('list_nav')) document.getElementById('list_nav').innerHTML= retStr;
	if (document.getElementById('list_nav_top')) document.getElementById('list_nav_top').innerHTML= retStr;
}