VaR sel = new object ();
VaR sel_num = 0;
Function getcookieval (offset ){
VaR endstr = Document. Cookie. indexof (";", offset );
If (endstr =-1) endstr = Document. Cookie. length;
Return Unescape (document. Cookie. substring (offset, endstr ));
}
Function getcookie (name ){
VaR Arg = Name + "= ";
VaR Alen = Arg. length;
VaR clen = Document. Cookie. length;
// Alert (document. Cookie. Length );
VaR I = 0;
While (I <clen ){
VaR J = I + Alen;
If (document. Cookie. substring (I, j) = Arg)
Return getCookieVal (j );
I = document. cookie. indexOf ("", I) + 1;
If (I = 0) break;
}
Return null;
}
Function SetCookie (name, value, expires, path, domain, secure ){
Document. cookie = name + "=" + escape (value) + (expires )? "; Expires =" + expires. toGMTString (): "") + (path )? "; Path =" + path: "") + (domain )? "; Domain =" + domain: "") + (secure )? "; Secure ":"");
Return value;
}
Function DeleteCookie (name ){
If (GetCookie (name )! = Null ){
Setcookie (name, "", null, "/", null );
}
}
Function cookie_content (){
I = 0;
VaR content = "";
For (key in SEL ){
If (I = 0 ){
Content + = Key + "[" + sel [Key] + "]";
}
Else {
Content + = "," + key + "[" + sel [Key] + "]";
} I ++;
}
Return content;
}
Function inni_data (){
Var cookie_sel = new Object ();
Cookie_str = GetCookie ("Member_COOKIE ");
If (cookie_str! = "" & Cookie_str! = Null ){
Cookie_sel = cookie_str.split (',');
For (var k = 0; k <cookie_sel.length; k ++ ){
I = cookie_sel [k]. indexOf ("[");
J = cookie_sel [k]. indexOf ("]");
Sel [cookie_sel [k]. substring (0, I)] = cookie_sel [k]. substring (I + 1, j );
Sel_num ++;
}
Draw ();
}
}
Function addMember (id, nm ){
If (! Sel [id]) {
Sel_num ++; sel [id] = nm;
}
Else
{Sel [id] = nm ;}
SetCookie ("Member_COOKIE", cookie_content (), null, "/", null );
}
Function draw (){
Out = '';
For (key in sel ){
$ ("#" + Key). val (sel [key]);
}
}