// jQuery slideDown Toggle function -  apply class jq-toggle to any next sibling element will slide up and down
$(function() {
	$(".jq-toggle").next().hide();
	
	$(".jq-toggle").css("cursor", "pointer");
	$(".jq-toggle").prepend("+ ");
	
	$(".jq-toggle").click(function() {
		$(this).next().slideToggle(1000);
		
		var v = $(this).html().substring( 0, 1 );
		if ( v == "+" )
			$(this).html( "-" + $(this).html().substring( 1 ) );
		else if ( v == "-" )
			$(this).html( "+" + $(this).html().substring( 1 ) );
	});
});


// jQuery tooltip function - apply class .tooltip to any elemant and will take title attribute as parameter
this.tooltip = function(){	
			
		xOffset = 10;
		yOffset = 20;		
		
	$(".tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

$(document).ready(function(){
	tooltip();
});



//// Outputs colorbox subscriber form for floorplan
$(document).ready(function(){
				$(".floorplan").colorbox();
			});

//// colorbox for exhibitors
$(document).ready(function(){
				$(".exhib-profiles").colorbox({width:"500px", height:"300px", iframe:true});
				});

// Columnzier initialiser - add class mcol2 to any ul
jQuery(document).ready(function($){
	$('.mcol2').makeacolumnlists({cols: 4, colWidth: 0, equalHeight: 'li', startN: 1});
});

$(function () {
	var apex = new Date(); 
	apex = new Date(apex.getFullYear(), 10 - 1, 4, 16); 
	
	$('#home-countdown').countdown({
		until: apex,
		timezone: +2,
		compact: true,
		format: 'dhMS',
		timeSeparator: '',
		compactLabels: ['', '', '', ''],
		layout: '<div class="count-days">{dnnn}</div>' + 
						'<div class="count-hours">{hnn}</div>' + 
						'<div class="count-mins">{mnn}</div>' + 
						'<div class="count-secs">{snn}</div>',
		serverSync: serverTime						
	}); 

	function serverTime() { 
    var time = null; 
    $.ajax({url: '/includes/time.php', 
        async: false, dataType: 'text', 
        success: function(text) { 
            time = new Date(text); 
        }, error: function(http, message, exc) { 
            time = new Date(); 
    }}); 
    return time; 
}
	
});

////top nav drop down div for left button UNCOMMENT TO ACTIVATE

//$(document).ready(function(){
//$("#top-nav-button-left").hover(function () {
//if ($("#top-nav-button-left-div").is(":hidden")) {
//$("#top-nav-button-left-div").slideDown(600);
//} else {
//$("#top-nav-button-left-div").hide();
//}
//});
//});
