// 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) {
         // @3010
         case "star":
              if (div=document.getElementById('star_click'+vl)) {
                 switch (mes) {
                    case "please_signin":
                         _out('please_signin',vl);
                         break;
                    case "del":
                         div.innerHTML="deleted";
                         goTo(base_domain+"/?com=shoppinglist");
                         break;
                    case "add":
                         div.innerHTML="<SPAN class='but_add_l'>Added</SPAN>";
                         if (div=document.getElementById('idShoppingList')) {
                            jsShoppingList=jsShoppingList+1;
                            div.innerHTML='( '+jsShoppingList+' )';
                         }
                         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=d[0];
                         if (div_vote_click=document.getElementById('vote_click'+vl))
                            div_vote_click.innerHTML="<img src=\""+base_url+"/pictures/starredfull13x13.gif\" border=\"0\" width=\"13\" height=\"13\">";
                      }
                      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;
         // @3010
         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;
         // @3010
         case "do_file":
              _file('in_file',vl,mes,d);
              break;
         // @3010
         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;
         //
         case "do_checklogin":
              _checklogin('in_checklogin',vl,mes,d);
              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;
      // @09
      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;
      // @3010
      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><font color='green'><b>Edit Comment</b></font></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,'comment'); 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 class=\"addAnswerFormButton\"><INPUT type=\"submit\" value=\"Submit\"></DIV>";
                    html=html+"</FORM>";
                    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) {
                    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;
      // @3010
      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;
      // @3010
      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,path_img;
                   for ( i=0; i<glb_addimages.length; i++ ) {
                      tmpNum=i+1;
                      if ((glb_addimages[i][2])&&(glb_addimages[i][2]==1)) {
                          path="http://i.embpersons.com/cutealph/sml/";
                          path_img="http://i.embpersons.com/cutealph/org/";
                      }
                      else { 
                          path="/cache/images/sml/";
                          path_img="/cache/images/org/";
                      }
                      html=html+"<DIV class=\"addLinkBodyLink\">["+tmpNum+"] <SPAN onclick=\"return(_out('image',"+vl+",'add_image_del',"+i+"))\" class=\"addLinkA\">delete</SPAN><BR><a href=\""+path_img+glb_addimages[i][0]+"\"><img src=\""+path+glb_addimages[i][0]+"\" border=\"0\"></a><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;
}
// @3010
function menuCurrent( nb )  {
   var current;
   if (current = document.getElementById( nb )) {
      current.className = "current";
   }
   return false;
}// @01
var glb_alpabet_tag=new Array('mandarinfont','twoheartslacefont','patchworkfont','umbrellafont','sakurafont','goldenpaintingfont','lovefont','schoolfont','bellsribbonsfont','cheesefont','butterflyfont','carnivalfont','crossstitchfont','birdfont','goldfont','autumnfont','oldscriptfont','bugsfont','swirlsfont','berryfont','boxcrossfont','christmascrossfont','christmasfont','cookiefont','cowboylassofont','daisiesfont','familytreefont','fantasyfont','firebirdfont','floralfont','forestfont','funnyblotfont','gardenflowerfont','gardenfont','happyfont','heartflowersfont','knightleaderfont','ladybugfont','leavesfont','pinkcrossfont','snowflakecrossfont','snowflakefont','springspiritsfont','valentinesdayfont','xmascrossfont');
var glb_alpabet_name=new Array('Mandarin','Two hearts lace','Patchwork','Umbrella','Sakura','Golden painting','Love','School','Bells ribbons','Cheese','Butterfly','Carnival','Cross stitch','Bird','Gold','Autumn','Old script','Bugs','Swirls','Berry','Box cross','Christmas cross','Christmas','Cookie','Cowboy lasso','Daisies','Family tree','Fantasy','Firebird','Floral','Forest','Funny blot','Garden flower','Garden','Happy','Heart flowers','Knight leader','Ladybug','Leaves','Pink cross','Snowflake cross','Snowflake','Spring spirits','Valentines day','Xmas cross');

$(document).ready(function(){
   //var zi = 10000;
   var el = $('#menu ul li').hover(
      function() {
         $(this).addClass("current");
      },
      function() {
         $(this).removeClass("current");
      }
   );
   //for (var i=0; i<el.length; i++) {
   //   el[i].style.zIndex = zi--;
   //}

   $("#nav ul li.navright").hover(
      function() {
         $(this).addClass("active");
         //$("#nav_tab").slideToggle("slow");
         //$("#nav_tab").addClass("current");
         //$(this).toggleClass("current");
      },
      function() {
         $(this).removeClass("active");
         //$("#nav_tab").removeClass("current");
         // $("#nav_tab").slideToggle("slow");
         //$(this).toggleClass("current");
      }
   );

   $(".slide_tag").click(function(){
      $("#panel_tag").slideToggle("slow");
      $(this).toggleClass("active");
      return false;
   });
   $(".slide_alphabet").click(function(){
      var html="",i;
      for ( var i=0; i<glb_alpabet_tag.length; i++ )
         html = html+" <a href='http://www.cutealphabets.com/tag/"+glb_alpabet_tag[i]+"/'>"+glb_alpabet_name[i]+"</a>";
      $("#panel_alphabet").html(html);
      $("#panel_alphabet").slideToggle("slow");
      $(this).toggleClass("active");
      return false;
   });

   $('.cutemenu ul li').hover(
      function() {
         // ╓╝║═╒╚О╔╛ ╞Ю╝╒╔Ю╝Г╙Ц - ╜╔ ╖═ёЮЦ╕═╚╗ ╚╗ ╓╝ МБ╝ё╝ М╚╔╛╔╜БК
         if ($(this).find('div').length == 0) {
            var id = $(this).attr('id');
            var li = $(this);
            $.ajax({
                url: 'http://www.cutealphabets.com/?com=feed&type=html&query='+id,
                beforeSend: function(){
                     li.addClass('loading');
                },
                success: function(data){
                     li.append(data);
                     li.find('div').slideDown();
                     li.removeClass('loading');
                }
            });
         } 
         else {
             $(this).find('div').slideDown();
         }
         $(this).addClass("active");
      },
      function() {
           $(this).find('div').slideUp('fast');
           $(this).removeClass("active");
      }
   );
});

