jQuery.noConflict();

jQuery(document).ready(function(){

jQuery('.box_custom_footer').parent().css({float:'right'});

	// activates the lightbox page, if you are using a dark color scheme use another theme parameter
	//my_lightbox("a[rel^='prettyPhoto'], a[rel^='lightbox']");
	
	jQuery(".thumb_gallery_image").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true,
		'titlePosition' :	'over'
	});
    
    k_menu(); // controls the dropdown menu
    k_pixelperfect();
    mojo_social();
    mojo_table();
    mojo_subscribe();
	
	// Override default parameters onload
	jQuery.fn.hoverscroll.params = jQuery.extend(jQuery.fn.hoverscroll.params, {
	   vertical : true,
	   width: 200,
	   height: 400,
	   arrows: false
	});

	// Generate hoverscroll with overridden default parameters
	jQuery('.accommodation-feed-content').hoverscroll();
    
    jQuery(".testimonials-wrap").mojo_slider({
    wrap: '.slide-wrap',
    previous: '.previous',
    next: '.next'
    });
    
    // accordion slider
	jQuery("#featured").not('.fadeslider, .newsslider').kricordion({
			slides: '.featured',		// wich element inside the container should serve as slide
			animationSpeed: 700,		// animation duration in milliseconds
			autorotation: true,			// autorotation true or false?
			autorotationSpeed:3,		// duration between autorotation switch in Seconds
			event: 'mouseover',			// event to focus a slide: mouseover or click
			imageShadow:true,			// should the image get a drop shadow to the left
			imageShadowStrength:0.5		// how dark should that shadow be, recommended values: between 0.3 and 0.8, allowed between 0 and 1
	});
	
	// fading slider
	jQuery('.fadeslider').mojo_fade_slider({
			slides: '.featured',				// wich element inside the container should serve as slide
			animationSpeed: 700,				// animation duration in milliseconds
			autorotation: true,					// autorotation true or false?
			autorotationSpeed:3				// duration between autorotation switch in Seconds
    });
	
	
	// news slider
	jQuery('.newsslider').mojo_news_slider({
			slides: '.featured',				// wich element inside the container should serve as slide
			animationSpeed: 700,				// animation duration in milliseconds
			autorotation: true,					// autorotation true or false?
			autorotationSpeed:3				// duration between autorotation switch in Seconds
	});
    
    //applies tooltips with images
	jQuery('.gallery_entry').mojo_tooltip({applyTooltip: '.item_small', showTitle: true });
	jQuery('.thumb_entry').mojo_tooltip({className:'text_tooltip tooltip', applyTooltip: '.thumb_img', tooltipContent:'.gallery_excerpt'});
    
    jQuery("a.gallery_image").click(function(){ return false; });

	k_form(); //controls the contact form
	k_box(); //controls the image Modalboxs
    jQuery('#main').mojo_image_preloader({delay:200});	// activates preloader for non-slideshow images
    k_inModal(); //Controls the inline Content Modalboxs
    k_jMap(); //Controls the Google Maps
    airlie_switch();
	nav_slide_hover();
});

function nav_slide_hover(){

//jQuery(window).load( function( )
//{
//jQuery("#nav > li").append('<span class="animate_icon"></div>');

jQuery("#nav > li").each(function(){
								  
								  var width = jQuery(this).width();
								  var pos = ((width/2)-17);

jQuery(this).find('.animate_icon').css({display: 'block', opacity: '0.0', top: '20px', left: pos+'px', zIndex: '1'});

								  });

jQuery("#nav > li a").css({zIndex:'5'});

jQuery("#nav li").not('.current').find("a").each(function(){
													  
													  var parent = jQuery(this).parent();
													  var icon = parent.find('.animate_icon');
													  
													  parent.hover(function(){
																				  
																				  icon.animate({top: '0px', opacity: '1.0'},200).pngFix( {blankgif: '/blank.gif'} );
																				  
																				  },function(){
																					  
																				  icon.animate({top: '20px', opacity: '0.0'},200).pngFix( {blankgif: '/blank.gif'} );
																					  
																				  });
													  
													  });

//});
	
}
    
/***************** Mojo Social ********************/

function mojo_social() {

jQuery("#static_social a").each(function(){

			// Trigger focus animation
			jQuery(this).bind("mouseover", function(){
				jQuery(this).siblings().stop().animate({"opacity": 0.2}, 500);
			});
			
			jQuery(this).bind("mouseout", function(){
				jQuery(this).siblings().stop().animate({"opacity": 1}, 500);
			});

});

}

