
function addcomment(oForm){ 
	b = oForm.b.value ; 
	n = oForm.n.value ; 
	c = oForm.c.value ; 
	if( b.length > 0 && n.length > 0 && c.length > 0 ){ 
		postForm(site_base+'/site/post.comment.php?b='+b+'&n='+n+'&c='+c,'commentmsgback',oForm);
		oForm.n.value = '' ; 
		oForm.c.value = '' ; 
		window.location.href = document.location.href + '&' + Math.random() ;
		//window.location.reload() ;
	}
}

function addvote(p,v){ 
	getUrl(site_base+'/site/post.vote.php?p='+p+'&v='+v+'','voteback');
}

function addcategory(oForm){ 
	p = oForm.p.value ; 
	c = oForm.c.value ; 
	postForm(site_base+'/site/post.category.php?p='+p+'&c='+c+'','categoryback',oForm);
}

function toggle(id){
    var objDiv = document.getElementById(id) ;
	objDiv.style.display = (objDiv.style.display == "block") ? "none" : "block" ;
}

function draw_flash(n,w,h,url){ 
	c = '<obj'+'ect id="'+n+'" width="'+w+'" height="'+h+'">\n' + 
	'<par'+'am name="movie" value="'+url+'"></param>\n' + 
	'<par'+'am name="wmode" value="transparent"></param>\n' + 
	'<em'+'bed name="'+n+'" src="'+url+'" type="application/x-shockwave-flash" wmode="transparent" width="'+w+'" height="'+h+'"></embed>\n' +
	'</obj'+'ect>\n'; 
	dwrite(c) ; 
}

function draw_video(url,w,h){ 
	n = 'videoplayer' ; 
	c = '<obj'+'ect id="'+n+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="'+w+'" height="'+h+'">\n' + 
	'<par'+'am name="movie" value="'+url+'"></param>\n' + 
	'<par'+'am name="wmode" value="transparent"></param>\n' + 
	'<em'+'bed name="'+n+'" src="'+url+'" type="application/x-shockwave-flash" wmode="transparent" width="'+w+'" height="'+h+'"></embed>' +
	'</obj'+'ect>'; 
	dwrite(c) ; 
}

function videochange(url,w,h){ 
	n = 'videoplayer' ; 
	c = '<obj'+'ect id="'+n+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="'+w+'" height="'+h+'">\n' + 
	'<par'+'am name="movie" value="'+url+'"></param>\n' + 
	'<par'+'am name="wmode" value="transparent"></param>\n' + 
	'<em'+'bed name="'+n+'" src="'+url+'" type="application/x-shockwave-flash" wmode="transparent" width="'+w+'" height="'+h+'"></embed>' +
	'</obj'+'ect>'; 
	document.getElementById('pvideo').innerHTML = c ; 
}

function draw_audio(version,w,h,url){ 
	n = 'audioplayer'; 
	c = '<obj'+'ect id="'+n+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="'+w+'" height="'+h+'">\n' + 
	'<par'+'am name="movie" value="'+site_base+'/site/flash/audio-player-'+version+'.swf?'+url+'"></param>\n' + 
	'<par'+'am name="wmode" value="transparent"></param>\n' + 
	'<em'+'bed name="'+n+'" src="'+site_base+'/site/flash/audio-player-'+version+'.swf?'+url+'" type="application/x-shockwave-flash" wmode="transparent" width="'+w+'" height="'+h+'"></embed>' +
	'</obj'+'ect>'; 
	dwrite(c) ; 
}

function audiochange(elname,version,w,h,url){ 
	n = 'audioplayer'; 
	c = '<obj'+'ect id="'+n+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="'+w+'" height="'+h+'">\n' + 
	'<par'+'am name="movie" value="'+site_base+'/site/flash/audio-player-'+version+'.swf'+url+'"></param>\n' + 
	'<par'+'am name="wmode" value="transparent"></param>\n' + 
	'<em'+'bed name="'+n+'" src="'+site_base+'/site/flash/audio-player-'+version+'.swf?'+url+'" type="application/x-shockwave-flash" wmode="transparent" width="'+w+'" height="'+h+'"></embed>' +
	'</obj'+'ect>'; 
	document.getElementById(elname).innerHTML = c ; 
}

function draw_events(s){ 
	w = 110 ; 
	h = 102 ; 
	n = 'audioplayer'; 
	c = '<obj'+'ect id="'+n+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="'+w+'" height="'+h+'">\n' + 
	'<par'+'am name="movie" value="'+site_base+'/site/flash/home.events.swf?s='+s+'"></param>\n' + 
	'<par'+'am name="wmode" value=""></param>\n' + 
	'<em'+'bed name="'+n+'" src="'+site_base+'/site/flash/home.events.swf?s='+s+'" type="application/x-shockwave-flash" wmode="transparent" width="'+w+'" height="'+h+'"></embed>' +
	'</obj'+'ect>'; 
	dwrite(c) ; 
}

function draw_tribe(s){
	w = 100 ; 
	h = 100 ; 
	n = 'tribes'; 
	c = '<obj'+'ect id="'+n+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="'+w+'" height="'+h+'">\n' + 
	'<par'+'am name="movie" value="'+site_base+'/site/flash/cube.tribe.swf?i='+s+'"></param>\n' + 
	'<par'+'am name="wmode" value="transparent"></param>\n' + 
	'<em'+'bed name="'+n+'" src="'+site_base+'/site/flash/cube.tribe.swf?i='+s+'" type="application/x-shockwave-flash" wmode="transparent" width="'+w+'" height="'+h+'"></embed>' +
	'</obj'+'ect>' ; 
	dwrite(c) ; 
}

