$('#st_debug').live('click',function () {
				$(this).html("").append('start').attr('id','start_debug');
				DEBUGPAD.debug("Debugging Stopped");
				DEBUGPAD.LOG_LEVEL = 0;
				return false;
			});
			$('#start_debug').live('click',function () {
				$(this).html("").append('stop').attr('id','st_debug');
				DEBUGPAD.LOG_LEVEL = 3;
				DEBUGPAD.debug("Debugging Resumed");
				return false;
			});
			$('#collapse').live('click',function () {
				$(this).html("").append('Expand').attr('id','expand');
				$('#debug_body').css('display','none');
				$('#'+DEBUGPAD.DEBUG_DIV).css('height','15px');
				$('#debug_title').css('height','15px');
				return false;
			});
			$('#expand').live('click',function () {
				$(this).html("").append('Collapse').attr('id','collapse');
				$('#debug_body').css('display','block');
				$('#'+DEBUGPAD.DEBUG_DIV).css('height','500px');
				$('#debug_title').css('height','15px');
				return false;
			});			
var DEBUGPAD  = {
		
		LOG_LEVEL : 0, //Other Options are INFO,DEBUG and ERROR. Debug
		DEBUG_DIV : "debugpad", 
		debug : function(data)
		{
			if(this.LOG_LEVEL == 3)
			{
				if(typeof(data) == 'Array')
				{
					for(var i in data)
					{
						if(this.LOG_LEVEL == 3)
						this.write("DEBUG :"+i,1);
					}
				}
				else
				{
					if(this.LOG_LEVEL == 3)
					this.write("DEBUG :"+data,1);
				}
			}
		},
		info : function(data)
		{
			if(this.LOG_LEVEL >= 2)
			{
				if(typeof(data) == 'Array')
				{
					for(var i in data)
					{
						if(this.LOG_LEVEL >= 2)
						this.write("INFO :"+i,2);
					}
				}
				else
				{
					if(this.LOG_LEVEL >= 2)
					this.write("INFO :"+data,2);
				}
			}
			
		},
		error : function(data)
		{
			if(this.LOG_LEVEL == 1)
			{
				if(typeof(data) == 'Array')
				{
					for(var i in data)
					{
						if(this.LOG_LEVEL == 1)
						this.write("ERROR :"+i,3);
					}
				}
				else
				{
					if(this.LOG_LEVEL == 1)
					this.write("ERROR :"+data,3);
				}
				
			}
		},
		write : function(message)
		{
			
			if($('#'+this.DEBUG_DIV).length == 0)
			{
				debugDiv = $(document.createElement("div")).attr("id",this.DEBUG_DIV);
				debugDiv.attr("style","background-color:#efefef;overflow:auto;height:400px;width:48%;top:50px;left:50%;position:fixed;z-index:1000;");
				debugTitle = $(document.createElement("div")).attr("id","debug_title").attr('style','width:48%;left:50%;top:50px;height:20px;position:fixed;padding-top:10px;padding-bottom:10px;background-color:#559999;color:#ffffff;');
				debugTitle.append("<b>Debugging Pad :-</b><a href='#' id='st_debug'>Stop</a>&#160;&#160;<a href='#' id='collapse'>Collapse</a>");
				debugDiv.append(debugTitle).appendTo('body');
				debugBody = $(document.createElement("div")).attr("id","debug_body");
				debugBody.attr("style","background-color:#efefef;overflow:scroll;height:400px;width:48%;top:70px;left:50%;position:fixed;z-index:1000;");
				debugDiv.append(debugBody);
				debugBody.append("<li style='list-style:none;margin-left:10px;'>"+message+"</li>");
				
				//debugDiv.scrollTo(0,debugDiv.scrollHeight);

			}
			else
			{
				
				$('#debug_body').append("<li style='list-style:none;margin-left:10px;'>"+message+"</li>");
				//$('#'+this.DEBUG_DIV).scrollTo(0,debugDiv.scrollHeight);
				/*$.getScript('/scripts/jquery.scrollTo-min.js', function() {
					
					  $('#debug_body').scrollTo(0,'100%');
					}); */		
			}	
			
		}
	
		
}

