<!--

/*
 returnObjById('warning').innerHTML
*/
  
  function initialization() {
    return null;
  }

  function returnObjById( id ){
    if (document.getElementById)
      var returnVar = document.getElementById(id);
    else if (document.all)
      var returnVar = document.all[id];
    else if (document.layers)
      var returnVar = document.layers[id];
    return returnVar;
  }

  function validate_registration() {
    Email  = returnObjById('reg_email').value;
    Login  = returnObjById('reg_login').value;
    Passwd = returnObjById('reg_passwd').value;
    //RegForm

    if (checkEmailValidation('reg_email') == true) returnObjById('RegForm').submit();
    
    return ( true );
  }
  
  function validate_message() {
    Recipient = returnObjById('who').value;
    Subject   = returnObjById('subject').value;
    Body      = returnObjById('body').value;
    Err       = 'n';
    returnObjById('warning').innerHTML = '';
    // testing
    if (Recipient.length < 3) { Err = 'y'; returnObjById('warning').innerHTML += "Zadejte Komu poslat zprávu"; }
    //if (Subject.length == 0)  { Err = 'y';}
    if (Body.length == 0) { Err = 'y'; returnObjById('warning').innerHTML += " Vyplňte text zprávy"; }  

    if (Err == 'n') {
      returnObjById('MessForm').submit();
    }
    return ( true );
  }
 
  
  /**
   *
   * EMAIL VALIDATION
   *
   */
  

  function checkEmailValidation ( addressField ) {
    // empty werning area
    returnObjById('warning').innerHTML = '';
    if ( stringEmpty ( returnObjById(addressField).value ) )
      returnObjById('warning').innerHTML +=  "Error! There is no E-Mail address entered" ;
    else if ( noAtSign ( returnObjById(addressField).value ) )
      returnObjById('warning').innerHTML +=  "Error! The E-Mail address does not contain an '@' character" ;
    else if ( nothingBeforeAt ( returnObjById(addressField).value ) )
      returnObjById('warning').innerHTML +=  "Error! An E-Mail address must contain at least one character before the '@' character" ;
    else if ( noLeftBracket ( returnObjById(addressField).value ) )
      returnObjById('warning').innerHTML +=  "Error! The E-Mail address contains a right square bracket ']',\nbut no corresponding left square bracket '['" ;
    else if ( noRightBracket ( returnObjById(addressField).value ) )
      returnObjById('warning').innerHTML +=  "Error! The E-Mail address contains a left square bracket '[',\nbut no corresponding right square bracket ']'" ;
    else if ( noValidPeriod ( returnObjById(addressField).value ) )
      returnObjById('warning').innerHTML +=  "Error! An E-Mail address must contain a period ('.') character" ;
    else if ( noValidSuffix ( returnObjById(addressField).value ) )
      returnObjById('warning').innerHTML +=  "Error! An E-Mail address must contain a two or three character suffix" ;
    else
      return (true);
    return ( false );
  }

  function linkCheckValidation ( formField ) {
    if ( checkValidation ( formField ) == true ) {
        returnObjById('warning').innerHTML += 'E-Mail Address Validates OK' ;
    }

    return ( false );
  }

  function stringEmpty ( address ) {
    // CHECK THAT THE STRING IS NOT EMPTY
    if ( address.length < 1 ) {
        return ( true );
    } else {
        return ( false );
    }
  }

  function noAtSign ( address ) {
    // CHECK THAT THERE IS AN '@' CHARACTER IN THE STRING
    if ( address.indexOf ( '@', 0 ) == -1 ) {
        return ( true )
    } else {
        return ( false );
    }
  }

  function nothingBeforeAt ( address ) {
    // CHECK THERE IS AT LEAST ONE CHARACTER BEFORE THE '@' CHARACTER
    if ( address.indexOf ( '@', 0 ) < 1 ) {
        return ( true )
    } else {
        return ( false );
    }
  }

  function noLeftBracket ( address ) {
    // IF EMAIL ADDRESS IN FORM 'user@[255,255,255,0]', THEN CHECK FOR LEFT BRACKET
    if ( address.indexOf ( '[', 0 ) == -1 && address.charAt ( address.length - 1 ) == ']' ) {
        return ( true )
    } else {
        return ( false );
    }
  }

  function noRightBracket ( address ) {
    // IF EMAIL ADDRESS IN FORM 'user@[255,255,255,0]', THEN CHECK FOR RIGHT BRACKET
    if ( address.indexOf ( '[', 0 ) > -1 && address.charAt ( address.length - 1 ) != ']' ) {
        return ( true );
    } else {
        return ( false );
    }
  }

  function noValidPeriod ( address ) {
    // IF EMAIL ADDRESS IN FORM 'user@[255,255,255,0]', THEN WE ARE NOT INTERESTED
    if ( address.indexOf ( '@', 0 ) > 1 && address.charAt ( address.length - 1 ) == ']' )
        return ( false );

    // CHECK THAT THERE IS AT LEAST ONE PERIOD IN THE STRING
    if ( address.indexOf ( '.', 0 ) == -1 )
        return ( true );
    return ( false );
  }

  function noValidSuffix ( address ) {
    // IF EMAIL ADDRESS IN FORM 'user@[255,255,255,0]', THEN WE ARE NOT INTERESTED
    if ( address.indexOf ( '@', 0 ) > 1 && address.charAt ( address.length - 1 ) == ']' )
        return ( false );

    // CHECK THAT THERE IS A TWO OR THREE CHARACTER SUFFIX AFTER THE LAST PERIOD
    var len = address.length;
    var pos = address.lastIndexOf ( '.', len - 1 ) + 1;
    if ( ( len - pos ) < 2 || ( len - pos ) > 3 ) {
        return ( true );
    } else {
        return ( false );
   }
 }
  /**
  * END - EMAIL VALIDATION
   */

