/******************************************************************/
/*	Back to top Animation									      */
/******************************************************************/

$(document).ready(function() {
$('.nv-top a').click(function(){
     $('html, body').animate({scrollTop: '0px'}, 300);
     return false;
});
});

/******************************************************************/
/*	Back to top Animation *END*								      */
/******************************************************************/


/******************************************************************/
/*	Stage Gallery Navigation								      */
/******************************************************************/
$(document).ready(function() {

	$('#stage-pause').click(function() {
		$('.stage-slider').cycle('pause');
	});

	$('#stage-resume').click(function() {
		$('.stage-slider').cycle('resume');
	});

	$("#stage-pauseresume").click(function () {
			$("#stage-pauseresume span").toggle();
	});

});
/******************************************************************/
/*	Stage Gallery Navigation *END*							      */
/******************************************************************/



/******************************************************************/
/*	Social Icons Animate									      */
/******************************************************************/
/*
$(document).ready(function() {

	// Show Social Icons
	$(".socialinit").click(function(){
		$("div.socialicons").animate({width: 'show'});

	});

	// Hide Social Icons
	$(".socialhide").click(function(){
		$("div.socialicons").animate({width: 'hide'});

	});

	// Switch buttons on click
	$("#togglesocial li").click(function () {
		$("#togglesocial li").toggle();
	});

});
*/
/******************************************************************/
/*	Social Icons Animate *END*								      */
/******************************************************************/



/******************************************************************/
/*	Group Slider Gallery 									      */
/******************************************************************/
/*
$(document).ready(function() {

	$('.group-slider').cycle({
		fx:     'scrollHorz',
		timeout: 0,
		speed: 750,
		easing: 'easeInOutExpo',
		prev: '#leftnav',
		next: '#rightnav'
	});

});
*/
/******************************************************************/
/*	Group Slider Gallery *END*								      */
/******************************************************************/



/******************************************************************/
/*	Sidebar Mini Gallery									      */
/******************************************************************/
/*
$(document).ready(function() {


	$('.mini-slider').cycle({
		fx:     'scrollHorz',
		timeout: 5000,
		speed: 750,
		easing: 'easeInOutExpo',
		prev: '#leftnav',
		next: '#rightnav',
		cleartype:  true,
    	cleartypeNoBg:  true
	});


	$('#pause').click(function() {
		$('.stage-slider').cycle('pause');
	});

	$('#resume').click(function() {
		$('.stage-slider').cycle('resume');
	});


	$("#toggle_slide_nav a").click(function () {
			$("#toggle_slide_nav a").toggle();
	});

});
*/
/******************************************************************/
/*	Sidebar Mini Gallery *END*								      */
/******************************************************************/


/******************************************************************/
/*	Text Resizer		 									      */
/******************************************************************/
/*
$(document).ready(function() {

  // Reset Font Size
  var originalFontSize = $('html').css('font-size');
    $(".resetFont").click(function(){
    $('html').css('font-size', originalFontSize);
  });
  // Increase Font Size
  $(".increaseFont").click(function(){
    var currentFontSize = $('.content-wrapper-inner').css('font-size');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*1.1;
    $('.content-wrapper-inner').css('font-size', newFontSize);
    return false;
  });
  // Decrease Font Size
  $(".decreaseFont").click(function(){
    var currentFontSize = $('.content-wrapper-inner').css('font-size');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*0.9;
    $('.content-wrapper-inner').css('font-size', newFontSize);
    return false;
  });

});
*/
/******************************************************************/
/*	Text Resizer *END*	 									      */
/******************************************************************/



/******************************************************************/
/*	Gallery Image Hover 									      */
/******************************************************************/

$(document).ready(function () {

/*
$('.galleryimg,.shortcodeimg,.shortcodevid,.galleryvid').hover(

		//Mouseover, fadeIn the hidden hover class
		function() {
		$(this).children('div').css('display', 'block'); // FIX IE BUG
		$(this).children('div').fadeTo("slow",0.6);

		},

		//Mouseout, fadeOut the hover class
		function() {
		$(this).children('div').fadeTo("fast",0, function() {
		});


	});
*/

});
/******************************************************************/
/*	Gallery Image Hover *END*								      */
/******************************************************************/


