jQuery(document).ready(function() {
 jQuery("a[rel^='prettyPhoto']:has(img) img").addClass("zoom");
 $(".cover").css('top',258);
 $(".cover").show();
 jQuery('.inputbox').addClass("idleInput");
 jQuery('.inputbox').focus(function() {
	jQuery(this).removeClass("idleInput").hide();
	jQuery(this).addClass("activeInput").show();
	if(this.value != this.defaultValue){
	    this.select();
	}
 });
 jQuery('.inputbox').blur(function() {
    jQuery(this).removeClass("activeInput").addClass("idleInput");
    if (jQuery.trim(this.value) == ''){
    	this.value = (this.defaultValue ? this.defaultValue : '');
    }
 });

 jQuery('.tooltip_image').tooltip(function (el) {
  var c = (el.anchor_title != "") ? "<br/>" + el.anchor_title : "";
  return "<img src='"+ el.alt +"' alt='a carregar...' />"+ c;
 }, {'tooltipID': 'tooltip'});

 jQuery('.tooltip_inline').tooltip(function (el) {
  return "<img src='"+ el.anchor_title +"' alt='a carregar...' />";
 }, {'tooltipID': 'tooltip_inline'});

 $('a[title].tooltip_preco').each(function() {
  $(this).qtip({
   content: $(this).attr('tooltip'),
   position: {
    corner: {
     target: 'leftMiddle',
    },
    adjust: {
     x:-280,
     y:-24
    },
   },
   show: { effect: { type: 'fade' } },
   style: {
    tip: {
     corner: 'rightMiddle', 
     size: {
      x: 20,
      y : 10
     }
    },
    name: 'capstyle'
   },
  });
 });

 $('a[title].tooltip_meio').each(function() {
  $(this).qtip({
   content: $(this).attr('tooltip'),
   position: {
    target: 'mouse',
    corner: {
     target: 'bottomRight',
    },
    adjust: {
     x:0,
     y:8
    },
   },
   show: { effect: { type: 'fade' } },
   style: {
    tip: {
     corner: 'topLeft', 
     size: {
      x: 10,
      y : 20
     }
    },
    name: 'capstyle'
   },
  });
 });

 $('a[title].tooltip_banner').each(function() {
  $(this).qtip({
   content: $(this).attr('tooltip'),
   position: {
    corner: {
     target: 'leftMiddle',
    },
    adjust: {
     x:-220,
     y:-140
    },
   },
   show: { effect: { type: 'fade' } },
   style: {
    tip: {
     corner: 'rightMiddle', 
     size: {
      x: 20,
      y : 10
     }
    },
    name: 'capstyle'
   },
  });
 });

 $('a[title].tooltip_header').each(function() {
  $(this).qtip({
   content: $(this).attr('tooltip'),
   position: {
    corner: {
     target: 'bottomMiddle',
    },
    adjust: {
     x:-80,
     y:-20
    },
   },
   show: { effect: { type: 'fade' } },
   style: {
    tip: {
     corner: 'topMiddle',
     size: { 
      x: 10,
      y: 20 
     }
    },
    name: 'capstyle'
   }
  });
 });

/*Sliding Boxes and Captions with JQuery
March 2009
By Sam Dunn
www.buildinternet.com / www.onemightyroar.com*/
//To switch directions up/down and left/right just place a "-" in front of the top/left attribute
//Vertical Sliding
 $('.boxgrid.slidedown').hover(function(){
 $(".cover", this).stop().animate({top:'-260px'},{queue:false,duration:300});
 }, function() {
  $(".cover", this).stop().animate({top:'0px'},{queue:false,duration:300});
 });
 //Horizontal Sliding
 $('.boxgrid.slideright').hover(function(){
 $(".cover", this).stop().animate({left:'325px'},{queue:false,duration:300});
 }, function() {
 $(".cover", this).stop().animate({left:'0px'},{queue:false,duration:300});
 });
 //Diagnal Sliding
 $('.boxgrid.thecombo').hover(function(){
 $(".cover", this).stop().animate({top:'260px', left:'325px'},{queue:false,duration:300});
 }, function() {
 $(".cover", this).stop().animate({top:'0px', left:'0px'},{queue:false,duration:300});
 });
 //Partial Sliding (Only show some of background)
 $('.boxgrid.peek').hover(function(){
 $(".cover", this).stop().animate({top:'90px'},{queue:false,duration:160});
 }, function() {
 $(".cover", this).stop().animate({top:'0px'},{queue:false,duration:160});
 });
 //Full Caption Sliding (Hidden to Visible)
 $('.boxgrid.captionfull').hover(function(){
 $(".cover", this).stop().animate({top:'300px'},{queue:false,duration:160});
 }, function() {
 $(".cover", this).stop().animate({top:'450px'},{queue:false,duration:160});
 });
 //Caption Sliding (Partially Hidden to Visible)
 $('.boxgrid.caption').hover(function(){
 $(".cover", this).stop().animate({top:'100px'},{queue:false,duration:160});
 }, function() {
 $(".cover", this).stop().animate({top:'220px'},{queue:false,duration:160});
 });
 //Full Caption Sliding (Hidden to Visible) dia do pai
 $('.boxgrid.captionddp').hover(function(){
 $(".cover", this).stop().animate({top:'160px'},{queue:false,duration:160});
 }, function() {
 $(".cover", this).stop().animate({top:'258px'},{queue:false,duration:160});
 });

});

$.fn.qtip.styles.capstyle = {
  width: {
   max: 250
  },
  padding: 5,
  tip: {
   corner: 'topMiddle', 
    size: {
     x: 10,
     y: 20
    }
   },
   border: {
    width: 8,
    radius: 4,
    color: '#46628c'
   },
   background: '#1b2536',
   color: '#fff',
}
