
var my_base_url='http://www.flashvip.com.br';
var my_pligg_base='';


dochref = document.location.href.substr(document.location.href.search('/')+2, 1000);
if(dochref.search('/') == -1){
	$thisurl = document.location.href.substr(0,document.location.href.search('/')+2) + dochref;
} else {
	$thisurl = document.location.href.substr(0,document.location.href.search('/')+2) + dochref.substr(0, dochref.search('/'));
}
$thisurl = $thisurl + '';

var xmlhttp
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
  try {
  xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")
 } catch (e) {
  try {
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
  } catch (E) {
   xmlhttp=false
  }
 }
@else
 xmlhttp=false
@end @*/

if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
{
  try {
	xmlhttp = new XMLHttpRequest ();
  }
  catch (e) {
  xmlhttp = false}
}

function myXMLHttpRequest ()
{
  var xmlhttplocal;
  try {
  	xmlhttplocal = new ActiveXObject ("Msxml2.XMLHTTP")}
  catch (e) {
	try {
	xmlhttplocal = new ActiveXObject ("Microsoft.XMLHTTP")}
	catch (E) {
	  xmlhttplocal = false;
	}
  }

  if (!xmlhttplocal && typeof XMLHttpRequest != 'undefined') {
	try {
	  var xmlhttplocal = new XMLHttpRequest ();
	}
	catch (e) {
	  var xmlhttplocal = false;
	}
  }
  return (xmlhttplocal);
}

var mnmxmlhttp = Array ();
var xvotesString = Array ();
var mnmPrevColor = Array ();
var responsestring = Array ();
var myxmlhttp = Array ();
var responseString = new String;


