﻿function getBible(sIge){
	sIge = utf8toansi(sIge);
    $('#biblecontent').load('inc/php/bibleload.php',{site2read:sIge},function(){});
}

function bindBible(){
    $('#words div').click(
        function(){
            if($(this).hasClass('active')){
                $(this).removeClass('active');
                $('#bible').removeAttr('style');
            }else{
                $('#words div').removeClass('active');
                $('#bible').attr('style', 'display:block');
                $(this).addClass('active');
                getBible($(this).html());
            }
	    });
}

function utf8toansi (sString){
	var encoded = '';
	for(i = 0; i < sString.length; i++){
		encoded += escape(String.fromCharCode(sString.charCodeAt(i)));
	}
	return encoded;
}

$(document).ready(function() {
	bindBible();
});