web/static/res/js/incchoice.js
author Edwin Razafimahatratra <edwin@robotalismsoft.com>
Fri, 18 Jan 2013 18:50:53 +0100
changeset 88 eeb0a6f3c07d
parent 78 8c3f0b94d056
child 93 7c37aaa2a8ae
permissions -rw-r--r--
resync
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
     1
var effectSpeed = 8;
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
     2
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
     3
function IncChoice()
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
     4
{
43
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
     5
	this.currentWorldIndex = 0;
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
     6
	this.canSelectWord = true;
45
f7bfdc49982b ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 43
diff changeset
     7
	this.image1;
f7bfdc49982b ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 43
diff changeset
     8
	this.image2;
f7bfdc49982b ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 43
diff changeset
     9
	this.image3;
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    10
	this.prefixCookieChosenWords = "niv1_ChosenWords";
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    11
	this.prefixCookieChosenVideos = "niv1_ChosenVideos";
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    12
	this.prefixCookiePlayedVideos = "niv1_PlayedVideos";
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    13
	this.prefixCookieSingleVideo = "niv1_SingleVideo";
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    14
	this.prefixCookieHD = "niv1_HD";
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    15
	this.prefixCookieSeekTime = "niv1_SeekTime";
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    16
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    17
	//----------------------------------------------------------------------------------------------------------------------------
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    18
	// Words display
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    19
	//----------------------------------------------------------------------------------------------------------------------------	
42
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    20
45
f7bfdc49982b ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 43
diff changeset
    21
	this.setMosaicImages = function(images1, images2, images3)
42
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    22
	{
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    23
		// Choose 2 image for the effect
45
f7bfdc49982b ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 43
diff changeset
    24
		this.image1 = images1[incMosaic.randomInt(0, images1.length)];
f7bfdc49982b ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 43
diff changeset
    25
		this.image2 = images2[incMosaic.randomInt(0, images2.length)];
f7bfdc49982b ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 43
diff changeset
    26
		this.image3 = images3[incMosaic.randomInt(0, images3.length)];
42
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    27
45
f7bfdc49982b ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 43
diff changeset
    28
	    incMosaic.addImageUrl("static/res/img/" + this.image1);
f7bfdc49982b ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 43
diff changeset
    29
	    incMosaic.addImageUrl("static/res/img/" + this.image2);
f7bfdc49982b ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 43
diff changeset
    30
	    incMosaic.addImageUrl("static/res/img/" + this.image3);
f7bfdc49982b ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 43
diff changeset
    31
f7bfdc49982b ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 43
diff changeset
    32
	    incMosaic.start("mosaic", effectSpeed, 9, 5, true, true, function() {incChoice.effectIsDone();});		
42
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    33
	};
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    34
45
f7bfdc49982b ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 43
diff changeset
    35
	this.setWordsAndEffect = function(choiceIndex)
42
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    36
	{
43
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    37
		if (choiceIndex == 0) {
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    38
			$("#mot1").html("famille");
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    39
			$("#mot2").html("amour");
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    40
			$("#mot3").html("travail");
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    41
			$("#mot4").html("international");
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    42
			$("#mot5").html("dieu");
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    43
			$("#mot6").html("président");
43
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    44
46
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 45
diff changeset
    45
			// class
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    46
			// by default there is the class blue
45
f7bfdc49982b ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 43
diff changeset
    47
43
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    48
		} else if (choiceIndex == 1) {
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    49
			$("#mot1").html("actif");
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    50
			$("#mot2").html("passif");
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    51
			$("#mot3").html("corps");
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    52
			$("#mot4").html("charité");
43
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    53
			$("#mot5").html("patrie");
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    54
			$("#mot6").html("politique");
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    55
46
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 45
diff changeset
    56
			// class
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    57
			$("#choice").removeClass("blue").addClass("whiteN");
45
f7bfdc49982b ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 43
diff changeset
    58
43
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    59
		} else {
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    60
			$("#mot1").html("spleen");
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    61
			$("#mot2").html("idéal");
43
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    62
			$("#mot3").html("origines");
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    63
			$("#mot4").html("peur");
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    64
			$("#mot5").html("désir");
43
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    65
			$("#mot6").html("bonheur");
45
f7bfdc49982b ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 43
diff changeset
    66
46
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 45
diff changeset
    67
			// class
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    68
			$("#choice").removeClass("whiteN").addClass("red");
48
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 46
diff changeset
    69
		}
42
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    70
	};
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    71
43
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    72
	this.effectIsDone = function()
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    73
	{
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    74
		this.canSelectWord = true;
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    75
45
f7bfdc49982b ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 43
diff changeset
    76
        // Set the list of words and the mosaic effect
f7bfdc49982b ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 43
diff changeset
    77
		this.setWordsAndEffect(this.currentWorldIndex);
f7bfdc49982b ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 43
diff changeset
    78
f7bfdc49982b ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 43
diff changeset
    79
		// Stop the mosaic effect
f7bfdc49982b ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 43
diff changeset
    80
		incMosaic.UnpauseEffect(false);
43
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    81
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
    82
		// Fade the text
46
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 45
diff changeset
    83
		$('.big_txt').animate({opacity: 1}, 10000 * 1 / effectSpeed);
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 45
diff changeset
    84
	};
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 45
diff changeset
    85
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    86
	//----------------------------------------------------------------------------------------------------------------------------
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    87
	// Selected Words
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    88
	//----------------------------------------------------------------------------------------------------------------------------	
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    89
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    90
	this.selectWord = function(wordIndex)
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    91
	{
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    92
		if (!this.canSelectWord) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    93
			// Don't set the word 2 times
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    94
			return;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    95
		}
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    96
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    97
		this.canSelectWord = false;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    98
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
    99
		// Save the word
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   100
		var allWorldIndex = this.currentWorldIndex * 6 + wordIndex;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   101
		this.setCookie(this.prefixCookieChosenWords + this.currentWorldIndex, allWorldIndex);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   102
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   103
		++this.currentWorldIndex;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   104
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   105
		if (this.currentWorldIndex == 3) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   106
			// The 3 words get choosen
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   107
			location.href = "niv1_videoplayer.html";
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   108
		} else {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   109
			
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   110
			// Start the mosaic effect
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   111
			incMosaic.UnpauseEffect(true);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   112
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   113
			// Fade the text
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   114
			$('.big_txt').animate({opacity: 0}, 20000 * 1 / effectSpeed);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   115
		}
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   116
	};
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   117
46
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 45
diff changeset
   118
	this.getChoosenWords = function()
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 45
diff changeset
   119
	{
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   120
		var words = [];
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   121
		for (var i = 0; i < 3; ++i) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   122
			words.push(this.getCookie(this.prefixCookieChosenWords + i));
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   123
		}
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   124
		return words;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   125
	};
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   126
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   127
	//----------------------------------------------------------------------------------------------------------------------------
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   128
	// Random Chosen Videos
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   129
	//----------------------------------------------------------------------------------------------------------------------------	
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   130
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   131
	this.saveChosenVideos = function(indexs)
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   132
	{
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   133
		for (var i = 0; i < indexs.length; ++i) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   134
			this.setCookie(this.prefixCookieChosenVideos + i, indexs[i]);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   135
		}
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   136
	};
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   137
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   138
	this.getChosenVideos = function()
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   139
	{
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   140
		var indexs = [];
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   141
		for (var i = 0; i < 3; ++i) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   142
			var n = this.getCookie(this.prefixCookieChosenVideos + i);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   143
			if (n !== null) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   144
				n = parseInt(n);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   145
				if (n != -1) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   146
					indexs.push(n);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   147
				}				
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   148
			}
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   149
		}
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   150
		return indexs;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   151
	};		
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   152
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   153
	//----------------------------------------------------------------------------------------------------------------------------
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   154
	// All time played videos
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   155
	//----------------------------------------------------------------------------------------------------------------------------	
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   156
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   157
	this.getChoosenVideosFlags = function()
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   158
	{
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   159
		var var32bits = [];
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   160
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   161
		// Get previous used videos
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   162
		for (var i = 0; i < 3; ++i) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   163
			var v32 = this.getCookie(this.prefixCookiePlayedVideos + i);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   164
			v32 = v32 === null ? 0 : parseInt(v32);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   165
			var32bits.push(v32);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   166
		}
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   167
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   168
		return var32bits;