function vote (user, id, htmlid, md5, value)
{
  	if (xmlhttp) {
		url = $thisurl + "/vote.php";
		var mycontent = "id=" + id + "&user=" + user + "&md5=" + md5 + "&value=" + value;
		anonymous_vote = false;
        if (anonymous_vote == false && user == '0') {
            window.location="http://www.flashvip.com.br/login.php?return="+location.href;
        } else {
    		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
    		if (mnmxmlhttp) {
    			mnmxmlhttp[htmlid].open ("POST", url, true);
    			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
    					   'application/x-www-form-urlencoded');
    
    			mnmxmlhttp[htmlid].send (mycontent);
    			errormatch = new RegExp ("^ERROR:");    
    			target1 = document.getElementById ('xvotes-' + htmlid);
    			mnmPrevColor[htmlid] = target1.style.backgroundColor;
    			mnmxmlhttp[htmlid].onreadystatechange = function () {
    				if (mnmxmlhttp[htmlid].readyState == 4) {
    					xvotesString[htmlid] = mnmxmlhttp[htmlid].responseText;
    					if (xvotesString[htmlid].match (errormatch)) {
    						xvotesString[htmlid] = xvotesString[htmlid].substring (6, xvotesString[htmlid].length);
							changemnmvalues (htmlid, value, true);    					} else {
														if (xvotesString[htmlid].substring (1, 6) == "ERROR") { alert(xvotesString[htmlid]);  } else {changemnmvalues (htmlid, value, false); }     					}
    				}
    			}
    		}
    	}
	}
}
function celebrityvote(user, id, htmlid, md5, value)
{
  	if (xmlhttp) {
		url = $thisurl + "/vote.php";
		var mycontent = "id=" + id + "&user=" + user + "&md5=" + md5 + "&value=" + value;
		anonymous_vote = false;
        if (anonymous_vote == false && user == '0') {
            window.location="http://www.flashvip.com.br/login.php?return="+location.href;
        } else {
    		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
    		if (mnmxmlhttp) {
    			mnmxmlhttp[htmlid].open ("POST", url, true);
    			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
    					   'application/x-www-form-urlencoded');
    
    			mnmxmlhttp[htmlid].send (mycontent);
    			errormatch = new RegExp ("^ERROR:");    
    			target1 = document.getElementById ('xvotes-' + htmlid);    
    			mnmPrevColor[htmlid] = target1.style.backgroundColor;
    			mnmxmlhttp[htmlid].onreadystatechange = function () {
    				if (mnmxmlhttp[htmlid].readyState == 4) {
    					xvotesString[htmlid] = mnmxmlhttp[htmlid].responseText;
    					if (xvotesString[htmlid].match (errormatch)) {
    						xvotesString[htmlid] = xvotesString[htmlid].substring (6, xvotesString[htmlid].length);
							changecelebrityvalues (htmlid, value, true, user, id, md5, true);    					} else {
														if (xvotesString[htmlid].substring (1, 6) == "ERROR") { alert(xvotesString[htmlid]);  } else {changecelebrityvalues (htmlid, value, false, user, id, md5, true); }     					}
    				}
    			}
    		}
    	}
	}
}
function flagit (user, id, htmlid, md5, value)
{
  	if (xmlhttp) {
		url = $thisurl + "/flag.php";
		var mycontent = "id=" + id + "&user=" + user + "&md5=" + md5 + "&value=" + value;
		anonymous_vote = false;
        if (anonymous_vote == false && user == '0') {
            window.location="http://www.flashvip.com.br/login.php?return="+location.href;
        } else {
    		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
    		if (mnmxmlhttp) {
    			mnmxmlhttp[htmlid].open ("POST", url, true);
    			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
    					   'application/x-www-form-urlencoded');
    			mnmxmlhttp[htmlid].send (mycontent);
    			errormatch = new RegExp ("^ERROR:");    
    			target1 = document.getElementById ('xvotes-' + htmlid);    
    			mnmPrevColor[htmlid] = target1.style.backgroundColor;
    			mnmxmlhttp[htmlid].onreadystatechange = function () {
    			}
    		}
			storyfade(htmlid, value, true);
    	}
	}
}
function storyfade (id, value, error)
{
	//target4 = document.getElementById ('xnews-' + id);
	//new Effect.Fade(target4);
		target5 = document.getElementById ('xnews-' + id);
		new Effect.Fade(target5);
	//new Effect.Opacity(target4, {duration:0.8, from:1.0, to:0.5});
		//target5 = document.getElementById ('flag-' + id);
		//new Effect.Fade(target5);
	
}
function vote_linkfield (user, id, htmlid, md5, value, link_field)
{
  	if (xmlhttp) {
		url = $thisurl + "/lvote.php";
		var mycontent = "id=" + id + "&user=" + user + "&md5=" + md5 + "&value=" + value + "&linkfield=" + link_field;
		//alert(mycontent);
		anonymous_vote = false;
        if (anonymous_vote == false && user == '0') {
            window.location="http://www.flashvip.com.br/login.php?return="+location.href;
        } else {
    		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
    		if (mnmxmlhttp) {
    			mnmxmlhttp[htmlid].open ("POST", url, true);
    			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
    					   'application/x-www-form-urlencoded');
    
    			mnmxmlhttp[htmlid].send (mycontent);
    			errormatch = new RegExp ("^ERROR:");    
    			//target1 = document.getElementById ('xvotes-' + htmlid);    
    			//mnmPrevColor[htmlid] = target1.style.backgroundColor;
    			mnmxmlhttp[htmlid].onreadystatechange = function () {
    				if (mnmxmlhttp[htmlid].readyState == 4) {
    					xvotesString[htmlid] = mnmxmlhttp[htmlid].responseText;
    					if (xvotesString[htmlid].match (errormatch)) {
    						xvotesString[htmlid] = xvotesString[htmlid].substring (6, xvotesString[htmlid].length);
							changemnmvalues_linkfield (htmlid, value, true);    					} else {
														if (xvotesString[htmlid].substring (1, 6) == "ERROR") { alert(xvotesString[htmlid]);  } else {changemnmvalues_linkfield (htmlid, value, false); }     					}
    				}
    			}
    		}
    	}
	}
}