/******************************************************************/
/*	Contact Form										      	  */
/******************************************************************/
/*
$(document).ready(function() {
	$('form#contactForm').submit(function() {
		$('form#contactForm .error').remove();
		var hasError = false;
		$('.requiredField').each(function() {
			if(jQuery.trim($(this).val()) == '') {
				var labelText = $(this).prev('label').text();
				$(this).parent().append('<span class="error">You forgot to enter your '+labelText+'.</span>');
				hasError = true;
			} else if($(this).hasClass('email')) {
				var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
				if(!emailReg.test(jQuery.trim($(this).val()))) {
					var labelText = $(this).prev('label').text();
					$(this).parent().append('<span class="error">You entered an invalid '+labelText+'.</span>');
					hasError = true;
				}
			}
		});
		if(!hasError) {
			//$('form#contactForm li.buttons button').fadeOut('normal', function() {
				//$(this).parent().append('<img src="/wp-content/themes/td-v3/images/template/loading.gif" alt="Loading&hellip;" height="31" width="31" />');
			//});
			var formInput = $(this).serialize();
			$.post($(this).attr('action'),formInput, function(data){
				$('form#contactForm').slideUp("fast", function() {
					$(this).before('<p class="thanks"><strong>Thanks!</strong> Your email was successfully sent. I check my email all the time, so I should be in touch soon.</p>');
				});
			});
		}

		return false;

	});
});
*/
/******************************************************************/
/*	Contact Form *END*									      	  */
/******************************************************************/


/******************************************************************/
/*	Accordion											      	  */
/******************************************************************/
$(document).ready(function() {

	// Accordion
	$(".accordion").accordion({ header: "h3.accordionhead",autoHeight: false });


});

/******************************************************************/
/*	Accordion *END*										      	  */
/******************************************************************/

/******************************************************************/
/*	Tabs												      	  */
/******************************************************************/
$(document).ready(function() {
	// Tabs
	$(".dyntabs").tabs({ fx: { height:'toggle', duration:'fast' }  });
});

/******************************************************************/
/*	Tabs *END*											      	  */
/******************************************************************/

/******************************************************************/
/*	Reveal Contnet 										      	  */
/******************************************************************/

$(document).ready(function() {

	$(".reveal-content").hide();

	// Toggle classes for reveal
	$("h4.reveal").toggle(function(){
		$(this).addClass("ui-state-active");}, function() {
		$(this).removeClass("ui-state-active ");
	});


	// Reveal content
	$("h4.reveal").click(function(){
	$(this).next(".reveal-content").animate({"height": "toggle"}, { duration: 300, easing: "easeInOutCubic" });
	});



});

/******************************************************************/
/*	Reveal Content *END*										  */
/******************************************************************/

$(document).ready(function() {
	// mail protege
	$('.eml').each(function(i){
	    var ext = '&#99;&#104;';
	    var domain = '&#109;&#101;&#100;&#115;&#105;&#116;&#101;';
	    var fulldom = domain + '.' + ext;
	    var nm = $(this).html();
	    var stylesStr = '';
	    var styles = $(this).attr('style');
	    if (styles) { stylesStr = ' style=\"' + styles + '\"'; }
		var ttlStr = '';
	    var ttl = $(this).attr('title');
	    if (ttl) { ttlStr = ttl; }
	    var classStr = '';
	    var classname = $(this).attr('class');
	    if (classname) { classStr = ' class=\"' + classname + '\"'; }
	    var dom = $(this).attr('alt');
	    if (dom) { fulldom = dom; }
	    if (ttlStr.length>0){
	    	$(this).html('<a' + stylesStr + classStr + ' href=\"mailto:' + nm + '@' + fulldom + '\">' + ttlStr + '</a>');
	    } else {
	    	$(this).html('<a' + stylesStr + classStr + ' href=\"mailto:' + nm + '@' + fulldom + '\">' + nm + '@' + fulldom + '</a>');
	    }
	});
});
