web/static/res/js/incchoice.js
author ymh <ymh.work@gmail.com>
Tue, 12 Feb 2013 10:54:34 +0100
changeset 134 678b07d351ef
parent 124 8d2376eb825c
permissions -rw-r--r--
Added tag V01.25 for changeset fe9ca5cd905e
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
93
7c37aaa2a8ae netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 88
diff changeset
    21
	this.setMosaicImages = function(images1, images2, images3, postFirstImageCallback)
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
93
7c37aaa2a8ae netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 88
diff changeset
    32
	    incMosaic.start("mosaic", effectSpeed, 9, 5, true, true, function() {incChoice.effectIsDone();}, postFirstImageCallback);		
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
	{
124
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 93
diff changeset
    37
		if (choiceIndex === 0) {
43
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
124
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 93
diff changeset
    48
		} else if (choiceIndex === 1) {
43
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
124
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 93
diff changeset
   105
		// FTV Tag
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 93
diff changeset
   106
		xt_click(this,"F" ,"5", "Creation_Film::Choix_mot_" + this.currentWorldIndex);
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 93
diff changeset
   107
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   108
		if (this.currentWorldIndex == 3) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   109
			// The 3 words get choosen
93
7c37aaa2a8ae netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 88
diff changeset
   110
			location.href = "film-aleatoire-the-end-etc.html";
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   111
		} else {
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
			// Start the mosaic effect
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   114
			incMosaic.UnpauseEffect(true);
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
			// Fade the text
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   117
			$('.big_txt').animate({opacity: 0}, 20000 * 1 / effectSpeed);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   118
		}
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   119
	};
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   120
46
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 45
diff changeset
   121
	this.getChoosenWords = function()
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 45
diff changeset
   122
	{
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   123
		var words = [];
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   124
		for (var i = 0; i < 3; ++i) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   125
			words.push(this.getCookie(this.prefixCookieChosenWords + i));
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
		return words;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   128
	};
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
	// Random Chosen Videos
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
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   134
	this.saveChosenVideos = function(indexs)
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
		for (var i = 0; i < indexs.length; ++i) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   137
			this.setCookie(this.prefixCookieChosenVideos + i, indexs[i]);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   138
		}
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
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   141
	this.getChosenVideos = function()
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   142
	{
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   143
		var indexs = [];
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   144
		for (var i = 0; i < 3; ++i) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   145
			var n = this.getCookie(this.prefixCookieChosenVideos + i);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   146
			if (n !== null) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   147
				n = parseInt(n);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   148
				if (n != -1) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   149
					indexs.push(n);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   150
				}				
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
		return indexs;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   154
	};		
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
	// All time played videos
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
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   160
	this.getChoosenVideosFlags = function()
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   161
	{
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   162
		var var32bits = [];
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   163
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   164
		// Get previous used videos
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   165
		for (var i = 0; i < 3; ++i) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   166
			var v32 = this.getCookie(this.prefixCookiePlayedVideos + i);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   167
			v32 = v32 === null ? 0 : parseInt(v32);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   168
			var32bits.push(v32);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   169
		}
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   170
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   171
		return var32bits;
46
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 45
diff changeset
   172
	};
