<?php

/**

 * The template for displaying the footer

 *

 * Contains footer content and the closing of the #main and #page div elements.

 *

 * @package WordPress

 * @subpackage Twenty_Twelve

 * @since Twenty Twelve 1.0

 */

?>

	</div><!-- #main .wrapper -->



	

	

	

	<footer id="colophon" role="contentinfo">

		<div class="site-info">

        

        <?php dynamic_sidebar('footeraddress'); ?>

        <?php dynamic_sidebar('footerMenu'); ?>

        <div class="clear"></div>

			<?php //do_action( 'twentytwelve_credits' ); ?>

			<?php /*?><a href="<?php echo esc_url( __( 'http://wordpress.org/', 'twentytwelve' ) ); ?>" title="<?php esc_attr_e( 'Semantic Personal Publishing Platform', 'twentytwelve' ); ?>"><?php printf( __( 'Proudly powered by %s', 'twentytwelve' ), 'WordPress' ); ?></a><?php */?>

		</div><!-- .site-info -->

	</footer><!-- #colophon -->

</div><!-- #page -->

<?php 

	if(is_category()):

		$category_name		=	single_cat_title( '', false );

		$category_id		=	get_cat_ID($category_name);

	else:

		$category_id		= (get_slug_catid($wp_query->query_vars['category']) ? get_slug_catid($wp_query->query_vars['category']) : '5');;

	endif;

?>

<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

<script type="text/javascript">

