$(document).ready(function() {
  $('a.buttonbox').each(function() {
    $(this).fancybox({
    'hideOnContentClick': false,
    'frameWidth': parseInt($(this).attr("width")),
    'frameHeight': parseInt($(this).attr("height"))
  })});

  $('a.fancybox').fancybox({
    'hideOnContentClick': false,
    'frameWidth': 640,
    'frameHeight': 400
  });

  $('a.affdetailbox').fancybox({
    'hideOnContentClick': false,
    'frameWidth': 800,
    'frameHeight': 500
  });
  
  $("#siteswitcher").fancybox({
  	frameWidth: 400,
  	frameHeight: 150,
  	enableEscapeButton: true,
  	hideOnContentClick: false
	});

  $('a.customerbox').fancybox({
    'hideOnContentClick': false,
    'frameWidth': 640,
    'frameHeight': 400
  });

  $('a[modal]').fancybox({
    'hideOnContentClick': false,
    'frameWidth': 640,
    'frameHeight': 400
  }); 

  $('input[tooltip],textarea[tooltip],select[tooltip]').each(function() {
    $(this).qtip({
      show: { 
        when: 'focus', 
        solo: true // Only show one tooltip at a time
      },
      hide: 'unfocus',
      content: jQuery(this).attr('tooltip'), // Use the tooltip attribute of the element for the content
      position: {
        corner: {
          target: 'rightMiddle',
          tooltip: 'leftMiddle'
        }
      },
      style: { 
        width: 300,
        padding: 10,
        background: '#E2EFF8',
        color: 'black',
        textAlign: 'left',
        border: {
          width: 7,
          radius: 7,
          color: '#588CE2'
        },
        tip: 'leftMiddle',
        name: 'dark'
      }
    });
  });
});
