// User vote

function rateuser(voter,candate,rate){

	try{
		cp.call('ajax/myajaxphp.php','process_uservote',return_uservote,voter,candate,rate);
	}
	catch(Err){
		alert('Connection failed');
	}

}

function return_uservote(result){

	try{

				myMsg=result.getElementsByTagName('myMsg').item(0).firstChild.data;
				cnt=result.getElementsByTagName('cnt').item(0).firstChild.data;

				 showMe('himr');
				if(cnt>5){cnt=5;}
				else if (cnt<0)	{cnt=0;}


					blank_star=5-cnt;

					var x=document.getElementById('tblViewUserVote').rows[0].cells;


					for (i=0;i<cnt;i++ )
					{

							x[i].innerHTML='<img src='+imgurl+'/star.gif>';
					}

					for (j=cnt;j<=4;j++ )
					{
							x[j].innerHTML='<img src=' + imgurl+'/blank_star.gif>';
					}




				if(myMsg=='f'){
					var x=document.getElementById('tblViewUserTate').rows[0].cells;
					x[0].innerHTML='<B>Sorry! You already rated him.</B>';

				}else{
						var x=document.getElementById('tblViewUserTate').rows[0].cells;
 						x[0].innerHTML='<B>Thanks!</B>';
				}



	}
		catch(Err){
			   alert('Server problem');
	}





}
// End user vote


start=1;

function fxOnload(){
	alert('this is on load');
}

function createNewList() {
    var name = prompt("Enter a name for a new contact group.", "");
    if(name)
            document.location.href="friends.php?add_list="+name;
}
function doAction(action) {
    if(action) {

            document.getElementById('action_name').value = action;
            document.friendsForm.submit();

    }
}

function invite_mem_addall() {
    var x=document.getElementById("myfriends");
    var y=document.getElementById("invitefriends");
    var i;
    i= x.options.length;
    if(i!=0)
    {
        y.options.length=i;
        for(var j=0;j<i;j++)
        {
                y.options[j]=new Option(x.options[j].text,x.options[j].value);
        }
        for(j=0;j<i;j++)
        {
                x.remove(0);
        }
    }
}

function invite_mem_add() {
    var x=document.getElementById("myfriends");
    var y=document.getElementById("invitefriends");
    var i;
    i = x.selectedIndex;
    if(i>=0)
    {
            y.options[y.options.length]=new Option(x.options[i].text,x.options[i].value);
            x.remove(x.selectedIndex);
    }
}

function invite_mem_removeall() {
    var x=document.getElementById("invitefriends");
    var y=document.getElementById("myfriends");
    var i;
    i= x.options.length;
    if(i!=0)
    {
            y.options.length=i;
            for(var j=0;j<i;j++)
            {
                    y.options[j]=new Option(x.options[j].text,x.options[j].value);

            }
            for(j=0;j<i;j++)
            {
                    x.remove(0);

            }
    }
}

function invite_mem_remove() {
    var x=document.getElementById("invitefriends");
    var y=document.getElementById("myfriends");
    var i;
    i = x.selectedIndex;
    if(i>=0)
    {
            y.options[y.options.length]=new Option(x.options[i].text,x.options[i].value);
            x.remove(x.selectedIndex);
    }
}

function invite_mem_send() {
    var i,out;
    var x=document.getElementById("invitefriends");
    for(i=0; i<x.options.length; i++)
    {
            out = out + "<input type=hidden name=flist[] value="+x.options[i].text+" >";
    }
    document.getElementById('friends_div').innerHTML=out;
    document.fform.submit();
}

function approve_post(id,idHlinkAprove) {
    alert("This posting will be approved. Refresh the page.");
    var y="apostform"+id;
    var x = document.getElementById(y);
    return x.submit();
}

function unapprove_post(id,idHlinkAprove) {
	var t= confirm('Are you sure you want to delete this topics?');
	if(t==true){
		var y = "unapostform" + id;
		var x = document.getElementById(y);
		return x.submit();
	}
}

function directMyvalueto(myValue,thatId){
	document.getElementById(thatId).value=myValue;
}