jQuery(document).ready(function($){







//jQuery( ".scroll ol" ).clone().appendTo( "#clonecopy" );

//jQuery("#clonecopy ol").hide();





jQuery(".word-list li a[data-id]").each(function(i,v){

    var txt3 = document.createElement("div");  // Create with DOM

    txt3.setAttribute("class", "popup");

    txt3.setAttribute("onmousedown", "return false");

    $(this).append(txt3);





jQuery("ol#chapter_selector_"+jQuery(this).attr("data-id")).clone().appendTo($(this).find("div"));

jQuery(this).find("ol").removeAttr("id");	

jQuery(this).find("ol").hide();	

});







/*jQuery(document).on("mouseover",".word-list li a",function(){ 

  //jQuery("#clonecopy ol").hide();

  //jQuery("#clonecopy ol#chapter_selector_"+jQuery(this).attr("data-id")).show();



jQuery("ol#chapter_selector_"+jQuery(this).attr("data-id")).clone().appendTo($(this));



  //jQuery("#clonecopy ol#chapter_selector_"+jQuery(this).attr("data-id")).css({"position":"absolute","left":jQuery(this).position().left,"top":jQuery(this).position().top+20});

});*/

jQuery(document).on("mouseenter",".word-list li a",function(){ 

  jQuery(this).find("ol").show();

});

jQuery(document).on("mouseleave",".word-list li a",function(){ 

  jQuery(this).find("ol").hide();

});















	/*$(".settingmodal").on("click",function(){

		$("#setting-modal").modal("show");

	});

*/



	$('div.dynamic_menu').hide();

	$('div.scroll ol').hide();

	var cat	=	<?php echo $category_id;?>;

	var catParent	=	<?php echo get_cat_parent($category_id);?>;

	if(cat==4){

		cat=5;

	}

	if(cat && catParent==4){

		$('div.scroll ol#chapter_selector_'+cat).show();

	}

	else

	{

		$('div.scroll ol:first').show();

	}

	

	$('ul#menu-main-menu li a').mouseover(function(e){



		var target= $(this).attr('href');









		if(target == "#menu_book_chapter"){ $(this).addClass("animated pulse"); }

		else if(target == "#menu_truth"){ $(this).addClass("animated shake"); }

		else if(target == "#menu_falsehoods"){ $(this).addClass("animated tada"); }

		else if(target == "#settings"){ $(this).find('i').addClass("fa-spin"); }

		





		$('div.dynamic_menu').hide();

		$(target).show();

		$(this).addClass('me');

		window.localStorage.setItem('me', $(this).parent('li').attr('id'));

		

		if(target=='#menu_book_chapter'){

			$( ".scroll" ).scrollTop( $(".scroll ul li a" ).index( $(".scroll ul li a.active")) * 35);

		}

	}).mouseout(function(){

		$(this).removeClass('me');

		$('ul#menu-main-menu li a').removeClass("animated");

		$('ul#menu-main-menu li a').removeClass("pulse");

		$('ul#menu-main-menu li a').removeClass("shake");

		$('ul#menu-main-menu li a').removeClass("tada");

		$('ul#menu-main-menu li a i').removeClass("fa-spin");

	});

	

	$('div.dynamic_menu').mouseover(function(){

		var href = window.localStorage.getItem('me')

		$('#'+href+' a').addClass('me');

	}).mouseout(function(){

		var href = window.localStorage.getItem('me')

		$('#'+href+' a').removeClass('me');

	});

	

	$(document).mouseover(function(e){

		var container = $('div.dynamic_menu,#site-navigation li');

		 if (!container.is(e.target) // if the target of the click isn't the container...

			 && container.has(e.target).length === 0) // ... nor a descendant of the container

		 {

			 $("div.dynamic_menu").hide();

		 }

	});



	

	

	$('ul.books li a').click(function(){

		var book	=	$(this).attr('data-book');

		$('ul.books li a').removeClass('active');

		$(this).addClass('active');

		$('div.scroll ol').hide();

		$('div.scroll ol#chapter_selector_'+book).show();

	});

	

	function changeThemeFunc(currentThemeName)

	{

		$.each([ "water","tree","fire","space","wood","stone","gold","king","chariot","seal","egypt","red" ], function( index, value ) {

		 	$('img.'+value+'-theme-image').hide();

		 	$('body').removeClass(value+'theme');

		});

		$('img.'+currentThemeName+'-theme-image').show();

		$('body').addClass(currentThemeName+'theme');

	}

	$(document).on('change','input[type="radio"].bible_radio',function(){

		var radio	= $(this);

		if(radio.is(':checked')){

			var name	=	radio.attr('name');

			var value	=	radio.val();

			$.ajax({

					type:'post',

					url:'<?php echo get_template_directory_uri();?>/bible-ajax.php',

					cache:false,

					data:name+"="+value

			}).success(function(response){

				if(name=='theme_color'){					

					changeThemeFunc(value);

				}

				else if(name=='style_options'){

					if(value == 'font-paprika'){

						font_style="Paprika";

					}

					else if(value == 'font-meriendaone'){

						font_style="'Merienda One', serif";

					}

					else if(value == 'font-oswald'){

						font_style="Oswald";

					}

					else if(value == 'font-kaushanscript'){

						font_style="'Kaushan Script', sans-serif";

					}

					else if(value == 'font-cinzeldecorative'){

						font_style="'Cinzel Decorative', sans-serif";

					}

					else if(value == 'font-verdana'){

						font_style="Verdana";

					}

					else if(value == 'font-georgia'){

						font_style="Georgia";

					}

					else if(value == 'font-markoone'){

						font_style="Marko One";

					}

					else if(value == 'font-permanentmarker'){

						font_style="Permanent Marker";

					}

					else if(value == 'font-specialelite'){

						font_style="Special Elite";

					}

					else if(value == 'font-cagliostro'){

						font_style="Cagliostro";

					}

					else if(value == 'font-strait'){

						font_style="Strait";

					}

					else{	

						font_style="Helvetica, Arial, sans-serif";

					}

					$('div#content').css('font-family',font_style);

					$('div.breadcrumbs').css('font-family',font_style);

			

				}

				else if(name=='size_options'){

					$('div#content').css('font-size',value);

					$('h1.entry-title a').css('font-size',value);

					$('h1.entry-title').css('font-size',value);

					$('h1.entry-verse-title a').css('font-size',value);

					$('h1.entry-verse-title').css('font-size',value);

					$('h3.home-title').css('font-size',value);

					$('h3.page-title').css('font-size',value);

					if(!$('h1.entry-title').hasClass('ispage')){

						if(value=='12px'){

							$('h1.entry-title').css('line-height','18px');

							$('h1.entry-verse-title').css('line-height','42px');

						}

						else if(value=='16px'){

							$('h1.entry-title').css('line-height','24px');

							$('h1.entry-verse-title').css('line-height','46px');

						}

						else if(value=='18px'){

							$('h1.entry-title').css('line-height','28px');

							$('h1.entry-verse-title').css('line-height','50px');

						}

						else if(value=='22px'){

							$('h1.entry-title').css('line-height','30px');

							$('h1.entry-verse-title').css('line-height','53px');

						}

						else if(value=='26px'){

							$('h1.entry-title').css('line-height','34px');

							$('h1.entry-verse-title').css('line-height','58px');

						}

					}

                    var lineheight = 39;
					var lineheight2 = 39;
                    console.log('footer', value);

                    value = parseInt(value.replace("px", "")) + 10;
                    var val2 = value + 10;

                    if(value == 32){
                        lineheight = 35;
                        lineheight2 = 29;
                    }else if(value == 36){
                        lineheight = 38;
                        lineheight2 = 32;
                    }else if(value == 28){
                        lineheight2 = 35;
                    }

                    value = value + 'px !important';
                    val2 = val2 + 'px !important';

                    lineheight = lineheight + 'px !important';
                    lineheight2 = lineheight2 + 'px !important';

                    if($('article.greek').length){
                        console.log('greek');
                        $('article.greek div.strongsdef:first-child span:last-child').attr('style', "font-size:" + value + ";line-height:" + lineheight);
                    }else{
                        console.log('hebrew');
                        $('article.hebrew div.strongsdef:first-child span:last-child').attr('style', "font-size:" + value + ";line-height:" + lineheight);
                        $('article.hebrew div.strongsdef:nth-child(2) span:last-child').attr('style', "font-size:" + val2 + ";line-height:" + lineheight2);
                    }

                    if($('div.strongsdef').length){
                        $('div.strongsdef:nth-child(4) .strongsbody').css('line-height', $('div.strongsdef:nth-child(5)').height()+'px');
                    }

					//$('div.breadcrumbs').css('font-size',value);

				}

			});

		}

	});

	var flag=0;

	$('.scroll ol').each(function(){

		if($(this).is(':visible')){

			flag=1;

		}

	});

	

	<?php

	$dd 	= array('falsehoods','truth','dozen');

	$link 	= "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";

	foreach($dd as $value){

	if(stripos($link, $value)){

		?>

		if(flag==0){

				$('div.scroll ol#chapter_selector_5').show();

			}

		<?php

		}

	}

	//$pre_cat	= $cat;

	//$cat_parent	=	 get_cat_parent($pre_cat);

	//if($pre_cat!=4 && !empty($pre_cat) && $cat_parent==4){

	?>

		//$('div.scroll ol#chapter_selector_5').hide();

		//$('#chapter_selector_<?php echo $pre_cat; ?>').show()

	<?php

	//}

	//else{?>

		//$('div.scroll ol').hide();

		//$('#chapter_selector_5').show()

	<?php

	//}

	?>

});

