$(document).ready(function() {

         $('.social img,a#map-inline').tipsy({fade: true});

	// Button Hover
	if($.browser.msie && $.browser.version == "7.0") {
		$(".action_buttons ul li a.action_button1, #newsletter button.submit,#content .column img, .social ul li,.columns a.more_button, .form_input button,a.tour_button,.botttom_contact img,a#contactform-inline").css("padding-top", "0px");
	} else {
		jQuery('.action_buttons ul li a.action_button1,.action_buttons ul li a.action_button2, #newsletter button.submit, #content .column img, #content .column_last img, .social ul li,.columns a.more_button, .form_input button,a.tour_button,.botttom_contact img,a#contactform-inline').hover(
			function() { jQuery(this).stop().animate({opacity:0.6},400); },
			function() { jQuery(this).stop().animate({opacity:1},400); }
		);
	}

});



/***************************************************
		IMAGE ZOOM
***************************************************/
$(document).ready(function() {
	$("a.zoom img").mouseover(function(){
		$(this).stop(true,true);
		$(this).fadeTo(300, 0.5);
	});

	$("a.zoom img").mouseout(function(){
		$(this).fadeTo(400, 1.0);
	});
	
		// FancyBox
		$("a#map-inline,a#contactform-inline").fancybox({
			'transitionIn'		:'elastic',
			'overlayShow'		:true,
			'speedIn'			:600,
			'titleShow':false
		});
		
		
		
	// nivo slider ------------------------------------------------------ //

	$('#slider').nivoSlider({
		effect:'random', //Specify sets like: 'fold,fade,sliceDown'
        slices:15,
        animSpeed:500, //Slide transition speed
        pauseTime:3000,
        startSlide:0, //Set starting Slide (0 index)
        directionNav:true, //Next & Prev
        directionNavHide:true, //Only show on hover
        controlNav:true, //1,2,3...
        controlNavThumbs:false, //Use thumbnails for Control Nav
        controlNavThumbsFromRel:false, //Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', //Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
        keyboardNav:true, //Use left & right arrows
        pauseOnHover:true, //Stop animation while hovering
        manualAdvance: false, //Force manual transitions
        captionOpacity:0.7 //Universal caption opacity
	});



});






  // Twitter script config


	getTwitters('twitter', {
        id: 'khon_kaen',
        count: 3,
        enableLinks: true,
        ignoreReplies: false,
        template: '<span class="twitterPrefix"><span class="twitterStatus">%text%</span>',
        newwindow: true

 	});

	$('#testimonial').cycle({
 		fx:'fade',
 		timeout:4000
 	});
 	


		$(function(){
			$("#tabset1").buildMbTabset({
				stop:function(){if ($("#array").is(":checked")) alert($.mbTabset.mbTabsetArray)},
				sortable:true
			});
			$("#tabset2").buildMbTabset({
				stop:function(){if ($("#array").is(":checked")) alert($.mbTabset.mbTabsetArray)},
				sortable:false,
				position:"left"
			});
			//$("#b").selectMbTab();
		});
    var ajaxUrl="content_2.html";
    var ajaxD="pippo=1&pluto=2";




/***************************************************
		PRETTYPHOTO  & Ajax contact form
***************************************************/

$(document).ready(function(){
	$("a[rel^='prettyPhoto']").prettyPhoto({animationSpeed:'slow',theme:'light_square',autoplay_slideshow: false});
	
	
		//Ajax Contact Form Submission
		$("#ajax-contact-form").submit(function(){
		var str = $(this).serialize();
		   $.ajax({
		   type: "POST",
		   url: "contact/contact.php",
		   data: str,
		   success: function(msg){
			$("#notification").ajaxComplete(function(event, request, settings){
			if(msg == 'OK') // Message Sent? Show the 'Thank You' message and hide the form
			{
			result = '<div class="notification_ok">Your message has been sent. Thank you!</div>';
			$("#fields").hide();
			}
			else
			{
			result = msg;
			}
			$(this).html(result);
			});
			}
		 });
		return false;
		});
});


		$(document).ready(function() {
			// Save  the jQuery objects for later use.
			var outer		= $("#preview_outer");
			var arrow		= $("#arrow");
			var thumbs		= $("#thumbs span");

			var preview_pos;
			var preview_els	= $("#preview_inner div");
			var image_width	= preview_els.eq(0).width(); // Get width of imaages

			// Hook up the click event
			thumbs.click(function() {
				// Get position of current image
				preview_pos = preview_els.eq( thumbs.index( this) ).position();

				// Animate them!
				outer.stop().animate( {'scrollLeft' : preview_pos.left},	500 );
				arrow.stop().animate( {'left' : $(this).position().left },	500 );
			});

			// Reset positions on load
			arrow.css( {'left' : thumbs.eq(0).position().left } ).show();
			outer.animate( {'scrollLeft' : 0}, 0 );

			// Set initial width
			$("#preview_inner").css('width', preview_els.length * image_width);
		});



