$(document).ready(function(){
	$(".pwdlink").colorbox({inline:true, href:"#pwd_pop"});
});

$(function(){
	$('#cats').hide();
	
	// Dialog
	$('#dialog_link').dialog({
		autoOpen: false,
		width: 600,
		buttons: {
			"Close": function() { 
				$(this).dialog("close"); 
			} 
		}
	});

	// Dialog
	$('#reply_dlg').dialog({
		autoOpen: false,
		width: 600,
		buttons: {
			"Close": function() { 
				$(this).dialog("close"); 
			} 
		}
	});


	$('#adminnav').click(function(){
		$('#dialog_link').dialog('open');
		return false;		
	})
	
	// Accordion
	$("#accordion").accordion({ 
		header: "h3",
		autoHeight: false
	});
	
	// Accordion
	$("#accordion2").accordion({ 
		header: "h3",
		autoHeight: false
	});
	
	$('#showcats').click(function(){
		$('#cats').show(500);
	});
	$('#showcats2').click(function(){
		$('#cats').show(500);
	});
	
	
	// expose the form when it's clicked or cursor is focused 
	$("form.xpose").bind("click keydown", function() { 
		$(this).expose({ 

			// custom mask settings with CSS 
			maskId: 'mask', 

			// when exposing is done, change form's background color 
			onLoad: function() { 
			this.getExposed().css({backgroundColor: '#8A1C25'}); 
			}, 

			// when "unexposed", return to original background color 
			onClose: function() { 
			this.getExposed().css({backgroundColor: null}); 
			}, 

			api: true 

		}).load(); 
	}); 
	
});

function msgSelect(imid, pos, max) {
	$.get('/inbox/rm/' + String(imid) );
	var el = document.getElementById("msg" + String(imid));
	el.style.fontWeight = "normal";
	
	for(var x = 0; x < max; x++) {
		var el = document.getElementById("replyMsg"  + String(x));
		el.style.display = "none";
	}
	var el = document.getElementById("replyMsg"  + String(pos));
	el.style.display = "block";
}

function replyMsg(msgId) {
	document.location.href='/inbox/reply/' + String(msgId);
	return false;
}