function draw_miniaudio(a){
	w = 250 ; 
	h = 35 ; 
	n = 'miniaudio'; 
	c = '<obj'+'ect id="'+n+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="'+w+'" height="'+h+'">\n' + 
	'<par'+'am name="movie" value="'+site_base+'/site/flash/mini-audio-player.swf?a='+a+'"></param>\n' + 
	'<par'+'am name="wmode" value="transparent"></param>\n' + 
	'<em'+'bed name="'+n+'" src="'+site_base+'/site/flash/mini-audio-player.swf?a='+a+'" type="application/x-shockwave-flash" wmode="transparent" width="'+w+'" height="'+h+'"></embed>' +
	'</obj'+'ect>' ; 
	dwrite(c) ; 
}

function miniaudiochange(p,u,w,h){ 
	if( w == 'undefined' ) w = 250 ; 
	if( h == 'undefined' ) h = 35 ; 
	n = 'miniaudio'+p ; 
	c = '<obj'+'ect id="'+n+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="'+w+'" height="'+h+'">\n' + 
	'<par'+'am name="movie" value="'+site_base+'/site/templates/'+site_l+'/'+site_d+'/mini-audio-player.swf?'+u+'"></param>\n' + 
	'<par'+'am name="wmode" value="transparent"></param>\n' + 
	'<em'+'bed name="'+n+'" src="'+site_base+'/site/templates/'+site_l+'/'+site_d+'/mini-audio-player.swf?'+u+'" type="application/x-shockwave-flash" wmode="transparent" width="'+w+'" height="'+h+'"></embed>' +
	'</obj'+'ect>' ; 
	document.getElementById('dminiaudio-'+p).innerHTML = c ; 
}

function toggle_miniaudio(i,murl,el,w,h){ 
	miniaudiochange(i,murl,w,h) ; 
    var objDiv = document.getElementById(el);
    objDiv.style.display = (objDiv.style.display == "block") ? "none" : "block" ;
}

function check_photo_upload(o){
	var l = o.fotoad.value.length ; 
	var check = true ; 
	if( check && l > 4 ){ 
		var ext = o.fotoad.value.substr( (l-4), 4 ).toLowerCase(); 
		if( ext != '.jpg' && ext != '.gif' && ext != '.png' && ext != '.bmp' ){
			alert('Só são aceitos arquivos no formato JPG, GIF, PNG e BMP.') ; 
			return false ; 
		}
	}
	if( l > 4 ){ 
		o.btsubmit.value = 'aguarde...' ; 
		o.btsubmit.disabled = true ;
		o.submit(); 
	}
	return false ; 
}

function submit_wait(el){
	el.value = 'aguarde...' ; 
	el.disabled = true ; 
}

function button_wait(el,o){
	el.value = 'aguarde...' ; 
	el.disabled = true ; 
	o.submit() ; 
}

function h( url ){ 
	window.location.href = '' + url ; 
}

function l( url ){ 
	window.top.location = '' + url ; 
}

function li(vir,uid){
	//window.top.location.reload() ; 
	//return ; 
	if( uid != undefined ) url = 'index.php?uid=' + uid ; 
	else url = 'index.php' ; 
	window.top.location = vir + '/' + url ; 
}

function p(){ 
	document.forms['home_comment'].elements[0].focus() ; 
}

var addwcnt = 0 ; 
function addwho(el,oForm){ 
	addwcnt = oForm.qqq.value ; 
	if( el.checked == true ){
		if( addwcnt < 10 ) addwcnt++ ;
		else el.checked = false ; 
	} else {
		addwcnt-- ;
	}
	if( addwcnt > 10 ){ 
		el.checked = false ; 
	} 
	oForm.qqq.value = addwcnt ; 
}

function addwig(oForm,u,w){ 
	getUrl(site_base+'/site/post.metoo.php?u='+u+'&w='+w+'','me_too_'+w);
}

function addfriend(oForm,f){
	getUrl(site_base+'/site/post.friend.php?f='+f,'add_f_'+f);
}

function respfriend(oForm,u,a){
	getUrl(site_base+'/site/post.friend.php?u='+u+'&a='+a,'add_u_'+u);
}

function removefavorite(oForm,u,fa){
	getUrl(site_base+'/site/post.favorite.php?fa='+fa+'','add_f_'+u);
}

/* formatting tags */
function insertURL(el){ 
	var txt = prompt("Digite a URL para incluir:","") ; 
	document.getElementById(el+'').value += '[url]' + txt + '[/url]' ; 
	document.getElementById(el+'').focus() ; 
}
function insertImage(el){
	var txt = prompt("Digite o endereço da imagem para ser incluída:","") ; 
	document.getElementById(el+'').value += '[img]' + txt + '[/img]' ; 
	document.getElementById(el+'').focus() ; 
}
function insertBold(el){
	var txt = prompt("Digite o texto em negrito:","") ; 
	document.getElementById(el+'').value += '[b]' + txt + '[/b]' ; 
	document.getElementById(el+'').focus() ; 
}
function insertItalic(el){
	var txt = prompt("Digite o texto em itálico:","") ; 
	document.getElementById(el+'').value += '[i]' + txt + '[/i]' ; 
	document.getElementById(el+'').focus() ; 
}
function insertUnderline(el){
	var txt = prompt("Digite o texto sublinhado:","") ; 
	document.getElementById(el+'').value += '[u]' + txt + '[/u]' ; 
	document.getElementById(el+'').focus() ; 
}