</script>

<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>

<script type="text/javascript">

	jQuery(document).ready(function($){

		    $( "#s" ).autocomplete({

			  source: "<?php echo get_template_directory_uri();?>/search-ajax.php",

			  minLength: 3,

			  select: function( event, ui ) {

			  	location.replace(ui.item.url);

				//$('form#searchform').submit();

			  }

			}).autocomplete( "instance" )._renderItem = function( ul, item ) {

			

			var htmlchar 	= item.label;

			var str = item.desc;

			var count = item.count;

			var contentLength = htmlchar.length;

			//console.log(contentLength);

			var title="";

			if(item.title!=""){

				title = "<span class='search-title'>"+ item.title+"</span>"

			}

			if(count>=5 || contentLength>2000){

				$('ul#ui-id-1').css({"height": "400px", "overflow-y": "scroll"}); 

			}else{

				$('ul#ui-id-1').css({"height": "auto", "overflow-y": "visible"});

			}

			str.match(/\w+/g).map(function(el) {

				var patt = new RegExp(el,"gi"); 

				htmlchar = htmlchar.replace(patt, function myFunction(x){return "<u><b>"+x+"</b></u>";});

				return true;

			});

						

			return  $("<li>" )

						.append( htmlchar + title)

						.appendTo( ul );

			

    };

		

	});

	

	function getMatches(theString, theRegex){

    return theString.match(theRegex).map(function(el) {

        var index = theString.indexOf(el);

        return [index, index + el.length - 1];

    });

}

	

</script>



 



<?php wp_footer(); ?>

</body>

</html>