function mojo_subscribe(){

                        jQuery('.newsletter-subscribe-wrap label').each(function()
                        {
                        
                        var label = jQuery(this).html();
                        
                        jQuery(this).prev('input').val(label);
                        
                        });
                        
                        jQuery('.newsletter-subscribe-wrap input').focus(function()
                        {
                        
                        var label = jQuery(this).parent().find('label').html();
                        
                        var value = jQuery(this).val();
                        
                        if(value == label)
                        {
                        
                        jQuery(this).val('');
                        
                        }
                        
                        });
                        
                        jQuery('.newsletter-subscribe-wrap input').blur(function()
                        {
                        
                        var label = jQuery(this).parent().find('label').html();
                        
                        var value = jQuery(this).val();
                        
                        if(value == '')
                        {
                        
                        jQuery(this).val(label);
                        
                        }
                        
                        });
                        
    if(!(jQuery.browser.msie && parseInt(jQuery.browser.version) < 7)) // ajax contact form disabled in ie6, it does work but ie6 shifts layout on error :P
	{
		
	var my_error;
	jQuery(".newsletter-subscribe-wrap .subscribe-btn").bind("click", function(){
											 
	my_error = false;
	jQuery(".newsletter-subscribe-wrap input[name=yourname], .newsletter-subscribe-wrap input[name=email]").each(function(i){
				
				var value = jQuery(this).val();
                var label = jQuery(this).parent().find('label').text();
				var check_for = jQuery(this).attr("name");
				var surrounding_element = jQuery(this).parent();
				
				if(check_for == "email"){
                
                if(value.length>0 && value != label)
                {
                
					if(!value.match(/^\w[\w|\.|\-]+@\w[\w|\.|\-]+\.[a-zA-Z]{2,4}$/)){
						
						surrounding_element.attr("class","").addClass("error");
                        
                        if(surrounding_element.find('.error-icon').length == 0){
                        
                        if(surrounding_element.find('.valid-icon').length == 0){
                        
                        surrounding_element.append('<div class="error-icon"></div>');
                        
                        }else{
                        
                        surrounding_element.find('.valid-icon').removeClass('valid-icon').addClass('error-icon');
                        
                        }
                        
                        }
                        
                        alert("Please Enter a Valid Email Address");
						
						my_error = true;
						}else{
						surrounding_element.attr("class","").addClass("valid");
                        
                        if(surrounding_element.find('.error-icon').length > 0){
                        
                        surrounding_element.find('.error-icon').removeClass('error-icon').addClass('valid-icon');
                        
                        }else{
                        
                        surrounding_element.append('<div class="valid-icon"></div>');
                        
                        }
                        
						}
                        
                 }
                 else
                 {
                 
                 surrounding_element.attr("class","").addClass("error");
                 
                 if(surrounding_element.find('.error-icon').length == 0){
                        
                 if(surrounding_element.find('.valid-icon').length == 0){
                        
                 surrounding_element.append('<div class="error-icon"></div>');
                        
                 }else{
                        
                 surrounding_element.find('.valid-icon').removeClass('valid-icon').addClass('error-icon');
                        
                 }
                 
                 }
						
				 my_error = true;
                 
                 }
                    
					}
				
				if(check_for == "yourname"){
					if(value == "" || value == label){
						
						surrounding_element.attr("class","").addClass("error");
                        
                        if(surrounding_element.find('.error-icon').length == 0){
                        
                        if(surrounding_element.find('.valid-icon').length == 0){
                        
                        surrounding_element.append('<div class="error-icon"></div>');
                        
                        }else{
                        
                        surrounding_element.find('.valid-icon').removeClass('valid-icon').addClass('error-icon');
                        
                        }
                        
                        }
						
						my_error = true;
						}else{
						surrounding_element.attr("class","").addClass("valid");
                        
                        if(surrounding_element.find('.error-icon').length > 0){
                        
                        surrounding_element.find('.error-icon').removeClass('error-icon').addClass('valid-icon');
                        
                        }else{
                        
                        surrounding_element.append('<div class="valid-icon"></div>');
                        
                        }
                        
						}
					}
						   if(jQuery(".newsletter-subscribe-wrap input[name=yourname], .newsletter-subscribe-wrap input[name=email]").length  == i+1){
								if(my_error == false){
									
								jQuery(".newsletter-subscribe-wrap input[type=text]").each(function()
                                {
                                
                                var value = jQuery(this).val();
                                var label = jQuery(this).next('label');
                                var labelval = label.text();
                                
                                if(value == labelval)
                                {
                                
                                jQuery(this).val('');
                                
                                }
                                
                                });
									
									jQuery(".newsletter-subscribe-wrap").slideUp(400);
									
									var $datastring = "ajax=true";
									jQuery(".newsletter-subscribe-wrap input").each(function(i)
									{
										var $name = jQuery(this).attr('name');	
										var $value = jQuery(this).attr('value');
										$datastring = $datastring + "&" + $name + "=" + $value;
									});
																		
									
									jQuery(".newsletter-subscribe-wrap").fadeOut(100);	
									
									jQuery.ajax({
									   type: "POST",
									   url: getBaseURL()+"subscribe.php",
									   data: $datastring,
									   success: function(response){
									   jQuery(".newsletter-subscribe-wrap").before("<div class='ajaxresponse' style='display: none; padding:0px 5px;'></div>");
									   jQuery(".ajaxresponse").html(response).slideDown(400); 
									   jQuery(".newsletter-subscribe-wrap").fadeIn(400);
									   jQuery(".newsletter-subscribe-wrap input[name=yourname], .newsletter-subscribe-wrap input[name=email]").each(function()
                                       {
                                       
									   var label = jQuery(this).parent().find('label').text();
                                       
                                       jQuery(this).parent().find('.error-icon, .valid-icon').remove();
									   
                                       jQuery(this).parent().removeClass('valid').addClass('input-wrap');
                                       jQuery(this).val(label);
                                       
                                       });
										   }
										});
									} 
							}
					});
			return false;
	});
}

}

function airlie_switch(){

var count = jQuery("#accommodation-wrap .accommodation-nav-wrap li").length;

jQuery('.accommodation-content-wrap').css('minHeight',count*62+'px');

jQuery("#accommodation-wrap .accommodation-nav-wrap li").click(function(){

var rel = jQuery(this).attr('rel');

if(jQuery(this).hasClass('active')){

}else{

jQuery("#accommodation-wrap .accommodation-nav-wrap li.active").removeClass('active');

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

jQuery(".accommodation-container h3.heading_active").fadeOut('normal',function(){

jQuery(this).removeClass('heading_active');

jQuery(".accommodation-container h3[rel="+rel+"]").addClass('heading_active').css('display','none');

jQuery(".accommodation-container h3.heading_active").fadeIn();

});

jQuery(".accommodation-content .content_active").fadeOut('normal',function(){

jQuery(this).removeClass('content_active');

jQuery(".accommodation-content div[rel="+rel+"]").addClass('content_active').css('display','none');

jQuery(".accommodation-content .content_active").fadeIn();

});

}

return false;
});

var container = jQuery("#accommodation-wrap .accommodation-content");

container.find('.image-links li').each(function(){

var num = jQuery(this).text();

jQuery(this).click(function(){

var wrap = jQuery(this).parent().parent().parent();

var featured_image = wrap.find('.acc_featured');

if(jQuery(this).hasClass('active')){}else{

featured_image.fadeOut(function(){

jQuery(this).removeClass('acc_featured');

});

wrap.find('div[rel=img'+num+']').fadeIn(function(){

jQuery(this).addClass('acc_featured');

});

jQuery(this).parent().find('.active').removeClass('active');

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

}

return false;
});

});

}

function mojo_table() {
	
    var i  = 1;
    
	jQuery('table tr').each(function(){
    
    if(i == 2){
    jQuery(this).addClass('odd');
    i = 1;
    }else{
    i++;
    }
    
    });

}
    
