// JavaScript Document
include('jquery/jquery-1.4.2.min.js') ;
include('jquery/jquery.easing.min.js') ;
include('jquery/jquery.cycle.min.js') ;
include('jquery/jquery.flash.js') ;

(function($){
	$.fn.ajax_submit = function(retfunc){
	retfunc = retfunc ? retfunc : function(__s){ return ;}
	$(this).submit(function(){
		__form		= $(this) ;
		__uri 		= __form.attr('action') ? __form.attr('action') : '#' ;
		__method 	= __form.attr('method') ? __form.attr('method').toUpperCase()  : 'POST';
		__data		= __form.serialize() ;
		__uri		= __method=='POST' ? __uri : __uri + '?'+__data ;
		$.ajax({    type: __method   ,url: __uri  ,data: __data   ,success: function(__s){ retfunc(__s,__form) }}) ;
		return false ;
	})
}
})(jQuery);

$(function(){

	$('.scroller').cycle({
			fx:     'scrollDown, scrollRight, scrollUp, scrollLeft',
			speed:  1500, 
			timeout: 4000,
			random: 0,
			pager:  '.scroller-nav',
			pagerAnchorBuilder: function(idx, slide) { 
				return '<a href="#'+idx+'"></a>'; 
			}
	})
	
	$('.footer-contact-ajax,.ajax-form-livre-dor').ajax_submit(function(_s){		alert(_s);	})
	window.setTimeout(function(){
			$('.gallery').flash({ 	swf: 'swf/simpleviewer.swf'		,height: 400,width: 840
			,wmode: 'transparent', menu : "false",	allowscriptaccess : "sameDomain"
			,allowFullScreen: true	,flashvars: {	galleryURL : "gallery.xml"} })		
		
		if($('.links-cont').length > 0){
			$.ajax({url:'links.html',type:'get'	,success: function(data) { 	$('.links-cont').html(data)	}})
		}
		if($('.welcome-links-cont').length > 0){
			$.ajax({url:'home-links.html',type:'get'	,success: function(data) { 	$('.welcome-links-cont').html(data)	}})
		}
	},300)
	
})
