function deleteConfirm(t) {
	return confirm('Are you sure you want to delete ' + t);
}


function setStyle(object,newStyle) {
	object.className = newStyle;
}


function saveComments(object,ticketCode) {
	var url = '/data.asmx/SaveComments';
	var pars = 'memberID=' + MemberID + '&ticketCode=' + ticketCode + '&text=' + $F(object);
	var myAjax = new Ajax.Request(
		url, 
		{
			method: 'post', 
			parameters: pars, 
			onComplete: commentsResponse
		});
}
var commentsHandlers = {
	onCreate: function(){
		
	},

	onComplete: function() {
		if(Ajax.activeRequestCount == 0){
			
		}
	}
};
function commentsResponse(originalRequest)
{
	var x = originalRequest.responseText.stripTags();
	x = x.trim();
	if (x=="ok") {
		//alert("ok");
	} else {
		alert("There was a problem saving your comment. Please try again later");
	}
}
Ajax.Responders.register(commentsHandlers);



function signupResponse(originalRequest)
{
	var x = parseInt(originalRequest.responseText.stripTags());
	switch(x) {
		case 0:
			//do nothing
			Element.hide('usedName');
			Element.hide('invalidName');
			break;
		case 1:
			Element.show('usedName');
			Element.hide('invalidName');
			break;
		case 2:
			Element.hide('usedName');
			Element.show('invalidName');
			break;
	}	
}

var signupHandlers = {
	onCreate: function(){
		Element.hide('usedName');
		Element.hide('invalidName');
		Element.show('checkingName');
	},

	onComplete: function() {
		if(Ajax.activeRequestCount == 0){
			Element.hide('checkingName');
		}
	}
};


function togglePanel(whichOne) {
	Element.visible(whichOne) ? Element.hide(whichOne) : Element.show(whichOne);
}


function imgSwp(imgID,state)
{
	$(imgID).src = "/images/" + imgID + state.toString() + ".gif";
}


function checkFieldBGStyle(obj,className) {
	if ($F(obj) != '') Element.removeClassName(obj,className);
}


function formatString() {
	targetString = arguments[0];
	if (arguments.length > 1) {
		for(i=1;i<arguments.length;i++) {
			targetString = targetString.split('{' + eval(i-1) + '}').join(arguments[i]);			
		}
	} else {
		alert("missing arguments!");
	}
	return targetString;
}


