$(document).ready(function(){


	// PNG fix
		$(document).pngFix();

	// Shadowbox initialize	
	Shadowbox.init({
		handleOversize:     "drag",
		displayNav:         true,
		handleUnsupported:  "remove",
		continuous:         true
	});
	
});


$(document).ready(function() {
	

	function megaHoverOver(){
		$(this).find(".sub").stop().fadeTo('fast', 1).show();
			
		//Calculate width of all ul's
		(function($) { 
			jQuery.fn.calcSubWidth = function() {
				rowWidth = 0;
				//Calculate row
				$(this).find("ul").each(function() {					
					rowWidth += $(this).width(); 
				});	
			};
		})(jQuery); 
		
		if ( $(this).find(".row").length > 0 ) { //If row exists...
			var biggestRow = 0;	
			//Calculate each row
			$(this).find(".row").each(function() {							   
				$(this).calcSubWidth();
				//Find biggest row
				if(rowWidth > biggestRow) {
					biggestRow = rowWidth;
				}
			});
			//Set width
			$(this).find(".sub").css({'width' :biggestRow});
			$(this).find(".row:last").css({'margin':'0'});
			
		} else { //If row does not exist...
			
			$(this).calcSubWidth();
			//Set Width
			$(this).find(".sub").css({'width' : rowWidth});
			
		}
	}
	
	function megaHoverOut(){ 
	  $(this).find(".sub").stop().fadeTo('fast', 0, function() {
		  $(this).hide(); 
	  });
	}


	var config = {    
		 sensitivity: 1000, // number = sensitivity threshold (must be 1 or higher)    
		 interval: 0, // number = milliseconds for onMouseOver polling interval    
		 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)    
		 timeout: 0, // number = milliseconds delay before onMouseOut    
		 out: megaHoverOut // function = onMouseOut callback (REQUIRED)    
	};

	$("ul#topnav li .sub").css({'opacity':'0'});
	$("ul#topnav li").hoverIntent(config);


});



	$(document).ready(function() {
		$('#coin-slider').coinslider({ 
										width: 1000, // width of slider panel
										height: 150, // height of slider panel
										spw: 8, // squares per width
										sph: 4, // squares per height
										delay: 6000, // delay between images in ms
										sDelay: 30, // delay beetwen squares in ms
										opacity: 1, // opacity of title and navigation. defalt= 0.7
										titleSpeed: 500, // speed of title appereance in ms
										effect: 'rain', // random, swirl, rain, straight
										navigation: true, // prev next and buttons
										links : true, // show images as links 
										hoverPause: true // pause on hover
									 });
	});





$(document).ready(function() {  
     setHeight('.col');  
 });  
   
 //global variable, this will store the highest height value  
 var maxHeight = 0;  
   
 function setHeight(col) {  
     //Get all the element with class = col  
     col = $(col);  
       
     //Loop all the col  
     col.each(function() {          
       
         //Store the highest value  
         if($(this).height() > maxHeight) {  
             maxHeight = $(this).height();;  
         }  
     });  
       
     //Set the height  
     col.height(maxHeight);  
};

// $(document).ready(function() {  
//      setHeight2('.col2');  
//  });  
//    
//  //global variable, this will store the highest height value  
//  var maxHeight2 = 0;  
//    
//  function setHeight2(col2) {  
//      //Get all the element with class = col  
//      col2 = $(col2);  
//        
//      //Loop all the col  
//      col2.each(function() {          
//        
//          //Store the highest value  
//          if($(this).height() > maxHeight2) {  
//              maxHeight2 = $(this).height();;  
//          }  
//      });  
//        
//      //Set the height  
//      col2.height(maxHeight2);  
// };

$(document).ready(function() {
	$(".tooltips").hover(
		function() { $(this).contents("span:last-child").css({ display: "block" }); },
		function() { $(this).contents("span:last-child").css({ display: "none" }); }
	);
	$(".tooltips").mousemove(function(e) {
		var mousex = e.pageX -290;
		var mousey = e.pageY -140;
		$(this).contents("span:last-child").css({  top: mousey, left: mousex });
	});
});
