jQuery.noConflict();


jQuery(document).ready(function(){
		kriesi_mainmenu();
	    kriesi_tab('.content_right','h4','.speciallist');
		jQuery(".more-link, .heading_tab").slowfade({use_span_class:"slowfade",use_class:"slowfade_mod", add_inner_html:true});
		jQuery("#nav>li>a").slowfade({use_span_class:"slowfade",use_class:"slowfade_mod", add_inner_html:true, ie6comp:"ie6fix"});
		call_lightbox_clone("auto");
		kriesi_start_slideshow();
		form_validation();
	 	validate_all();

});
 
 
 
 
 

function form_validation(){
	jQuery(".empty, .email").each(function(i){
									  
				jQuery(this).bind("blur", function(){
				
				var value = jQuery(this).attr("value");
				var check_for = jQuery(this).attr("class");
				var surrounding_element = jQuery(this).parent("p");
				var template_url = jQuery("meta[name=amplify3]").attr('content');
				
				 jQuery.ajax({
					   type: "POST",
					   url: template_url + "/validate.php",
					   data: "value="+value+"&check_for="+check_for,
					   beforeSend:function(){
						   surrounding_element.attr("class","").addClass("ajax_loading");
						 },
					   error:function(){
						   surrounding_element.attr("class","").addClass("ajax_alert");
						 },
					   success: function(response){
						   if(response == "true"){
							surrounding_element.attr("class","").addClass("ajax_valid");
						   }else{
							surrounding_element.attr("class","").addClass("ajax_false");
						   }
					     }
						   
			 });
		 });
	});
}



function validate_all(){
	var my_error;
	jQuery(".ajax_form #send").bind("click", function(){
	my_error = false;
	jQuery(".empty, .email").each(function(i){
										   
				var value = jQuery(this).attr("value");
				var check_for = jQuery(this).attr("class");
				var surrounding_element = jQuery(this).parent("p");
				var template_url = jQuery("meta[name=amplify3]").attr('content');
				
				 jQuery.ajax({
					   type: "POST",
					   url: template_url + "/validate.php",
					   data: "value="+value+"&check_for="+check_for,
					   beforeSend:function(){
						   surrounding_element.attr("class","").addClass("ajax_loading");
						 },
					   error:function(){
						   surrounding_element.attr("class","").addClass("ajax_alert");
						 },
					   success: function(response){
						   if(response == "true"){
							surrounding_element.attr("class","").addClass("ajax_valid");
						   }else{
							surrounding_element.attr("class","").addClass("ajax_false");
							my_error = true;
						   }
						   if(jQuery(".empty, .email").length  == i+1){
								if(my_error == false){
									jQuery("#ajax_form").slideUp(400);
									var yourname = jQuery("#name").attr('value');
									var email = jQuery("#email").attr('value');
									var website = jQuery("#website").attr('value');
									var message = jQuery("#message").attr('value');
									var myemail = jQuery("#myemail").attr('value');
									var myblogname = jQuery("#myblogname").attr('value');
									
									jQuery.ajax({
									   type: "POST",
									   url: template_url + "/send.php",
									   data: "Send=true&yourname="+yourname+"&email="+email+"&website="+website+"&message="+message+"&myemail="+myemail+"&myblogname="+myblogname,
									   success: function(response){
									   jQuery("#ajax_response").css({display:"none"}).html(response).slideDown(400);   
										   }
												});
									
									
									} 
							}
					     }
				 });
				 
			});
	
	return false;
	});
}

 
 function kriesi_start_slideshow() //preloading images for the slideshow, then calling the slideshow
 {
	var $images = jQuery('.feature_image_container img');
	var $everything_loaded = true;
	
	
	$images.each(function(i)
	{
		if ($images[i].complete == false || $images[i].complete == undefined || $images[i].complete == null)
		{
		$everything_loaded = false;	
		} 
	});
	
	
	if($everything_loaded)
		{
			kriesi_amplify_slideshow();	
		}
		else
		{
			window.setTimeout('kriesi_start_slideshow()',1000);
		}
}