function unvote (user, id, htmlid, md5, value)
{
  	if (xmlhttp) {
		url = $thisurl + "/vote.php";
		var mycontent = "unvote=true&id=" + id + "&user=" + user + "&md5=" + md5 + "&value=" + value;
		anonymous_vote = false;
        if (anonymous_vote == false && user == '0') {
            window.location="http://www.flashvip.com.br/login.php?return="+location.href;
        } else {
    		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
    		if (mnmxmlhttp) {
    			mnmxmlhttp[htmlid].open ("POST", url, true);
    			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
    					   'application/x-www-form-urlencoded');
    
    			mnmxmlhttp[htmlid].send (mycontent);
    			errormatch = new RegExp ("^ERROR:");    
				target1 = document.getElementById ('xvotes-' + htmlid);
  				target2 = document.getElementById ('xvote-' + htmlid);    
    			mnmPrevColor[htmlid] = target1.style.backgroundColor;
    			mnmxmlhttp[htmlid].onreadystatechange = function () {
    				if (mnmxmlhttp[htmlid].readyState == 4) {
    					xvotesString[htmlid] = mnmxmlhttp[htmlid].responseText;
    					if (xvotesString[htmlid].match (errormatch)) {
    						 xvotesString[htmlid] = xvotesString[htmlid].substring (6, xvotesString[htmlid].length);
							changemnmvalues (htmlid, value, true);target2.innerHTML = "<span>Voto</span>";						} else {
							if (xvotesString[htmlid].substring (1, 6) == "ERROR") { alert(xvotesString[htmlid]);  } else {target2.innerHTML = "<span>Voto</span>";changemnmvalues (htmlid, value, false); }							
    					}
    				}
    			}
    		}
    	}
	}
}
function celebrityunvote (user, id, htmlid, md5, value)
{
  	if (xmlhttp) {
		url = $thisurl + "/vote.php";
		var mycontent = "unvote=true&id=" + id + "&user=" + user + "&md5=" + md5 + "&value=" + value;
		anonymous_vote = false;
        if (anonymous_vote == false && user == '0') {
            window.location="http://www.flashvip.com.br/login.php?return="+location.href;
        } else {
    		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
    		if (mnmxmlhttp) {
    			mnmxmlhttp[htmlid].open ("POST", url, true);
    			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
    					   'application/x-www-form-urlencoded');
    
    			mnmxmlhttp[htmlid].send (mycontent);
    			errormatch = new RegExp ("^ERROR:");    
				target1 = document.getElementById ('xvotes-' + htmlid);
  				target2 = document.getElementById ('xvote-' + htmlid);    
    			mnmPrevColor[htmlid] = target1.style.backgroundColor;
    			mnmxmlhttp[htmlid].onreadystatechange = function () {
    				if (mnmxmlhttp[htmlid].readyState == 4) {
    					xvotesString[htmlid] = mnmxmlhttp[htmlid].responseText;
    					if (xvotesString[htmlid].match (errormatch)) {
    						 xvotesString[htmlid] = xvotesString[htmlid].substring (6, xvotesString[htmlid].length);
							changecelebrityvalues (htmlid, value, true, user, id, md5, false);target2.innerHTML = "<span>Voto</span>";						} else {
							if (xvotesString[htmlid].substring (1, 6) == "ERROR") { alert(xvotesString[htmlid]);  } else {target2.innerHTML = "<span>Voto</span>";changecelebrityvalues (htmlid, value, false, user, id, md5, false); }							
    					}
    				}
    			}
    		}
    	}
	}
}


function cvote (user, id, htmlid, md5, value)
{
	if (xmlhttp) {
		url = $thisurl + "/cvote.php";
		mycontent = "id=" + id + "&user=" + user + "&md5=" + md5 + "&value=" + value;
		anonymous_vote = false;

        if (anonymous_vote == false && user == '0') {
            window.location="http://www.flashvip.com.br/login.php?return="+location.href;
        } else {
    		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
    		if (mnmxmlhttp) {
    			mnmxmlhttp[htmlid].open ("POST", url, true);
    			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type', 'application/x-www-form-urlencoded');    
    			mnmxmlhttp[htmlid].send (mycontent);
    			errormatch = new RegExp ("^ERROR:");
    			target1 = document.getElementById ('cvote-' + htmlid);        
    			mnmPrevColor[htmlid] = target1.style.backgroundColor;
    			target1.style.backgroundColor = '#FFFFFF';
    			mnmxmlhttp[htmlid].onreadystatechange = function () {
    				if (mnmxmlhttp[htmlid].readyState == 4) {
    					xvotesString[htmlid] = mnmxmlhttp[htmlid].responseText;
    					if (xvotesString[htmlid].match (errormatch)) {
    						xvotesString[htmlid] = xvotesString[htmlid].substring (6, xvotesString[htmlid].length);						
    						changecvotevalues (htmlid, true);							
    					} else {
							target1 = document.getElementById ('ratebuttons-' + id);
							target1.style.display = "none";
							target2 = document.getElementById ('ratetext-' + id);
							target2.innerHTML = "";
							changecvotevalues (htmlid, false);
    					}
    				}
    			}
    		}
    	}
	}
}

