/*    
 *    Copyright (c) 2010 VidiScript
 *
 *    This file is part of VidiScript.
 *
 *    VidiScript is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation, either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    VidiScript is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with VidiScript.  If not, see <http://www.gnu.org/licenses/>.
 *
 *    File Name: play.js
 *    Description: Ajax functions for player page
 *    $Date: 2010-02-19 00:53:11 +0000 (Fri, 19 Feb 2010) $
 *    $Revision: 13 $
 */
var ajaxfriendlyurl = document.getElementById('ajax').value;
$(document).ready(function() {
   $.get(ajaxfriendlyurl+"ajaxfunc.php",
       {id: 1, tags: $("#tags").html(), poster: $("#posterz").html()},
	   
       function(data)
       {
         $("#resultz").html(data);
       });
    $("#tags").hide();
 });

$(document).ready(function() {
   $.get(ajaxfriendlyurl+"ajaxfunc.php",
       {id: 4},
       function(data)
       {
         $("#commentz").append(data);
       });
 });

function doRelated(tagz,posterz)
{
	$.get(ajaxfriendlyurl+"ajaxfunc.php",
       {id:1, tags: tagz, poster: posterz},
       function(data)
       {
          $("#resultz").html(data);
       });							
}

function doUser(tagz,posterz)
{
	
	$.get(ajaxfriendlyurl+"ajaxfunc.php",
       {id: 2, tags: tagz, poster: posterz}, 
       function(data)
       {
          $("#resultz").html(data);
       });							
}


function RefreshComments()
{
   $.get(ajaxfriendlyurl+"ajaxfunc.php",
       {id: 4},
       function(data)
       {
         $("#commentz").html(data);
       });
}

function Mcomment(vidid, loggedIn)
{	
	$.get(ajaxfriendlyurl+"ajaxfunc.php",
		  {id: 3, name: $("#name").val(), comment: $("#text").val(), scode2: $("#security_code").val(), visitor: $("#visitor").val(), vidid: vidid, loggedIn: loggedIn},
		 function(data)
		 {
			  RefreshComments();
			 $("#Cstats").html(data);
			 $("#text").val("");
			 $("#security_code").val("");
		 });
}
function deleteComment(num)
{
   $.get(ajaxfriendlyurl+"ajaxfunc.php",
       {id: 5, num: num},
       function(data)
       {
         RefreshComments();
       });
}
