// v.09051@
function server_do(url,data)
{
   JsHttpRequest.query(
      url,
      data,
      function(result,errors)
      {
         document.getElementById("debug").innerHTML=errors; 
         if (result)
            _in(result);
      },
      true
   );
}
var glb_addlinks=new Array();
var glb_addimages=new Array();
var glb_addvideos=new Array();
var glb_addfiles=new Array();
var glb_addcolors=new Array();
// 
function _in(result)
{
      var fn,vl,mes,d,add="",html="";
      fn=result["fn"];
      vl=result["vl"];
      mes=result["mes"];
      d=result["d"];
      _closeOpenBox(0);
      var div,i,html="";
      switch (fn) {
         // @2408
         case "do_follow":
              _follow( mes, vl, d );
              break;
         // 0905@
         case "star":
              if (div=document.getElementById('star_click'+vl)) {
                 switch (mes) {
                    case "please_signin":
                         _out('please_signin',vl);
                         break;
                    case "del":
                         div.innerHTML="<a href=\"#\" class=\"ic mr0\" onClick=\"return(_out('do_star',"+vl+"))\" title=\"Mark\">&nbsp;</a>";
                         break;
                    case "add":
                         div.innerHTML="<a href=\"#\" class=\"ic mr1\" onClick=\"return(_out('do_star',"+vl+"))\" title=\"Remove mark from question\">&nbsp;</a>";
                         break;
                 }
              }
              break;
         // 0905@
         case "vote":
              switch (mes) {
                 case "please_signin":
                      _out('please_signin',vl);
                      break;
                 case "current_vote":
                      if (d[0]) {
                         var div_vote_count,div_vote_click;
                         if (div_vote_count=document.getElementById('vote_count'+vl))
                            div_vote_count.innerHTML="<i>thanks</i> +"+d[0];
                         if (div_vote_click=document.getElementById('vote_click'+vl))
                            div_vote_click.innerHTML="<strong><img src=\""+base_url+"/pictures/vote_1.gif\" border=0></strong>";
                      }
                      break;
              }
              break;
         // 0905@
         case "do_label":
              switch (mes) {
                 case "please_signin":
                      _out('please_signin',vl);
                      break;
                 case "add":
                       _label('add',vl,''+d+'');
                       break;
                 case "remove":
                       _label('remove',vl,''+d+'');
                       break;
              }
              break;
         // 0905&-optional---
         case "do_livesearchtag":
              if ( mes=="empty" ) {
                 _service("wgl",vl,"<b>No results found.</b> Please try a different search.",["service_live"]);
              }
              else {
                 for( i in d )
                    html=html+" <a class=\"s0 s"+d[i][3]+"\" href=\""+base_url+"/tag/"+d[i][0]+"\">"+d[i][1]+"</a>";
                 if ((mes=="add")||(mes=="myadd")) 
                    _service("wgl",vl,html,["service_live"]);
                 if (mes=="my")
                   _wg('l','mytagcloud',html,vl);
              }
              break;
         // 0905&-optional---
         case "do_livesearchmembers":
              if ( mes=="empty" ) {
                 _service("members","","<b>No results found.</b> Please try a different search.",["service_live"]);
              }
              else {
                 for( i in d )
                 {
                    if ( d[i][0] == "" ) {
                       d[i][0]="a";
                       d[i][1]="author.jpg";
                    }
                    html=html+"<img src=\""+base_domain+"/images/sml/"+d[i][0]+"/"+d[i][1]+"\" title=\""+d[i][2]+"\"> <a href=\""+base_url+"/site/"+d[i][2]+"/\">"+d[i][2]+"</a><BR>";
                 }
                 if (mes>0)
                    html=html+"<DIV style=\"text-align:right\"><a href=\"#\" onClick=\"return(_out('do_livesearchmembers',"+vl+","+mes+"))\">More</a></DIV>"

                 _service("members","",html,["service_live2"]);
              }
              break;
         // 0905@i
         case "do_tags":
              switch (mes) {
                 case "please_signin":
                      _out('please_signin',vl);
                      break;
                 case "add":
                       for( i in d )
                          html=html+" <a href=\""+base_url+"/tag/"+d[i]+"\">"+d[i]+"</a>";
                       _service("",vl,html,"");
                       break;
                 default:
                       break;
              }
              break;
         // 0905@i
         case "wg":
              if (div=document.getElementById('wg_html_'+mes )) {
                 for ( var i=0; i<d.length; i++ )
                    html=html+"<nobr><em class=\"a5\"><img src=\""+base_domain+"/images/sml/"+d[i][3]+"/"+d[i][2]+"\" alt=\""+d[i][1]+"\"> <a href=\""+base_domain+"/site/"+d[i][1]+"/\">"+d[i][1]+"</a> "+d[i][4]+"<i class=\"ic fls\">&nbsp;</i></em></nobr>";
                 div.innerHTML = html;
                 div.style.display = "block";
              }
              return(false);
              break;
         // 0905@i
         case "do_link":
              switch (mes) {
                 case "please_signin":
                      _out('please_signin',vl);
                      break;
                 case "add":
                      if ( d  && d[0] ) {
                         num=add_link_num(d[0]);
                         if ( num==-1 ) num=glb_addlinks.length;
                         glb_addlinks[num]=d;
                         _out('link',vl,'add_link_title');
                         _out('link',vl,'add_link_clearerror');
                         _out('link',vl,'add_link_body');
                         _out('do_link',vl,'clear');
                      }
                      break;
                 case "error":
                      if (div=document.getElementById( 'add_link_error_'+vl ))
                      {
                         div.style.display = "block";
                         div.innerHTML = 'URL Error';
                      }
                      break;
              }
              break;
         // 0905@i
         case "do_image":
              switch (mes) {
                 case "please_signin":
                      _out('please_signin',vl);
                      break;
                 case "add":
                      if ( d  && d[0] ) {
                         num=arr_num(d[0], glb_addimages);
                         if ( num==-1 ) num=glb_addimages.length;
                         glb_addimages[num]=d;
                         _out('link',vl,'add_link_clearerror');
                         _out('image',vl,'add_image_body');
                         _out('do_image',vl,'clear');
                      }
                      break;
                 case "error":
                      if (div=document.getElementById( 'add_link_error_'+vl ))
                      {
                         div.style.display = "block";
                         div.innerHTML = 'Upload Error:'+d;
                      }
                      break;
              }
              break;
         // @0609
         case "do_file":
              _file('in_file',vl,mes,d);
              break;
         // @0609
         case "do_color":
              _color('in_color',vl,mes,d);
              break;
         // 0905@i
         case "do_video":
              switch (mes) {
                 case "please_signin":
                      _out('please_signin',vl);
                      break;
                 case "add":
                      if ( d  && d[0] ) {
                         num=arr_num(d[0], glb_addvideos);
                         if ( num==-1 ) num=glb_addvideos.length;
                         glb_addvideos[num]=d;
                         _out('video',vl,'add_link_clearerror');
                         _out('video',vl,'add_video_body');
                         _out('do_video',vl,'clear');
                      }
                      break;
                 case "error":
                      if (div=document.getElementById( 'add_video_error_'+vl ))
                      {
                         div.style.display = "block";
                         div.innerHTML = 'Upload Error:'+d;
                      }
                      break;
              }
              break;
         default:
      }
}

