var $core = {};

/**
 * Opensa qtip box
 * */
$core.init_qtip = function(qt)
{
   var the_id = qt.id;
   var the_text = $("#pop_"+the_id).html();
   var qt_pos = "middleLeft";
   var the_title = $(qt).text();
   var target_pos = "rightMiddle";
   var tip_pos = "leftMiddle";
   
   if(qt_pos == "topLeft"){
	target_pos = "rightTop";
	tip_pos = "leftBottom";
   }
   
   if(qt_pos == "middleLeft"){
	target_pos = "rightMiddle";
	tip_pos = "leftMiddle";
   }
   
   if(qt_pos == "middleRight"){
	target_pos = "leftMiddle";
	tip_pos = "rightMiddle";
   }
   
   if(qt_pos == "topRight"){
	target_pos = "leftTop";
	tip_pos = "rightBottom";
   }
   if(qt_pos == "bottomRight"){
	target_pos = "leftBottom";
	tip_pos = "rightTop";
   }
   
  
   
   // Match all link elements with href attributes within the content div
   $(qt).qtip({
	content: {
		text: the_text, // Give it some content, in this case a simple string
		title: {text: the_title}
	},
	hide: { when: 'mouseout', fixed: true, delay: 500  },
	classes: {content: "qtip-tip"},
	style: { 
      width: 300,
      padding: 5,
      
      color: 'black',
      textAlign: 'left',
      border: {
         width: 5,
         radius: 2,
         color: '#a1b62b'
      },
      tip: 'bottomMiddle',
      name: 'dark' // Inherit the rest of the attributes from the preset dark style
   },
    position: {
        target: false,
	corner: {
		target: 'bottomMiddle',
                tooltip: 'bottomMiddle'		
	    }
	}
   });
}


$(function(){
    
   //setsoff qtips
	$("li.qtip").mouseover(function(){
		$(this).qtip("show");	
	});
	
	$("#rotator a").click(function(){
         console.log("boo");
        });
	
	//sets up qtip DOM objects
	$("a.qtip").each(function(){
		
                $core.init_qtip(this);
	});
        

})