function kriesi_amplify_slideshow()
{	
		
	if(jQuery("#feature_area").length == 0){
		active_rotation = setInterval(function(){},100000000); //fake_var
		return false} //check if this is starting page
	
	jQuery(".feature_thumbs").fadeIn(1400);
	
	
	var thumbs = jQuery(".feature_thumbs .amplify_thumb");
	var articles = jQuery(".text_container");
	var autorotate = jQuery("meta[name=amplify1]").attr('content');
	var autorotate_duration = jQuery("meta[name=amplify2]").attr('content');
	
	if(thumbs.length > 1 && autorotate == 2) //check if rotation should be started?
	{ 
		active_rotation = setInterval(amplify_autorotate,autorotate_duration); 
		//change the number for a different pause between slides, 
		//has to be at least 2000 if you have more than 6 slides
		
	}
	else
	{
		if(thumbs.length == 1)
		{
			jQuery(".feature_thumbs").css({display:"none"}); // if only one thumb hide it
		}
		active_rotation = setInterval(function(){},100000000); //fake_var
	}


	var transition_duration = 500;
	var transition_easing = "easeOutBack";
	var autorotate = 0;
	var current_thumb_pos = 0;
	var thumbsdisplayed = 6;
	var modifier = 1;
	var may_change = 1;
	
	jQuery(".feature_thumbs .amplify_thumb").bind("click",amplify_rotation);
	
	if(thumbsdisplayed < thumbs.length){
		jQuery(".feature_image").prepend('<a href="" class="prev_thumbs">Prev</a><a href="" class="next_thumbs">Next</a>');
		
		jQuery(".next_thumbs").css({display:"none"}).fadeIn(2200).bind("click","next",amplify_change_thumbs);
		jQuery(".prev_thumbs").css({display:"none"}).fadeIn(2200).bind("click","prev",amplify_change_thumbs);
	}
	
	
	function amplify_autorotate()
	{	
		autorotate = jQuery(".feature_thumbs .amplify_thumb").length-1 <= autorotate? 0 : autorotate+1;
		jQuery(".feature_thumbs .amplify_thumb:eq("+autorotate+")").trigger("click",["auto"]);
		
		if (autorotate+2 > thumbsdisplayed * modifier || autorotate+2 > jQuery(".feature_thumbs .amplify_thumb").length)
		{	
			jQuery(".next_thumbs").trigger("click",["auto"]);
		}
		
	}
	
	function amplify_change_thumbs(click_event, auto)
	{	
		if (auto != "auto"){
		clearInterval(active_rotation);	
			}
		thumbnails = jQuery(".feature_thumbs .amplify_thumb_wrap");		
		show_segment = thumbsdisplayed * modifier;
		current_thumb_pos = show_segment - thumbsdisplayed;
		modifier = click_event.data == "next" ? modifier +1: modifier -1;
		
		if (modifier == 0){
			modifier = thumbnails.length/thumbsdisplayed;
			modifier = Math.ceil(modifier);			
			}
			
			
		if (modifier > Math.ceil(thumbnails.length/thumbsdisplayed)){
			modifier = 1;
			}
				
				
				
		thumbnails.slice(show_segment,thumbnails.length).css({display:"none"});
		thumbnails.slice(current_thumb_pos,show_segment).each(function(i)
		{
			jQuery(this).fadeOut(transition_duration,function()
			{
			show_segment = thumbsdisplayed * modifier;
			current_thumb_pos = show_segment - thumbsdisplayed;
			
			thumbnails.slice(current_thumb_pos,show_segment).fadeIn(transition_duration);
			});
	
		});
		
		current_thumb_pos += thumbsdisplayed;
	return false;	
	}
	
	
	function amplify_rotation(event, $auto)
	{	
	
		if (may_change == 0) return false;
		
		may_change = 0;
		if($auto != "auto")
		{
		clearInterval(active_rotation);
		}
				
		$image = jQuery(this);
		if ($image.hasClass("current_image")) {may_change = 1; return false};
		jQuery(".current_image").removeClass("current_image");
		$image.addClass("current_image");
		/*positioning of the soon to be cloned image*/
		$image_pos = $image.offset();
		$container = jQuery("#feature_area").offset();
		$new_pos_top  =  $image_pos.top - $container.top ;
		$new_pos_left =  $image_pos.left - $container.left;
		
		$imgwrap_y = jQuery(".imgwrap").height();
		$imgwrap_x = jQuery(".imgwrap").width();
		
		$animate_to = jQuery(".feature_image_container").offset();
		
		$own_center_y = $image.height()/2;
		$own_center_x = $image.width()/2;
		
		$animate_to_center_y = jQuery(".feature_image_container").height()/2;
		$animate_to_center_x = jQuery(".feature_image_container").width()/2;
		
		$step1 = $animate_to.top- $container.top + $animate_to_center_y - $own_center_y;
		$step2 = $animate_to.left - $container.left + $animate_to_center_x - $own_center_x;
		
		$step3 = $animate_to.top- $container.top +1; //+1 is a modifier because the new image does not have a border
		$step4 = $animate_to.left - $container.left +1;
		
		$number_of_image = $image.attr('id').replace(/amplify_thumb_/,"");
				
				
		/*cloning image and apllying styles*/
		$slidingImage = $image.clone().appendTo(jQuery("#feature_area")).css(
		{
			position:"absolute",
			top:$new_pos_top,
			left:$new_pos_left,
			zIndex:12
		});
		
		//not used anymore, could be used with resizing script
		//$img = $slidingImage.find(".thumbwrap img");
		//$img.attr('src',$img.attr('alt'));
	
		
		/*changing text that is displayed*/
		jQuery('.text_container:visible').fadeOut(transition_duration,function()
		   {
		   		jQuery(this).addClass('hidden').css({display:"none"});
				jQuery("#text_container_"+$number_of_image).css({display:"none"}).removeClass('hidden').fadeIn(transition_duration/2);
		   });
		
		$slidingImage.animate(
		{
			top:$step1,left:$step2
		
		},transition_duration,transition_easing, 
		function()
	    {
			
	
			
			jQuery(this).css({zIndex:3}).animate(
			{
				top:$step3,
				left:$step4,
				width:$animate_to_center_x*2,
				height:$animate_to_center_y*2
			},
				transition_duration,transition_easing); 
			
				call_lightbox_clone($auto);
				

			
jQuery(this).addClass('noborder_padding').find(".thumbwrap").removeClass("nojava_resize").animate(
			{
				width:$imgwrap_x,
				height:$imgwrap_y
				},
				transition_duration,transition_easing, function()
				{
				var items = jQuery(".amplify_thumb").not(".feature_thumbs .amplify_thumb");	
				may_change = 1;
				if(items.length > 3){	
				items.slice(0,1).remove();
				}
				});
		   });
		
		return false;
	}
	
}