// -------------------------------------------------------------------------------------------
// Tooltip Plugin
// -------------------------------------------------------------------------------------------
(function($)
{
	$.fn.mojo_tooltip = function(options) 
	{
		var defaults = 
		{
			className: 'tooltip',
			applyTooltip:'.item',
			tooltipContent:'img:last',
			offset: {left:20, top:20 },
			opacity: 1,
			showTitle: false
		};
		
		var options = $.extend(defaults, options);
	
		return this.each(function()
		{
			var container = $(this),
				item = container.find(options.applyTooltip),
				viewport = $(window),
				body = $('body'),
				content = container.find(options.tooltipContent).clone(),
				title = '<div class="tooltip_title">'+container.find(options.tooltipContent).attr('title')+'</div>',
				tooltip = $("<div class='"+options.className+"'></div>").appendTo(body),
				border_top = viewport.scrollTop(),
				border_right = viewport.width(),
				left_pos, top_pos, pos,
				tooltipPadding = 
				{
					x: parseInt(tooltip.css('paddingLeft')) + parseInt(tooltip.css('paddingRight')) + 2,
					y: parseInt(tooltip.css('paddingTop')) + parseInt(tooltip.css('paddingBottom')) + 2
				};
				
				if(options.showTitle == true){
					
				tooltip.append(title);
				
				}
				
				container.find(options.tooltipContent).attr('title','');
				
				content.prependTo(tooltip);
						
			item.mouseover(function(e)
			{
				border_top = viewport.scrollTop();
				border_right = viewport.width();
				pos = get_cursor_position(e);
				tooltip.css({left:pos.left, top:pos.top, opacity:options.opacity, display:"none", visibility:"visible"}).stop().fadeIn(400);
			})
			.mousemove(function(e)
			{
					
				pos = get_cursor_position(e);
				tooltip.css({left:pos.left, top:pos.top});

			})
			.mouseout(function()
			{
				tooltip.stop().fadeOut();				  
			});
			
			function get_cursor_position(e)
			{
				if(border_right - (options.offset.left * 2) >= tooltip.width() + tooltipPadding.x + e.pageX){
					left_pos = e.pageX+ options.offset.left;
					} else{
					left_pos = border_right-tooltip.width()-tooltipPadding.x-(options.offset.left);
					}

				if(border_top + (options.offset.top *2)>= e.pageY - tooltip.height() - tooltipPadding.y){
					top_pos = border_top + options.offset.top;
					} else{
					top_pos = e.pageY-tooltip.height()-tooltipPadding.y-options.offset.top;
					}
				var mypos = {top: top_pos, left: left_pos};
					
				return mypos;
			}
			
		});
	}
})(jQuery);

// -------------------------------------------------------------------------------------------
// galleryDisplay
// -------------------------------------------------------------------------------------------
(function($)
{
	$.fn.galleryDisplay = function(options) 
	{
		var defaults = 
		{
			links: 'a.display',
			linkContainer: '.display_buttons',
			items:'.gallery_entry',
			transitionSpeed:1600,
			easing:'easeInOutQuart'
		};
		
		var options = $.extend(defaults, options);
	
		return this.each(function()
		{
			
			var itemContainer = $(this),
				linkContainer = $(options.linkContainer),
				links = linkContainer.find(options.links),
				items = itemContainer.find(options.items),
				animationSet = options.animationSet,
				itemSet = [];
				
			itemContainer.methods = {
			
				preloadingDone: function()
				{	
					links.bind('click',itemContainer.methods.changeStyle);
					linkContainer.slideDown();
				},
				
				changeStyle: function()
				{
					var id = this.id;
					$('.display_active').removeClass('display_active');
					this.className += ' display_active';
					
					if(!$.browser.msie || ($.browser.msie && $.browser.version < 8) || ($.browser.msie && $.browser.version >= 9))
					{
						itemContainer.animate({opacity:'0'}, function()
						{
							itemContainer.attr('id',id+"_gallery");
							if(id == 'item_large')
							{
								$('.gallery_image .item_small').css('visibility','hidden');
								$('.gallery_image .item_big').css('visibility','visible');
							}
							else
							{
								$('.gallery_image .item_small').css('visibility','visible');
								$('.gallery_image .item_big').css('visibility','hidden');
							}
						});
						
					}
					else
					{
						itemContainer.attr('id',id+"_gallery");
					}
					
										
					$.cookie('gallery_display', id+"_gallery", { expires: 7});
					itemContainer.animate({opacity:'1'});					
					return false;
				}
			
			};
			
			itemContainer.attr('id',$.cookie('gallery_display'));
			itemContainer.mojo_image_preloader({delay:100, callback:itemContainer.methods.preloadingDone});
			
		});
	}
})(jQuery);

// -------------------------------------------------------------------------------------------
// The Image preloader
// -------------------------------------------------------------------------------------------

(function($)
{
	$.fn.mojo_image_preloader = function(options) 
	{
		var defaults = 
		{
			repeatedCheck: 500,
			fadeInSpeed: 1000,
			delay:600,
			callback: ''
		};
		
		var options = $.extend(defaults, options);
		
		return this.each(function()
		{	
			var imageContainer = jQuery(this),
				images = imageContainer.find('img').not('.no_preload').css({opacity:0, visibility:'hidden'}),
				imagesToLoad = images.length;				
				
				imageContainer.operations =
				{	
					preload: function()
					{	
						var stopPreloading = true;
												
						images.each(function(i, event)
						{	
							var image = $(this);							
							
							if(event.complete == true)
							{	
								if($.browser.opera) imagesToLoad --;
								imageContainer.operations.showImage(image);
							}
							else
							{	
								if($.browser.opera) imagesToLoad --;
								image.bind('error load',{currentImage: image}, imageContainer.operations.showImage);
							}
							
						});
						
						return this;
					},
					
					showImage: function(image)
					{	
						if(!$.browser.opera) imagesToLoad --;
						if(image.data.currentImage != undefined) { image = image.data.currentImage;}
													
						if (options.delay <= 0) image.css('visibility','visible').animate({opacity:1}, options.fadeInSpeed);
											 
						if(imagesToLoad == 0)
						{
							if(options.delay > 0)
							{
								images.each(function(i, event)
								{	
									var image = $(this);
									setTimeout(function()
									{	
										image.css('visibility','visible').animate({opacity:1}, options.fadeInSpeed, function()
										{
											$(this).parent().removeClass('preloading');
										});
									},
									options.delay*(i+1));
								});
								
								if(options.callback != '')
								{
									setTimeout(options.callback, options.delay*images.length);
								}
							}
							else if(options.callback != '')
							{
								(options.callback)();
							}
							
						}
						
					}

				};
				
				imageContainer.operations.preload();
		});
		
	}
})(jQuery);

