'+syllableWord1[sysId]+'');
}
else{
sysId = ((10*(sectionNum+2)) - 1)-sId;
$('#container').append(''+syllableWord2[sysId]+'
');
}
var dragObjCss = {
'float':'left','position':'relative','cursor': 'move','margin': '1em',
'width':'100px','height':'30px','border': '2px solid black',
'font':'20px/25px bold Arial,Verdana,Geneva,Helvetica',
'text-align':'center'
};
$('#drag'+sId).css(dragObjCss);
$('#drag'+sId).click(function(){
currentSyllable = $(this).text();
if(dropNum === 0){
fstSyllableId = $(this).attr('id');
fstSyllableId = parseInt(fstSyllableId.substring(4));
startTimer();
}
else{
secondSyllableId = $(this).attr('id');
secondSyllableId = parseInt(secondSyllableId.substring(4));
}
$('#drop'+dropNum).html(currentSyllable);
dropNum++;
if(dropNum === 2){
dropNum = 0;
resetTimer();
check_answers();
}
check_game_over();
});
};
var assignDropPlaces = function(drpId){
$('#joinSyllable').append('');
var dropObjCss = {
'float':'left','width':'100px','height': '45px','margin': '0.5em 0.5em',
'font':'20px/35px bold Arial,Verdana,Geneva,Helvetica',
'text-align':'center','color':'#FF00FF'
};
if(drpId === 2){
$('#drop'+drpId).css(dropObjCss).css({'width':'200px'}).html('------------');
}
else{
$('#drop'+drpId).css(dropObjCss).html('----------');
}
};
var next_syllables = function(){
resetTimer();
$('#content').removeClass('backOpaque').html('');
$('#content').append('');
$('#content').append('');
$('#content').append('');
$('#left-side').append('');
$('#leftText').html('Computer Building');
$('#right-side').append('');
$('#rightText').html('Player Building');
$('#main-content').append('Join two syllables to make one word
');
$('#main-content').append('');
$('#main-content').append('');
genRandPosition();
playerCounter = 0;
compCounter = 0;
for(i = 0; i< 20; i++){
var randNum = randPositions[i];
assignSyllableWords(randNum);
}
$('#joinSyllable').html('');
for(i = 0; i< 3;i++){
assignDropPlaces(i);
if(i === 0){
$('#joinSyllable').append('+
');
}
else if(i === 1){
$('#joinSyllable').append('=
');
}
}
for(var i = 0; i< TOTAL_QUES; i++){
$('#left-side').append('');
$('#playerBuild'+i).addClass('default');
}
};
function game_start(){
gamePlay = 0;
$('#linkNextExercise').hide();
$('#linkPrevExercise').hide();
$('#gameOver').hide();
dropNum = 0;
correctCounter = 0;
totalCounter = 0;
sectionNum = k.rand(0,1);
next_syllables();
}
function game(){
$('#linkNextExercise').hide();
$('#linkPrevExercise').hide();
$('#gameOver').hide();
}
game();
$('#linkNextExercise').click(function(){
$('#linkNextExercise').hide();
if(sectionNum === 0){
sectionNum += 1;
}
else{
sectionNum -= 1;
}
gamePlay++;
next_syllables();
});
$('#linkPrevExercise').click(function(){
$('#linkPrevExercise').hide();
if(sectionNum === 0){
sectionNum += 1;
}
else{
sectionNum -= 1;
}
gamePlay--;
next_syllables();
});
$('#linkStart').click(function(){
game_start();
});
$('#linkPlayAgain').click(function(){
game_start();
});
$('#linkHelp').mouseover(function(){
$('#help').slideDown(2000);
})
.mouseout(function(){
$('#help').slideUp(2000);
});
}); //end of k.ready
}); //end of document.read