if(document.all && !document.getElementById) {
    document.getElementById = function(id) {
         return document.all[id];
    }
}

function addtofavs( memberid )
{
	displayWarning('/favourites/addtofav.php?mid='+memberid) ;
	//window.open('/favourites/addtofav.php?mid='+memberid,'addtofavs','width=200,height=200,toolbar=no,location=no');
}

function removeFromFavs( memberid )
{
	displayWarning('/favourites/removefav.php?mid='+memberid) ;
	//window.open('/favourites/removefav.php?mid='+memberid,'removefavs','width=200,height=200,toolbar=no,location=no');
}

function launchMail()
{
	// removed ability to launch mail
	//window.open('/messages/launched/messages.php?launched=1','mail','width=497,height=297,toolbar=no,location=no,scrollbars=yes') ;
}

function addRecipient()
{
	window.open('/messages/addrecipient.php','recipient','width=217,height=300,toolbar=no,location=no,scrollbars=yes') ;
}

function returnRecipient( rid, rname )
{
	opener.compose_form.rname.value = rname ;
	opener.compose_form.recipientid.value = rid ;
	opener.compose_form.recipientblist.selectedIndex=0 ;
	window.close() ;
	opener.focus() ;
}

function copyBuddyToRecipient()
{
	if( document.compose_form.recipientblist.selectedIndex > 0)
	{
		document.compose_form.rname.value = document.compose_form.recipientblist[ document.compose_form.recipientblist.selectedIndex ].text ;	
		document.compose_form.recipientid.value = document.compose_form.recipientblist[ document.compose_form.recipientblist.selectedIndex ].value ;
	}
}


function displayWarning(i) {
	w=document.getElementById('warning');
	w.src=i;
	wd=document.getElementById('warndiv');
	wd.style.display = '';
	scroll(0,0);
}

function buddyRequest( memberid )
{
displayWarning('/messages/addbuddy.php?mid='+memberid);
//window.open('/messages/addbuddy.php?mid='+memberid,'buddyrequest','width=200,height=200,toolbar=no,location=no');	
}

function processBuddyRequest( yorn, reqid, hc, omid )
{
	displayWarning('/messages/buddyrequest.php?act='+yorn+'&rid='+reqid+'&hc='+hc+'&omid='+omid) ;
	//window.open('/messages/buddyrequest.php?act='+yorn+'&rid='+reqid+'&hc='+hc,'processbuddyrequest','width=200,height=200,toolbar=no,location=no');	
}

function blockMember( memid )
{
	displayWarning('/messages/block.php?mid='+memid);
//	window.open('/messages/block.php?mid='+memid,'blockmember','width=200,height=200,toolbar=no,location=no');	
}

function viewProfile( memid )
{
		window.open('/members/popdetails.php?pop=1&mid=' + memid,'profile', 'width=497,height=297,toolbar=no,location=no,scrollbars=yes') ;
}

function sendFlirt( memberid )
{
	flirtid = document["flirt_"+memberid].flirt[ document["flirt_"+memberid].flirt.selectedIndex ].value ;
	displayWarning('/messages/flirt.php?fid='+flirtid+'&mid='+memberid) ;
	//window.open('/messages/flirt.php?fid='+flirtid+'&mid='+memberid,'flirt','width=200,height=200,toolbar=no,location=no');	
}


var rowHighlight = true // turn on row highlights
function getElement( el ) 
{
    var tagList = new Object
    for (var i = 1; i < arguments.length; i++)
      tagList[arguments[i]] = true
    while ((el!=null) && (tagList[el.tagName]==null))
      el = el.parentElement
    return el
}

function checkHighlight(which) 
{
    var el = getElement(event.srcElement,"TH","TD")
    if (el==null) return
    
    if ((el.tagName=="TD") && (rowHighlight)) 
    {
      var row = getElement(el, "TR") 
      var table = getElement(row, "TABLE")
      if (which) 
        row.className = "rover"
      else
        row.className = ""
      cache = row
    }
}

function switchAll( form, name ) 
{
	j = 0 ;
	while( eval( "form."+ name + j ) )
	{
		box = eval( "form."+ name + j ); 
		box.checked = !box.checked;
  	j ++ ;
  	
  }
  
}
