
/* játékok indítása */

$(document).ready( function () {
if ($('#tesco-graduates').length > 0) {
		swfobject.embedSWF("media/swf/TescoGraduates-Flash.swf", "tesco-graduates", "713", "616", "7.0.0", false, false, {wmode:'transparent', AllowScriptAccess:"always"});
	}
})

$(document).ready( function () {
if ($('#gabor').length > 0) {
		swfobject.embedSWF("media/pictures/working_for_tesco/gabor.swf", "gabor", "550", "220", "7.0.0", false, false, {wmode:'transparent', AllowScriptAccess:"always"});
	}
})

$(document).ready( function () {
if ($('#anett').length > 0) {
		swfobject.embedSWF("media/pictures/why_tesco/anett.swf", "anett", "550", "220", "7.0.0", false, false, {wmode:'transparent', AllowScriptAccess:"always"});
	}
})

$(document).ready( function () {
if ($('#agnes').length > 0) {
		swfobject.embedSWF("media/pictures/programmes/agnes.swf", "agnes", "550", "220", "7.0.0", false, false, {wmode:'transparent', AllowScriptAccess:"always"});
	}
})

$(document).ready( function () {
if ($('#daniel').length > 0) {
		swfobject.embedSWF("media/pictures/about_tesco/daniel.swf", "daniel", "550", "220", "7.0.0", false, false, {wmode:'transparent', AllowScriptAccess:"always"});
	}
})

$(document).ready( function () {
if ($('#gergely').length > 0) {
		swfobject.embedSWF("media/pictures/how_to_apply/gergely.swf", "gergely", "550", "220", "7.0.0", false, false, {wmode:'transparent', AllowScriptAccess:"always"});
	}
})

$(document).ready( function () {
if ($('#xxx').length > 0) {
		swfobject.embedSWF("media/pictures/", "xxx", "550", "220", "7.0.0", false, false, {wmode:'transparent', AllowScriptAccess:"always"});
	}
})

$(document).ready( function () {
if ($('#xxx').length > 0) {
		swfobject.embedSWF("media/pictures/", "xxx", "550", "220", "7.0.0", false, false, {wmode:'transparent', AllowScriptAccess:"always"});
	}
})

/**
 * Captcha frissítése
 *
 * @param refreshButton Frissítő button azonosítója
 */
function refreshCaptcha(refreshButton){
	$('#captcha-input')
		.addClass('pform-equal simple captcha')
		.prevAll('img')
		.after('<a href="#" id="'+refreshButton+'" rel="nofollow">'+ js_constants['NEW_CAPTCHA'] +'</a>')
		.parent('div').addClass('captcha_container');
	$('#captcha').hide();
}

/**
 * Captcha frissítő js inicializálás
 *
 * @param formName Form osztályneve
 * @param captchaName Captcha elem neve
 * @param refreshButton Frissítő gomb azonosítója
 */
function initCaptcha(formName, captchaName, refreshButton){
	refreshCaptcha(refreshButton);
	$('#'+refreshButton).live('click', function(e){
		$.ajax({
			url: "ajax/refreshCaptcha.php",
			type: "POST",
			data: "form_class="+formName+"&captcha_element_name="+captchaName,
			success: function(data){
				$('#captcha-input').closest("div").replaceWith(data);
				refreshCaptcha(refreshButton);
			}
		});
		e.preventDefault();
	});
}
