jQuery(document).ready(function() {
	// INIT Carosuel
	
	jQuery('#newproductlist').jcarousel({
		scroll: 5
	});
	
	jQuery('#featureddesignerslider').jcarousel({
		scroll: 5
	});
	
	jQuery('.hppopupbox').qtip({
		content: {
			text: '<div style="text-align: center"><strong>Loading...</strong><br /><img src="/wp-content/themes/DTS/images/popuploading.gif" alt="" /></div>',
		},
		hide: {
			fixed: true,
			delay: 500,
			effect: function(offset) {
		    	jQuery(this).fadeOut(200); // "this" refers to the tooltip
			}
		},
		show: {
			solo: true,
			target : false
		},
		position: {
			my: 'bottom center',
			at: 'top center'
		},
		events: {
			render: function(event, api) {
				// Grab the BGIFrame element
				var elem = api.elements.bgiframe;
			}
		},
		style: {
			classes: 'ui-tooltip-light ui-tooltip-shadow ui-tooltip-rounded'
		}
	}).bind('mouseenter', function(event){
		var api = jQuery(this).qtip();
		jQuery.ajax({
			type: "POST",
			url: "/wp-content/themes/DTS/ajax/getfeaturedproductinfo.php",
			data: "id=" + jQuery(this).attr("rel"),
			beforeSend: function() {
				api.set('content.text', '<div style="text-align: center"><strong>Loading...</strong><br /><img src="/wp-content/themes/DTS/images/popuploading.gif" alt="" /></div>');
				api.show(event);
			},
			success: function(msg){
				api.set('content.text', msg);
			}
		});
	});
	
	if (jQuery('#isloggedin').val()==0) { 					// User isn't logged in
		initRegisterBox();
	}
});
