﻿/// <reference path="jQuery-1.4.1.js"/>

/*
* Global Scripts
*/
function toggleD(item) {
	jQuery(item).toggle();
}

function newWin(url) {
	blankWin = window.open(url, '_blank', 'menubar=yes,toolbar=yes,location=yes,directories=yes,fullscreen=no,titlebar=yes,hotkeys=yes,status=yes,scrollbars=yes,resizable=yes');
}

function uriEncode(value) {
	return encodeURIComponent(value).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A');
}

// AJAX loading indicator
$(function () {
	$("#ajaxLoading").bind("ajaxSend", function () {
		$(this).show();
	}).bind("ajaxComplete", function () {
		$(this).hide();
	});
});

function ajaxFail(msg) {
	var errorText = msg.status + ': ' + msg.statusText;
	if (msg.ErrorText != '') {
		errorText = msg.ErrorText;
	}

	$("#dialog").dialog('option', 'title', 'Error');
	$("#dialog").html('<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>' + errorText + '</p>');
	$("#dialog").dialog('option', 'buttons', [
			{
				text: "Close",
				click: function () {
					$(this).dialog('close');
				}
			}
		]);
	$("#dialog").dialog('open');
}
