var clicableVar = 0;
var adCount=1;
var adKey = true;
var checker = 0;
var conCheck = 0;
var tryCount = 0;
var errorList = [];
var wordList = [];
var allset = [];
var fullset = true;
var adviseUsed = 0;
function reklam()
{
setTimeout(function(){
console.log("cartoon appended")
$("body").append('
');
$("#reklam").bind("click",function(){
$(this).remove()
});
},1000)
}
function crossword(param,clicableVar)
{
$(".targeted").css("background-color", "white");
$(".targeted").removeClass("targeted");
var sel = $(param).attr('class');
var newset = sel.split(" ");
if (newset.length == 2)
{
var newSel="."+newset[1];
$(newSel).css("background-color", "#F7C5B4");
$(newSel).addClass("targeted");
$("input").focus();
}
if (newset.length == 3)
{
var firstSel = "."+newset[1];
var secondSel = "."+newset[2];
if (clicableVar%2==0){
$(firstSel).css("background-color", "#F7C5B4");
$(firstSel).addClass("targeted");
$("input").focus();
}
if(clicableVar%2==1){
$(secondSel).css("background-color", "#F7C5B4");
$(secondSel).addClass("targeted");
$("input").focus();
}
clicableVar+=1;
}
return clicableVar;
}
function alt()
{
$(".visible").unbind("click");
$(".visible").bind("click",function(){
adviser(this);
});
}
function getMark(){
for(var i = 0; i=needArr[i][0] && adviseUsed<=needArr[i][1])
{
var myImage = needArr[i][2];
var putImg = "
"
console.log(putImg);
$("body").append(putImg);
$("body").append("
");
}
}
}
function loadReady()
{
var nowPage = $.cookie("activeNumber");
console.log(alcgeimer,nowPage);
if(nowPage)
{
var curPage = parseInt(nowPage);
if(alcgeimer!=curPage && issget)
{
document.location.href = document.location.href+"?page="+String(curPage+1);
}
}
var hex = $.cookie();
if(hex["advises"+alcgeimer.toString])
{
adviseUsed = parseInt(hex["advises"+alcgeimer.toString()]);
}
else
{
adviseUsed = 0;
}
var lenC = Object.keys(hex).length;
var alclen=(alcgeimer+".").length;
for (var i=0;i"+letter+"");
});
}
tryCount++;
var timeSel = parseInt(Object.keys(hex)[i])+1;
timeSel = "#"+timeSel;
$(timeSel).css("color","black");
$(timeSel).css("opacity","0.3");
$(timeSel).click(function(){
return false;
});
}
var shag = 0;
var vals = Object.keys(hex).map(function(key) {
return hex[key];
});
if(vals[i].slice(0,alclen)==alcgeimer+".")
{
checker+=1;
var def = "."+vals[i].slice(alclen);
console.log(def);
var newdefiner = parseInt(def.slice(5));
$(def).each(function(){
$(this).css("background-color", "#D8ECE0");
if ($(this).hasClass("visible")){
$(this).find("span").remove();
$(this).append(""+sigma[1][newdefiner][5][shag]+"");
shag+=1;
}
$(this).unbind();
$(this).removeClass("listed");
});
}
}
errorList=[];
allset = true;
$(".visible").each(function(){
var id = $(this).attr("id");
var x = id.split("pes")[1];
var y = id.split("pes")[0];
var currentLet = $(this).find("span").text();
if(currentLet.toLowerCase()!=extraMatrix[y][x].toLowerCase())
{
if(currentLet!=""){
var letter = extraMatrix[y][x];
errorList.push({"x":x,"y":y,"letter":letter});
}
else
{
allset = false;
}}
});
if (errorList.length==0 && allset)
{
getMark();
$("#fellow").click(function(){
$(this).remove();
});
}
}
function adviser(element)
{
adviseUsed+=1;
$.cookie("advises"+alcgeimer.toString(),adviseUsed.toString(),{expires: 365});
$(".targeted").css("background-color", "white");
$(".targeted").removeClass("targeted");
var idfy = $(element).attr('id');
var arr = $(element).attr("class");
var splited = arr.split(" ");
var idsplit = idfy.split("pes");
var firstId=parseInt(idsplit[0]);
var secondId=parseInt(idsplit[1]);
var definer = "asdf";
if (splited.length == 2)
{
definer=splited[1];
}
if (splited.length == 3)
{
definer = splited[2];
}
var newdefiner = parseInt(definer.slice(4));
definer = "."+definer;
$(definer).css("background-color","#F7C5B4");
$(definer).addClass("targeted");
$("input").focus();
var exLetter = letterNum[firstId][secondId];
var letter = extraMatrix[firstId][secondId];
$(element).find("span").remove();
$(element).append(""+letter+"");
adCount-=1;
if(adCount==0)
{
$(".visible").unbind();
$(".visible").bind("click",function(){
clicableVar=crossword(this,clicableVar);
});
adCount=1;
}
errorList=[];
allset = true;
$(".visible").each(function(){
var id = $(this).attr("id");
var x = id.split("pes")[1];
var y = id.split("pes")[0];
var currentLet = $(this).find("span").text();
if(currentLet.toLowerCase()!=extraMatrix[y][x].toLowerCase())
{
if(currentLet!=""){
var letter = extraMatrix[y][x];
errorList.push({"x":x,"y":y,"letter":letter});
}
else
{
allset = false;
}}
});
if (errorList.length==0 && allset)
{
$.cookie(alcgeimer,"finished", {expires: 14});
var siles = $.cookie();
var keys = Object.keys(siles);
for(var i=0; i"+ask[shag]+"");
shag+=1;
}
$(this).unbind("click");
});
$("input").val("");
$("input").css("background-color", "#D8ECE0");
$.cookie(alcgeimer+definer,alcgeimer+definer, {expires: 14});
if (checker==data)
{
var siles = $.cookie();
for (var stepic = 0;stepic