<script>

/*************************** File Directories ***************************/

var rootFolder='<?php echo get_template_directory_uri(); ?>';


/*************************** Remove Javascript Disabled Class ***************************/

var el = document.getElementsByTagName("html")[0];
el.className = "";
	
/*************************** Toggle Search Panel ***************************/

//jQuery(document).ready(function(){
//
//	jQuery("#search-box").hide(); 
//	
//	jQuery("#search-icon").toggle(function(){
//		jQuery(this).addClass("active");
//		}, function () {
//		jQuery(this).removeClass("active");
//	});
//	
//	jQuery("#search-icon").click(function(){
//		jQuery(this).next("#search-box").slideToggle('fast');
//	});
//	
//});


/*************************** Toggle Share Link ***************************/

jQuery(document).ready(function(){

	jQuery("#share-review").hide(); 
	jQuery("#share-review-link a").html("<?php _e('Share &#9660;', 'gp_lang'); ?>");
	
	jQuery("#share-review-link a").toggle(function(){
		jQuery(this).html("<?php _e('Share &#9650;', 'gp_lang'); ?>");
		}, function () {
		jQuery(this).html("<?php _e('Share &#9660;', 'gp_lang'); ?>");
	});
	
	jQuery("#share-review-link a").click(function(){
		jQuery(this).next("#share-review").slideToggle('fast');
	});
	
});


/*************************** Transform Select Drop Down Forms ***************************/

jQuery(document).ready(function() {

    jQuery("#dropdown-filter").show();
    jQuery(".order-by-form").jqTransform();
    jQuery(".order-form").jqTransform();

	jQuery(".order-by-form .jqTransformSelectWrapper ul li a").click(function(){
		var index = jQuery(this).attr('index');
		var value = jQuery('.order-by-form select.jqTransformHidden option:eq('+index+')').attr('value');
		window.location.href=value;
	});
	
	jQuery(".order-form .jqTransformSelectWrapper ul li a").click(function(){
		var index = jQuery(this).attr('index');
		var value = jQuery('.order-form select.jqTransformHidden option:eq('+index+')').attr('value');
		window.location.href=value;
	});
	
});


/*************************** Marquee Width ***************************/

jQuery(window).load(function() {

	jQuery("#scroller-marquee").show();
	var socialWidth = jQuery("#social-icons").width();
	var scrollertitleWidth = jQuery("#scroller-title").width();
	
	if(socialWidth > 0) {
		jQuery("#scroller").css({"width" : 840 - socialWidth});
		jQuery("#scroller #scroller-marquee").css({"width" : 840 - socialWidth - scrollertitleWidth});
	} else {
		jQuery("#scroller").css({"width" : 920});
		jQuery("#scroller #scroller-marquee").css({"width" : 920 - scrollertitleWidth});	
	}
	
});


/*************************** Profile Details Height ***************************/

jQuery(document).ready(function(){

	var profiledetailsHeight = jQuery(".profile-details").height();
	if(profiledetailsHeight > 90) {
	jQuery(".profile-avatar").css({"height" : profiledetailsHeight});
	}
});


/*************************** Review Tabs ***************************/

jQuery(document).ready(function(){

	var panelContainer = jQuery('#review-panels');
	
	var panelLocation = location.hash.slice(1);
	
	if(panelLocation == '1'){
		var panelNum = panelLocation;
	} else if(panelLocation == '2'){
		var panelNum = panelLocation;
	} else if(panelLocation == '3'){
		var panelNum = panelLocation;
	} else if(panelLocation == '4'){
		var panelNum = panelLocation;
	} else if(panelLocation == '5'){
		var panelNum = panelLocation;
	} else if(panelLocation == '6'){
		var panelNum = panelLocation;
	} else if(panelLocation == '7'){
		var panelNum = panelLocation;
	} else if(panelLocation == '8'){
		var panelNum = panelLocation;			
	} else if(panelLocation == '9'){
		var panelNum = panelLocation;			
	} else if(panelLocation == '10'){
		var panelNum = panelLocation;
	} else{
		var panelNum = '1';
	}	

	panelContainer.find('.review-panel').hide();
	panelContainer.find('.review-panel:nth-child(' + panelNum + ')').fadeIn('slow');
	jQuery('#review-links ul').find('li.tab-link.tab:nth-child(' + panelNum + ')').removeClass('tab').addClass('tab-active');

	jQuery('#review-links ul').find('li.tab-link').each(function(n){
		jQuery(this).click(function(){
			panelContainer.find('.review-panel').hide();
			panelContainer.find('.review-panel:nth-child(' + (n+1) + ')').fadeIn('slow');
			jQuery(this).parent().find('li.tab-link').removeClass('tab-active').addClass('tab');
			jQuery(this).removeClass('tab').addClass('tab-active');
		});
	});
	
});


/*************************** Gallery Shortcode Lightbox Support ***************************/

jQuery(document).ready(function(){

	jQuery("div.gallery-item .gallery-icon a").attr("rel", "prettyPhoto[gallery]");

});


/*************************** Lightbox ***************************/

function gp_lightbox() {

	jQuery("a[rel^='prettyPhoto']").prettyPhoto({
		theme: 'pp_default',
		deeplinking: false,
		social_tools: ''
	});

}

jQuery(document).ready(function(){
	gp_lightbox();
});


/*************************** Lightbox Image Hover ***************************/

function gp_image_hover() {

	jQuery("a[rel^='prettyPhoto']").hover(
		function() {
			jQuery(this).find("img").stop().fadeTo(750, 0.5);
		},
		function() {
			jQuery(this).find("img").stop().fadeTo(750, 1);			
		}
	);
		
}

jQuery(document).ready(function(){
	gp_image_hover();
});


/*************************** Back To Top ***************************/

jQuery(document).ready(function() {
	jQuery(".back-to-top").click(function() {
		jQuery("html, body").animate({ scrollTop: 0 }, 'slow');
	});
});


/*************************** Accordion ***************************/

jQuery(document).ready(function(){

	jQuery(".accordion").accordion({ header: "h3.accordion-title", autoHeight: false });
	jQuery("h3.accordion-title").toggle(function(){
		jQuery(this).addClass("active");
		}, function () {
		jQuery(this).removeClass("active");
	});	
	
});


/*************************** Tabs ***************************/

jQuery(document).ready(function(){

	jQuery(".sc-tabs").tabs({
		fx: {
			height:'toggle',
			duration:'fast'
		}
	});	
	
});


/*************************** Toggle Content ***************************/

jQuery(document).ready(function(){

	jQuery(".toggle-box").hide(); 
	
	jQuery(".toggle").toggle(function(){
		jQuery(this).addClass("toggle-active");
		}, function () {
		jQuery(this).removeClass("toggle-active");
	});
	
	jQuery(".toggle").click(function(){
		jQuery(this).next(".toggle-box").slideToggle();
	});
	
});


/*************************** Contact Form ***************************/

jQuery(document).ready(function(){
	
	jQuery('#contact-form').submit(function() {

		jQuery('.contact-error').remove();
		var hasError = false;
		jQuery('.requiredFieldContact').each(function() {
			if(jQuery.trim(jQuery(this).val()) == '') {
				jQuery(this).addClass('input-error');
				hasError = true;
			} else if(jQuery(this).hasClass('email')) {
				var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
				if(!emailReg.test(jQuery.trim(jQuery(this).val()))) {
					jQuery(this).addClass('input-error');
					hasError = true;
				}
			}
		});
	
	});
				
	jQuery('#contact-form .contact-submit').click(function() {
		jQuery('.loader').css({display:"block"});
	});	

});

</script>