//conversões e comportamentos via classe
$(function(){

  $("form.jumpmenu").submit(function() {
      var sel = $('.locations option:selected')
      if (sel != '') {
          location.href=$(this).attr("action") + '/' + sel.attr('value');
      }
      return false;
  });

	$('.msie6 .png2gif').each(function() {
		var convert = $(this).css('background-image')
		//var convert = $(this).attr('src')
		convert = String(convert).replace('.png','.gif');
		$(this).css('background-image',convert).removeClass('hideIE6');
		//$(this).attr('src',convert).removeClass('hideIE6');
	})

	$('.msie6 .png2gifImg').each(function() {
		var convert = $(this).attr('src')
		convert = String(convert).replace('.png','.gif');
		$(this).attr('src',convert).removeClass('hideIE6');
	})

	$('.valign').each(function() {
		var circ = $(this).height() / 2;
		$(this).css({
			'margin-top' : -circ,
			'top' : '50%'
		})
		$(this).removeClass('valign')
	})

	$('.halign').each(function() {
		var circ = $(this).width() / 2;
		$(this).css({
			'margin-left' : -circ,
			'left' : '50%'
		})
		$(this).removeClass('halign')
	})

/** Binds da home **/
	$('#openSocio').click(function() {

		/*if($('#miniForms').hasClass('hide')) {
			//corrigindo IE 6 select´s bug
			$('.msie6 #dropCity').addClass('invisible');
			parent.$('.msie6 #dropCity').addClass('invisible');
			parent.$('.miniLoginIframe').addClass('open');
			//exbindo o bg e o form
			$('#miniForms').toggleClass('hide');
			$('#miniLogin').toggleClass('hide');

		}else{
			//corrigindo IE 6 select´s bug
			parent.$('.msie6 #dropCity').removeClass('invisible');
			parent.$('.miniLoginIframe').removeClass('open');
			//ocultando tudo
			$('#miniLogin').addClass('hide');
			$('#miniForget').addClass('hide');
			$('#miniForms').addClass('hide');

		}	*/
		parent.document.location = '../login.php'

	})

	$('#miniLogin .forgetPassword').click(function() {
			$('#miniLogin').toggleClass('hide');
			$('#miniForget').toggleClass('hide');
	})



	$('.focusEmpty').focus(function() { $(this).val('') })
	$('.focusEmpty').blur(function() { if($(this).val() == '') $(this).val($(this).attr('title')) })



	$('#motivosList .btRight').bind('click',function() {
		var nextSnap = $('#motivosList ul li').next('.snap').offset()
		nextSnap = nextSnap.left

		var startSnap = $('#motivosList ul').offset()
		startSnap = startSnap.left

		$('#motivosList ul').animate({left:startSnap-nextSnap},700)

	})

	$('#motivosList .btLeft').bind('click',function() {
		var prevSnap = $('#motivosList ul li').prev('.snap').offset()
		prevSnap = prevSnap.left

		var startSnap = $('#motivosList ul').offset()
		startSnap = startSnap.left

		$('#motivosList ul').animate({left:startSnap-prevSnap},700)

	})



/**Binds SEJA SÓCIO **/
	$('#motivosTool li').bind('mousemove',function(e) {
		$('#tooltip').addClass('visible')
		$('#tooltip span').html($(this).children('span').html())
		$('#tooltip').css({left:e.pageX - 50 - 155,top:e.pageY})
	})

	$('#motivosTool').bind('mouseleave',function(e) {
		$('#tooltip').removeClass('visible')
	})

/**Binds UNIDADE INTERNA **/
	$('#miniIcons li').bind('mousemove',function(e) {
		$('#tooltip').addClass('visible')
		$('#tooltip span').html($(this).children('span').html())
		$('#tooltip').css({left:e.pageX + 20,top:e.pageY})
	})

	$('#miniIcons').bind('mouseleave',function(e) {
		$('#tooltip').removeClass('visible')
	})


/** FLASHS **/
	// swfobject.embedSWF("/swf/valor.swf", "flashSmart", "100%", "100%", "9.0.0",null, {preco:$('#valueSmart').html(),escuro:'0xFFA400',claro:'0xFFC800',titulo:$('#fraseSmart').html()}, {wmode:'transparent'}, null);
	// swfobject.embedSWF("/swf/valor.swf", "flashBlack", "100%", "100%", "9.0.0",null, {preco:$('#valueBlack').html(),escuro:'0xFFA400',claro:'0xFFC800',titulo:$('#fraseBlack').html()}, {wmode:'transparent'}, null);
	// swfobject.embedSWF("/swf/signFess.swf", "signFess", "65", "13", "9.0.0",null,null,{wmode:"transparent"});

});
