
/*------------------------------
Unreal Button Functions
------------------------------*/
function ttub_click_fx(ttub_action) {
	//trace("ttub click");
	ttub_track(ttub_action);
}

function ttub_close_fx(ttub_action) {
//close button fx
	thisMovie("button").resetButton();
	clearTimeout(tt.to);
	$("#tt_unReal_otp").hide();
	$("#tt_unReal_otp").empty();
	
	//track the effect load
	ttub_track(ttub_action);
}

function ttub_open_fx(fx) {
	//alert("ttub_open_fx fx:"+fx);
	
	var fxArr = Array("en","fr");
	fxArr["en"]=Array();
	fxArr["fr"]=Array();
	
	//cut and paste
	//fxArr["en"][#]="/teletoon4/en/button/ufo.html";
	//fxArr["fr"][#]="/teletoon4/fr/button/ufo.html";
	//array data
	fxArr["en"][0]="/teletoon4/en/button/ufo.html";
	fxArr["fr"][0]="/teletoon4/fr/button/ufo.html";
	fxArr["en"][1]="/teletoon4/en/button/wildGruel.html";
	fxArr["fr"][1]="/teletoon4/fr/button/wildGruel.html";
	fxArr["en"][2]="/teletoon4/en/button/whoopie.html";
	fxArr["fr"][2]="/teletoon4/fr/button/whoopie.html";
	fxArr["en"][3]="/teletoon4/en/button/gruelMonster.html";
	fxArr["fr"][3]="/teletoon4/fr/button/gruelMonster.html";
	fxArr["en"][4]="/teletoon4/en/button/lunchLady.html";
	fxArr["fr"][4]="/teletoon4/fr/button/lunchLady.html";
	fxArr["en"][5]="/teletoon4/en/button/eyeballs.html";
	fxArr["fr"][5]="/teletoon4/fr/button/eyeballs.html";
	fxArr["en"][6]="/teletoon4/en/button/thwarpCodeHalloween.html";
	fxArr["fr"][6]="/teletoon4/fr/button/thwarpCodeHalloween.html";
    fxArr["en"][7]="/teletoon4/en/button/mbv_rip.html";
	fxArr["fr"][7]="/teletoon4/fr/button/mbv_rip.html";
    fxArr["en"][8]="/teletoon4/en/button/bats.html";
	fxArr["fr"][8]="/teletoon4/fr/button/bats.html";
    fxArr["en"][9]="/teletoon4/en/button/anvil.html";
	fxArr["fr"][9]="/teletoon4/fr/button/anvil.html";
    fxArr["en"][10]="/teletoon4/en/button/daffy.html";
	fxArr["fr"][10]=""; //no french version
    fxArr["en"][11]="/teletoon4/en/button/picklePanic.html";
	fxArr["fr"][11]="/teletoon4/fr/button/picklePanic.html";
    fxArr["en"][12]="/teletoon4/en/button/fallingSnow.html";
	fxArr["fr"][12]="/teletoon4/fr/button/fallingSnow.html";
    fxArr["en"][13]="/teletoon4/en/button/snowman.html";
	fxArr["fr"][13]="/teletoon4/fr/button/snowman.html";
	fxArr["en"][14]="/teletoon4/en/button/thwarpCodeSnowedIn.html";
	fxArr["fr"][14]="/teletoon4/fr/button/thwarpCodeSnowedIn.html";
	fxArr["en"][15]="/teletoon4/en/button/valentine6teen.html";
	fxArr["fr"][15]="/teletoon4/fr/button/valentine6teen.html";
	fxArr["en"][16]="/teletoon4/en/button/valentine.html";
	fxArr["fr"][16]="/teletoon4/fr/button/valentine.html";
	fxArr["en"][17]="/teletoon4/en/button/2012_02_lego_01.html";
	fxArr["fr"][17]="";
	fxArr["en"][18]="/teletoon4/en/button/2012_02_lego_02.html";
	fxArr["fr"][18]="";
	//fxArr["en"][]="/teletoon4/en/button/.html";
	//fxArr["fr"][]="/teletoon4/fr/button/.html";
	
	var loadThis= fxArr[tt.language][fx];
	tt.button= fxArr[tt.language][fx];
	
	//load the effect
	$("#tt_unReal_otp").empty();
	$("#tt_unReal_otp").load(loadThis);
	$("#tt_unReal_otp").show();
	
	//track the effect load
	ttub_track("load");
	
}

function ttub_track(ttub_action){
	//trace("ttub tracking");
	
	var formData = "&language=";
	formData += escape(tt.language);
	formData += "&itemName=";
	formData += escape(tt.button);
	formData += "&itemType=";
	formData += escape(ttub_action);
	formData += "&itemValue=";
	formData += escape(tt.pageURL);
	formData += "&action=";
	formData += escape("count");
	
	//trace("formData="+formData);

	$.post(
		'/teletoon4/tracking/tt_track_button.php',
		formData,
		function(data){
			//trace(data.errorMsg);
			if (data.errorMsg == "click-user") {
				//trace("send callback to animation swf");
				thisMovie("bt_swf").loadUrl();
			} else {
				//trace("tracking recorded, no action to follow");
			}
		},
		'json'
	);
}

function ttub_fx00() {
	ttub_open_fx(0);
}

function ttub_fx01() {
	ttub_open_fx(1);
}

function ttub_fx02() {
	ttub_open_fx(2);
}

function ttub_fx03() {
	ttub_open_fx(3);
}

function ttub_fx04() {
	ttub_open_fx(4);
}

function ttub_fx05() {
	ttub_open_fx(5);
}

function ttub_fx06() {
	ttub_open_fx(6);
}

function ttub_fx07() {
	ttub_open_fx(7);
}

function ttub_fx08() {
	ttub_open_fx(8);
}

function ttub_fx09() {
	ttub_open_fx(9);
}

function ttub_fx10() {
	ttub_open_fx(10);
}

function ttub_fx11() {
	ttub_open_fx(11);
}

function ttub_fx12() {
	ttub_open_fx(12);
}

function ttub_fx13() {
	ttub_open_fx(13);
}

function ttub_fx14() {
	ttub_open_fx(14);
}

function ttub_fx15() {
	ttub_open_fx(15);
}

function ttub_fx16() {
	ttub_open_fx(16);
}

function ttub_fx17() {
	ttub_open_fx(17);
}

function ttub_fx18() {
	ttub_open_fx(18);
}
