$(document).ready(function() {

	bindInterstitialContinue();

});

function bindInterstitialContinue() {
	$("#interstitial_continue").click(function(e) {
		history.back();
	});
}


function showGame(which_id) {
	$('#' + which_id).trigger("click");
}

function getSDate() {
	omniture_data = new Array();
	omniture_data[0] = s.getTimeParting('h','-5');
	omniture_data[1] = s.getTimeParting('d','-5');
	omniture_data[2] = s.getTimeParting('w','-5');
		
	return omniture_data;
}

// captcha stuff 
	
function openCaptcha(callback, withErrors) {
	var captcha_href = $('#captcha').attr("href");
	$('#captcha').attr("href", captcha_href.replace(/(callback=)([a-zA-Z0-9_]+)&/, "callback=" + callback + "&"));
	var captcha_href = $('#captcha').attr("href");
	$('#captcha').attr("href", captcha_href.replace(/(with_errors=)([a-zA-Z0-9_]+)&/, "with_errors=" + withErrors + "&"));
	$('#captcha').trigger("click");
}



function submitCaptcha() {
	var reCAPTCHAObj = new Object();
	reCAPTCHAObj.recaptcha_challenge_field = $("#recaptcha_challenge_field").attr("value");
	reCAPTCHAObj.recaptcha_response_field = $("#recaptcha_response_field").attr("value");
	var flash_object = self.parent.document.getElementById("flash_object");
	self.parent.continueSubmit($.callback, reCAPTCHAObj);
	
}


function continueSubmit(which, obj) {

	if (which == "returnCAPTCHA") {
		thisMovie("flash").returnCAPTCHA(obj);
	} else {
		//thisMovie("flash").continueSubmitSettle(obj);
	}
	tb_remove();
}

function flashTrace(obj){
	alert("flash trace : " + obj);	
}

function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    } else {
        return document[movieName]
    }
}