function k_box()
{
	
var i = 1;

jQuery(".box").each(function()
							 {
								
								jQuery(this).addClass("box"+i);
								
								if(i == 3)
								{
								
								i = 1;
									
								}else{
								
								i++;
								
								}
								 
							 });
	
}

function k_inModal()
{
    
    jQuery(".modal-link").click(function()
    {
    
    var rel = jQuery(this).attr('rel');
    
    jQuery.fn.colorbox({width:"900", height:"470", iframe:true, href: getBaseURL()+"modal_iframe.php?id="+rel });
    
    return false;
    
    });

}

// -------------------------------------------------------------------------------------------
// The Image preloader
// -------------------------------------------------------------------------------------------


(function($)
{
	$.fn.mojo_image_preloader = function(options) 
	{
		var defaults = 
		{
			repeatedCheck: 500,
			fadeInSpeed: 1000,
			delay:600,
			callback: ''
		};
		
		var options = $.extend(defaults, options);
		
		return this.each(function()
		{
			var imageContainer = jQuery(this),
				images = imageContainer.find('img').css({opacity:0, visibility:'hidden'}),
				imagesToLoad = images.length;				
				
				imageContainer.operations =
				{	
					preload: function()
					{	
						var stopPreloading = true;
						
						images.each(function(i, event)
						{	
							var image = $(this);
							
							
							if(event.complete == true)
							{	
								imageContainer.operations.showImage(image);
							}
							else
							{
								image.bind('error load',{currentImage: image}, imageContainer.operations.showImage);
							}
							
						});
						
						return this;
					},
					
					showImage: function(image)
					{	
						imagesToLoad --;
						if(image.data.currentImage != undefined) { image = image.data.currentImage;}
												
						if (options.delay <= 0) image.css('visibility','visible').animate({opacity:1}, options.fadeInSpeed);
												 
						if(imagesToLoad == 0)
						{
							if(options.delay > 0)
							{
								images.each(function(i, event)
								{	
									var image = $(this);
									setTimeout(function()
									{	
										image.css('visibility','visible').animate({opacity:1}, options.fadeInSpeed);
									},
									options.delay*(i+1));
								});
								
								if(options.callback != '')
								{
									setTimeout(options.callback, options.delay*images.length);
								}
							}
							else if(options.callback != '')
							{
								(options.callback)();
							}
							
						}
						
					}

				};
				
				imageContainer.operations.preload();
		});
		
	}
})(jQuery);

// -------------------------------------------------------------------------------------------
// The Fade Slider
// -------------------------------------------------------------------------------------------

(function($)
{
	$.fn.mojo_fade_slider= function(options) 
	{
		var defaults = 
		{
			slides: '>div',				// wich element inside the container should serve as slide
			animationSpeed: 900,		// animation duration
			autorotation: true,			// autorotation true or false?
			autorotationSpeed:3,		// duration between autorotation switch in Seconds
			appendControlls: '',
			backgroundOpacity:0.8		// opacity for background
		};
		
		var options = $.extend(defaults, options);
		
		return this.each(function()
		{
			var slideWrapper 	= $(this),								
				slides			= slideWrapper.find(options.slides).css({display:'none',zIndex:0}),
				slideCount 	= slides.length,
				currentSlideNumber = 0,
				interval,
				current_class = 'active_item',
				controlls = '',
				skipSwitch = true;
				
				//slides.find('.feature_excerpt').css('opacity',options.backgroundOpacity);
				
				slideWrapper.methods = {
				
					init: function()
					{
						slides.filter(':eq(0)').css({zIndex:2, display:'block'});
						
						if(slideCount <= 1)
						{
							slideWrapper.mojo_image_preloader({delay:200});
						}
						else
						{
							slideWrapper.mojo_image_preloader({callback:slideWrapper.methods.preloadingDone, delay:200});
							
							if (options.appendControlls)
							{
								controlls = $('<div></div>').addClass('slidecontrolls').css({position:'absolute'}).appendTo(options.appendControlls);
								slides.each(function(i)
								{	
									var controller = $('<span class="ie6fix '+current_class+'"></span>').appendTo(controlls);
									controller.bind('click', {currentSlideNumber: i}, slideWrapper.methods.switchSlide);
									current_class = "";
								});	
							}
						}						
					},
					
					preloadingDone: function()
					{
						skipSwitch = false;
						
						if(options.autorotation)
						{
							slideWrapper.methods.autorotate();
						}
					},
					
					switchSlide: function(passed)
					{	
						var noAction = false;
						
						if(passed != undefined && !skipSwitch)
						{	
						
							if(currentSlideNumber != passed.data.currentSlideNumber)
							{	
								currentSlideNumber = passed.data.currentSlideNumber;
							}
							else
							{
								noAction = true;
							}
						}
						
						if(passed != undefined)
						{	
							clearInterval(interval);
						}
						
						if(!skipSwitch && noAction == false)
						{	
							skipSwitch = true;
							var currentSlide = slides.filter(':visible'),
							caption = currentSlide.find('.feature_excerpt'),
							nextSlide = slides.filter(':eq('+currentSlideNumber+')'),
							next_caption = nextSlide.find('.feature_excerpt').css({bottom:'-50px'});
							
								if(options.appendControlls)
								{	
									controlls.find('.active_item').removeClass('active_item');
									controlls.find('span:eq('+currentSlideNumber+')').addClass('active_item');									
								}
								
							currentSlide.css({zIndex:4});
							nextSlide.css({zIndex:2, display:'block'});
							
							if(caption.length>0){
							
							caption.animate({bottom:'-50px'},function(){
							currentSlide.fadeOut(options.animationSpeed, function()
							{
								currentSlide.css({zIndex:0, display:"none"});
								skipSwitch = false;
								if(next_caption.length>0){
									next_caption.animate({bottom:'0px'});
								}
								
							});
							
																  });
																  }else{
																	  
																	currentSlide.fadeOut(options.animationSpeed, function()
							{
								currentSlide.css({zIndex:0, display:"none"});
								skipSwitch = false;
								if(next_caption.length>0){
									next_caption.animate({bottom:'0px'});
								}
							});
																	  
																  }
						}
					},
					
					autorotate: function()
					{	
						interval = setInterval(function()
						{ 	
							currentSlideNumber ++;
							if(currentSlideNumber == slideCount) currentSlideNumber = 0;
							
							slideWrapper.methods.switchSlide();
						},
						(parseInt(options.autorotationSpeed) * 1000));
					}
				
				};
				
				slideWrapper.methods.init();
		});
		
	}
})(jQuery);

