$(function(){
	if ($('.scroller').length > 0){
			$('.scroller').cycle({
				fx:     'fade',
				timeout: 5000,
				speed:  1000, 
				pager:  '.scroller-nav', 
				pagerAnchorBuilder: function(idx, slide) { 
					return '<a href="javascript:"></a>'; 
				} 
			})
	}
});	
$(function(){
	if ($('.testimonials').length > 0){
			$('.testimonials').cycle({
				fx:     'scrollVert',
				timeout: 5000,
				speed:  1000
			})
		
	}
});	
$(function(){
	if ($('.p-pdt-taber').length > 0){
			$('.p-pdt-taber a').click(function(){
				$('.p-pdt-tabcont-tab').hide()
				$($(this).attr("href").replace('#','.p-pdt-')).show()
				return false;
			})		
	}
});

$(document).ready(function(){
	function setStateList(){
		if ( $('#countries_states_'+$('#id_country').val() ).length > 0 ){
				$('#id_state').html($('#countries_states_'+$('#id_country').val() ).html())
		}else{
				$('#id_state').html('<option value="">-</option>')
		}
	}
	if($('#id_country').length > 0){
		setStateList()
		$('#id_country').change(function(){	setStateList()	})
	}
})


$(function(){
	$('.pagination-outer').appear(function(){
			aph($(this))			
			function aph(___stc){
				if (___stc.find('.pagination-next a').length > 0){
					uri  = ___stc.find('.pagination-next a').attr('href')+'&content_only=1'
					___stc.html('<span class="loading" />')
					$.ajax({url:uri,type:'get',success:function(s){					
						___stc.after(s)
						___stc.remove()
						$('.pagination-outer').appear(function(){aph($(this))})
					}})				
				}else{
					___stc.css({display:'none'})
				}
			}
	})

});
$(function(){
	$('a[rel="colorbox"]').colorbox()
})


