$(document).ready(function(){

	var shadowbox_conf = {
		animate: true,
		animateFade: true,
		animSequence: "wh",
		modal: false,
		overlayColor: "#000",
		overlayOpacity: 0.8,
		flashBgColor: "#000000",
		autoplayMovies: true,
		showMovieControls: true,
		slideshowDelay: 0,
		resizeDuration: 0.55,
		fadeDuration: 0.35,
		displayNav: true,
		continuous: false,
		displayCounter: true,
		counterType: "default",
		counterLimit: 10,
		viewportPadding: 20,
		handleOversize: "resize",
		handleUnsupported: "link",
		enableKeys: true
	};

		Shadowbox.init(shadowbox_conf);

    $('#nav').localScroll({
        stop: true,
        hash: true,
        duration: 1000,
        onAfter: function() {
            //titleName = $('.screenPage .inview:first').attr('title');
            //className = $('.screenPage .inview').eq(0).attr('class');
            //console.log(titleName);
            //console.log(className);
        }
    });

    $('.mainPage header.main').localScroll({
        stop: true,
        hash: true,
        duration: 1000,
        onAfter: function() {
            //titleName = $('.screenPage .inview:first').attr('title');
            //className = $('.screenPage .inview').eq(0).attr('class');
            //console.log(titleName);
            //console.log(className);
        }
    });

    Cufon.replace('.subContent > h1, .shade h1, h1.quizTitle, h1.soFarTitle, h1.tomorrowTitle, h1.joinToOurJourney, .quizTabs .tab', {textShadow: '#fff -1px -1px, #333 1px 1px'});


    $('.alertPopup .tamamBtn').click(function() {
        $('.alertPopup').css('display', 'none');
        $('.transparentBg').css('display', 'none');
    })
	
	if($('.cycleContainer').size()) {
		$('.cycleContainer')
			.after('<div id="cycleNav">')
			.cycle({
			fx:     'fade', 
			speed:  'slow', 
			timeout: 6000, 
			pager:  '#cycleNav',
			pause: true
			});
	}


    
})

function openAlertBox (alertTxt, currQuestion, nextQ) {

    documentHeight = $(document).height();
    $('.transparentBg').height(documentHeight);
    $('.transparentBg').css('display', 'block');

    windowWidth = $(window).width();
    windowHeight = $(window).height();
    scrollTop = $(window).scrollTop();

    cartBoxWidth = $('.alertPopup').width();
    cartBoxHeight = $('.alertPopup').height();


    leftPos = (windowWidth - cartBoxWidth) / 2;
    //topPos =  ((windowHeight - cartBoxHeight)/ 2) + scrollTop;
    topPos = 290;

    $('.alertPopup .alertTxt').text(alertTxt);
    $('.alertPopup .questionIdContainer').html(currQuestion);
    $('.alertPopup .nextQuestionIdContainer').html(nextQ);
    $('.alertPopup').css({'top': topPos, 'left': leftPos, 'display': 'block'});
    
}