43
21a791340354 ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 42
diff changeset
   173
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   174
	this.savePlayedVideos = function(indexs, markPlayed)
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
		// 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
   177
		// 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
   178
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   179
		// Get previous used videos
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   180
		var var32bits = this.getChoosenVideosFlags();
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   181
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   182
		// Update 32 bits flags var
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   183
		var i;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   184
		for (i = 0; i < indexs.length; ++i) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   185
			var index = indexs[i];
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   186
			for (var j = 0; j < var32bits.length; ++j) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   187
				var indexMax = (j+1)*32;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   188
				if (index < indexMax) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   189
					var flag = 1 << (index - indexMax + 32);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   190
					if (markPlayed) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   191
						var32bits[j] = var32bits[j] | flag;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   192
					} else {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   193
						var32bits[j] = var32bits[j] & ~flag;						
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
					break;
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
			}			
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   198
		}
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   199
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   200
		// Save updated flags
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   201
		for (i = 0; i < 3; ++i) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   202
			this.setCookie(this.prefixCookiePlayedVideos + i, var32bits[i]);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   203
		}
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
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   206
	this.IsThisVideoWasPlayed = function(var32bits, index)
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   207
	{
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   208
		for (var j = 0; j < var32bits.length; ++j) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   209
			var indexMax = (j+1)*32;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   210
			if (index < indexMax) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   211
				return var32bits[j] & (1 << (index - indexMax + 32));
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
		return false;
124
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 93
diff changeset
   215
	};
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   216
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   217
	this.clearAllVideosChoices = function()
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
		for (i = 0; i < 3; ++i) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   220
			this.removeCookie(this.prefixCookiePlayedVideos + i);
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
	};
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
	// Single video
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
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   228
	this.saveSingleVideo = function(name)
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.setCookie(this.prefixCookieSingleVideo, name);
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
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   233
	this.getSingleVideo = function()
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
		return this.getCookie(this.prefixCookieSingleVideo);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   236
	};
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
	// Hd
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
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   242
	this.setHD = function(state)
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.setCookie(this.prefixCookieHD, state); 
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
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   247
	this.getHD = function()
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   248
	{
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   249
		var hd = this.getCookie(this.prefixCookieHD);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   250
		if (hd == "0") {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   251
			return false;
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
		return true;
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
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   256
	this.setSeekTime = function(time)
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.setCookie(this.prefixCookieSeekTime, time); 
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
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   261
	this.getSeekTime = function()
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   262
	{
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   263
		var time = this.getCookie(this.prefixCookieSeekTime);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   264
		if (time === null) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   265
			return 0;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   266
		}
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   267
		return time;
88
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   268
	};
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
	// Url share
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   272
	//----------------------------------------------------------------------------------------------------------------------------			
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   273
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   274
	this.createShareUrl = function(index1, index2, index3)
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   275
	{
93
7c37aaa2a8ae netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 88
diff changeset
   276
		var index = this.getChosenVideos();
124
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 93
diff changeset
   277
		var code = 	index[0] + index[2];	
93
7c37aaa2a8ae netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 88
diff changeset
   278
		var param = (index[0] << 24) | (index[1] << 16) | (index[2] << 8) | code;
88
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   279
		var urlBase = document.URL;
93
7c37aaa2a8ae netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 88
diff changeset
   280
		urlBase = urlBase.replace("partage-du-film-aleatoire-the-end-etc", "film-aleatoire-the-end-etc");
88
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   281
		var url = urlBase + "?" + param;
93
7c37aaa2a8ae netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 88
diff changeset
   282
		
88
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   283
		return url;
124
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 93
diff changeset
   284
	};
88
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   285
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   286
	this.readUrlVideosIndex = function()
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   287
	{
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   288
		var query = window.location.search.substring(1);
124
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 93
diff changeset
   289
		if (query.length === 0) {
93
7c37aaa2a8ae netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 88
diff changeset
   290
			return [];
88
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   291
		}
93
7c37aaa2a8ae netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 88
diff changeset
   292
		return this.decodeUrlIndex(query);
7c37aaa2a8ae netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 88
diff changeset
   293
	};
88
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   294
93
7c37aaa2a8ae netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 88
diff changeset
   295
	this.decodeUrlIndex = function(query)
7c37aaa2a8ae netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 88
diff changeset
   296
	{
88
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   297
		var number = parseInt(query);
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   298
93
7c37aaa2a8ae netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 88
diff changeset
   299
		var code = number & 255; 
7c37aaa2a8ae netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 88
diff changeset
   300
		number >>= 8;
88
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   301
		var index3 = number & 255; 
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   302
		number >>= 8;
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   303
		var index2 = number & 255; 
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   304
		number >>= 8;
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   305
		var index1 = number & 255;
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   306
93
7c37aaa2a8ae netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 88
diff changeset
   307
		if (code != index1 + index3) {
88
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   308
			return [];
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   309
		}
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   310
93
7c37aaa2a8ae netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 88
diff changeset
   311
		if (typeof( incPlayer ) != "undefined") {
7c37aaa2a8ae netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 88
diff changeset
   312
			var maxVideoIndex = incPlayer.allSequencesData.videos.length - 1;
7c37aaa2a8ae netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 88
diff changeset
   313
			if (index1 > maxVideoIndex || index2 > maxVideoIndex || index3 > maxVideoIndex) {
7c37aaa2a8ae netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 88
diff changeset
   314
				return [];
7c37aaa2a8ae netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 88
diff changeset
   315
			}
7c37aaa2a8ae netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 88
diff changeset
   316
		}
7c37aaa2a8ae netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 88
diff changeset
   317
88
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   318
		return [index1, index2, index3]; 
124
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 93
diff changeset
   319
	};				
78
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
	//----------------------------------------------------------------------------------------------------------------------------
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   322
	// Cookies tools
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   323
	//----------------------------------------------------------------------------------------------------------------------------		
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   324
42
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   325
	this.setCookie = function(name, value)
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   326
	{
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   327
		this.removeCookie(name);
46
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 45
diff changeset
   328
		$.cookie(name, value, { expires: 7, path: '/' }); 
42
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   329
    };
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   330
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   331
	this.getCookie = function(name)
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   332
	{
42
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   333
		return $.cookie(name);
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   334
	};
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   335
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   336
	this.removeCookie = function(name)
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   337
	{
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   338
		$.removeCookie(name, { path: '/' });
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 48
diff changeset
   339
	};	
42
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   340
}
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   341
01415303372e écran choix
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   342
var incChoice = new IncChoice();