$(function() {
	$(".tagshow").tabs(".taglist > ul", {event:'mouseover'});
	$(".tagshow2").tabs(".img_advertise > .sponser_c", {event:'mouseover'});

	$(".show_layout").click(function(){
		var widths = $(this).prev().find('img').eq(1).attr('width');
		var widthInt = parseInt(widths);
		if(widthInt > 200){
			$(this).prev().css("width",widthInt);
		}
		$(this).prev().show();									 
	});
	$(".out_layout").click(function(){
		$(this).hide();					  
	});
	//font size
	$(".large_icon").click(function(){
	   var size=parseInt($(".article_content").css("font-size"),10);
	   if(size<22)
	   {
		size+=2;
		$(".article_content").css({"font-size":size+"px"});
	   }
	});
	$(".small_icon").click(function(){
		var size=parseInt($(".article_content").css("font-size"),10);
		if(size>12){
			size-=2;
			$(".article_content").css({"font-size":size+"px"});
		}
	});
	//加入收藏夹
	$(".article_tag").click(function() { 
        var ctrl = (navigator.userAgent.toLowerCase()).indexOf('mac') != -1 ? 'Command/Cmd' : 'CTRL'; 
        if (document.all){ 
          window.external.addFavorite(window.location.href, document.title); 
          }else if (window.sidebar){ 
         window.sidebar.addPanel(document.title, window.location.href, ""); 
       }else { 
               alert('您可以尝试通过快捷键' + ctrl + ' + D 加入到收藏夹!'); 
       } 
    });
	//print
	$(".article_print").click(function(){
		$(".article_news").printArea();
	});

});
function shareartcle(site){
	var exURL = location.href;
	var exHed = document.title;
	var exDek = $("meta[name=Description]").attr("content");
	switch(site){
        case "twitter":
            OpenPop('http://twitter.com/home?status='+exHed+'+'+exURL,'twitter','toolbar=no,resizable=yes,scrollbars=yes,width=850,height=500');
            break; 
        case "digg":
            OpenPop('http://digg.com/remote-submit?phase=2&url='+exURL+'&title='+exHed+'&bodytext='+exDek,'digg','toolbar=no,resizable=yes,scrollbars=yes,width=850,height=500');
            break;        
        case "delicious":
            OpenPop('http://del.icio.us/post?tags=test&v=4&noui&jump=close&url='+exURL+'&title='+exHed+'&notes='+exDek+'&tags='+keywords, 'delicious','toolbar=no,resizable=yes,scrollbars=yes,width=850,height=500');
            break;        
        case "facebook":
            OpenPop('http://www.facebook.com/sharer.php?u=' + exURL + '&t=' + exHed, 'facebook', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
            break;        
        case "yahoo":
            OpenPop('http://buzz.yahoo.com/submit?submitUrl=' + exURL + '&submitHeadline=' + exHed+ '&submitSummary=' + exDek, 'yahoo', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
            break;        
        case "myspace":
            OpenPop('http://www.myspace.com/Modules/PostTo/Pages/?u=' + exURL + '&t=' + exHed+ '&c=' + exDek, 'myspace', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
            break;        
        case "google":
            OpenPop('http://www.google.com/bookmarks/mark?op=add&bkmk=' + exURL + '&title=' + exHed+ '&annotation=' + exDek, 'google', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
            break;        
        case "linkedin":
            OpenPop('http://www.linkedin.com/shareArticle?mini=true&url=' + exURL + '&title=' + exHed+ '&summary=' + exDek, 'linkedin', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
            break;
        case "technorati":
            OpenPop('http://technorati.com/faves/inistone?add=' + exURL, 'technorati', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
            break;
        case "yahoobookmk":
            OpenPop('http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&u=' + exURL+'&t='+ exHed, 'yahoobookmk', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
            break;
        case "mixx":
            OpenPop('http://www.mixx.com/submit?page_url=' + exURL+'&t='+ exHed, 'mixx', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
            break;
        case "yahoomyweb":
            OpenPop('http://myweb2.search.yahoo.com/myresults/bookmarklet?u=' + exURL+'&t='+ exHed, 'yahoomyweb', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
            break;
        case "windowslive":
            OpenPop('https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url=' + exURL+'&title='+ exHed+'&top=1', 'windowslive', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
            break;
        case "friendfeed":
            OpenPop('http://friendfeed.com/share?url=' + exURL+'&title='+ exHed, 'friendfeed', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
            break;
	}
}
function OpenPop(url, name, params) {
	var win = window.open(url, name, params);
}

function includeFile(placeID, filename){
	$.ajax({
        url:'/2010/ajax/article_getfile.php',
        type:'post',
        dataType:'html',
        data:'filename='+filename, 
        error: function(){
            
        },
        success: function(msg){
            $("#"+placeID).html( msg );
        }
    });
}
function change_maincat(id){
	$('.mainnav').find('li').removeClass('current');
	$("#maincat"+id).addClass('current');
	$('.quicklink').hide();
	$("#subnav"+id).show();
}
function change_subcat(id){
	$('.quicklink').find('li').removeClass('current');
	$("#subcat"+id).addClass('current');
}
