﻿// ==/UserScript==
// @name		Join & Unjoin (Participar e Deixar de Participar)
// @author		POWER.LA  - ISSO SIM E PODER ! - http://www.orkut.com/Profile.aspx?uid=14757431368851775288
// @community		http://www.orkut.com/Community.aspx?cmm=25443115
// @description		Confirms its choice in Join or UnJoin in the communities (Confirma sua escolha em Participar ou Deixar de Participar das comunidades)
// @include        		http://www.orkut.com/CommunityJoin.aspx?*
// @include        		http://www.orkut.com/CommunityUnjoin.aspx?*
// @include        		http://www.orkut.com/CommBond.aspx?*
// @include        		http://www.orkut.com/CommPolls.aspx?*
// @LAST UPDATE	  	15/05/2007
// ==/UserScript==

	function comm_join()
	{
	if( location.href.toLowerCase().indexOf('commbond.aspx') > -1)
	if(! confirm('Precione OK para se tornar membro !') ){ history.go(-1); return;}

	var bt = document.createElement('input');
	bt.setAttribute("type", "submit");
	bt.setAttribute("value", "aguarde...");
	bt.setAttribute("style", "background:#ccffcc");

 	if(location.href.toLowerCase().indexOf('unjoin.aspx') > -1){
	 bt.setAttribute("name", "Action.unjoin");
	 document.forms[1].appendChild(bt);
	}
 	else if(location.href.toLowerCase().indexOf('bond.aspx') > -1){
	 var trs = document.getElementsByTagName('tr');
	 for( var i = 0; i < trs.length; i++)
	{
	  if(trs[i].innerHTML.toLowerCase().indexOf('<table') > -1) continue;
	  if(trs[i].getAttribute("onclick") && trs[i].getAttribute("onclick").toLowerCase().indexOf('join.aspx') > -1)
	  {
	   trs[i].appendChild(bt);
	   break;
	  }
	 }
	} else {
	 bt.setAttribute("name", "Action.join");
	 document.forms[1].appendChild(bt);
	}
	 bt.click();
	}

	comm_join();