function SetRank(ID){
  for (i=1; i <= ID; i++) {
    returnObjById("YourRank"+i).src = "http://www.gamerztube.cz/gfx/stars2/VoteStars1.png";
  }
}
function SetDefaultRank(){
  for (i=1; i <= 5; i++) {
    returnObjById("YourRank"+i).src = "http://www.gamerztube.cz/gfx/stars2/VoteStars0.png";
  }
}

function ReplyComment(VideoID, ID){
  //var elem = returnObjById('AllComment').elements;
  var HTMLComment = "";
  
  if (user_auth == 'yes') {
    if (returnObjById('ReplyID'+ID).innerHTML == '') {
      HTMLComment = "";
/*
      HTMLComment = "";
      HTMLComment += "        <form action=\"./scripts/CommentReply.php\" method=\"post\">\n";
      HTMLComment += "        <input name=\"IDVideo\" type=\"hidden\" value=\""+VideoID+"\">\n";
      HTMLComment += "        <input name=\"CommentID\" type=\"hidden\" value=\""+ID+"\">\n";
      HTMLComment += "        <div class=\"playcommreply\" id=\"ReplyForm"+ID+"\">\n";
      HTMLComment += "          <div class=\"playcommreplyinputy\">\n";
      HTMLComment += "            <label for=\"Title\"><strong>Nadpis (titulek):</strong></label><br />\n";
      HTMLComment += "            <input name=\"Title\" type=\"text\" class=\"playcommreplyinput\" value=\"\" />\n";
      HTMLComment += "            <br /><br />\n";
      HTMLComment += "            <label for=\"Content\"><strong>Zpráva (sdělení):</strong></label><br />\n";
      HTMLComment += "            <textarea name=\"Content\" rows=\"6\" class=\"playcommreplyinput\"></textarea><br />\n";
      HTMLComment += "            <div align=\"right\"><input type=\"submit\" class=\"playcommreplybutton\" value=\"Uložit\" /></div>\n";
      HTMLComment += "          </div>\n";
      HTMLComment += "          <div class=\"playcommreplytext\">\n";
      HTMLComment += "          <a href=\"javascript:ReplyClose("+ID+");\">\n";
      HTMLComment += "            <div class=\"playcommreplyclose\"></div>\n";
      HTMLComment += "          </a>\n";
      HTMLComment += "            <div style=\"clear: right\"></div>\n";
      HTMLComment += "            <div>Prosíme, zachovejte diskuzi věcnou, slušnou, nehanlivou.<br><br>Děláte to pro sebe.<br><br><br><br><strong>Děkujeme mnohokrát</strong></div>\n";
      HTMLComment += "          </div>\n";
      HTMLComment += "          <div style=\"clear: both\"></div>\n";
      HTMLComment += "        </div>\n";
      HTMLComment += "        </form>\n";
*/ 
      HTMLComment += "    <form action=\"http://www.gamerztube.cz/scripts/watch/comment-reply.php\" method=\"post\">\n";
      HTMLComment += "    <input name=\"IDVideo\" type=\"hidden\" value=\""+VideoID+"\">\n";
      HTMLComment += "    <input name=\"CommentID\" type=\"hidden\" value=\""+ID+"\">\n";
      HTMLComment += "    <div class=\"playcommreply\" id=\"ReplyForm"+ID+"\">\n";
      HTMLComment += "    <div class=\"WatchCommentContent\">";
      HTMLComment += "      <div class=\"WatchCommentContentLeft\">";
      HTMLComment += "        <label for=\"Title\"><strong>Nadpis, předmět, titulek:</strong></label><br />";
      HTMLComment += "        <input name=\"Title\" id=\"Title\" type=\"text\" class=\"playcommreplyinput\" value=\"\" size=\"60\" /><br /><br />";
      HTMLComment += "        <label for=\"Content\"><strong>Zpráva (sdělení):</strong></label><br />";
      HTMLComment += "        <textarea name=\"Content\" id=\"Content\" rows=\"6\" cols=\"68\" class=\"playcommreplyinput\"></textarea>";
      HTMLComment += "        <div>Prosíme, zachovejte diskuzi věcnou, slušnou, nehanlivou.<br />Děláte to pro sebe.<br /><strong>Děkujeme mnohokrát</strong></div>";
      HTMLComment += "        <div style=\"padding:5px 0 0 0\"><input type=\"submit\" class=\"playcommreplybutton\" value=\"Uložit komentář\" /></div>";
      HTMLComment += "      </div>";
      HTMLComment += "      <div class=\"WatchCommentContentRight\"><a href=\"javascript:ReplyClose("+ID+");\"><img src=\"http://www.gamerztube.cz/gfx/gzt_watch_coment_close.png\" alt=\"Zavřít\" border=\"0\" /></a></div>";
      HTMLComment += "      <div style=\"clear:left\"></div>";
      HTMLComment += "    </div>";
      HTMLComment += "  </div>";
      HTMLComment += "  </form>";
      
    } else {
      HTMLComment = "";
    }
  }
  
  if (user_auth == 'no') {
    if (returnObjById('ReplyID'+ID).innerHTML == '') {
      HTMLComment = "<div style=\"color:#E24F51;text-align:center;padding:10px\">Pro vložení komentáře musíte být přihlášen.</div>";
    } else {
      HTMLComment = "";
    }
  }
  
  //returnObjById('ReplyID'+ID).innerHTML = HTMLComment;  
  
  returnObjById('ReplyID'+ID).style.display="";
  returnObjById('ReplyID'+ID).innerHTML = HTMLComment;  
}

