


function WM_setCookie (name, NS_value, IE_value, hours, path, domain, evalValue) {


    daValue = (navigator.appName == 'Netscape')?NS_value:IE_value;

    //fix layer ref if not supported (thanks, Ken Sundermeyer!)

    if ((daValue.indexOf('document.layers[')==0 && document.layers==null)|| (daValue.indexOf('document.all[')==0 && document.all==null)) {

      daValue = 'document'+daValue.substring(daValue.substring(0,daValue.lastIndexOf('.')).lastIndexOf('.'),daValue.length);

    }


    if(evalValue == 1) daValue = eval(daValue + '.value');


  // set the cookie, adding any parameters that were specified

  // (convert hours to milliseconds (*3600000) and then to a GMTString)

    document.cookie = name + '=' + escape(daValue) + ((hours)?(';expires=' + ((new Date((new Date()).getTime() + parseInt(hours)*3600000)).toGMTString())):'') + ((path)?';path=' + path:'') + ((domain)?';domain=' + domain:'');

}

function WM_readCookie(name, NS_outputElement, IE_outputElement) {

  // if there's no cookie, don't do anything

  if(document.cookie != '') {

    var actualValue, outputElement, firstChar, lastChar;


    // get the entire cookie string (this may have other name=value pairs in it

    var theBigCookie = document.cookie;

    // grab just this cookie from theBigCookie string

    // find the start of 'name'

    firstChar = theBigCookie.indexOf(name);

    // if you found it

    if(firstChar != -1) {

      // skip 'name' and '='

      firstChar += name.length + 1;

      // find the end of the value string (i.e. the next ';')

      lastChar = theBigCookie.indexOf(';', firstChar);

      if(lastChar == -1) lastChar = theBigCookie.length;

      // return the value

      actualValue = unescape(theBigCookie.substring(firstChar, lastChar));

    } else {

      // if there was no cookie, return false

      actualValue = false;

    }


    outputElement = (navigator.appName == 'Netscape')?NS_outputElement:IE_outputElement;

    //fix layer ref if not supported (thanks, Ken Sundermeyer!)

    if ((outputElement.indexOf('document.layers[')==0 && document.layers==null)|| (outputElement.indexOf('document.all[')   ==0 && document.all   ==null)) {

      outputElement = 'document'+outputElement.substring(outputElement.substring(0,outputElement.lastIndexOf('.')).lastIndexOf('.'),outputElement.length);

    }


    if(outputElement && actualValue) {
// thanks to Matthew Toledo for pointing out IE5 not handling some evals..
fehIE5=eval(outputElement);
fehIE5.value = actualValue;
    }

  }

}

function WM_killCookie(name, path, domain) {

  var firstChar, lastChar, theValue;

  // get the entire cookie string (this may have other name=value pairs in it

  var theBigCookie = document.cookie;

  // grab just this cookie from theBigCookie string

  // find the start of 'name'

  firstChar = theBigCookie.indexOf(name);

  // if you found it

  if(firstChar != -1) {

    // skip 'name' and '='

    firstChar += name.length + 1;

    // find the end of the value string (i.e. the next ';')

    lastChar = theBigCookie.indexOf(';', firstChar);

    if(lastChar == -1) lastChar = theBigCookie.length;

    // set theValue

    theValue = theBigCookie.substring(firstChar, lastChar);

  } else {

    // there is no such cookie

    theValue = false;

  }

  // assuming there actually is such a cookie

  if(theValue) {

    // set an expired cookie, adding 'path' and 'domain' if they were given

    document.cookie = name + '=' + theValue + '; expires=Fri, 13-Apr-1970 00:00:00 GMT' + ((path)?';path=' + path:'') + ((domain)?';domain=' + domain:'');

  }

}


function metaCookieKill(){
WM_killCookie('RLSourireUserFName','','');
WM_killCookie('RLSourireUserLName','','');
WM_killCookie('RLSourireUserGender','','');
WM_killCookie('RLSourireUserEpisode','','');
}

function metaCookieRead(){
WM_readCookie('RLSourireUserFName','document.userPrefs.Fname','document.userPrefs.Fname');
WM_readCookie('RLSourireUserLName','document.userPrefs.Lname','document.userPrefs.Lname');
WM_readCookie('RLSourireUserGender','document.userPrefs.Gender','document.userPrefs.Gender');
WM_readCookie('RLSourireUserEpisode','document.userPrefs.Episode','document.userPrefs.Episode');
}

function metaCookieSet(){
WM_setCookie('RLSourireUserFName','document.userPrefs.Fname','document.userPrefs.Fname','2400','','',1);
WM_setCookie('RLSourireUserLName','document.userPrefs.Lname','document.userPrefs.Lname','2400','','',1);
WM_setCookie('RLSourireUserGender','document.userPrefs.Gender','document.userPrefs.Gender','2400','','',1);
WM_setCookie('RLSourireUserEpisode','document.userPrefs.Episode','document.userPrefs.Episode','2400','','',1);
}

function SWFmetaCookieRead(){
WM_readCookie('RLSourireUserFName','document.userPrefs.Fname','document.userPrefs.Fname');
WM_readCookie('RLSourireUserLName','document.userPrefs.Lname','document.userPrefs.Lname');
WM_readCookie('RLSourireUserGender','document.userPrefs.Gender','document.userPrefs.Gender');
WM_readCookie('RLSourireUserEpisode','document.userPrefs.Episode','document.userPrefs.Episode');
}

function SWFmetaCookieSet(varFname,varLname,varGender,varEpisode){


WM_setCookie('RLSourireUserGender',varGender,varGender,'2400','','',-1);
WM_setCookie('RLSourireUserEpisode',varEpisode,varEpisode,'2400','','',-1);
WM_readCookie('RLSourireUserFName','document.userPrefs.Fname','document.userPrefs.Fname');
WM_readCookie('RLSourireUserLName','document.userPrefs.Lname','document.userPrefs.Lname');
WM_readCookie('RLSourireUserGender','document.userPrefs.Gender','document.userPrefs.Gender');
WM_readCookie('RLSourireUserEpisode','document.userPrefs.Episode','document.userPrefs.Episode');
// document.userPrefs.Fname.value = varFname;
// document.userPrefs.Lname.value = varLname;
// document.userPrefs.Gender.value = varGender;
// document.userPrefs.Episode.value = varEpisode;
}

function SWFmetaCookieSetPrologue(varFname,varLname,varGender,varEpisode){

WM_setCookie('RLSourireUserFName',varFname,varFname,'2400','','',-1);
WM_setCookie('RLSourireUserLName',varLname,varLname,'2400','','',-1);
WM_setCookie('RLSourireUserGender',varGender,varGender,'2400','','',-1);
WM_setCookie('RLSourireUserEpisode',varEpisode,varEpisode,'2400','','',-1);
WM_readCookie('RLSourireUserFName','document.userPrefs.Fname','document.userPrefs.Fname');
WM_readCookie('RLSourireUserLName','document.userPrefs.Lname','document.userPrefs.Lname');
WM_readCookie('RLSourireUserGender','document.userPrefs.Gender','document.userPrefs.Gender');
WM_readCookie('RLSourireUserEpisode','document.userPrefs.Episode','document.userPrefs.Episode');
// document.userPrefs.Fname.value = varFname;
// document.userPrefs.Lname.value = varLname;
// document.userPrefs.Gender.value = varGender;
// document.userPrefs.Episode.value = varEpisode;
}