// -------------------------------------------------------------------------------------------
// The Mojo Content Slider
// -------------------------------------------------------------------------------------------

(function($)
{
	$.fn.mojo_slider= function(options) 
	{
		var defaults = 
		{
			wrap: '>div',				// wich element inside the container should serve as slide
            previous: '.previous',
            next: '.next'
		};
		
		var options = $.extend(defaults, options);
		
		return this.each(function()
		{
			var wrapper 	= $(this),
            	slideWrapper = $(this).find(options.wrap),
                parent = slideWrapper.parent();
				slides			= slideWrapper.css({float:'left'}),
				slideCount 	= slides.length,
                slideWidth  = slides.width();
                stripWidth  = slideCount*slideCount;
				currentSlideNumber = 1,
				current_pos = 0,
				controlls = '',
				skipSwitch = true,
                next_control = wrapper.find(options.next),
                previous_control = wrapper.find(options.previous);
                counter = 0;
				
				wrapper.methods = {
				
					init: function()
					{
                    
                    var start_height = wrapper.find(options.wrap+'[rel=0]').height();
                    
                    parent.animate({
				"height": start_height+'px'				
					}, 500);
                    
                    wrapper.methods.nav_activity();
                    wrapper.methods.nextSlide();
                    wrapper.methods.previousSlide();
                        			
					},
                    nextSlide: function(){
                    
                    next_control.bind("click",function(){
                    
                    counter++;
                    
                    wrapper.methods.nav_activity();
                    
                    var next_height = wrapper.find(options.wrap+'[rel='+(counter)+']').height();
                    
                    parent.animate({"left": (-(counter) * slideWidth)}, 500, function(){
                    
                    parent.animate({
				"height": next_height+'px'				
					}, 500);
                    
                    });
                    
                    return false;
                    });
                    
                    },
                    previousSlide: function(){
                    
                    previous_control.bind("click",function(){
                    
                    counter--;
                    
                    wrapper.methods.nav_activity();
                    
                    var previous_height = wrapper.find(options.wrap+'[rel='+(counter)+']').height();
                    
                    parent.animate({"left": (-(counter) * slideWidth)}, 500, function(){
                    
                    parent.animate({
				    "height": previous_height+'px'				
					}, 500);
                    
                    });
                    
                    return false;
                    });
                    
                    },
                    nav_activity: function(){
                    
                    if(counter+1 == slideCount){
                    
                    next_control.css("display","none");
                    
                    }else{
                    
                    next_control.css("display","block");
                    
                    }
                    
                    if(counter == 0){
                    
                    previous_control.css("display","none");
                    
                    }else{
                    
                    previous_control.css("display","block");
                    
                    }
                    
                    }
				
				};
				
				wrapper.methods.init();
		});
		
	}
})(jQuery);

// -------------------------------------------------------------------------------------------
// The News Slider
// -------------------------------------------------------------------------------------------

(function($)
{
	$.fn.mojo_news_slider= function(options) 
	{
		var defaults = 
		{
			slides: '>div',				// wich element inside the container should serve as slide
			animationSpeed: 900,		// animation duration
			autorotation: true,			// autorotation true or false?
			autorotationSpeed:3,		// duration between autorotation switch in Seconds
			easing: 'easeOutQuint',
			backgroundOpacity:0.8		// opacity for background
		};
		
		var options = $.extend(defaults, options);
		
		return this.each(function()
		{
			var slideWrapper 	= $(this),								
				slides			= slideWrapper.find(options.slides).css({display:'none',zIndex:0}),
				slideCount 	= slides.length,
				accelerator = 0,				// accelerator of scrolling speed
				scrollInterval = '',			// var that stores the setInterval id
				mousePos = '',					// current mouse position
				moving = false,					// scrollbar currently moving or not?
				controllWindowHeight = 0,		// height of the wrapping element that hides overflow
				controllWindowPart = 0,			// mouseoverpart of the wrapping element that hides overflow
				itemWindowHeight = 0,			// height of element to move
				current_class = 'active_item',
				skipSwitch = true,
				currentSlideNumber = 0,
				newsSelect ='',
				newsItems = '';	
				
				slides.find('.feature_excerpt').css('opacity',options.backgroundOpacity);			
				
				slideWrapper.methods = {
				
					init: function()
					{
						newsSelect = $('<div></div>').addClass('newsselect').appendTo(slideWrapper);
						newsItems = $('<div></div>').addClass('newsItems').appendTo(newsSelect);
						fadeout = $('<div></div>').addClass('fadeout').addClass('ie6fix').appendTo(slideWrapper);
						
						slides.filter(':eq(0)').css({zIndex:2, display:'block'});
						
						slides.each(function(i)
						{	
							var slide = $(this),
								url = slide.find('a').attr('href'),
								controll = $('<a class="single_item '+current_class+'"></a>').appendTo(newsItems).attr('href',url);
								current_class ='';
								
							slide.find('.feature_excerpt .sliderheading, .feature_excerpt .sliderdate').clone().appendTo(controll);
							controll.bind('click', {currentSlideNumber: i}, slideWrapper.methods.switchSlide);
						});
						
						controllWindowHeight = newsSelect.height();
						controllWindowPart = controllWindowHeight/3;
						itemWindowHeight = newsItems.height();
						
						if(slideCount > 1)
						{
							slideWrapper.mojo_image_preloader({delay:200});
							slideWrapper.methods.preloadingDone();
						}
					},
					
					preloadingDone: function()
					{	
						skipSwitch = false;
						var offset = newsSelect.offset();
						
						newsSelect.mousemove(function(e)
						{
							mousePos = e.pageY - offset.top;
							
							if(!moving)
							{
								scrollInterval = setInterval(function() { slideWrapper.methods.scrollItem(mousePos); }, 25);
								moving = true;
							}
						}); 
										
						newsSelect.bind('mouseleave', function()
						{ 
							clearInterval(scrollInterval); 
							moving = false;
							accelerator = 0;
						});
						
					},
					
					scrollItem: function()
					{	
						var movement = 0,
							percent = controllWindowPart / 100,
							modifier = 10,
							currentTop = parseInt(newsItems.css('top'));
							
						accelerator = accelerator <= 2 ? accelerator + 0.5 : accelerator; 
						
						if(mousePos < controllWindowPart)
						{	
							movement = ((controllWindowPart - mousePos) / percent) * accelerator;
							newPos = currentTop + (movement/modifier);
							
							if(currentTop < 0)
							{	
								if (newPos > 0) newPos = 0;
								newsItems.css({top:newPos + "px"});
							}
						}
						else if(mousePos > controllWindowPart * 2)
						{	
							movement = ((mousePos - controllWindowPart * 2) / percent) * accelerator;
							newPos = currentTop + (movement/modifier * -1);
							
							if((currentTop * -1) < itemWindowHeight - controllWindowHeight)
							{
								if (newPos * -1 > itemWindowHeight - controllWindowHeight) newPos = controllWindowHeight - itemWindowHeight;
								
								newsItems.css({top:newPos + "px"});
							}
						}
						else
						{
							accelerator = 0;
						}
					},
					
					switchSlide: function(passed)
					{	
						
						var noAction = false;
						
						if(passed != undefined && !skipSwitch)
						{
							if(currentSlideNumber != passed.data.currentSlideNumber)
							{	
								currentSlideNumber = passed.data.currentSlideNumber;
							}
							else
							{
								noAction = true;
							}
						}
						
						if(passed != undefined)
						{	
							// clearInterval(interval);
						}
						
						
						if(!skipSwitch && noAction == false)
						{	
							skipSwitch = true;
							var currentSlide = slides.filter(':visible'),
								nextSlide = slides.filter(':eq('+currentSlideNumber+')');
																
							newsSelect.find('.active_item').removeClass('active_item');
							newsSelect.find('a:eq('+currentSlideNumber+')').addClass('active_item');	
																
							currentSlide.css({zIndex:4});
							nextSlide.css({zIndex:2, display:'block'});
							
							currentSlide.fadeOut(options.animationSpeed, function()
							{
								currentSlide.css({zIndex:0, display:"none"});
								skipSwitch = false;
							});
						}
						return false;
					},
					
					autorotate: function()
					{	
						//autorotation not yet supportet
					}
				
				};
				
				slideWrapper.methods.init();
		});
		
	}
})(jQuery);


