
function ssn(val) {

        if (val.replace(/\D/g,"").length != 9) return val
        val = val.replace(/\D/g,"")
        return val.substring(0,3) + "-" +
               val.substring(3,5) + "-" +
               val.substring(5)
} 


function isan(string) {
    if (string.length == 0)
        return false;
    for (var i=0;i < string.length;i++)
        if ((string.substring(i,i+1) < '0') || (string.substring(i,i+1) > '9'))
            return false;
    
    return true;
}

//Macromedia Functions
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}


//Fade in-out functions for images
//Necessary: class=trans in the <Img> tag
//Usage: onMouseOver=high(this) et OnMouseOut=low(this)
function high(which2){
theobject=which2
highlighting=setInterval("highlightit(theobject)",50)
}

function low(which2){
clearInterval(highlighting)
if (which2.style.MozOpacity)
which2.style.MozOpacity=0.5
else if (which2.filters)
which2.filters.alpha.opacity=50
}

function highlightit(cur2){
if (cur2.style.MozOpacity<1)
cur2.style.MozOpacity=parseFloat(cur2.style.MozOpacity)+0.1
else if (cur2.filters&&cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=10
else if (window.highlighting)
clearInterval(highlighting)
}


//Open the Top frame and subnav frame according to the titles written in BODY tag
//Usage: page1 -> first part of name  /   page2 -> second part of name   /   framesize -> size of the subnav frame
//actions:
        //subnav = /subnav/page1page2sub.php - size=framesize
        //topnav = refreshed top page, images will change
        //first part of section name=/images/topleft/page1.gif
        //second part of section name=/images/topleft/page2.gif
        //option image name=/images/topleft/option/page1page2option.gif

function OpenRightPage(page1,page2,framesize)
{
parent.topnav.location=("/nav/top.php?framesize="+framesize+"&first="+page1+"&second="+page2);
parent.subnav.location=("/subnav/"+page1+page2+".php");
parent.infopanel.location=("/nav/infopanel.php?path="+"home%20umbarakrendezvous");
}

function OpenRightPageParam(page1,page2,framesize,param)
{
parent.topnav.location=("/nav/top.php?framesize="+framesize+"&first="+page1+"&second="+page2);
parent.subnav.location=("/subnav/"+page1+page2+".php"+param);
parent.infopanel.location=("/nav/infopanel.php?path="+"home%20umbarakrendezvous");
}



function OpenRightPageRdv(page1,page2,framesize,date,type)
{
parent.topnav.location=("/nav/top.php?framesize="+framesize+"&first="+page1+"&second="+page2);
parent.subnav.location=("/subnav/"+page1+page2+".php?GO_TYPE="+type+"&GO_DAT="+date);
parent.infopanel.location=("/nav/infopanel.php?path="+"home%20umbarakrendezvous");
}


//for the member details page, swaps between normal and detailed view
function detailchange(detailpage,membernumber,page)
{
if (document.all)
        {frm=eval("document.all."+detailpage);}
if (document.getElementById)
        {frm=document.getElementById(detailpage);}
if (frm.src!="/subpages/" + page + "?member=" + membernumber)
        {
        frm.src="/subpages/" + page + "?member=" + membernumber;
        }
}

//changes the picture displayed on a member details page
function setactivepic(picture,picid)
{
pic=eval("document.all."+picture);
pic.src=picid;
}

function minipopup(theurl,thename,width,height)
{
window.open(theurl,thename,'width='+width,'height='+height,'scrollbar=no','resize=no','statusbar=no','navigation=no','location=no');
}

function openumbarak(idum)
{
         var top=(screen.height-380)/2;
         var left=(screen.width-800)/2;
         //alert(idum);
         window.open('/pages/findpeopleresult.php?ID_PEOPLE_TOP='+idum,'umbarak'+idum,'width=800,height=380,scrollbar=no,resize=no,statusbar=no,navigation=no,location=no');
}

function sendmessage(idum)
{
         var top=(screen.height-380)/2;
         var left=(screen.width-800)/2;
         //alert(idum);
         window.open('/pages/sendmessage.php?ID_PEOPLE='+idum,'umbarak'+idum,'width=600,height=320,scrollbar=no,resize=no,statusbar=no,navigation=no,location=no');
}

function iwasthere(idum)
{
         var top=(screen.height-380)/2;
         var left=(screen.width-800)/2;
         //alert(idum);
         window.open('/pages/iwasthere.php?REPLY=YES&ID_FO='+idum,'umbarak'+idum,'width=600,height=320,scrollbar=no,resize=no,statusbar=no,navigation=no,location=no');
}

function hotspot(idum)
{
         var top=(screen.height-380)/2;
         var left=(screen.width-800)/2;
         //alert(idum);
         window.open('/pages/hotspot.php?ID_LO='+idum,'umbarak'+idum,'width=600,height=320,scrollbar=no,resize=no,statusbar=no,navigation=no,location=no');
}

function sendcoloredmessage(idum)
{
         var top=(screen.height-380)/2;
         var left=(screen.width-800)/2;
         //alert(idum);
         window.open('/subpages/advancedmessage.php?ID_PEOPLE='+idum,'umbarak'+idum,'width=700,height=435,scrollbar=no,resize=no,statusbar=no,navigation=no,location=no');
}


// NOSECONDMOUSE button
/*
function NSclick(e) {
        if (navigator.appName=="Netscape" && parseInt(navigator.appVersion)==4) {
                if (e.which == 3) {
                        return false;
                }
        }
        if (navigator.appName=="Netscape" && parseInt(navigator.appVersion)>=5) {
                    if (e.button == 2 || e.button == 3) {
                              e.preventDefault();
                        return false;
                  }
        }
}

if (navigator.appName=="Netscape" && parseInt(navigator.appVersion)==4) {
        document.onmousedown=NSclick;
        document.captureEvents(Event.MOUSEDOWN);
}
if (navigator.appName=="Netscape" && parseInt(navigator.appVersion)>=5) {
        document.onmouseup=NSclick;
}
if (navigator.appName=="Microsoft Internet Explorer") {
        document.oncontextmenu = new Function("return false;")
}
*/