function kriesi_mainmenu()
{
		jQuery("#nav a").removeAttr('title');
		jQuery(" #nav ul ").css({display: "none"}); // Opera Fix
		jQuery(" #nav li").hover(function()
		{
			jQuery(this).find('ul:first:hidden').css({visibility: "visible",display: "none"}).fadeIn(500);
		}
		,function()
		{
			jQuery(this).find('ul:first').css({visibility: "hidden"});
		});
}
					
		
		

function kriesi_tab(wrapper, header, content){
	var title = wrapper + " " + header;
	var container_to_hide = wrapper + " " + content;
	disable = false;
	

jQuery(title).css({display: "none"}).each(
					  function(i){
						 if (i == 0){
						jQuery(wrapper).prepend("<a href='/' class='heading_tab advanced_link active tab"+(i+1)+"'>"+jQuery(this).html()+"</a>");
							}else{
						jQuery(".advanced_link:last").after("<a href='/'class='heading_tab advanced_link tab"+(i+1)+"'>"+jQuery(this).html()+"</a>");
							}
						 }
					  );

jQuery(container_to_hide).each(
						 function(i){
						jQuery(this).addClass("tablist list_"+i); 
							if(i != 0){
								jQuery(this).css({display: "none"});
							}
						  }
					 );

jQuery(".advanced_link").each(
					  function(i){
						jQuery( this ).bind ("click",function(){
												if(jQuery(this).hasClass('active')){return false}
														 if(disable == false){disable = true;
														 jQuery(".advanced_link").removeClass("active");
														 jQuery(this).addClass("active");
														 
														 /*adaptation for slowfade*/	
														jQuery(".content_right .slowfade_mod").removeClass("slowfade_mod");
														jQuery(".content_right .slowfade").remove();										   
														jQuery(".heading_tab").slowfade({use_span_class:"slowfade",use_class:"slowfade_mod", add_inner_html:true});
																	/*end adaptation*/
														 
														 jQuery(container_to_hide+":visible").fadeOut(200,function(){
																		
																	
																	
																	jQuery(".list_"+i).fadeIn(200, function(){disable=false; });
																								   });
														 }
														 return false;

														 });
						  }
					  );
}







