// Init sequece

initCommands=[]

function initAll() {
	for(i=0;i<initCommands.length;i++) {
		eval(initCommands[i])
	}
}

// Color button animation

function rotateColors(element,center,amplitude,what) {
	var el=document.getElementById(element)
	date=new Date()
	cx=date.getTime()/15;
	ca=Math.round(amplitude*Math.sin(cx/10)+center)
	cb=Math.round(amplitude*Math.sin(cx/11)+center)
	cc=Math.round(amplitude*Math.sin(cx/9)+center)
	el.style[what]="rgb("+ca+","+cb+","+cc+")"
}

function initButton(el) {
	if (compatibleBrowser) {
		var tst=document.getElementById(el)
		if (tst) setInterval("rotateColors('"+el+"',200,30,'backgroundColor')","20")
	}
}

function initText(el) {
	if (compatibleBrowser) {
		var tst=document.getElementById(el)
		if (tst) setInterval("rotateColors('"+el+"',50,50,'color')","20")
	}
}

// Title animation

data=['','Z','d','a','r','m','a','n','e','t']
function groovy(i,d) {
	i+=d
	var title=''
	for(j=0;j<10;j++) {
		if (j>=i) {
			title+=data[j]+'.....'
		} else {
			title+=data[j]
		}
	}
	document.title=title
	if (i==10) {
		d=-d
		setTimeout('groovy('+i+','+d+')','25000')
	} else if (i==0) {
		d=-d
		setTimeout('groovy('+i+','+d+')','2000')
	} else {
		setTimeout('groovy('+i+','+d+')','80')
	}		
}

if (compatibleBrowser) {
	initCommands[initCommands.length]="groovy(9,1)"
}

// Menu printing function

function printMemberMenu(t_home,t_member,t_search,t_invitation,t_profile,t_options,t_logout,t_chat,nicks) {
	document.writeln('<span class=menu>')
	document.writeln('<a href="index.php4?target=home&'+sid+'">'+t_home+'</a> | ')
	document.writeln('<a href="index.php4?target=member&'+sid+'">'+t_member+'</a> | ')
	document.writeln('<a href="index.php4?target=search&'+sid+'">'+t_search+'</a> | ')
	document.writeln('<a href="index.php4?target=invitation&'+sid+'">'+t_invitation+'</a> | ')
	document.writeln('<a href="index.php4?target=profile&'+sid+'">'+t_profile+'</a> | ')
	document.writeln('<a href="index.php4?target=options&'+sid+'">'+t_options+'</a> | ')
	document.writeln('<a href="index.php4?naction=logout">'+t_logout+'</a> | ')
	document.writeln('<a href="#top" onclick="open('+"'chat_m.php4','','width=550,height=250,resizable=1'"+')">'+t_chat+'<span class=nickscount>'+nicks+'</span></a>')
	document.writeln('</span>')
}

function printHeaderRest(hiddenMenu,t_boost,t_logged,user) {
	document.write('<td width=390 align=center class=login>')
	if (hiddenMenu) {
		document.writeln('<a href="index.php4?target=texts&'+sid+'"><img src="img/zdarmanet.png" border=0></a>')
	} else {
		document.writeln('<img src="img/zdarmanet.png" border=0>')
	}
	document.writeln('<br>'+t_boost+'</td>')
	document.writeln('<td valign=center align=center width=185><br>')
	document.writeln('<span class=logged>'+t_logged+'</span><br><span class=loggedLogin>'+user+'</span></td></tr>')
	document.writeln('<tr>')
	document.writeln('<td colspan=3 height=6 class=hr_f>&nbsp;</td></tr>')
	document.writeln('<td colspan=3 height=5 class=hr_e>&nbsp;</td></tr>')
	document.writeln('<tr>')
	document.writeln('<td width=760 colspan=3 valign=top align=center>')
}


function printFooter(translators,legal,english,french,spanish,german,czech,greek,finnish) {
	var txt="<iframe name=\"RFC\" style=\"border: none; width: 0px; height: 0px; margin: 0px 0px 0px 0px;\"></iframe>"
	txt+="</td></tr>\n<tr><td colspan=3 height=30><img src=\"img/dot.gif\"></td></tr>\n<tr><td></td><td height=15 background=\"img/hr.gif\"><img src=\"img/dot.gif\"></td><td></td></tr>\n<tr><td colspan=3 class=login align=center>\n"
	txt+="<a href=\"index.php4?naction=language.switch&switch=czech\">"+czech+"</a>"
	txt+=" | <a href=\"index.php4?naction=language.switch&switch=german\">"+german+"</a>"
	txt+=" | <a href=\"index.php4?naction=language.switch&switch=greek\">"+greek+"</a>"
	txt+=" | <a href=\"index.php4?naction=language.switch&switch=english\">"+english+"</a>"
	txt+=" | <a href=\"index.php4?naction=language.switch&switch=spanish\">"+spanish+"</a>"
	txt+=" | <a href=\"index.php4?naction=language.switch&switch=french\">"+french+"</a>"
	txt+=" | <a href=\"index.php4?naction=language.switch&switch=finnish\">"+finnish+"</a>"
	txt+="\n<br><a id=\"trans\" class=login href=\"index.php4?target=translators&"+sid+"\">"+translators+"</a>"
	txt+="\n<small><br>--<br>© 2001-2003 The Zdarma Company<br>\n"
	txt+="<a href=\"index.php4?target=faq&"+sid+"\">faq</a>"
	txt+=" | <a href=\"index.php4?target=legal&"+sid+"\">"+legal+"</a>"
	txt+="\n<br><a href=\"mailto:webmaster@zdarmanet.net\">webmaster@zdarmanet.net</a></small>\n"
	txt+="</td></tr></table>"
	document.write(txt)
}

function remoteFunctionCall(what) {
	top.RFC.location.href=what+"&"+sid
}