// ================================================
// = Frogzog. Unified Theme. Connect Specific JS. =
// ================================================

// req'd js
/* jquery.js, jquery.unified.js, pngfix.js (for ie < 7) */
// req'd css
/* unified.css, unified_connect.css, unified_connect.css */

// ajax requests defaults
$.ajaxSetup({ error: function(xml_http_request, text_status, error_thrown) { alert('AJAX error: request failed. (' + text_status + ').'); } });

// on ready
$(document).ready(function() {
	// apply all merchant unified theme bindings
	setTimeout('fzuc_bind()', 50);
});

// fzuc, apply all bindings
function fzuc_bind(context) {
	// apply all unified theme bindings
	fzu_bind(context);
}

// refresh content
function fzuc_contentRefresh(content_id) {
	// set loading
	$('#' + content_id).addClass('loading');
	// load content
	$.ajax({ dataType: 'html', type: 'GET', url: '/connect/account/' + content_id + '/list', success: function(html) { $('#' + content_id).removeClass('loading').html(html); fzuc_bind($('#' + content_id)); } });
}

// refresh message content
function fzuc_messagesRefresh() {
	// set loading
	$('#messages').addClass('loading');
	// load content
	$.ajax({ dataType: 'html', type: 'GET', url: '/connect/account/messages/list', success: function(html) { $('#messages').removeClass('loading').html(html); fzuc_bind($('#messages')); } });
}

// refresh notifications content
function fzuc_notificationsRefresh() {
	// set loading
	$('#notifications').addClass('loading');
	// load content
	$.ajax({ dataType: 'html', type: 'GET', url: '/connect/account/notifications/list', success: function(html) { $('#notifications').removeClass('loading').html(html); fzuc_bind($('#notifications')); } });
}