function ReplyClose(ID){
  returnObjById('ReplyForm'+ID).style.display="none";
}

function CommentClose(ID){
  returnObjById(ID).style.display="none";
}

function CommentNew(ID) {
  if (user_auth == 'yes') {
    if(returnObjById(ID).style.display==""){
      returnObjById(ID).style.display="none";
    }else{
      returnObjById(ID).style.display="";
    }
  } else {
    if(returnObjById('CommentNewoff').style.display==""){
      returnObjById('CommentNewoff').style.display="none";
    }else{
      returnObjById('CommentNewoff').style.display="";
    }
  
  }
}

function SwapTable(NAME){
  if(NAME == "GamerZ"){
    returnObjById("MovieZ").style.display = 'none';
    returnObjById("GamerZ").style.display = '';
    
    returnObjById('aGamerZ').style.fontWeight="bold";
    returnObjById('aMovieZ').style.fontWeight="normal";
  }
  if(NAME == "MovieZ"){
    returnObjById("GamerZ").style.display = 'none';
    returnObjById("MovieZ").style.display = '';

    returnObjById('aMovieZ').style.fontWeight="bold";
    returnObjById('aGamerZ').style.fontWeight="normal";
  }

}
  
  
function select_all(id) {
  var text_val = returnObjById(id);
  text_val.focus();
  text_val.select();
}

function switch_watch_more(id) {
  if (id == 'watch-more-best') {
    
    returnObjById('watch-more-user').style.display    = 'none';
    returnObjById('watch-more-user-left').className   = 'blackbunkacontenttopzalozkableft';
    returnObjById('watch-more-user-center').className = 'blackbunkacontenttopzalozkabcenter';
    returnObjById('watch-more-user-right').className  = 'blackbunkacontenttopzalozkabright';
    
    returnObjById('watch-more-best').style.display    = '';
    returnObjById('watch-more-best-left').className   = 'blackbunkacontenttopzalozkaaleft';
    returnObjById('watch-more-best-center').className = 'blackbunkacontenttopzalozkaacenter';
    returnObjById('watch-more-best-right').className  = 'blackbunkacontenttopzalozkaaright';
  }
  
  if (id == 'watch-more-user') {
    
    returnObjById('watch-more-user').style.display    = '';
    returnObjById('watch-more-user-left').className   = 'blackbunkacontenttopzalozkaaleft';
    returnObjById('watch-more-user-center').className = 'blackbunkacontenttopzalozkaacenter';
    returnObjById('watch-more-user-right').className  = 'blackbunkacontenttopzalozkaaright';
    
    returnObjById('watch-more-best').style.display    = 'none';
    returnObjById('watch-more-best-left').className   = 'blackbunkacontenttopzalozkableft';
    returnObjById('watch-more-best-center').className = 'blackbunkacontenttopzalozkabcenter';
    returnObjById('watch-more-best-right').className  = 'blackbunkacontenttopzalozkabright';
    
  }
}
//-->