// [BOOK]
var oc=new Array();
var serviceBlock;
serviceBlock = new Array();
var timeout = null;

// 0905@
function _out(fn,vl,mes,d)
{
   var div, html = "";
   //_closeOpenBox(0);
   switch (fn) {
      // 0905@
      case "do_keyup_livesearchtag":
           if (timeout) clearTimeout(timeout);
           timeout=setTimeout("_out('do_livesearchtag',"+vl+",'"+mes+"')",1000);
           break;
      // 0905@
      case "do_keyup_livesearchmembers":
           if (timeout) clearTimeout(timeout);
           timeout=setTimeout("_out('do_livesearchmembers',"+vl+",'"+mes+"')",500);
           break;
      // 0905@
      case "do_livesearchtag":
           if ((div=document.getElementById('live_search_tag')) && (div.value)) {
              server_do( base_url+'/?vl='+vl+'&cm=livesearchtag&type='+mes, { 'livesearchtag': ''+div.value } );
              _service("wgl",vl,"loading...",["service_ajax"]);
           }
           break;
      // 0905@
      case "do_livesearchmembers":
           if ((div=document.getElementById('live_search_members')) && (div.value)) {
              server_do( base_url+'/?vl='+vl+'&cm=livesearchmembers&type='+mes, { 'livesearchmembers': ''+div.value,'more':mes } );
              _closeOpenBox(0);
              _service("members","","loading...",["service_ajax"]);
           }
           break;
      // 0905@
      case "signinform":
           if (div=document.getElementById('signin_form')) {
              if (div.style.display=="block") {
                 div.style.display="none"; 
                 div.innerHTML=""; 
              } 
              else {
                 div.style.display="block";	
                 div.innerHTML="<DIV class=\"signinform\"><FORM method=\"post\" action=\""+base_domain+"/index.php\">Username:&nbsp;<INPUT type=\"text\" name=\"login\" value=\"\">&nbsp;Password:&nbsp;<INPUT type=\"password\" name=\"pass\" value=\"\">&nbsp;<SPAN style=\"font-size:10px;\">Remember me?</SPAN>&nbsp;<INPUT checked=\"checked\" type=\"checkbox\" name=\"remember\">&nbsp;<INPUT type=\"hidden\" name=\"com\" value=\"signin\"><INPUT type=\"hidden\" name=\"gourl\" value=\""+base_url+"\"><INPUT type=\"hidden\" name=\"form_key\" value=\"c7gHjdh\"><INPUT type=\"submit\" value=\"Log In\"> <a href=\""+base_domain+"/?com=retrieve\">Forgot password?</a></FORM></DIV>";
              }
           }
           break;
      // 0905@
      case "do_star":
           if (sess) {
              server_do(base_url+'/?vl='+vl+'&cm=star',{'ClassID':450});
              _service("",vl,"loading...",["service_ajax"]);
           }
           else
              _out('please_signin',vl,'');
           break;
      // 0905@
      case "vote":
           if (sess) {
              server_do(base_url+'/?vl='+vl+'&cm=vote',{'ClassID':483});
              _service("",vl,"loading...",["service_ajax"]);
           }
           else
              _out('please_signin',vl,'');
           break;
      // 0905@
      case "please_signin":
           var nm="",nd="";
           if ((mes=='service') && (d)) {
              nm=mes;
              nd=d;
           }
           html="Please <a class=\"a8\" href=\""+base_domain+"/?com=signin&gourl="+base_url+"&govl="+vl+"\">Sign in</a>";
           if (mes=='no_go') html="Please <a class=\"a8\" href=\""+base_domain+"/?com=signin\">Sign in</a>";
           if (mes=='govl') html="Please <a class=\"a8\" href=\""+base_domain+"/?com=signin&gourl="+base_url+"&govl="+d+"\">Sign in</a>";
           html=html+" or <a class=\"a8\" href=\""+base_domain+"/?com=joinnow\">Register</a>, It's Free . <SPAN><a href=\"#\" onClick=\"return(_closeOpenBox(0))\" class=\"ic clo\">&nbsp;</a></SPAN>";
           _service(nd,vl,html,"");
           break;
      // 0905@i
      case "add_tags":
           if (sess) {
              if (mes=="do") {
                 if (div=document.getElementById('add_tags_form_tags_'+vl )) {
                    if (div.value) {
                       server_do(base_url+'/?vl='+vl+'&cm=tags',{'ClassID':430,'tags':div.value});
                       _closeOpenBox(0);
                       _service("",vl,"loading...",["service_ajax"]);
                    }
                    else
                    {
                       _closeOpenBox(0);
                       _service("",vl,"Tag have to be at least 1 character.","");
                    }
                 }
              }
              if (mes=="open") {
                 html=html+"<INPUT id=\"add_tags_form_tags_"+vl+"\" VALUE=\"\">&nbsp;<button onClick=\"return(_out('add_tags',"+vl+",'do'))\">Add Tags</button>&nbsp;or <a href=\"#\" onClick=\"return(_closeOpenBox(0))\">Cancel</a><BR>Tags are keywords used to help people find project. ( commas separated )";
                 _service("",vl,html,["service service_form"]);
              }
           }
           else
              _out( 'please_signin',vl,'tags' );
           break;
      // 1509i
      case "add_answer":
           if (sess) {
              if (div=document.getElementById( 'add_answer_form_'+vl )) {
                 var div_head=document.getElementById( 'add_answer_head_'+vl ), edit_text="", type=0;
                 if (mes=="edit") {
                    // [ ]
                    type=d[0][0];
                    edit_text=d[0][1];
                    mes="open";
                 }
                 if (mes=="open") {
                    div.style.display = "block";
                    if (type>0) html="<EM>Add Your Comment (edit)</EM><BR>";
                    else html="<EM>Add Your Comment</EM><BR>";
                    html=html+"Write a comment:<BR>";
                    html=html+"<FORM METHOD=\"POST\" ACTION=\""+base_url+"/index.php\" enctype=\"multipart/form-data\" onSubmit=\"_validForm(this,'answer'); return false\">";
                    html=html+"<TEXTAREA NAME=\"SubBOX\" rows=7>"+edit_text+"</TEXTAREA><BR>";
                    html=html+"<INPUT type=\"hidden\" name=\"vl\" value="+vl+">";
                    html=html+"<INPUT type=\"hidden\" name=\"ClassID\" VALUE=\"1803\">";
                    html=html+"<INPUT type=\"hidden\" name=\"cm\" value=\"answer\">";
                    html=html+"<INPUT type=\"hidden\" name=\"type\" value=\""+type+"\">";
                    html=html+"<DIV id=\"add_link_body_"+vl+"\" class=\"addLinkBody\"></DIV>";
                    html=html+"<DIV id=\"add_image_body_"+vl+"\" class=\"addLinkBody\"></DIV>";
                    html=html+"<DIV id=\"add_video_body_"+vl+"\" class=\"addLinkBody\"></DIV>";
                    html=html+"<DIV id=\"add_link_error_"+vl+"\" class=\"addLinkError\"></DIV>";
                    html=html+"<DIV id=\"service_addlink\"></DIV>";
                    html=html+"<DIV class=\"wga\"><UL id=\"addlink_ul\"><li class=\"active\"><span>Add Links</span></li><li><a href=\"#\" onClick=\"return(_out('do_image',"+vl+",'current'))\">Upload Image</a></li><li><a href=\"#\" onClick=\"return(_out('do_video',"+vl+",'current'))\">Upload Video</a></li></UL></DIV>";
                    html=html+"<DIV class=\"addLinkForm\" id=\"add_link_form\">";
                    html=html+"Page URL:<BR>";
                    html=html+"<INPUT id=\"add_link_form_link_"+vl+"\" class=\"http\" VALUE=\"http://\">&nbsp;";
                    html=html+"<button onClick=\"return(_out('do_link',"+vl+",'do'))\">Add Link</button><BR>";
                    html=html+"</DIV>";
                    html=html+"<DIV class=\"addAnswerFormButton\"><INPUT type=\"submit\" value=\"Submit\">&nbsp;<INPUT type=\"submit\" value=\"Cancel\" onClick=\"return(_out('add_answer',"+vl+",'close'))\"></DIV>";
                    html=html+"</FORM><BR><BR>";
                    if ( div_head ) div_head.style.display = "none";
                 }
                 if (mes=="close") {
                    div.style.display="none";
                    if (div_head) div_head.style.display="block";
                 }
                 div.innerHTML = html;
                 if (type>0) {
                    for( i in d[1] )
                       _in({'fn':'do_link','vl':vl,'mes':'add','d':d[1][i]});
                    for( i in d[2] )
                       _in({'fn':'do_image','vl':vl,'mes':'add','d':d[2][i]});
                 }
                 goTo('#service_search');
              }
           }
           else
              _out('please_signin',vl,'');
           break;
      // 0905@i
      case "do_link":
           if (sess) {
              if (mes=='current') {
                 if (div=document.getElementById('addlink_ul')) {
                    div.innerHTML="<li class=\"active\"><span>Add Links</span></li><li><a href=\"#\" onClick=\"return(_out('do_image',"+vl+",'current'))\">Upload Image</a></li><li><a href=\"#\" onClick=\"return(_out('do_video',"+vl+",'current'))\">Upload Video</a></li>";
                    if (div=document.getElementById('add_link_form')) {
                       html=html+"Page URL:<BR>";
                       html=html+"<INPUT id=\"add_link_form_link_"+vl+"\" class=\"http\" VALUE=\"http://\">&nbsp;";
                       html=html+"<button onClick=\"return(_out('do_link',"+vl+",'do'))\">Add Link</button><BR>";
                       div.innerHTML=html;
                    }
                 }
              }
              else {
              if ((div=document.getElementById('add_link_form_link_'+vl)) && (div.value.length>7)) {
                 if (mes=='do') {
                    server_do('/?vl='+vl+'&cm=insertlink',{'insertlink':div.value});
                    _closeOpenBox(0);
                    _service("addlink","","loading...",["service_load"]);
                 }
                 if (mes=='clear')
                    div.value="";
              }
              else
                 if (mes=='do') alert('Please input page URL');
              }
           }
           else
              _out('please_signin',vl,'');
           break;
      // 0905@i
      case "do_image":
           if (sess) {
              if (mes=='current') {
                 if (div=document.getElementById('addlink_ul')) {
                    div.innerHTML="<li><a href=\"#\" onClick=\"return(_out('do_link',"+vl+",'current'))\">Add Links</a></li><li class=\"active\"><span>Upload Image</span></li><li><a href=\"#\" onClick=\"return(_out('do_video',"+vl+",'current'))\">Upload Video</a></li>";
                    if (div=document.getElementById('add_link_form')) {
                       html=html+"Upload an image:<BR>";
                       html=html+"<INPUT type=\"file\" name=\"upl\" id=\"upl\"> &nbsp;<button onClick=\"return(_out('do_image',"+vl+",'do',this.form.upl))\">Upload</button>";
                       div.innerHTML=html;
                    }
                 }
              }
              else {
              if ((div=document.getElementById('upl')) && (div.value)) {
                 if (mes=='do') {
                    server_do('/?vl='+vl+'&cm=insertimage',{'q':d});
                    _closeOpenBox(0);
                    _service("addlink","","loading...",["service_load"]);
                 }
                 if (mes=='clear')
                    div.value="";
              }
              else
                 if (mes=='do') alert('Please choose a file');
              }
           }
           else
              _out('please_signin',vl,'');
           break;
      // 0905@i
      case "do_video":
           if (sess) {
              if (mes=='current') {
                 if (div=document.getElementById('addlink_ul')) {
                    div.innerHTML="<li><a href=\"#\" onClick=\"return(_out('do_link',"+vl+",'current'))\">Add Links</a></li><li><a href=\"#\" onClick=\"return(_out('do_image',"+vl+",'current'))\">Upload Image</a></li><li class=\"active\"><span>Upload Video</span></li>";
                    if (div=document.getElementById('add_link_form')) {
                       html=html+"Attach a video::<BR>";
                       html=html+"<INPUT id=\"upl_video\" class=\"http\" VALUE=\"\"> &nbsp;<button onClick=\"return(_out('do_video',"+vl+",'do'))\">Add Video</button><BR>";
                       html=html+"Enter the &lt;embed&gt; code from <a target=\"_blank\" href=\"http://www.youtube.com/\">Youtube</a> to add a video to your answer.";
                       div.innerHTML=html;
                    }
                 }
              }
              else {
              if ((div=document.getElementById('upl_video')) && (div.value)) {
                 if (mes=='do') {
                    server_do('/?vl='+vl+'&cm=insertvideo',{'insertvideo':div.value});
                    _closeOpenBox(0);
                    _service("addlink","","loading...",["service_load"]);
                 }
                 if (mes=='clear')
                    div.value="";
              }
              else
                 alert('Please enter the <embed> code');
              }
           }
           else
              _out('please_signin',vl,'');
           break;
      // 0905@i
      case "link":
           switch (mes) {
              case "add_link_title":
                   var i, l=glb_addlinks.length;
                   for ( i=0; i<l; i++ ) {
                      if (document.getElementById('httplinktitle'+i))
                         glb_addlinks[i][2]=document.getElementById('httplinktitle'+i).value;
                   }
                   break;
              case "add_link_clearerror":
                   if (div=document.getElementById('add_link_error_'+vl)) {
                      div.style.display="none";
                      div.innerHTML="";
                   }
                   break;
              case "add_link_del":
                   _out('link',vl,'add_link_title');
                   glb_addlinks=unset( glb_addlinks, d );
                   _out( 'link', vl, 'add_link_body' );
                   break;
              case "add_link_body":
                   var tmpLink,tmpShortLink,tmpDomain,tmpNum,tmpTitle,i,l=glb_addlinks.length;
                   for ( i=0; i<l; i++ ) {
                      tmpLink=glb_addlinks[i][0];
                      tmpShortLink=_unsize(tmpLink,50);
                      tmpDomain=glb_addlinks[i][1];
                      tmpNum=i+1;
                      tmpTitle = "";
                      if ( glb_addlinks[i][2] )
                         tmpTitle=glb_addlinks[i][2];
                      html=html+"<DIV class=\"addLinkBodyLink\">["+tmpNum+"] Title: <INPUT id=\"httplinktitle"+i+"\" name=\"httplinktitle"+i+"\" value=\""+tmpTitle+"\" class=\"\"> <SPAN onclick=\"return(_out('link',"+vl+",'add_link_del',"+i+"))\" class=\"addLinkA\">delete</SPAN><BR><a href=\""+tmpLink+"\" target=\"_blank\" rel=\"nofollow\">"+tmpShortLink+"</a><BR><i>"+tmpDomain+"</i><BR><INPUT type=\"hidden\" name=\"httplinklink"+i+"\" value=\""+tmpLink+"\"></DIV>";
                   }
                   if (div=document.getElementById('add_link_body_'+vl)) {
                      if (html) {
                         html="<DIV>Links: <INPUT type=\"hidden\" name=\"httplinkcount\" value=\""+l+"\"></DIV>"+html;
                         div.style.display="block";
                      }
                      else
                         div.style.display="none";
                      div.innerHTML = html;
                   }
                   break;
              default:
                   break;
           }
           break;
      // 0905@i
      case "image":
           switch (mes) {
              case "add_image_del":
                   glb_addimages=unset( glb_addimages, d );
                   _out( 'image', vl, 'add_image_body' );
                   break;
              case "add_image_body":
                   var tmpNum,i,path;
                   for ( i=0; i<glb_addimages.length; i++ ) {
                      tmpNum=i+1;
                      if ((glb_addimages[i][2])&&(glb_addimages[i][2]==1)) path="/images/std/"+glb_addimages[i][1]+"/";
                      else path="/images/tmp/std/";
                      html=html+"<DIV class=\"addLinkBodyLink\">["+tmpNum+"] <SPAN onclick=\"return(_out('image',"+vl+",'add_image_del',"+i+"))\" class=\"addLinkA\">delete</SPAN><BR><img src=\""+base_domain+path+glb_addimages[i][0]+"\" border=\"0\"><BR><INPUT type=\"hidden\" name=\"httpimageimage"+i+"\" value=\""+glb_addimages[i][0]+"\"></DIV>";
                   }
                   if (div=document.getElementById('add_image_body_'+vl)) {
                      if (html) {
                         html="<DIV>Images: <b>"+glb_addimages.length+"</b> <INPUT type=\"hidden\" name=\"httpimagecount\" value=\""+glb_addimages.length+"\"></DIV>"+html;
                         div.style.display="block";
                      }
                      else
                         div.style.display="none";
                      div.innerHTML = html;
                   }
                   break;
              default:
                   break;
           }
           break;
      // 0905@i
      case "video":
           switch (mes) {
              case "add_video_del":
                   glb_addvideos=unset( glb_addvideos, d );
                   _out( 'video', vl, 'add_video_body' );
                   break;
              case "add_video_body":
                   var tmpNum,i;
                   for ( i=0; i<glb_addvideos.length; i++ ) {
                      tmpNum=i+1;
                      html=html+"<DIV class=\"addLinkBodyLink\">["+tmpNum+"] <SPAN onclick=\"return(_out('video',"+vl+",'add_video_del',"+i+"))\" class=\"addLinkA\">delete</SPAN><BR>"+glb_addvideos[i][1]+"<BR><INPUT type=\"hidden\" name=\"httpvideovideo"+i+"\" value=\""+glb_addvideos[i][0]+"\"><INPUT type=\"hidden\" name=\"httpvideosource"+i+"\" value=\""+glb_addvideos[i][2]+"\"></DIV>";
                   }
                   if (div=document.getElementById('add_video_body_'+vl)) {
                      if (html) {
                         html="<DIV>Video: <INPUT type=\"hidden\" name=\"httpvideocount\" value=\""+glb_addvideos.length+"\"></DIV>"+html;
                         div.style.display="block";
                      }
                      else
                         div.style.display="none";
                      div.innerHTML = html;
                   }
                   break;
              default:
                   break;
           }
           break;
      // 1509@i
      case "add_comment":
           if (sess) {
              var div_form,div_head;
              if (div_form=document.getElementById('add_comment_form_'+vl)) {
                 div_head=document.getElementById('add_comment_head_'+vl);
                 if (div_form.style.display=="block") {
                    div_form.style.display="none";
                    div_form.innerHTML="";
                    div_head.style.display="block";
                 }
                 else {
                    div_form.style.display="block";
                    html="<FORM METHOD=\"POST\" ACTION=\""+base_url+"/index.php\" onSubmit=\"_validForm(this,'comment'); return false\"><TEXTAREA NAME=\"SubBOX\" rows=\"5\"></TEXTAREA><BR><INPUT type=\"hidden\" name=\"vl\" value=\""+vl+"\"><INPUT type=\"hidden\" name=\"ClassID\" VALUE=\"1833\"><INPUT type=\"hidden\" name=\"cm\" value=\"reply\"><INPUT class=\"f11\" type=\"submit\" value=\"Submit\">&nbsp;&nbsp;&nbsp;<INPUT class=\"f11\" type=\"submit\" value=\"Cancel\" onClick=\"return(_out('add_comment',"+vl+"))\"></FORM>";
                    div_form.innerHTML=html;
                    div_head.style.display="none";
                 }
              }
           }
           else
              _out('please_signin',vl,'govl',d);
           break;
      // 0905@
      case "more_topics":
          if (div=document.getElementById('more_topics')) {
             document.getElementById('more_topics_link').style.display="none";
             div.style.display="inline";
          }
          break;
      default:
   }
   return(false);
}
// [A]
function _re( l )
{
   return window.location=l
}
// 0905@
function _closeOpenBox(vl)
{
   var buf=new Array();
   var i,div;
   if (!serviceBlock[vl]) {
      for( i in serviceBlock ) {
         div = document.getElementById( 'service_'+i );
         if (( div ) && ( div.style.display == "block" )) {
            div.innerHTML = "";
            div.style.display = "none"; 
         }
      }
      serviceBlock=buf;
   }
   return(false);
}
// 0905@
function _service(fn,vl,mes,d)
{
   var div,i;
   if (fn) 
      i=fn+vl;
   else 
      i=vl;
   if (div=document.getElementById('service_'+i)) {
      _closeOpenBox(i);
      if (div.style.display=="block") {
         div.innerHTML="";
         div.style.display="none"; 
      } 
      else {
         serviceBlock[i]=i;
         if (d[0]) div.className=d[0];
         else div.className="service service_please";
         div.innerHTML=mes;
         div.style.display="block";	
      }
   }
   return(false);
}
// 0905@
function _validFormSrv(id,n)
{
   var div,mess='min 3 characters.',len=3;
   if (n=='post') { 
      len=7;
      mess='A message must be longer than '+len+' characters.';
   }
   if (div=document.getElementById(id)) {
      if (div.value.length<len) { 
         _service("search","",mess,"");
      }
      else f.submit()
   }
}
// Id tools--- ANSWER
function _validForm(f,n)
{
   var mess='min 3 characters.';
   if (n=='answer') mess='Your Answer ?';
   if (n=='comment') mess='Comments have to be at least 3 characters.';
   if (f.SubBOX.value.length<3) alert(mess);
   else f.submit()
}
// [@0905]
function _clearForm(id)
{
  var div;
  if (div=document.getElementById(id)) {
    if ((div.value=="Enter Keywords...")||(div.value=="Search topic...")||(div.value=="Search for Members. Enter member name")) {
       div.value="";
       div.style.color="#000";
    }
  }
}
// 0905@i
function add_link_num( url ) {
   for (var i=0; i<glb_addlinks.length; i++)
      if (glb_addlinks[i][0]==url) return i;
   return -1;
}
// 0905@i
function arr_num( s, arr ) {
   for (var i=0; i<arr.length; i++)
      if (arr[i][0]==s) return i;
   return -1;
}
// 0905@i
function unset( arr, num ) 
{
   var tmparr=new Array();
   var x=0;
   for ( i=0; i<arr.length; i++ ) {
      if (i!=num) tmparr[x++]=arr[i];
   }
   return tmparr
}
// -Id--- [ANSWER]
function _unsize( str, num ) 
{
   var tmpstr = "";
   tmpstr = str.substr( 0, num );
   if ( str.length > tmpstr.length )
      tmpstr = tmpstr + '...';
   return tmpstr
}
function goTo(where) {
  document.location.replace(where);
  return false;
}
// @2308 ext -- sess, base_url
function _follow( fn, user, d )
{
   var div,html="",i,str="";
   if ( !sess )
      fn = "please_signin";
   switch ( fn ) 
   {
      case "please_signin":
           _out('please_signin','','service','follow');
           break;
      case "error":
           _service("follow","",""+d+"",["service_live"]);
           break;
      case "follow":
           if ( div = document.getElementById( 'site_follow' ) ) {
              div.style.display = "none";
              div.innerHTML = "";
           }
           _service("follow","",""+d+"",["service_live"]);
           break;
      case "help_follow":
           _service("follow","","You may follow <b>"+user+"</b> as well by clicking on the \"follow\" button.",["service_live"]);
           break;
      case "help_stop_following":
           _service("follow","","<b>You follow "+user+".</b><BR>"+user+"'s personal messages appear in your <a href=\""+base_url+"/personal/\">Personal Area</a>.",["service_live"]);
           break;
      case "do_follow":
           _service("follow","","loading...",["service_ajax"]);
           server_do( base_url+'/?com=follow&type='+d, { 'user': user } );
           break;
      default:
           break;
   }
   return(false);
}