function changemnmvalues (id, value, error)
{
	split = new RegExp ("~--~");
	b = xvotesString[id].split (split);
	//alert(id);
	target1 = document.getElementById ('xvotes-' + id);
	target2 = document.getElementById ('xvote-' + id);
	target3 = document.getElementById ('xreport-' + id);
	target4 = document.getElementById ('xnews-' + id);
	if (error) {
		if (value > 0) {
			//target2.innerHTML = "<span>Votado</span> "; 
		}
		else if (value < 0) { 
			//target2.innerHTML = "<span>Sem Interesse</span> "; 
		}
		return false;
	}
	if (b.length <= 3) {
		target1.innerHTML = b[0];
		target1.style.backgroundColor = mnmPrevColor[id];
		if (value > 0) {
			//target2.innerHTML = "<span>Votado</span> "; 
			target2.innerHTML = "<img width='14' height='19' src='/templates/topceleb/images/vote_up.png'/><span style='color:#6ca53c;font-weight:bold;'>Eu gosto</span>";
			target3.innerHTML = "<img width='14' height='19' src='/templates/topceleb/images/vote_down.png'/><span style='color:#d80f32;font-weight:bold;'>Não Gosto</span>";
			new Effect.Fade(target3);
		}
		else if (value < 0 ) {
			//target2.innerHTML = "<span>Sem Interesse</span> ";
			target2.innerHTML = "<img width='14' height='19' src='/templates/topceleb/images/vote_up.png'/><span style='color:#6ca53c;font-weight:bold;'>Eu gosto</span>";
			target3.innerHTML = "<img width='14' height='19' src='/templates/topceleb/images/vote_down.png'/><span style='color:#d80f32;font-weight:bold;'>Não Gosto</span>";
			new Effect.Fade(target2);
			new Effect.Opacity(target4, {duration:0.8, from:1.0, to:0.5});
		}
	}
	return false;
}
function changemnmvalues_linkfield (id, value, error)
{
	split = new RegExp ("~--~");
	b = xvotesString[id].split (split);
	//alert(id);
	target1 = document.getElementById ('lvotes-' + id);
	target2 = document.getElementById ('lvote-' + id);
	target3 = document.getElementById ('lreport-' + id);
	//target4 = document.getElementById ('xnews-' + id);
	if (error) {
		if (value > 0) {
			//target2.innerHTML = "<span>Votado</span> "; 
		}
		else if (value < 0) { 
			//target2.innerHTML = "<span>Sem Interesse</span> "; 
		}
		return false;
	}
	if (b.length <= 3) {
		target1.innerHTML = b[0];
		target1.style.backgroundColor = mnmPrevColor[id];
		if (value > 0) {
			//target2.innerHTML = "<span>Votado</span> "; 
			target2.innerHTML = "<img width='14' height='19' src='/templates/topceleb/images/vote_up.png'/><span style='color:#6ca53c;font-weight:bold;'>Eu gosto</span>";
			target3.innerHTML = "<img width='14' height='19' src='/templates/topceleb/images/vote_down.png'/><span style='color:#d80f32;font-weight:bold;'>Não Gosto</span>";
			new Effect.Fade(target3);
		}
		else if (value < 0 ) {
			//target2.innerHTML = "<span>Sem Interesse</span> ";
			target2.innerHTML = "<img width='14' height='19' src='/templates/topceleb/images/vote_up.png'/><span style='color:#6ca53c;font-weight:bold;'>Eu gosto</span>";
			target3.innerHTML = "<img width='14' height='19' src='/templates/topceleb/images/vote_down.png'/><span style='color:#d80f32;font-weight:bold;'>Não Gosto</span>";
			new Effect.Fade(target2);
			//new Effect.Opacity(target4, {duration:0.8, from:1.0, to:0.5});
		}
	}
	return false;
}