// -------------------------------------------------------------------------------------------
// The Main accordion slider - KRICORDION

// Dependencies: equalheight function, mojo_image_preoloader. jquery easing
//
// -------------------------------------------------------------------------------------------
(function($)
{
	$.fn.kricordion = function(options) 
	{
		var defaults = 
		{
			slides: '>div',				// wich element inside the container should serve as slide
			animationSpeed: 900,		// animation duration
			autorotation: true,			// autorotation true or false?
			autorotationSpeed:3,		// duration between autorotation switch in Seconds
			easing: 'easeOutQuint',		// animation easing, more options at the bottom of this file
			event: 'mouseover',			// event to focus a slide: mouseover or click
			imageShadow:true,			// should the image get a drop shadow to the left
			imageShadowStrength:0.5,	// how dark should that shadow be, recommended values: between 0.3 and 0.8, allowed between 0 and 1
			fontOpacity: 1,				// opacity for font, if set to 1 it will be stronger but most browsers got a small rendering glitch at 1
			backgroundOpacity:0.8		// opacity for background
			
		};
		
		// merge default values with the values that were passed with the function call
		var options = $.extend(defaults, options);
		
		return this.each(function()
		{	
			// save some jQuery selections into variables, also calculate base values for each slide
			var slideWrapper 	= $(this),								// element that holds the slides
				slides			= slideWrapper.find(options.slides).css('display','block'),	// the slides
				slide_count 	= slides.length,						// number of slides
				slide_width		= slideWrapper.width(), // slide_count	// width of the slides
				expand_slide 	= slides.width(),						// size of a slide when expanded, defined in css, class ".featured" by default
				minimized_slide	= (slideWrapper.width() - expand_slide), // (slide_count - 1), // remaining width is shared among the non-active slides
				overlay_modifier = 200 *(1- options.imageShadowStrength),					//increases the size of the minimized image div to avoid flickering
				excerptWrapper = slideWrapper.find('.feature_excerpt'),
				interval = '',
				current_slide = 0;
			
				
			//modify excerptWrapper and re-select it, also add positioning span -------------------------
			excerptWrapper.wrap('<span class="feature_excerpt"></span>').removeClass('feature_excerpt').addClass('position_excerpt');
			excerptWrapper = slideWrapper.find('.feature_excerpt').css('opacity',options.backgroundOpacity);
			// -------------------------------------------------------------------------------------------
			
				
			//equal heights for all excerpt containers, then hide basic excerpt content -----------------
			excerptWrapper.equalHeights().find('.position_excerpt').css({display:'block', opacity:0, position:'absolute'});
			var excerptWrapperHeight = excerptWrapper.height();
			// -------------------------------------------------------------------------------------------
			
						
			
			//iterate each slide and set new base values, also set positions for acitve and inactive states and event handlers
			slides.each(function(i)
			{
				var this_slide = $(this),											// current slide element
					this_slide_a = this_slide.find('a'),							// a tag inside the element
					real_excerpt = this_slide.find('.position_excerpt'),			// wrapper to center the excerpt content verticaly
					real_excerpt_height = real_excerpt.height(),					// height of the excerpt content
					slide_heading =this_slide.find('.sliderheading'),  				// slide heading
					cloned_heading =   slide_heading.clone().appendTo(this_slide_a) // clone heading for heading only view
													.addClass('heading_clone')
													.css({opacity:options.fontOpacity, width:slide_width-30}),
					clone_height = cloned_heading.height();							// height of clone heading, needed to center verticaly as well
					
					
					this_slide.css('backgroundPosition',parseInt(slide_width/2-8) + 'px ' + parseInt((this_slide.height()- real_excerpt_height)/2 -8) + 'px');						
					
					cloned_heading.css({bottom: (excerptWrapperHeight-clone_height)/2 +9});			//center clone heading
					real_excerpt.css({bottom: (excerptWrapperHeight-real_excerpt_height)/2 +9});	//center real excerpt
												
					this_slide.data( //save data of each slide via jquerys data method
					'data',
					{
						this_slides_position: i * slide_width,							// position if no item is active
						pos_active_higher: i * minimized_slide,							// position of the item if a higher item is active
						pos_active_lower: ((i-1) * minimized_slide) + expand_slide		// position of the item if a lower item is active
					});
					
				//set base properties	
				this_slide.css({zIndex:i+1, left: i * slide_width, width:slide_width + overlay_modifier});
								
				
				//apply the fading div if option is set to do so
				if(options.imageShadow)
				{
					this_slide.find('>a').prepend('<span class="fadeout ie6fix"></span>');
				}
								
			});
			
			// calls the preloader, mojo_image_preloader plugin needed
			jQuery('#featured').mojo_image_preloader({callback:add_functionality});
			
			function add_functionality()
			{
				
				//set autorotation ---------------------------------------------------------------------------
				
				
				if(options.autorotation)
				{
					interval = setInterval(function() { autorotation(); }, (parseInt(options.autorotationSpeed) * 1000));
				}
				
				slides.each(function(i)
				{	
					var this_slide = $(this), 
						real_excerpt = this_slide.find('.position_excerpt'), 
						cloned_heading = this_slide.find('.heading_clone');
						
					//set mouseover or click event
					this_slide.bind(options.event, function(event, continue_autoslide)
					{	
						//stop autoslide on userinteraction
						if(!continue_autoslide)
						{
							clearInterval(interval)
						}
						
						var objData = this_slide.data( 'data' );
						//on mouseover expand current slide to full size and fadeIn real content
						real_excerpt.stop().animate({opacity:options.fontOpacity},options.animationSpeed, options.easing);
						cloned_heading.stop().animate({opacity:0},options.animationSpeed, options.easing);
						
						this_slide.stop().animate({	width: expand_slide + (overlay_modifier * 1.2), 
													left: objData.pos_active_higher},
													options.animationSpeed, options.easing);
											
						//set and all other slides to small size
						slides.each(function(j){
						
							if (i !== j)
							{	
								var this_slide = $(this),
									real_excerpt = this_slide.find('.position_excerpt'),
									cloned_heading = this_slide.find('.heading_clone'),
									objData = this_slide.data( 'data' ),
									new_pos = objData.pos_active_higher;
									
								if(i < j) { new_pos = objData.pos_active_lower; }
								this_slide.stop().animate({left: new_pos, width:minimized_slide + overlay_modifier},options.animationSpeed, options.easing);
								real_excerpt.stop().animate({opacity:0},options.animationSpeed, options.easing);
								cloned_heading.stop().animate({opacity:options.fontOpacity},options.animationSpeed, options.easing);
							}
						
						});
						
					});
				});
				
				
				//set mouseout event: expand all slides to no-slide-active position and width
				slideWrapper.bind('mouseleave', function()
				{
					slides.each(function(i)
					{
						var this_slide = $(this),
							real_excerpt = this_slide.find('.position_excerpt'),
							cloned_heading = this_slide.find('.heading_clone'),
							objData = this_slide.data( 'data' ),
							new_pos = objData.this_slides_position;
							
							this_slide.stop().animate({left: new_pos, width:slide_width + overlay_modifier},options.animationSpeed, options.easing);
							real_excerpt.stop().animate({opacity:0},options.animationSpeed, options.easing);
							cloned_heading.stop().animate({opacity:options.fontOpacity},options.animationSpeed, options.easing);
					});
					
				});
			}
			
			
			// autorotation function for the image slider
			function autorotation()
			{	
				if(slide_count  == current_slide)
				{
					slideWrapper.trigger('mouseleave');
					current_slide = 0;
				}
				else
				{
					slides.filter(':eq('+current_slide+')').trigger(options.event,[true]);
					current_slide ++;
				}
			}
		});
	};
})(jQuery);
// -------------------------------------------------------------------------------------------
// END KRICORDION
// -------------------------------------------------------------------------------------------


