/*
/* themes/Dreamy/dreamy.js 
/*************************************
Site:    http://leotheme.cn/
Version: 3.0
Date:    2009/09/28
Author:  Await(等待)
Email:   yltfy2008@gmail.com
**************************************/
jQuery(document).ready(function(){

	jQuery("a").bind("focus",function(){ if(this.blur){  this.blur();}}); //去掉链接的虚线框

	//Ctrl+Enter快速回复
	jQuery("#comment").keydown( function(moz_ev) {
		var ev = null; 
                if (window.event){ 
                        ev = window.event; 
                }else{ 
                        ev = moz_ev; 
                } 
                if (ev != null && ev.ctrlKey && ev.keyCode == 13) { 
                        jQuery("#submit").click(); 
                } 
     });

	 //侧边栏收缩
	 jQuery(".sidebar li h2").append("<span class=sidebarup title=展开收起>展开收起</span>");
	 jQuery(".sidebar li:first").parent().append("<div class=liborderbottom></div>");
	 jQuery(".sidebar li h2 span").click(function () {
		 jQuery(this).parent().next().slideToggle();
		 jQuery(this).parent().parent().css("paddingBottom","10px");
		 jQuery(this).toggleClass("sidebardown");
	 });

	//表情
	jQuery("#smilles").click(function(){
		jQuery(".wp_smilies").show();
	});
	jQuery("#comment").click(function(){
		jQuery(".wp_smilies").hide();
	});
	
	//在新窗口在打开外部链接
	 if(jQuery("body").hasClass("archive")) {
		 jQuery("#sidebarComment").hide();
		 jQuery("#sidebarComment").parent().css("paddingBottom","10px");
	 }
	jQuery(".entry a[href*='http://leotheme'],.entry a:has(img),.entry a[href*='#'],.entry a[href*='javascript:void(0);']").css({background: "none", margin: "0", padding: "0"}).attr("rel","external");
	jQuery(".entry a[rel!='external']").click(function(){window.open(this.href);return false;});//给外部的链接添加标识图并在新窗口中打开


});


// ----------------------------------------------------------------------------
// markItUp!
// ----------------------------------------------------------------------------
// Copyright (C) 2008 Jay Salvat
// http://markitup.jaysalvat.com/
// ----------------------------------------------------------------------------
// Html tags
// http://en.wikipedia.org/wiki/html
// ----------------------------------------------------------------------------
// Basic set. Feel free to add more tags
// ----------------------------------------------------------------------------
mySettings = {	
	onShiftEnter:  	{keepDefault:false, replaceWith:'<br />\n'},
	onCtrlEnter:  	{keepDefault:false, openWith:'\n<p>', closeWith:'</p>'},
	onTab:    		{keepDefault:false, replaceWith:'    '},
	markupSet:  [ 	
		{name:'Bold', key:'B', openWith:'(!(<strong>|!|<b>)!)', closeWith:'(!(</strong>|!|</b>)!)' },
		{name:'Italic', key:'I', openWith:'(!(<em>|!|<i>)!)', closeWith:'(!(</em>|!|</i>)!)'  },
		{name:'Stroke through', key:'S', openWith:'<del>', closeWith:'</del>' },
		{separator:'---------------' },
		{name:'Picture', key:'P', replaceWith:'<img src="[![Source:!:http://]!]" alt="[![Alternative text]!]" />' },
		{name:'Link', key:'L', openWith:'<a href="[![Link:!:http://]!]"(!( title="[![Title]!]")!)>', closeWith:'</a>', placeHolder:'Your text to link...' },
		{separator:'---------------' },
		{name:'Quotes', openWith:'<quote>', closeWith:'</quote>'}, 
		{name:'Code', openWith:'<code>', closeWith:'</code>'}, 
		{separator:'---------------' },
		{name:'Clean', className:'clean', replaceWith:function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") } }		
	]
}
//All End