function changecelebrityvalues (id, value, error, user, linkid, md5, isVoted)
{
	split = new RegExp ("~--~");
	b = xvotesString[id].split (split);
	target1 = document.getElementById ('xvotes-' + id);
	target2 = document.getElementById ('xvote-' + id);
	//target3 = document.getElementById ('xreport-' + id);
	//target4 = document.getElementById ('xnews-' + id);
	if (error) {
		if (value > 0) {
			target2.innerHTML = "<span>Votado</span> "; 
		}
		else if (value < 0) { 
			target2.innerHTML = "<span>Sem Interesse</span> "; 
		}
		return false;
	}
	if (b.length <= 3) {
		//target1.innerHTML = b[0];
		target1.innerHTML = "<img height='16' width='16' style='position:relative;top:3px;' src='/templates/topceleb/images/heart.png'>"+b[0]+" Fãs</a>";
		//target1.style.backgroundColor = mnmPrevColor[id];
		if (value > 0) {
			if(isVoted) {target2.innerHTML = "<a href=\"javascript:celebrityunvote("+ user +","+ linkid +","+ id +",'"+ md5 +"',"+ value +")\" style='color:#999999;position: relative;' ><img width='19' height='18' src='/templates/topceleb/images/fanstar.gif'/><span style='color:#999999;font-weight:bold;'>Deixe de ser Fã</a></span>";}
			else {target2.innerHTML = "<a href=\"javascript:celebrityvote("+ user +","+ linkid +","+ id +",'"+ md5 +"',"+ value +")\"  style='color:#999999;position: relative;' ><img width='19' height='18' src='/templates/topceleb/images/fanstar.gif'/><span style='color:#999999;font-weight:bold;'>Torne-se Fã</a></span>";}
		}
	}
	return false;
}
function changecvotevalues (id, error)
{
	split = new RegExp ("~--~");
	b = xvotesString[id].split (split);
	target1 = document.getElementById ('cvote-' + id);
	if (error) {
		return false;
	}
	if (b.length <= 3) {
		target1.innerHTML = b[0];
		target1.style.backgroundColor = mnmPrevColor[id];
	}
	return false;
}


function enablebutton (button, button2, target)
{
	var string = target.value;
	button2.disabled = false;
	if (string.length > 0) {
		button.disabled = false;
	} else {
		button.disabled = true;
	}
}

function checkfield (type, form, field)
{
	url = $thisurl + '/checkfield.php?type='+type+'&name=' + field.value;
	checkitxmlhttp = new myXMLHttpRequest ();
	checkitxmlhttp.open ("GET", url, true);
	checkitxmlhttp.onreadystatechange = function () {
		if (checkitxmlhttp.readyState == 4) {
		responsestring = checkitxmlhttp.responseText;
			if (responsestring == 'OK') {
				document.getElementById (field.name+'checkitvalue').innerHTML = '<span style="color:black">"' + field.value + 
						'": ' + responsestring + '</span>';
				form.submit.disabled = '';
			} else {
				document.getElementById (field.name+'checkitvalue').innerHTML = '<span style="color:red">"' + field.value + '": ' +
				responsestring + '</span>';
				form.submit.disabled = '';
			}
		}
	}
  checkitxmlhttp.send (null);
  return false;
}