46
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 45
diff changeset
   169
	};
43
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
   170
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   171
	this.savePlayedVideos = function(indexs, markPlayed)
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   172
	{
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   173
		// This function used 3 values of 32 bits to records used videos
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   174
		// This means we can record the state of 32 * 3 = 96 videos
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   175
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   176
		// Get previous used videos
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   177
		var var32bits = this.getChoosenVideosFlags();
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   178
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   179
		// Update 32 bits flags var
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   180
		var i;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   181
		for (i = 0; i < indexs.length; ++i) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   182
			var index = indexs[i];
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   183
			for (var j = 0; j < var32bits.length; ++j) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   184
				var indexMax = (j+1)*32;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   185
				if (index < indexMax) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   186
					var flag = 1 << (index - indexMax + 32);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   187
					if (markPlayed) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   188
						var32bits[j] = var32bits[j] | flag;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   189
					} else {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   190
						var32bits[j] = var32bits[j] & ~flag;						
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   191
					}
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   192
					break;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   193
				}
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   194
			}			
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   195
		}
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   196
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   197
		// Save updated flags
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   198
		for (i = 0; i < 3; ++i) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   199
			this.setCookie(this.prefixCookiePlayedVideos + i, var32bits[i]);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   200
		}
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   201
	};
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   202
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   203
	this.IsThisVideoWasPlayed = function(var32bits, index)
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   204
	{
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   205
		for (var j = 0; j < var32bits.length; ++j) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   206
			var indexMax = (j+1)*32;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   207
			if (index < indexMax) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   208
				return var32bits[j] & (1 << (index - indexMax + 32));
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   209
			}
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   210
		}
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   211
		return false;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   212
	}
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   213
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   214
	this.clearAllVideosChoices = function()
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   215
	{
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   216
		for (i = 0; i < 3; ++i) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   217
			this.removeCookie(this.prefixCookiePlayedVideos + i);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   218
		}
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   219
	};
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   220
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   221
	//----------------------------------------------------------------------------------------------------------------------------
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   222
	// Single video
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   223
	//----------------------------------------------------------------------------------------------------------------------------
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   224
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   225
	this.saveSingleVideo = function(name)
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   226
	{
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   227
		this.setCookie(this.prefixCookieSingleVideo, name);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   228
	};
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   229
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   230
	this.getSingleVideo = function()
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   231
	{
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   232
		return this.getCookie(this.prefixCookieSingleVideo);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   233
	};
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   234
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   235
	//----------------------------------------------------------------------------------------------------------------------------
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   236
	// Hd
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   237
	//----------------------------------------------------------------------------------------------------------------------------	
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   238
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   239
	this.setHD = function(state)
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   240
	{
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   241
		this.setCookie(this.prefixCookieHD, state); 
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   242
	};
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   243
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   244
	this.getHD = function()
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   245
	{
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   246
		var hd = this.getCookie(this.prefixCookieHD);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   247
		if (hd == "0") {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   248
			return false;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   249
		}
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   250
		return true;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   251
	};
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   252
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   253
	this.setSeekTime = function(time)
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   254
	{
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   255
		this.setCookie(this.prefixCookieSeekTime, time); 
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   256
	};
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   257
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   258
	this.getSeekTime = function()
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   259
	{
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   260
		var time = this.getCookie(this.prefixCookieSeekTime);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   261
		if (time === null) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   262
			return 0;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   263
		}
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   264
		return time;
