function stripslashes(str) {
	str=str.replace(/\\'/g,'\'');
	str=str.replace(/\\"/g,'"');
	str=str.replace(/\\\\/g,'\\');
	str=str.replace(/\\0/g,'\0');
	return str;
}
function get_pag(program,container){
	$('#loading').show();
	$("#"+container).html('');
	$.ajax({
      type: "POST",
      dataType: "html",
      url: program,
	  timeout: 12000,
      success: function(data){
          	$("#"+container).html(data);
			$('#loading').hide();
      }
    })
}
function escapeURI(u){
	if(encodeURIComponent){
		return encodeURIComponent(u);
	}
	if(escape){
		return escape(u);
	}
}
function htmlspecialchars(text){
	if(typeof(text)=='undefined'||!text.toString){
		return'';
	}
	if(text===false){
		return'0';
	}else if(
		text===true
	){
		return'1';
	}
	return text.toString().replace(/&/g,'&amp;').replace(/"/g,'&quot;').replace(/'/g,'&#039;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
}
function confirmReject(confirmMsg, rejectLink) { if(confirm(confirmMsg)) { self.location=rejectLink;}return true}
(function($) {
	$.fn.toggleVal = function(theOptions) {
		theOptions = $.extend({
			focusClass: "tv-focused",
			changedClass: "tv-changed",
			populateFrom: "default",
			removeLabels: false
		}, theOptions);
		return this.each(function() {
			var defText = "";
			switch(theOptions.populateFrom) {
				case "alt":
					defText = $(this).attr("alt");
					$(this).val(defText);
					break
				case "label":
					defText = $("label[for='" + $(this).attr("id") + "']").text();
					$(this).val(defText);
					break
				default:
					defText = $(this).val();
			}
			$(this).addClass("toggleval");
			if(theOptions.removeLabels == true) { $("label[for='" + $(this).attr("id") + "']").remove(); }
			$(this).focus(function() {
				if($(this).val() == defText) { $(this).val(""); }
				$(this).addClass(theOptions.focusClass).removeClass(theOptions.changedClass);
			}).blur(function() {
				if($(this).val() == "") { $(this).val(defText); }
				$(this).removeClass(theOptions.focusClass);
				if($(this).val() != defText) { $(this).addClass(theOptions.changedClass); }
					else { $(this).removeClass(theOptions.changedClass); }
			});
		});
	};
})(jQuery);

