var Geral = {

	__construct: function() {
		_this = Geral;
		$("input[type='text'],input[type='password'],textarea").resetDefaultValue();
		$("a.lightbox").lightBox();
	}

}

$(document).ready(function(){
	Geral.__construct();
	
	$('.j-img').cycle({ 
	fx:      'fade',
    delay:   -2000,
	timeout: 9000,
	next: '#seta-direita',
	prev: '#seta-esquerda'
	
	});
	
	
	//Portfolio ultimos trabalhos
	$('.bubbleInfo').each(function () {
	var distance = 10;
	var time = 250;
	var hideDelay = 300;
	
	var hideDelayTimer = null;
	
	var beingShown = false;
	var shown = false;
	var trigger = $('.trigger', this);
	var info = $('.popup', this).css('opacity', 0);
	
	
	$([trigger.get(0), info.get(0)]).mouseover(function () {
	if (hideDelayTimer) clearTimeout(hideDelayTimer);
	if (beingShown || shown) {
	return;
	} else {
	beingShown = true;
	
	info.css({
	top: -140,
	left: 33,
	display: 'block'
	}).animate({
	top: '-=' + distance + 'px',
	opacity: 2
	}, time, 'swing', function() {
	beingShown = false;
	shown = true;
	});
	}
	
	return false;
	}).mouseout(function () {
	if (hideDelayTimer) clearTimeout(hideDelayTimer);
	hideDelayTimer = setTimeout(function () {
	hideDelayTimer = null;
	info.animate({
	top: '-=' + distance + 'px',
	opacity: 0
	}, time, 'swing', function () {
	shown = false;
	info.css('display', 'none');
	});
	
	}, hideDelay);
	
	return false;
	});
	});
	
	
			//Portfolio ultimos trabalhos
	$('.box-potiguares').each(function () {
	var distance = 10;
	var time = 250;
	var hideDelay = 300;
	
	var hideDelayTimer = null;
	
	var beingShown = false;
	var shown = false;
	var trigger = $('.trigger', this);
	var info = $('.popup', this).css('opacity', 0);
	
	
	$([trigger.get(0), info.get(0)]).mouseover(function () {
	if (hideDelayTimer) clearTimeout(hideDelayTimer);
	if (beingShown || shown) {
	return;
	} else {
	beingShown = true;
	
	info.css({
	top: -140,
	left: 33,
	display: 'block'
	}).animate({
	top: '-=' + distance + 'px',
	opacity: 2
	}, time, 'swing', function() {
	beingShown = false;
	shown = true;
	});
	}
	
	return false;
	}).mouseout(function () {
	if (hideDelayTimer) clearTimeout(hideDelayTimer);
	hideDelayTimer = setTimeout(function () {
	hideDelayTimer = null;
	info.animate({
	top: '-=' + distance + 'px',
	opacity: 0
	}, time, 'swing', function () {
	shown = false;
	info.css('display', 'none');
	});
	
	}, hideDelay);
	
	return false;
	});
	});
	
	
		//Portfolio ultimos trabalhos
	$('.box-destaque').each(function () {
	var distance = 10;
	var time = 250;
	var hideDelay = 300;
	
	var hideDelayTimer = null;
	
	var beingShown = false;
	var shown = false;
	var trigger = $('.trigger', this);
	var info = $('.popup', this).css('opacity', 0);
	
	
	$([trigger.get(0), info.get(0)]).mouseover(function () {
	if (hideDelayTimer) clearTimeout(hideDelayTimer);
	if (beingShown || shown) {
	return;
	} else {
	beingShown = true;
	
	info.css({
	top: -140,
	left: 33,
	display: 'block'
	}).animate({
	top: '-=' + distance + 'px',
	opacity: 2
	}, time, 'swing', function() {
	beingShown = false;
	shown = true;
	});
	}
	
	return false;
	}).mouseout(function () {
	if (hideDelayTimer) clearTimeout(hideDelayTimer);
	hideDelayTimer = setTimeout(function () {
	hideDelayTimer = null;
	info.animate({
	top: '-=' + distance + 'px',
	opacity: 0
	}, time, 'swing', function () {
	shown = false;
	info.css('display', 'none');
	});
	
	}, hideDelay);
	
	return false;
	});
	});
	
	
	

	
	
	

	$('#enviar').click(function(){
		$form = $('#form-contato');
		end = $form.attr('action');
		//alert(end);
		
		$.post(end,
			   $form.serialize(),
			   function(data){
				   		$('#osx-modal-data p').html(data);
				   })
	})

});