function k_menu()
{
	jQuery("#nav a, #topnav a").removeAttr('title');
	jQuery(" #nav ul, #topnav ul").css({display: "none"}); // Opera Fix
	
	jQuery("#nav li, #topnav li").each(function()
	{	
		
		var $sublist = jQuery(this).find('ul:first');
		
		jQuery(this).hover(function()
		{	
			$sublist.stop().css({overflow:"hidden", height:"auto", display:"none"}).slideDown(400, function()
			{
				jQuery(this).css({overflow:"visible", height:"auto"});
			});	
		},
		function()
		{	
			$sublist.stop().slideUp(400, function()
			{	
				jQuery(this).css({overflow:"hidden", display:"none"});
			});
		});	
	});
}

function my_lightbox($elements)
{
jQuery($elements).prettyPhoto({
		"theme": 'light_square' /* light_rounded / dark_rounded / light_square / dark_square */																
	});

jQuery($elements).each(function()
{	
	var $image = jQuery(this).contents("img");
	$newclass = 'lightbox_video';
	
	if(jQuery(this).attr('href').match(/(jpg|gif|jpeg|png|tif|php)/)) $newclass = 'lightbox_image';
		
	if ($image.length > 0)
	{	
		if(jQuery.browser.msie &&  jQuery.browser.version < 7) jQuery(this).addClass('ie6_lightbox');
		
		var $bg = jQuery("<span class='"+$newclass+" ie6fix'></span>").appendTo(jQuery(this));
		
		jQuery(this).bind('mouseenter', function(){
			$height = $image.height();
			$width = $image.width();
			$pos =  $image.position();		
			$bg.css({height:$height, width:$width, top:$pos.top, left:$pos.left});
		});
	}
	
	
	
});
}

//equalHeights by james padolsey
jQuery.fn.equalHeights = function() {
    return this.height(Math.max.apply(null,
        this.map(function() {
           return jQuery(this).height()
        }).get()
    ));
};


function k_pixelperfect()
{	
	// sometimes some elements are offset by one or two pixels. 
	// this isnt anything bad but i really like pixel perfection, therefore this function adds some css rules for specific browsers :)
	if((jQuery.browser.msie && jQuery.browser.version < 7 ) || jQuery.browser.opera)
	{	
		jQuery('#headextras #searchsubmit').css({top:"10px"});
	}
	
	//same size for sidebars:
	jQuery('.sidebar').equalHeights();
}



