


function updateUserPage(vid, sid) {
	videoID = vid;
	showID = sid;


$.get('shared_libs/php-bin/services/ajax/getAJAXcontent.php?param=getVideoMetaData&id=' + vid + '&sid=' + showID, function(data){
$("#videoMetaTitle").html(data);
});

$.get('shared_libs/php-bin/services/ajax/getAJAXcontent.php?param=getShowTitle&id=' + vid + '&sid=' + showID, function(data){
$(".itemSelected").addClass("item");
$(".itemSelected").removeClass("itemSelected");
var string = "#" + data;
$(string).addClass("itemSelected");
checkCurrentlyWatching();
});
if ( $("#comments").length > 0 ) {  

	getUserComments(videoID,showID, 0, 5);


}
	else {
		
	$(".itemSelected").addClass("item");
	$(".itemSelected").removeClass("itemSelected");
	}
}







function postUserComment(vidid,showid,myComment) {

	$.post("comments/php-bin/services/postComment.php", { comment: myComment, vid: vidid, show: showid },
		     function(data){
   $("#comments > #postComments").html(data);	
  });
}

function deleteUserComment(commentId) {
	$.post("comments/php-bin/services/removeComment.php", { comment: commentId },
		     function(data){
			
   getComments(videoID,showID, 0, 5);
  });
}



function getUserComments(vidid, showid, rangeMin, rangeMax) {
	videoID = vidid;
	showID = showid;
	$.get('comments/php-bin/component.php?vidid=' + vidid + '&showid=' + showid + '&rangeMin=' + rangeMin + '&rangeMax=' + rangeMax + '', function(data){
		$("#comments > #viewComments").html(data);
		$("#comments > #postComments").html('<form name="comment" id="domComment"><div class="inputfield"><div class="fieldDesc">Comment:</div><textarea name="commentText" id="commentText" cols="40" rows="10"></textarea></div><div class="inputfield"><a href="javascript:postComment(videoID, showID, document.forms[\'comment\'].commentText.value)">Post Comment</a></div> </form>');
	});
	buildCommentPagination();
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
var userParentLogic = "";
function userTabEvent(parent,clickElem,targetElem,script,param) {
	
		userParentLogic = param;

       $.get("" + script + "?param=" + param +"&sortby=" + getUserFilterLogic(), function(data){
        $(targetElem).html(data);
        buildPagination();
        if (gethideViewMore()) {
           $('#viewOptions').css('display', 'none');	
        }
});
        $(parent + " ul#tabs li a").removeClass("select");
        $(clickElem).addClass("select");
    }
function nill() {
   
}
function getUserParentLogic() {
	return userParentLogic
}

var userFilterLogic = "";
    function userFilterEvent(script,param1,param2,targetElem) {
    userFilterLogic = "&cat=" + param1 + "&uUser=" + param2;
   
    $.get("" + script + "?param=" + getUserParentLogic() + userFilterLogic, function(data){
    	 buildPagination();

        $(targetElem).html(data);
            	if (gethideViewMore()) {
           $('#viewOptions').css('display', 'none');	
        }
});
    }
    function getUserFilterLogic() {
    return userFilterLogic;
    }

