function SwapImage(main, slide) {
	var objMain  = classObjetos.findObj(main);
	var objSlide = classObjetos.findObj(slide);
	var local1   = objMain.getAttribute('local') +"index.php?module=loaders&file=loaders&path=foto&tipomidia="+objMain.getAttribute('tipomidia')+"&midiaid="+objMain.getAttribute('iduser')+"&fotoid="+objSlide.getAttribute('oldpic')+"&thumbid="+objMain.getAttribute('thumbid');
	var local2   = objMain.getAttribute('local') +"index.php?module=loaders&file=loaders&path=foto&tipomidia="+objMain.getAttribute('tipomidia')+"&midiaid="+objMain.getAttribute('iduser')+"&fotoid="+objMain.getAttribute('oldpic')+"&thumbid="+objSlide.getAttribute('thumbid');
	
	var oldpic1  = objSlide.getAttribute('oldpic');
	var oldpic2  = objMain.getAttribute('oldpic');
	
	objMain.setAttribute('oldpic', oldpic1);
	objSlide.setAttribute('oldpic', oldpic2);
	
	objMain.src  = local1;
	objSlide.src = local2;
}

var callback = {
	nextPhoto : function(result){
			
		//troca a foto
		var image = document.getElementById('fotoUsuario');
		image.src = result[0];
		
		//botao
		var botao = document.getElementById('btnNextPhoto');				
		botao.onclick = function(event) { Ajax_Profile.nextPhoto(result[1],result[2]); };		
	}	
	/*StuffUP : function (result) {},
	Convert : function (result) {
		ObjDiv = classObjetos.findObj(result[0]);
		ObjDiv.innerHTML = result[1];
	},
	AddFavorite : function(result){
		ShowDivMsg(result,'','',false);
	},
	BlockUser : function(result){
		ShowDivMsg(result,'','',false);
	},
	UnBlockUser : function(result){
		ShowDivMsg(result,'','',false);		
	},	
	AddWink : function(result){				
		ShowDivMsg(result[1],'','',false);
		var status = result[0];
		if(status == true) 
		{	
			document.getElementById('winkButton').setAttribute('disabled',status);;
			document.getElementById('winkButton').setAttribute('class','BTS_01_70 alpha_50');				
		}			
	},
	AddFriends : function(result){
		ShowDivMsg(result,'','',false);			
	}*/
}

//var Ajax_Profile = new ajax_profile(callback);

/*
function Normaliza(str){
		str = str.replace(/\n/g,"<BR>");
		str = str.replace(/\[b\]/g,"<b>");
		str = str.replace(/\[\/b\]/g,"</b>");
		str = str.replace(/\[u\]/g,"<u>");
		str = str.replace(/\[\/u\]/g,"</u>");
		str = str.replace(/\[i\]/g,"<i>");
		str = str.replace(/\[\/i\]/g,"</i>");
		
		str = str.replace(/\[url=/,"<a href='");
		str = str.replace(/\]/,"' target='_blank'>");

		str = str.replace(/\[\/url\]/,"</a>");
		return str;
}
*/
function Normaliza(texto) {
	
	texto = texto.replace(/\</g,"&lt;");
	texto = texto.replace(/\>/g,"&gt;");	
	texto = texto.replace(/\[b\](.*)\[\/b\]/g, "<b>$1</b>");
	texto = texto.replace(/\[i\](.*)\[\/i\]/g, "<i>$1</i>");
	texto = texto.replace(/\[u\](.*)\[\/u\]/g, "<u>$1</u>");
	texto = texto.replace(/\[center\](.*)\[\/center\]/g, "<center>$1</center>");
	texto = texto.replace(/\[url=(.*)\](.*)\[\/url\]/g, "<a href=\"$1 aaaaa\" target=\"_blank\">$2</a>");
	
	return texto;
}

function AtualizaStuff(Qtd) {
	var ObjInput, ObjDiv;
	
	for (var i = 0; i < Qtd; i++) {
		ObjInput = classObjetos.findObj('ds_stuff_'+i);
		ObjDiv   = classObjetos.findObj('stuffView_'+i);
		
		Ajax_Profile.StuffUP(ObjInput.getAttribute('usuariostuff'), escape(ObjInput.value).replace(/\+/g,' '));
		
		if (ObjInput.value != ''){
			Ajax_Profile.Convert('stuffView_'+i,ObjInput.value.replace(/\n/g,"<br />"));
		}else{
			ObjDiv.innerHTML = 'Not Answered';
		}
	
	}
	
	sleep(1500);
	EditStuff();
}

function EditStuff() {
	var DIVS = document.getElementsByTagName("DIV");
	
	for (var i = 0; i < DIVS.length; i++) {
		if (DIVS[i].getAttribute('stuffEditDiv') != null || DIVS[i].getAttribute('stuffViewDiv') != null) {
			DIVS[i].style.display = (DIVS[i].style.display != 'none') ? 'none' : 'block';
		}
	}
	
	classObjetos.findObj('bloco_stuff_save').style.display = (classObjetos.findObj('bloco_stuff_save').style.display != 'none') ? 'none' : 'block';
}

function Block(id,status,obj){
	
	if(status==1){
		obj.setAttribute('statusblock','2')	;
		obj.innerHTML = 'Block User';
		Ajax_Profile.UnBlockUser(id);
	}else if(status==2){
		obj.setAttribute('statusblock','1')	;
		obj.innerHTML = 'Unblock User';
		Ajax_Profile.BlockUser(id);
	}
}