88
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   265
	};
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   266
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   267
	//----------------------------------------------------------------------------------------------------------------------------
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   268
	// Url share
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   269
	//----------------------------------------------------------------------------------------------------------------------------			
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   270
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   271
	this.createShareUrl = function(index1, index2, index3)
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   272
	{
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   273
		var index = this.getChoosenWords();		
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   274
		var param = ((index[0] << 16) | (index[1] << 8) | index[2]) << 4;
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   275
		var urlBase = document.URL;
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   276
		var url = urlBase + "?" + param;
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   277
		return url;
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   278
	}
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   279
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   280
	this.readUrlVideosIndex = function()
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   281
	{
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   282
		var query = window.location.search.substring(1);
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   283
		if (query.length < 0) {
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   284
			return;
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   285
		}
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   286
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   287
		var number = parseInt(query);
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   288
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   289
		number >>= 4;
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   290
		var index3 = number & 255; 
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   291
		number >>= 8;
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   292
		var index2 = number & 255; 
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   293
		number >>= 8;
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   294
		var index1 = number & 255;
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   295
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   296
		var maxVideoIndex = this.allSequencesData.videos.length - 1;
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   297
		if (index1 > maxVideoIndex || index2 > maxVideoIndex || index3 > maxVideoIndex) {
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   298
			return [];
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   299
		}
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   300
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   301
		return [index1, index2, index3]; 
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   302
	};				
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   303
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   304
	//----------------------------------------------------------------------------------------------------------------------------
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   305
	// Cookies tools
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   306
	//----------------------------------------------------------------------------------------------------------------------------		
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   307
42
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   308
	this.setCookie = function(name, value)
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   309
	{
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   310
		this.removeCookie(name);
46
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 45
diff changeset
   311
		$.cookie(name, value, { expires: 7, path: '/' }); 
42
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   312
    };
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   313
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   314
	this.getCookie = function(name)
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   315
	{
42
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   316
		return $.cookie(name);
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   317
	};
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   318
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   319
	this.removeCookie = function(name)
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   320
	{
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   321
		$.removeCookie(name, { path: '/' });
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   322
	};	
42
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   323
}
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   324
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   325
var incChoice = new IncChoice();