/* ********* */
/* ALERTS */
/* ********* */
function showAlert(msg,type) {
	$(".GoodAlert").fadeOut(100);
	$(".BadAlert").fadeOut(100);
	myobj = '\
		<div class="'+type+'Alert">\
			<div class="AlertInside">\
				<img src="/images/template/hide.png" alt="HIDE ^" border="0" align="right" vspace="0" style="padding-left: 15px;"/>\
				'+msg+'\
			</div>\
		</div>\
	';

	var alertBox = $(myobj), alertTimer;
	alertBox.fadeTo(600,0.90).click(function(){
		if(alertTimer) clearTimeout(alertTimer);
		alertBox.fadeOut(400);
		t=false;
	});
	alertTimer = setTimeout(function(){alertBox.fadeOut(400);t=false;},6000);
	$("body").prepend(alertBox);
}

$().ready(function() {
	$("input:radio").css({"display":"none"});
	$("input:radio").before("<div class=\'radio\'></div>");
	$("input:radio:checked").prev(".radio").removeClass("radio").addClass("radioOn");
	$("input:radio").change(function() {
		if($(this).attr("checked")) {
			var fieldName = $(this).attr("name");
			$("input[name="+fieldName+"]").prev(".radio, .radioOn").removeClass("radio radioOn").addClass("radio");
			$(this).prev(".radio, .radioOn").removeClass("radio, radioOn").addClass("radioOn");
		}
	});
	$(".radio, .radioOn").click(function() {
		theRadio = $(this).next("input:radio");
		$(theRadio).attr("checked","checked");
		if($(theRadio).attr("checked")) {
			var fieldName = $(theRadio).attr("name");
			$("input[name="+fieldName+"]").prev(".radio, .radioOn").removeClass("radio radioOn").addClass("radio");
			$(theRadio).prev(".radio, .radioOn").removeClass("radio, radioOn").addClass("radioOn");
		}
	});
});
