function ismaxlength(obj){var mlength=obj.getAttribute?parseInt(obj.getAttribute("maxlength")):"";if(obj.getAttribute&&obj.value.length>mlength){obj.value=obj.value.substring(0,mlength);}}
function addFriend(id,name)
{document.getElementById('challenge_match').click();document.getElementById('challenged_user').innerHTML='<a href="#" onclick="setRandom(); return(false);" title="click to remove">'+name+'</a>';document.getElementById('challengedId').value=id;document.getElementById('challengedName').value=name;document.getElementById('duration_random').style.display='none';document.getElementById('duration_challenge').style.display='inline';}
function setRandom()
{document.getElementById('random_match').click();document.getElementById('challenged_user').innerHTML='';document.getElementById('challengedId').value='';document.getElementById('challengedName').value='';document.getElementById('duration_random').style.display='inline';document.getElementById('duration_challenge').style.display='none';document.getElementById('duration').value=2;}
function gotoTheme(type,theme){if(!theme){location.href='/showdowns/view.php?type='+type;}
else{location.href='/showdowns/view.php?type='+type+'&theme='+theme;}}
var openmenu;var clickcount=0;var username;var currentZIndex=10;function menuShowShowdown(ob,uid,usn){var m=ob.getElementsByTagName('ul')[0];m.blur();if(openmenu==m)return;if(openmenu){openmenu.style.left='-999px';openmenu=null;}
if(username){username.className='';}
username=ob.getElementsByTagName('a')[0];ob.style.zIndex=++currentZIndex;currentShow=ob;username.className='highlight';openmenu=m;document.onclick=menuHideShowdown;clickcount=0;m.innerHTML='<li><a href="/home/'+usn+'">View Profile</a></li> <li><a href="/showdowns/archive.php?view=user_all&user='+uid+'">View Showdowns</a></li> <li><a href="/showdowns/new.php?challenge='+uid+'">Challenge Her</a></li> <li><a href="/messages/send.php?to_user_id='+uid+'">Send a Message</a></li></li>';m.style.left='auto';}
function menuHideShowdown(e){var target=(typeof e=='undefined'?event.srcElement.parentNode.parentNode:e.target.parentNode.parentNode);if(!openmenu||!target)return;if(clickcount++>0){if(target!=openmenu){openmenu.style.left='-999px';openmenu=null;document.onclick=null;username.className='';}}}
