﻿function TwlDigg()
{
	this.Sexe;

	var AxAddDiggVideo = {
		delay: 200,
		prepare: function() { 
			InputVar = new Array(myTwlVideo.IdVideo,myTwlDigg.Sexe);
		},
		call: proxies.AjaxFunc.AddDiggVideo,
		finish: function (p) 
		{ 
			document.getElementById("TwlDigg" + myTwlDigg.Sexe).innerHTML = p + "<br>vote(s)";
			document.getElementById("TwlDiggM").href = "javascript:myTwlDigg.AlreadyVotedVideo()";
			document.getElementById("TwlDiggF").href = "javascript:myTwlDigg.AlreadyVotedVideo()";
			document.getElementById("TwlVotez").innerHTML = "<span class='misc_text disable'>Votre vote a bien été enregistré.</span>";
		},
		onException: ajax.alertException
	}
	
	var AxAddDiggPlaylist = {
		delay: 200,
		prepare: function() { 
			InputVar = new Array(myTwlPlaylist.IdPlaylistCurrent,myTwlDigg.Sexe);
		},
		call: proxies.AjaxFunc.AddDiggPlaylist,
		finish: function (p) 
		{ 
			document.getElementById("TwlDiggPlaylist").className = "digg on";
			document.getElementById("TwlPlaylistDigg" + myTwlDigg.Sexe).innerHTML = p + "<br>vote(s)";
			document.getElementById("TwlPlaylistDiggM").href = "javascript:myTwlDigg.AlreadyVotedPlaylist()";
			document.getElementById("TwlPlaylistDiggF").href = "javascript:myTwlDigg.AlreadyVotedPlaylist()";
		},
		onException: ajax.alertException
	}



	this.AddDiggVideo = function (aSexe)
	{
		myTwlDigg.Sexe = aSexe;
		SoapMethod = "POST";
		ajax.Start(AxAddDiggVideo);
	}
	
	this.AddDiggPlaylist = function (aSexe)
	{
		myTwlDigg.Sexe = aSexe;
		SoapMethod = "POST";
		ajax.Start(AxAddDiggPlaylist);
	}

	this.AlreadyVotedVideo = function ()
	{
		alert("Vous avez déjà voté pour cette vidéo.");
	}
	
	this.AlreadyVotedPlaylist = function ()
	{
		alert("Vous avez déjà voté pour cette playlist.");
	}
}

var myTwlDigg = new TwlDigg();

