
var lastCountrySearch="";
var lastCountySearch="";
var lastClubSearch="";
var roundEntry=false;
var theCountrySearchField=null;
var theCountySearchField=null;
var unselectedBorderColor="#6f7f99";
var selectedBorderColor = "#996f73";
var unselectedBackgroundColor="#f5f6f8";
var selectedBackgroundColor="#f7e6e8";
var optionsId="0";
var photoElement=null;
var photoElementSrc="";
var photoObject=null;
var commandToUpload="";
var roundsPage=1;
var refreshtimer=null;
var pausetimer=null;
var minuteInterval=5;
var refreshInterval=60000*minuteInterval;
var unregUsers=null;
var regUsers=null;
var invitedUsers=null;
var processingEmail="";
var contactDivScrollTop=0;
var lastButton=null;
var playerTemp="";
var roundTemp="";
var editDetailSourceObject=null;
var roundPlayers="";
var roundCourses="all";
var showPlayedTogether=false;
var showMyRounds=true;
var currentPageNumber=1;
var currentPerPage=5;
var detailsPath="/inside";
var administrateID="";
var administrateWebsite="";
var administrateEmail="";
var administrateDomain="";
var thisUserID="";
function showSummary() {
    startFadeUp();
    pasteRawHTML(returnRoundedBox("summary","My Profile Summary","<div id=\"summaryContent\">Loading summary...<br /><img src=\"/skin/loading.gif\" /></div>",true,60,null,true,false),document.body);
    sendRequest("/inside/admin.ashx?cmd=summary",summaryReceived);
}
function summaryReceived(reply) {
    setInnerHTMLCentered("summaryContent",reply,"summary");
}
function addClub()
{
    insert="<div style=\"border:1px dashed #cccccc\"><img src=\"/skin/clear.gif\" style=\"cursor:pointer;float:right\" onmouseout=\"javascript:this.src='/skin/clear.gif'\" onmouseover=\"javascript:this.src='/skin/clearOver.gif'\" onclick=\"setInnerHTML('clubBusinessCard','');\" />New Club Name:<br />";
    insert+= "<input type=\"text\" id=\"newClubName\" onkeyup=\"checkForClub(this)\" onclick=\"checkForClub()\" style=\"font-size:10px;width:90%;background-color:" + unselectedBackgroundColor + ";border:1px solid " + unselectedBorderColor + "\" />";
    insert+= "<br />Town:<br /><input type=\"text\" id=\"newClubTown\" onkeyup=\"checkForClub()\" onclick=\"checkForClub(this)\" style=\"font-size:10px;width:90%;background-color:" + unselectedBackgroundColor + ";border:1px solid " + unselectedBorderColor + "\" />";
    insert+="<div id=\"newClubComment\"></div></div>";
    setInnerHTML("clubBusinessCard",insert);
}
function checkForClub(){
    clubName=document.getElementById("newClubName").value;
    clubTown=document.getElementById("newClubTown").value;
    if (countryCode!="" && countyCode!="") {
        if (clubName!="" && clubTown!="") {
            docUrl="/shortlistClubs.ashx?q="+clubName+"&cc="+countryCode+"&state="+countyCode+"&check=1&town="+clubTown;
            sendRequest(docUrl,clubChecked);
        }else{
            setInnerHTML("newClubComment","<span style=\"color:#66000\">Set Club name and town...</span>");
        }
    }else{
        setInnerHTML("newClubComment","<span style=\"color:#66000\">Set Country and "+document.getElementById("countyType").innerHTML+" above...</span>");
    }
}
function clubChecked(reply) {

    if (reply=="") {
        insert="<center><img src=\"/skin/create.gif\" style=\"cursor:pointer\" onmouseout=\"javascript:this.src='/skin/create.gif'\" onmouseover=\"javascript:this.src='/skin/createOver.gif'\" onclick=\"createTheClub()\" /></center>";
        setInnerHTML("newClubComment",insert);
    }else{
        var theList="";
        var clubs=reply.split("-optionsplit-");
        for (var i=0;i<clubs.length;i++) {
            var thisClub=clubs[i].split("-datasplit-");
            theList+="<div>"+thisClub[1]+"</div>";
        }
        setInnerHTML("newClubComment","Ensure the club is not listed here:<div style=\"border:1px dotted #cccccc;margin:2px\">"+theList+"</div>");
    }
}
function createTheClub() {
    clubName=document.getElementById("newClubName").value;
    clubTown=document.getElementById("newClubTown").value;
    docUrl="/inside/Admin.ashx?cmd=addClub&country="+countryCode+"&county="+countyCode+"&town="+clubTown+"&name="+clubName;
    sendRequest(docUrl,clubCreated);
    setInnerHTML("newClubComment","<span style=\"color:#66000\">Saving "+clubName+"...</span>");
}
function clubCreated(reply) {
    setInnerHTML("clubBusinessCard",reply);
}
function findCountries(srcObj)
{
    theCountrySearchField=srcObj;
    countryCode="";
    srcObj.style.border="1px solid "+unselectedBorderColor;
    srcObj.style.backgroundColor=unselectedBackgroundColor;
    srcObj.title="Unselected";
    var searchField=srcObj.value;
    lastCountrySearch=searchField;
    var docUrl="/shortlistCountries.ashx?q="+searchField;
    if (window.XMLHttpRequest)
    {
        xmlhttp=new XMLHttpRequest();
        xmlhttp.onreadystatechange=foundCountries;
        xmlhttp.open("GET",docUrl,true);
        xmlhttp.send(null);
    }
    else if (window.ActiveXObject)
    {
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
        if (xmlhttp)
        {
            xmlhttp.onreadystatechange=foundCountries;
            xmlhttp.open("GET",docUrl,true);
            xmlhttp.send();
        }
    }
}
function resetCountry(srcObj)
{
    srcObj.style.border="1px solid "+unselectedBorderColor;
    srcObj.style.backgroundColor=unselectedBackgroundColor;
    srcObj.value=lastCountrySearch;
    srcObj.title="Unselected";
    countryCode="";
    countyCode="";
    var countyObj="countySearchField";
    if (srcObj.id.substring(0,1)=="S") countyObj="S"+countyObj;
    var cntyObj=document.getElementById(countyObj);
    cntyObj.style.border="1px solid "+unselectedBorderColor;
    cntyObj.style.backgroundColor=unselectedBackgroundColor;
    cntyObj.value=lastCountySearch;
    cntyObj.title="Unselected";
    findCountries(srcObj);
}
function countryChosen(code2,countryName,stateType)
{
    if (theCountrySearchField.id.substring(0,1)=="S")
    {
        if (document.getElementById("ScountyType")!=null)
        {
            document.getElementById("ScountyType").innerHTML=stateType;
        }
    }
    else
    {
        document.getElementById("countyType").innerHTML=stateType;
    }
    theCountrySearchField.value=countryName;
    theCountrySearchField.title=countryName;
    theCountrySearchField.style.border="1px solid "+selectedBorderColor;
    theCountrySearchField.style.backgroundColor=selectedBackgroundColor;
    countryCode=code2;
    countyCode="";
    removeTheNode('shortlist');
    if (document.getElementById("ScountySearchField")!=null)
    {
        getUsers();
    }
}
function foundCountries()
{
    if (xmlhttp.readyState==4)
    {
        if (xmlhttp.status==200)
        {
            if (document.getElementById("shortlist")==null)
            {
                var floater="<div id=\"shortlist\" class=\"shortlist\">"+xmlhttp.responseText+"</div>";
                pasteRawHTML(floater,document.body);
            }
            else
            {
                document.getElementById("shortlist").innerHTML=xmlhttp.responseText;
            }
            alignObjectUnderTarget(document.getElementById("shortlist"),theCountrySearchField,3);
        }
        else
        {
            alert("Problem retrieving XML data:" + xmlhttp.statusText+"\n"+xmlhttp.responseText);
        }
    }
}
function findCounties(srcObj)
{
    theCountySearchField=srcObj;
    countyCode="";
    if (countryCode!="")
    {
        srcObj.style.border="1px solid "+unselectedBorderColor;
        srcObj.style.backgroundColor=unselectedBackgroundColor;
        srcObj.title="Unselected";
        var searchField=srcObj.value;
        lastCountySearch=searchField;
        var docUrl="/shortlistCounties.ashx?q="+searchField+"&country="+countryCode;
        if (window.XMLHttpRequest)
        {
            xmlhttp=new XMLHttpRequest();
            xmlhttp.onreadystatechange=foundCounties;
            xmlhttp.open("GET",docUrl,true);
            xmlhttp.send(null);
        }
        else if (window.ActiveXObject)
        {
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
            if (xmlhttp)
            {
                xmlhttp.onreadystatechange=foundCounties;
                xmlhttp.open("GET",docUrl,true);
                xmlhttp.send();
            }
        }
    }
    else
    {
        if (countryCode=="")
        {
            srcObj.style.border="1px solid "+unselectedBorderColor;
            srcObj.style.backgroundColor=unselectedBackgroundColor;
            srcObj.title="No Country selected";
        }
    }
}
function foundCounties()
{
    if (xmlhttp.readyState==4)
    {
        if (xmlhttp.status==200)
        {
            if (document.getElementById("shortlist")==null)
            {
                var floater="<div id=\"shortlist\" class=\"shortlist\">"+xmlhttp.responseText+"</div>";
                pasteRawHTML(floater,document.body);
            }
            else
            {
                document.getElementById("shortlist").innerHTML=xmlhttp.responseText;
            }
            alignObjectUnderTarget(document.getElementById("shortlist"),theCountySearchField,3);
        }
        else
        {
            alert("Problem retrieving XML data:" + xmlhttp.statusText+"\n"+xmlhttp.responseText);
        }
    }
}
function resetCounty(srcObj)
{
    countyCode="";
    srcObj.style.border="1px solid "+unselectedBorderColor;
    srcObj.style.backgroundColor=unselectedBackgroundColor;
    srcObj.value=lastCountySearch;
    srcObj.title="Unselected";
    findCounties(srcObj);
}
function countyChosen(code,countyName)
{
    theCountySearchField.value=countyName;
    theCountySearchField.title=countyName;
    theCountySearchField.style.border="1px solid "+selectedBorderColor;
    theCountySearchField.style.backgroundColor=selectedBackgroundColor;
    countyCode=code;
    removeTheNode('shortlist');
    if (document.getElementById("ScountySearchField")!=null)
    {
        getUsers();
    }
}
function avatarUpload(uid,srcObj)
{
    commandToUpload="uid_"+uid;
    thisUserID=uid;
    startFadeUp();
    
    embedded="<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" width=\"120\" height=\"100\" id=\"uploader\" align=\"middle\">";
    embedded+="<param name=\"allowScriptAccess\" value=\"sameDomain\" />";
    embedded+="<param name=\"movie\" value=\"/skin/uploader.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"wmode\" value=\"opaque\" /><param name=\"bgcolor\" value=\"#ffffff\" />";
    embedded+="<embed src=\"/skin/uploader.swf\" quality=\"high\" wmode=\"opaque\" bgcolor=\"#ffffff\" width=\"120\" height=\"100\" name=\"uploader\" align=\"middle\" swLiveConnect=\"true\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />";
    embedded+="</object>";
    embedded=embeduploader("uid_"+uid,"uploadCompleted");
    insert="<img src=\""+document.getElementById("myPhoto").src.replace("size=80","size=120")+"\" />";
    insert+=embedded;
    
    insert=returnRoundedBox("avatarUpload","Upload a new photo",insert,true,34,null,true)
    pasteRawHTML(insert,document.body)
    centerObject(document.getElementById("avatarUpload"));
}
function getUploadCommand()
{
    return commandToUpload;
}
function uploadCompleted()
{
    imgs=document.getElementsByTagName("img");
    for (i=0;i<imgs.length;i++) {
        s=imgs[i].src;
        if (s.match(/avatar/)) {
            if (s.match("u="+thisUserID)) {
                temp1=s.split("ver=");
                temp2=temp1[1].split("&");
                ver=temp2[0]*1;
                verp=ver+1;
                s=s.replace("ver="+ver,"ver="+verp);
            }
            imgs[i].src=s;
        }
    }
    startFadeDown();
    removeTheNode("avatarUpload");
}
function showMap2(theURL,courseid,holenumber)
{
    removeTheNode("mapper");
    var maxSize=getWindowWidth();
    var maxHeight=getWindowHeight();
    if (maxHeight<maxSize)
    {
        maxSize=maxHeight;
    }
    maxSize-=50;
    var theTitle="The Course map";
    theUrl="/courseMap.ashx?cid="+courseid;
    if (holenumber!=0 && holenumber!=null)
    {
        theUrl+="&hole="+holenumber;
        theTitle="The map for hole "+holenumber.toString();
    }
    insert="<img src=\"/skin/loading.gif\" id=\"imageLoading\" />"
    insert+="<img src=\""+theUrl+"&size="+maxSize.toString()+"\" onload=\"javascript:this.style.display='block';removeTheNode('imageLoading');centerObject(document.getElementById('mapper'))\" />"
    insert=returnRoundedBox("mapper",theTitle,insert,true,34,null,true)
    
    pasteRawHTML(insert,document.body)
    centerObject(document.getElementById("mapper"));
}
function showAvatar(e,uid,username,handi)
{
    var theURL="/avatar.ashx?u="+uid+"&size=80";
    if (document.getElementById("facebookPortal")) theURL+="&f=1";
    var insert="<div style=\"width:80px;height:80px;vertical-align:middle;text-align:center\"><center><img src=\"/skin/loading.gif\" id=\"avatarLoading\" />"
    insert+="<img src=\""+theURL+"\" style=\"display:none\" onload=\"removeTheNode('avatarLoading');this.style.display='block'\" /></center></div>"
    insert+=handi;
    
    insert=returnRoundedBox("largeAvatar",username,insert,true,34,null,false)
    
    pasteRawHTML(insert,document.body)
    alignLargeAvatar(e);
}
function unshowAvatar()
{
    removeTheNode("largeAvatar");
}
function alignLargeAvatar(e)
{


    if (document.getElementById("largeAvatar")!=null) {
        var posx = 0;
        var posy = 0;
        if (!e) var e = window.event;
        var windowOffset=getScrollXY();
        if (e.pageX || e.pageY)
        {
            posx = e.pageX;
            posy = e.pageY;
        }
        else if (e.clientX || e.clientY)
        {
            posx = e.clientX+windowOffset[0];
            posy = e.clientY+windowOffset[1];
        }
        var offset=20;
        var obj=document.getElementById("largeAvatar");
        obj.style.top=(posy-obj.offsetHeight-offset)+"px";
        obj.style.left=(posx-(obj.offsetWidth/2))+"px";
    }
}	
function toggle(srcObj,e,target,unaccepted)
{	
    var targ;
	if (!e) var e = window.event;
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	if (targ.nodeType == 3) // defeat Safari bug
		targ = targ.parentNode;
    if (targ==srcObj) {
        if (!e) var e = window.event;
	    e.cancelBubble = true;
	    if (e.stopPropagation) e.stopPropagation();
    }
    targetObj=document.getElementById(target);
    var regex=/[a-zA-Z0-9]/i;
    var targetEmpty=true;
    if (regex.test(targetObj.innerHTML)) targetEmpty=false;
    if (target=="roundContainer")
    {
        if (unaccepted)
        {
            setInnerHTML(target,"<img src=\"/skin/loading.gif\"><br>Loading rounds...")
               srcObj.className="sectionExpanded";
            loadUnacceptedRounds();
        }
        else
        {
            if (targetEmpty)
            {
                setInnerHTML(target,"<img src=\"/skin/loading.gif\"><br>Loading rounds...")
               srcObj.className="sectionExpanded";
                gotoRoundPage(1,5,false);
            }
            else
            {
                setInnerHTML(target,"")
               srcObj.className="sectionExpander";
            }
        }
    }
    else
    {
        if (targetEmpty)
        {
            if (target=="messageContainer")
            {
                setInnerHTML(target,"<img src=\"/skin/loading.gif\"><br>Loading messages...");
               srcObj.className="sectionExpanded";
                refreshMessages();
            }
            if (target=="coursesContainer")
            {
                setInnerHTML(target,"<img src=\"/skin/loading.gif\"><br>Loading courses...");
               srcObj.className="sectionExpanded";
                refreshPlayed(false);
            }
        }
        else
        {
            setInnerHTML(target,"");
               srcObj.className="sectionExpander";
        }
    }
}
function refreshMe()
{
    var docUrl="/inside/me.ashx?";
    sendRequest(docUrl,meReceived);
}
function meReceived(reply)
{
    document.getElementById("meContainer").innerHTML=reply;
}
function refreshPlayed(headerOnly)
{
    var docUrl="/inside/coursesPlayed.ashx";
    if (headerOnly)
    {
        docUrl+="?header=1"
    }
    else
    {
        docUrl+="?header=0"
    }
    sendRequest(docUrl,playedReceived);
}
function playedReceived(reply)
{
            var docs=reply.split("<header-content>");
            if (document.getElementById("coursesTitleContainer").innerHTML!="")
            {
                document.getElementById("coursesTitleContainer").innerHTML=docs[0];
            }
            setInnerHTML("coursesContainer",docs[1]);
}
function initiateRefresh()
{
    refreshtimer = setTimeout("checkRefresh()",refreshInterval);
    var intMes="This page checks for updates every "+minuteInterval.toString()+" minute";
    if (minuteInterval>1) intMes+="s";
    document.getElementById("intervalInfo").innerHTML=intMes;
}
function checkRefresh()
{
    var intMes="Checking for updates...";
    document.getElementById("intervalInfo").innerHTML=intMes;
    var docUrl="/inside/needUpdating.ashx?mins="+minuteInterval.toString();
    sendRequest(docUrl,refreshReceived);
}
function refreshReceived(reply)
{
    var now=new Date();
    var intMes="Last update check:"+now.toLocaleTimeString();
    document.getElementById("intervalInfo").innerHTML=intMes;
    if (reply=="yes")
    {
        reloadContainers();
        refreshFriends();
    }
    refreshtimer = setTimeout("checkRefresh()",refreshInterval);
}
function reloadContainers()
{
    if (!checkAlphaNumeric(document.getElementById("roundContainer").innerHTML))
    {
    
        setInnerHTML("roundContainer","<img src=\"/skin/loading.gif\"><br>Loading rounds...");
        gotoRoundPage(1,5,true);
    }
    else
    {
        setInnerHTML("roundContainer","<img src=\"/skin/loading.gif\"><br>Loading rounds...");
        gotoRoundPage(1,5,false);
    }
    if (!checkAlphaNumeric(document.getElementById("messageContainer").innerHTML))
    {
        setInnerHTML("messageContainer","<img src=\"/skin/loading.gif\"><br>Loading messages...");
        refreshMessages(true);
    }
    else
    {
        setInnerHTML("messageContainer","<img src=\"/skin/loading.gif\"><br>Loading messages...");
        refreshMessages(false);
    }
    if (!checkAlphaNumeric(document.getElementById("coursesContainer").innerHTML))
    {
        setInnerHTML("coursesContainer","<img src=\"/skin/loading.gif\"><br>Loading courses...");
        refreshPlayed(true);
    }
    else
    {
        setInnerHTML("coursesContainer","<img src=\"/skin/loading.gif\"><br>Loading courses...");
        refreshPlayed(false);
    }
}
function loadComparedPies() {
    startFadeUp();
    if (document.getElementById("loading")!=null) {        
        displayLoader();
    }
    var docUrl="/inside/comparePies.ashx?";
    sendRequest(docUrl,PiesReceived);
}
function PiesReceived(reply) {
            removeTheNode("loading");
            var result=reply;
            if (document.getElementById("facebookPortal")!=null) result=result.replace(/img/g,"img onload=\"centerObject(document.getElementById('pies'))\"");
            if (document.getElementById("facebookPortal")!=null) result=result.replace(/avatar.ashx\?/g,"avatar.ashx?f=1&");
            
            theTable=returnRoundedBox("pies","Pie charts",result,true,34,null,true)
            pasteRawHTML(theTable,document.body);
            centerObject(document.getElementById("pies"));
}
function displayStats() {
    flashfile="/skin/stats.swf";
    title="Your statistics";
    flashWidth=600;
    flashHeight=400;
    alignment="center";
    toembed="<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" width=\""+flashWidth+"\" height=\""+flashHeight+"\" id=\""+title+"\" align=\""+alignment+"\">";
    toembed+="<param name=\"allowScriptAccess\" value=\"sameDomain\" />";
    toembed+="<param name=\"movie\" value=\""+flashfile+"\" /><param name=\"quality\" value=\"high\" /><param name=\"wmode\" value=\"opaque\" /><param name=\"bgcolor\" value=\"#ffffff\" />";
    toembed+="<embed src=\""+flashfile+"\" quality=\"high\" wmode=\"opaque\" bgcolor=\"#ffffff\" width=\""+flashWidth+"\" height=\""+flashHeight+"\" name=\""+title+"\" align=\""+alignment+"\" swLiveConnect=\"true\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />";
    toembed+="</object>";
    theTable=returnRoundedBox("statviewer","Statistics",toembed,true,34,null,true);
    startFadeUp();
    pasteRawHTML(theTable,document.body);
    centerObject(document.getElementById("statviewer"));
}
function editProfile() {
    toInsert="<img id=\"loading\" src=\"/skin/loading.gif\" /><div id=\"profileContainer\"></div>";
    startFadeUp();
    pasteRawHTML(returnRoundedBox("myProfile","My Profile",toInsert,true,34,null,true),document.body);
    centerObject(document.getElementById("myProfile"));
    sendRequest("/inside/editMyDetails.ashx?n=1",editProfileReceived);
}
function editProfileReceived(reply) {
    removeTheNode("loading");
    document.getElementById("profileContainer").innerHTML=reply;
    centerObject(document.getElementById("myProfile"));
}
function setSex(src,ismale) {
    editDetailSourceObject=src.parentNode;
    editDetailSourceObject.innerHTML="Savings...";
    docUrl="/inside/Admin.ashx?cmd=savedetail&detail=sex&val="+ismale;
    sendRequest(docUrl,sexChanged);
}
function sexChanged(reply) {
    editDetailSourceObject.innerHTML=reply;
}
function selectHandicap(src) {
    selectWhich=src.id;
    comment="Saving...";
    if (selectWhich!="manualSelection") comment="Saving &amp; recalculating your handicaps...";
    document.getElementById("handicapDescription").innerHTML=comment;
    docUrl="/inside/Admin.ashx?cmd=savedetail&detail=handtype&val="+selectWhich;
    sendRequest(docUrl,handicapChanged);
}
function handicapChanged(reply) {
    if (reply=="OK") {
        document.getElementById("handicapDescription").innerHTML="Reloading...";
        sendRequest("/inside/editMyDetails.ashx?n=1",editProfileReloaded);
    }
}
syncTemp="";
syncContainer=null;
function setSyncAvatar(src,val) {
    syncContainer=src.parentNode;
    syncTemp=src.parentNode.innerHTML;
    src.parentNode.innerHTML="WAIT";
    docUrl="/inside/Admin.ashx?cmd=savedetail&detail=syncavatar&val="+val;
    sendRequest(docUrl,syncChanged);
}
function syncChanged(reply) {
    if (reply=="OK") {
        syncContainer.innerHTML="Reloading...";
        sendRequest("/inside/editMyDetails.ashx?n=1",editProfileReloaded);
    }else{
        syncContainer.innerHTML=syncTemp;
    }
}
function editProfileReloaded(reply) {
    document.getElementById("profileContainer").innerHTML=reply;
    centerObject(document.getElementById("myProfile"));
    refreshMe();
}
function validEmail(email) {
    var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(email)) {
	    return true;
	}else{
	    return false;
	}
}
function validAddress(web) {
    var filter=/^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$/;
	if (filter.test(web)) {
	    return true;
	}else{
	    return false;
	}
}
function acceptAdminRequest(rid) {
    document.getElementById("requestAdmin").innerHTML="<img src=\"/skin/loading.gif\" />";
    docUrl="/inside/Admin.ashx?cmd=acceptAdminRequest&rid="+rid;
    sendRequest(docUrl,AdminRequestReceived);
}
function revokeAdminRequest(rid) {
    document.getElementById("requestAdmin").innerHTML="<img src=\"/skin/loading.gif\" />";
    sendRequest("/inside/Admin.ashx?cmd=revokeAdminRequest&rid="+rid,AdminRequestReceived);
}
function AdminRequestReceived(reply) {
    document.getElementById("requestAdmin").innerHTML=reply;
}
function getClubList(cmd) {
    setInnerHTML("clubListContainer","<img src=\"/skin/loading.gif\" />");
    sendRequest("/inside/Admin.ashx?cmd="+cmd,ClubListReceived);
}
function ClubListReceived(reply) {
    setInnerHTML("clubListContainer",reply);
}
function showProfile(uid) {
    if (document.getElementById("userprofile")!=null) {
        setInnerHTMLCentered("miniProfile","Loading&nbsp;user...<br /><img src=\"/skin/loading.gif\" />","userprofile");
    }else{
        startFadeUp();
        toInsert="<div id=\"miniProfile\">Loading&nbsp;user...<br /><img src=\"/skin/loading.gif\" /></div>";
        pasteRawHTML(returnRoundedBox("userprofile","User&nbsp;details",toInsert,true,34,null,true),document.body);
        centerObject(document.getElementById("userprofile"));
    }
    sendRequest("/inside/Admin.ashx?cmd=userProfile&user="+uid,ProfileLoaded);
}
function ProfileLoaded(reply) {
    setInnerHTMLCentered("miniProfile",reply,"userprofile")
}