function emailto (original_id, htmlid, instpath, address_count)
{
	email_message = document.getElementById('email_message' + htmlid).value;
	email_address = document.getElementById('email_address_1_' + htmlid).value;
	if (address_count > 1){ 
		for ($i = 2; $i <= address_count; $i++) {
			if(document.getElementById('email_address_' + $i + '_' + htmlid).value != "") {
				email_address = email_address + ', ' + document.getElementById('email_address_' + $i + '_' + htmlid).value;
			}
		}
	}
	
	if (xmlhttp) {
		url = $thisurl + "/recommend.php";
		mycontent = "email_address=" + escape(email_address) + "&email_to_submit=submit&email_message=" + escape(email_message) + "&original_id=" + original_id + "&backup=0";
		target2 = document.getElementById ('emailto-' + htmlid);
		target2.innerHTML = "<br>Sending, please wait....";
		
		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
		if (mnmxmlhttp) {
			mnmxmlhttp[htmlid].open ("POST", url, true);
			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
					   'application/x-www-form-urlencoded');

			mnmxmlhttp[htmlid].send (mycontent);
			errormatch = new RegExp ("^ERROR:");
			target1 = document.getElementById ('emailto-' + htmlid);
			mnmxmlhttp[htmlid].onreadystatechange = function () {
				if (mnmxmlhttp[htmlid].readyState == 4) {
					xvotesString[htmlid] = mnmxmlhttp[htmlid].responseText;
			
					if (xvotesString[htmlid].match (errormatch)) {
						xvotesString[htmlid] = xvotesString[htmlid].substring (6, xvotesString[htmlid].length);						
						target2 = document.getElementById ('emailto-' + htmlid);
						target2.innerHTML = xvotesString[htmlid];						
					} else {
						target2 = document.getElementById ('emailto-' + htmlid);
						target2.innerHTML = xvotesString[htmlid];
					}
				}
			}
		}
	}
}

