///////////////////////////////  VNSMART PROJECT  //////////////////////////////
//                                                                            //
//             PROGRAMMING AND SOLUTIONS BY LUONG TUAN ANH                    //
//             CONTACT EMAIL : proschooltechsite@yahoo.com                    //
//                                                                            //
//  you can redistribute and modify this module under the terms of GNU General//
//  Public License as published by the Free Software Foundation either version//
//  2 of the License. I saw someone use open sources and solutions but they   //
//  delete all the author's copyright from modules and replace by their       //
//  copyright. That's not good and not like real programmers. You're reading  //
//  this copyright of my module. Hope you like it and don't remove copyright  //
//                      www.programmingschool.net                             //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////

var xmlHttp

function closeIt(where){
   document.getElementById(where).innerHTML='';
   window.location = "";
}

function simpleClose(where){
   document.getElementById(where).innerHTML='';
}

function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
   {
   document.getElementById("WindowMe").innerHTML=xmlHttp.responseText
   }
}

function GetXmlHttpObject()
{
var objXMLHttp=null
if (window.XMLHttpRequest)
  {
  objXMLHttp=new XMLHttpRequest()
  }
else if (window.ActiveXObject)
  {
  objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
  }
return objXMLHttp
}


//on Index Actions
function UserViewAllIndexCat(){
        var url = "news.php?cs=TopicsOnIndexView&op=alltopics";
        AjaxAction("main_index_stage", url);
}

function UserOpenTopicToView(topic_id, curpage, cs, where){
        if(cs=='openspan'){
          var url = "news.php?cs=TopicsOnIndexView&op=OpenTopicSpan&topic_id="+topic_id
          AjaxAction(where, url);
        }else{
            var url = "news.php?cs=TopicsOnIndexView&op=ViewInTopics&topic_id="+topic_id+"&curpage="+curpage;
            //AjaxAction("main_index_stage", url);
            var control = document.getElementById('LTA_psonline_menu_content');
          if(control){
              AjaxAction("LTA_psonline_menu_content", url);
              control.style.overflow = 'auto';
          }else{
              Dialogs.newInfoWindow(url ,'LTA_psonline_menu','Programming School Online', true, false, true, 670, 400, 670, 400, 'center');
              var control = document.getElementById('LTA_psonline_menu_content');
              control.style.overflow = 'auto';
          }
        }
}

function openchild(where, typeid, idex, incase){
     if(incase=='projects'){
        var url = "?module/name|Projects/cs|openchild/catid|"+typeid;
     }

     if(incase=='documentation'){
        var url ="?module/name|Projects/cs|documentation/typeid|"+typeid;
     }

        AjaxAction(where, url);
}

function changeNewChild(where, t, idex, incase){
          var element  = "<img onclick="+'"'+"CloseSpanChild('"+where+"','"+t+"','"+idex+"','"+incase+"')" +'"';
           element += 'border="0" src="images/minus.gif">';
           document.getElementById(where).innerHTML = element;
   }

function openTreeCatchild(where, typeid, incase){
    if(incase=='projects'){
        var url = "?module/name|projects/cs|openchild/catid|"+typeid;
    }

    if(incase=='documentation'){
        var url = "?module/name|projects/cs|Docopenchild/catid|"+typeid;
    }

        AjaxAction(where, url);
}

function CloseSpanChild(where, typeid, idex, incase){
        if(!idex){
      idexl = typeid;
        }else{
          idexl = idex;
        }
    if(incase=='projects'){
        var url ="?module/name|Projects/cs|CloseChildOnMenu/typeid|"+typeid+"/idex|"+idex;
    }

    if(incase=='documentation'){
        var url="?module/name|Projects/cs|CloseDocChildOnMenu/typeid|"+typeid+"/catid|"+idex+"/where|"+where;
    }

        document.getElementById("itemopen_"+idexl).innerHTML = '';
        AjaxAction(where, url);
}

//project action

function UserViewAllIndexProjects(){
        var url = "?module/name|Projects/cs|vprojoin";
        AjaxAction("downloadviewlocation", url);
}

function documentopenboard(where, catid){
     var url = "?module/name|projects/cs|documentation/catid|"+catid;
     AjaxAction(where, url);
}

function openspan(where, titid){
    var url = "news.php?cs=spanmenu&tid="+titid;
    AjaxAction(where, url);
}

function ifamOpen(where, link){
      var url ="news.php?cs=spanmenu&cs=opIfamTvW";
      var params = "&link="+link+"&loc="+where;
      moveTo(where, 0, 0);
      AjaxPostAction(where, url, params);
}

/*do effect on id NODE*/
function __myEffect(){}
__myEffect.prototype.getit = function(myId, myEffect){
    this.id = myId;
    this.effect = myEffect;
}
__myEffect.prototype.callEffect = function(){
    if(this.effect=='link'){
    var control = document.getElementById(this.id);
    control.style.textDecoration = 'underline';}
}
__myEffect.prototype.restore = function(){
    if(this.effect=='link'){
    var control = document.getElementById(this.id);
    control.style.textDecoration = 'none';}
}

effect = new __myEffect();
/*do effect on id NODE*/

/*my account actions*/
function __myAccount(){}
__myAccount.prototype.edit = function(stage){
    AjaxAction(stage, 'account.php?op=edit');
}

account = new __myAccount();
/*my account actions*/