function k_form(){
	if(!(jQuery.browser.msie && parseInt(jQuery.browser.version) < 7)) // ajax contact form disabled in ie6, it does work but ie6 shifts layout on error :P
	{
    
    jQuery(".ajax_form input[type=text], .ajax_form textarea").each(function()
    {
    
    var value = jQuery(this).val();
    var label = jQuery(this).next('label');
    var labelval = label.text();
    
    label.css('display','none');
    
    if(value == '')
    {
    
    jQuery(this).val(labelval);
    
    }
    
    });
    
    jQuery('input,textarea').focus(function()
									   {
										   
										 var label = jQuery(this).next('label').text();
										 
										 var value = jQuery(this).val();
										 
										 if(value == label)
										 {
											 
											 jQuery(this).val('');
											 
										 }
										   
									   });
                                       
      jQuery('input,textarea').blur(function()
									   {
										  
										  var label = jQuery(this).next('label').text();
										  
										  var value = jQuery(this).val();
										  
										  if(value == '')
										  {
											
											jQuery(this).val(label);
											  
										  }
										   
									   });
		
	var my_error;
	jQuery(".ajax_form #send").bind("click", function(){
											 
	my_error = false;
    
	jQuery(".ajax_form #name, .ajax_form #message, .ajax_form #email, .ajax_form #valid").each(function(i){
				
				var value = jQuery(this).val();
                var label = jQuery(this).next('label').text();
				var check_for = jQuery(this).attr("id");
				var surrounding_element = jQuery(this).parent();
				if(check_for == "email"){
                
                if(value.length>0 && value != label)
                {
                
					if(!value.match(/^\w[\w|\.|\-]+@\w[\w|\.|\-]+\.[a-zA-Z]{2,4}$/)){
						
						surrounding_element.attr("class","").addClass("error");
                        
                        alert("Please Enter a Valid Email Address");
						
						my_error = true;
						}else{
						surrounding_element.attr("class","").addClass("valid");	
						}
                        
                 }
                 else
                 {
                 
                 surrounding_element.attr("class","").addClass("error");
						
				 my_error = true;
                 
                 }
                    
					}
				
				if(check_for == "name" || check_for == "message"){
					if(value == "" || value == label){
						
						surrounding_element.attr("class","").addClass("error");
						
						my_error = true;
						}else{
						surrounding_element.attr("class","").addClass("valid");	
						}
					}
                    
                  if(check_for == "valid"){
                  if(value == "" || value == label){
                  
                  surrounding_element.attr("class","").addClass("error");
						
						my_error = true;
						}else{
                        
                        var cid = jQuery("#cid").val();
                        
                        var validate = jQuery.ajax({
                        type:"POST",
                        url: getBaseURL()+"ajax_captcha.php",
                        data:"id="+cid+"&valid="+value,
                        async: false
                        }).responseText;
                        
                        if(validate == 'true'){
                        
                        surrounding_element.attr("class","").addClass("valid");
                        
                        }else{
                        
                        my_error = true;
                        surrounding_element.attr("class","").addClass("error");
                        alert("Your Validation Code is incorrect, please try again");
                        
                        }
                        
				  }
                  
                  }
                    
                 
						   if(jQuery(".ajax_form #name, .ajax_form #message, .ajax_form #email, .ajax_form #valid").length  == i+1){
								if(my_error == false){
                                
                                jQuery(".ajax_form input[type=text]").each(function()
                                {
                                
                                var value = jQuery(this).val();
                                var label = jQuery(this).next('label');
                                var labelval = label.text();
                                
                                if(value == labelval)
                                {
                                
                                jQuery(this).val('');
                                
                                }
                                
                                });
                                
									jQuery(".ajax_form").slideUp(400);
									
									var $datastring = "ajax=true";
									jQuery(".ajax_form input, .ajax_form textarea").each(function(i)
									{
										var $name = jQuery(this).attr('name');	
										var $value = jQuery(this).attr('value');
										$datastring = $datastring + "&" + $name + "=" + $value;
									});
																		
									
									jQuery(".ajax_form").fadeOut(100);	
									
									jQuery.ajax({
									   type: "POST",
									   url: getBaseURL()+"send.php",
									   data: $datastring,
									   success: function(response){
									   jQuery(".ajax_form").before("<div class='ajaxresponse' style='display: none;'></div>");
									   jQuery(".ajaxresponse").html(response).slideDown(400); 
									   jQuery(".ajax_form").fadeIn(400);
									   jQuery(".ajax_form #name, .ajax_form #message, .ajax_form #email , .ajax_form #phone, .ajax_form #valid").each(function()
                                       {
                                       
                                       jQuery(this).parent().removeClass('valid');
                                       jQuery(this).val("");
                                       
                                       });
										   }
										});
									} 
							}
					});
			return false;
	});
}

}

function k_jMap()
{

if(jQuery('.google_map_address').length>0)
{

jQuery('.google_map_address').each(function(i)
{

var container = jQuery(this);
var set_longitude = container.attr('longitude');
var set_latitude = container.attr('latitude');

//var popupHTML = container.find('.popup-label');

var address = jQuery(this).text();

if(address.length>0 && set_longitude.lenght==0)
{

var dat = encodeURIComponent(address);

jQuery.ajax({

type: "POST",
url: getBaseURL()+"geo.php",
data: "loc=" + dat,
success: function(coord)
{

var coord_array = coord.split("::");

var latitude = coord_array[0];

var longitude = coord_array[1];

var latlon = [latitude,longitude];
    
    container.gMap({
    latitude: latitude,
    longitude: longitude,
    zoom: 17,
    maptype: G_HYBRID_MAP,
        markers: [{
            latitude: latitude,
            longitude: longitude
        }]
    }); 


}

});

}else{

container.gMap({
    latitude: set_latitude,
    longitude: set_longitude,
    zoom: 17,
    maptype: G_HYBRID_MAP,
        markers: [{
            latitude: set_latitude,
            longitude: set_longitude
        }]
    }); 

}

});


}

}

/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});

function getBaseURL() {
    var url = location.href;  // entire url including querystring - also: window.location.href;
    var baseURL = url.substring(0, url.indexOf('/', 14));


    if (baseURL.indexOf('http://localhost') != -1) {
        // Base Url for localhost
        var url = location.href;  // window.location.href;
        var pathname = location.pathname;  // window.location.pathname;
        var index1 = url.indexOf(pathname);
        var index2 = url.indexOf("/", index1 + 1);
        var baseLocalUrl = url.substr(0, index2);

        return baseLocalUrl + "/";
    }
    else {
        // Root Url for domain name
        return baseURL + "/";
    }

}