function call_lightbox_clone(action){
			if (action != "auto"){
			clearInterval(active_rotation);
			}
			jQuery("a[rel^='prettyPhoto'], a[rel^='lightbox']").not(".feature_thumbs .amplify_thumb a").prettyPhoto({theme:'dark_square',padding: 40});
	}
	

 
(function($)
{ 
	$.fn.slowfade = function(default_options) 
	{
		var defaults = 
		{  
			duration:400,
			opacity:1,
			add_inner_html:false, 	//set true for text links
			use_class:false, 		// set to classname
			use_span_class:false, 	// set to classname
			ie6comp:false 			//ie6 compatibility mode, used when ie6 is used and wrapping item has no fixed width, set to classname
		};  
		var default_options = $.extend(defaults, default_options); 
		
		return this.each(function()
		{	
			var my = $(this);
			var $pos = my.css("position") == "absolute" ? "absolute" : "relative";
			var $bg = my.css("background-position") === undefined ? my.css("background-position-x") + ' ' + my.css("background-position-y") : my.css("background-position");
			var $inner_html = default_options.add_inner_html ? my.text() : "";
			
			if(!default_options.use_class)
			{
				my.css({position:$pos, backgroundPosition:"right bottom"});
			}
			else
			{
				my.addClass(default_options.use_class);
			}
			
			if(!default_options.use_span_class)
			{
				$hover_replace = $('<span>'+$inner_html+'</span>').appendTo(my).css(
				{	
					height: my.height(), width: my.width(), backgroundImage: my.css("background-image"), backgroundPosition: $bg,
					cursor: "pointer", position:"absolute",top:"0",left:"0",display:"block"
				});
			}
			else
			{
				$hover_replace = $('<span class="'+default_options.use_span_class+'">'+$inner_html+'</span>').appendTo(my);
			}
			
			if(default_options.ie6comp && $.browser.msie && $.browser.version.substr(0,1)<7)
			{
				$hover_replace.css({height: my.height(), width: my.width()}).addClass(default_options.ie6comp);
			}
						
			
			$hover_replace.hover(
			function()
			{	
				$(this).stop().animate({opacity: 0},default_options.duration);	
				if(default_options.opacity != 1) my.stop().animate({opacity: default_options.opacity},default_options.duration);	
			},
			function()
			{
				$(this).stop().animate({opacity: 1},default_options.duration);
				if(default_options.opacity != 1) my.stop().animate({opacity: 1},default_options.duration);	

			});
		});	
	}
})(jQuery); 




/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2008 George McGinley Smith
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
*/

// 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 = 0.6;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 0.6;
		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;
	}
});

/*
 *
 * TERMS OF USE - EASING EQUATIONS
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2001 Robert Penner
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
 */
 
 