function show_recommend(htmlid, linkid, instpath)
{
	var emailtodisplay=document.getElementById('emailto-' + htmlid).style.display ? '' : 'none';
	document.getElementById('emailto-' + htmlid).style.display = emailtodisplay;
	if (xmlhttp) {
		url = $thisurl + "/recommend.php";
		mycontent = "draw=small&htmlid=" + htmlid + "&linkid=" + linkid;
		target2 = document.getElementById ('emailto-' + htmlid);
		target2.innerHTML = "<br>Loading, please wait....";		
		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
		
		if (mnmxmlhttp) {
			mnmxmlhttp[htmlid].open ("POST", url, true);
			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
					   'application/x-www-form-urlencoded');

			mnmxmlhttp[htmlid].send (mycontent);
			errormatch = new RegExp ("^ERROR:");
			target1 = document.getElementById ('emailto-' + htmlid);
			mnmxmlhttp[htmlid].onreadystatechange = function () {
				if (mnmxmlhttp[htmlid].readyState == 4) {
					xvotesString[htmlid] = mnmxmlhttp[htmlid].responseText;			
					if (xvotesString[htmlid].match (errormatch)) {
						xvotesString[htmlid] = xvotesString[htmlid].substring (6, xvotesString[htmlid].length);						
						target2 = document.getElementById ('emailto-' + htmlid);
						target2.innerHTML = xvotesString[htmlid];						
					} else {
						target2 = document.getElementById ('emailto-' + htmlid);
						target2.innerHTML = xvotesString[htmlid];
					}
				}
			}
		}
	}
}
function getContacts(uname, pass, type, uid)
{
	document.getElementById ('test').innerHTML = "<img src='http://www.flashvip.com.br/templates/topceleb/images/indicator.gif' alt='' />";
	if (type == "gmail.com") url = 'http://www.flashvip.com.br/mail_import/gmail.php?username='+uname+'&password=' + pass + '&uid=' + uid + '&act=showContacts';
	else if (type == "hotmail.com") url = 'http://www.flashvip.com.br/mail_import/hotmail.php?username='+uname+'&password=' + pass + '&uid=' + uid + '&act=showContacts';
	else if (type == "orkut") url = 'http://www.flashvip.com.br/mail_import/orkut.php?username='+uname+'&password=' + pass + '&uid=' + uid + '&act=showContacts';
	else document.getElementById ('test').innerHTML = "Unable to import contacts for the given mail service.";
	if (url) {
		http = new myXMLHttpRequest ();
		http.open ("GET", url, true);
		http.onreadystatechange = function () {
			if (http.readyState == 4) {
				responsestring = http.responseText;
				document.getElementById ('test').innerHTML = responsestring;
			}
		}
		http.send (null);
	}
	return false;
}
function send_invite_mail(id, content, uid)
{
	/*alert(content);
	alert(id);
	alert(uid);*/
	document.getElementById ('test').innerHTML = "<img src='http://www.flashvip.com.br/templates/topceleb/images/indicator.gif' alt='' />";
	var url = 'http://www.flashvip.com.br/send_email.php?content='+content+'&addresses=' + id + '&uid=' + uid;
	if (url) {
		http = new myXMLHttpRequest ();
		http.open ("GET", url, true);
		http.onreadystatechange = function () {
			if (http.readyState == 4) {
				responsestring = http.responseText;
				document.getElementById ('test').innerHTML = responsestring;
			}
		}
		http.send (null);
	}
	return false;
}
function ccontentshow(cname, id, toggleMore)
{
	target1 = document.getElementById ('firstcontent');
	target2 = document.getElementById ('fullcontent');
	targetmore = document.getElementById ('morelink');
	targetless = document.getElementById ('lesslink');
	
	// decide if toggle needed: 1 = do more; 0 = do less;
	if(toggleMore == 1) {
		if(target2.innerHTML != '') {
			target1.style.display = 'none'; // hide short desc
			targetmore.style.display = "none"; // hide more link
			
			target2.style.display = ''; // show full desc
			targetless.style.display = ''; // show less link
			return;
		}
	} else {
		if(target2.innerHTML != '') {
			target1.style.display = ''; // show short desc
			targetmore.style.display = ""; // show more link
			
			target2.style.display = 'none'; // hide full desc
			targetless.style.display = 'none'; // hide less link
			return;
		}
	}
	
	if (xmlhttp) {
		url = $thisurl + "/wikifetch.php";
		mycontent = "title=" + cname + "&id=" + id;

		mnmxmlhttp[0] = new myXMLHttpRequest ();
		if (mnmxmlhttp) {
			mnmxmlhttp[0].open ("POST", url, true);
			mnmxmlhttp[0].setRequestHeader ('Content-Type', 'application/x-www-form-urlencoded');    
			mnmxmlhttp[0].send (mycontent);
			errormatch = new RegExp ("^ERROR:");
			
			mnmxmlhttp[0].onreadystatechange = function () {
				if (mnmxmlhttp[0].readyState == 4) {
					xvotesString[0] = mnmxmlhttp[0].responseText;
					if (xvotesString[0].match (errormatch)) {
						// donot perform anything...							
					} else {					
						split = new RegExp ("~--~");
						b = xvotesString[0].split (split);
						if (b.length <= 3) {
								target1.style.display = "none";
								targetmore.style.display = "none";
								
								target2.style.display = "";
								target2.innerHTML = b[1];
						}
					}
				}
			}
		}
    	
	}
}

function friends(friend, action)
{
	target1 = document.getElementById ('remove_friend');
	target2 = document.getElementById ('add_friend');
	
	var url = 'http://www.flashvip.com.br/friendaddremove.php?friend='+friend+'&action=' + action;
	if (url) {
		http = new myXMLHttpRequest ();
		http.open ("GET", url, true);
		errormatch = new RegExp ("^ERROR:");
		
		http.onreadystatechange = function () {
			if (http.readyState == 4) {
				responsestring = http.responseText;
				//alert("responsestring "+responsestring);
				if (responsestring.match (errormatch)) {
					// donot perform anything...
				} else {					
					split = new RegExp ("~--~");
					b = responsestring.split (split);
					if (b.length <= 2) {
						//alert("In B array match "+ b[0] + " : " +);
						if(b[1] == "remove") {
							target1.style.display = 'none';
							new Effect.Appear(target2);
						}
						if (b[1] == "add") {
							target2.style.display = 'none';
							new Effect.Appear(target1);
						}
					}
				}
			}
		}
		http.send (null);
	}
}