$(function(){
    $(":text, :password").focus(function(){
		$(this).attr("class","input_focus");
	}).blur(function(){
        $(this).removeClass("input_focus");
	});
	$("textarea").focus(function(){
		$(this).attr("class","textarea_focus");
	}).blur(function(){
        $(this).removeClass("textarea_focus");
	});
	$(":radio").attr("class","radio");
});
function change_captcha(id){
	$("#"+id).attr("src","captcha.php?"+Math.random());
}
function redirect(url)
{
	if(url.lastIndexOf('/.') > 0)
	{
		url = url.replace(/\/(\.[a-zA-Z]+)([0-9]+)$/g, "/$2$1");
	} else if(url.match(/\/([a-z]+).html([0-9]+)$/)) {
		url = url.replace(/\/([a-z]+).html([0-9]+)$/, "/$1-$2.html");
	} else if(url.match(/-.html([0-9]+)$/)) {
		url = url.replace(/-.html([0-9]+)$/, "-$1.html");
	}

	if(url.indexOf('://') == -1 && url.substr(0, 1) != '/' && url.substr(0, 1) != '?') url = $('base').attr('href')+url;
	location.href = url;
}
//添加收藏夹
function myAddPanel()
{
    var title = document.title;
    var url = window.location;
    if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function'))
    {
        window.sidebar.addPanel(title,url,"");
    }
    else
    {
        window.external.addFavorite(url,title);
    }
}
function confirmurl(url,message)
{
	if(confirm(message)) redirect(url);
}

function confirmform(form,message)
{
	if(confirm(message)) form.submit();
}
function ContentSize(size)
{
	var obj=document.getElementById("endtext");
	obj.style.fontSize=size+"px";
}
function copyToClipBoard(){
	var clipBoardContent='';
	clipBoardContent+=document.title;
	clipBoardContent+="\r\n"+window.location.href;
	window.clipboardData.setData("Text",clipBoardContent);
	alert("您已复制标题及链接，请粘贴到QQ/MSN等发给好友!");
}
function showimage(id, file, dir){
	$('#'+id).attr('src', dir+file);
}
