var lsPanelClass = new Class({	
	initialize: function(){
		
	},
	
	putText: function(obj,text) {
		obj=$(obj);
		obj.insertAtCursor(text);
	}, 
	
	putTag: function(obj,tag) {
		this.putText(obj,'<'+tag+'/>');
	},
	
	putTextAround: function(obj,textStart,textEnd) {
		obj=$(obj);
		obj.insertAroundCursor({
			before: textStart,
			defaultMiddle: '',
			after: textEnd
		});
	},
	
	putTagAround: function(obj,tagStart,tagEnd) {
		if (!tagEnd) {
			tagEnd=tagStart;
		}
		this.putTextAround(obj,'<'+tagStart+'>','</'+tagEnd+'>');
	},
	
	putTagUrl: function(obj,sPromt) {
		obj=$(obj);
		if (url=prompt(sPromt,'http://')) {
			var sel=obj.getSelectedText();
        	this.putText(obj,'<a href="'+url+'">'+sel+'</a>');
        }
		}, 
 	       
 	    putQuote: function(obj) { 
 	    obj=$(obj); 
 	    if (selText=window.getSelected()) {                      
 	this.putText(obj,'<blockquote>'+selText+'</blockquote>'); 
 	} else { 
 	this.putTagAround(obj,'blockquote'); 
 	}
	} ,
	putTagImg: function(obj,sPromt) {
                obj=$(obj);
                if (url=prompt(sPromt,'http://')) {
                this.putText(obj,'<img src="'+url+'">');
        }
        },
	putTagUrlsound: function(obj,sPromt) {
		obj=$(obj);
		if (url=prompt(sPromt,'http://')) {
			var sel=obj.getSelectedText();
        	this.putText(obj,'<object type="application/x-shockwave-flash" data="http://flv-mp3.com/i/pic/ump3player_500x70.swf" height="60" width="400"><param name="wmode" VALUE="transparent" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="movie" value="http://flv-mp3.com/i/pic/ump3player_500x70.swf" /><param name="FlashVars" value="way='+url+'&amp;swf=http://flv-mp3.com/i/pic/ump3player_500x70.swf&amp;w=400&amp;h=60&amp;time_seconds=164&amp;autoplay=0&amp;q=&amp;skin=orange&amp;volume=70&amp;comment=" />'+sel+'</object>');
        }
	}
});

var lsPanel;

window.addEvent('domready', function() { 
	$extend(window,{ 
 	getSelected: function(){ 
 	if (this.ie) return document.selection.createRange().text; 
 	if (this.khtml) return this.getSelection(); 
 	return document.getSelection(); 
 	} 
 	});								 
    lsPanel = new lsPanelClass();   
});