// JavaScript Document
$(window).bind("load",function() {

 $('#lele-slide').jcarousel({
		scroll:3	,
		wrap: 'circular'
	});
     //start slideshow 
    $('#slide_home').cycle({ 
        timeout:  2000, 
       	speed: 2000
    }); 
	$('.sgdress_mid a').lightBox();
	
	$('#menu ul').lavaLamp({
						  // fx: 'backout',
                speed: 400,
				returnDelay:500,
                click: function(event, menuItem) {}
	});
   	$('#ctt_main form input').focus(function(){	
	var Bag = $(this).attr('id');
	var selfValue = Bag.substr(0);	
		if($(this).val() == selfValue){
			$(this).val('');
		}
	}).blur(function(){
	var Bag = $(this).attr('id');
	var selfValue = Bag.substr(0);
		if($(this).val() == ''){
			$(this).val(selfValue);
		}	
	});
	$('#ctt_main form textarea').focus(function(){	
	var Bag = $(this).attr('id');
	var selfValue = Bag.substr(0);	
		if($(this).text() == selfValue){
			$(this).text('');
		}
	}).blur(function(){
	var Bag = $(this).attr('id');
	var selfValue = Bag.substr(0);
		if($(this).text() == ''){
			$(this).text(selfValue);
		}	
	});
	$('#divText').jScrollPane();
	
	  $('#frm_ctt').validate({
            rules:{
                Nome:{
                    required: true,
                    minlength: 3
                },
                Email: {
                    required: true,
                    email: true
                }
            },
            messages:{
                Nome:{
                    required: "O campo nome é obrigatorio.",
                    minlength: "O campo nome deve conter no mínimo 3 caracteres."
                },
                Email: {
                    required: "O campo email é obrigatorio.",
                    email: "O campo email deve conter um email válido."
                }
            }
 
        });
	
		$('#loadDiv').fadeOut();
	$('#loadDiv').remove();

	
	$('div.navigation').css({'width' : '320px', 'float' : 'left'});
	$('div.content').css('display', 'block');
	
	 	var onMouseOutOpacity = 0.67;
				$('#thumbs ul.thumbs li').opacityrollover({
					mouseOutOpacity:   onMouseOutOpacity,
					mouseOverOpacity:  1.0,
					fadeSpeed:         'fast',
					exemptionSelector: '.selected'
				});
				
				// Initialize Advanced Galleriffic Gallery
				$('#thumbs').galleriffic({
					delay:                     2500,
					numThumbs:                 20,
					preloadAhead:              40,
					//enableTopPager:            true,
					enableBottomPager:         true,
					maxPagesToShow:           5,
					imageContainerSel:         '#slideshow',
					controlsContainerSel:      '#controls',
					captionContainerSel:       '#caption',
					loadingContainerSel:       '#loading',
					//renderSSControls:          true,
					//renderNavControls:         true,
					//playLinkText:              'Play Slideshow',
//					pauseLinkText:             'Pause Slideshow',
					prevLinkText:              '&lsaquo; Previous Photo',
					nextLinkText:              'Next Photo &rsaquo;',
					nextPageLinkText:          ' &rsaquo;',
					prevPageLinkText:          '&lsaquo; ',
					enableHistory:             false,
					autoStart:                 false,
					syncTransitions:           true,
					defaultTransitionDuration: 900,
					onSlideChange:             function(prevIndex, nextIndex) {
						// 'this' refers to the gallery, which is an extension of $('#thumbs')
						this.find('ul.thumbs').children()
							.eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end()
							.eq(nextIndex).fadeTo('fast', 1.0);
					},
					onPageTransitionOut:       function(callback) {
						this.fadeTo('fast', 0.0, callback);
					},
					onPageTransitionIn:        function() {
						this.fadeTo('fast', 1.0);
					}
				});
				

	
	
});
