function setShare() {
	jiathis_config.title = "@金山词霸 #"+json_data.dw.title+"#"+json_data.dw.en+json_data.dw.cn;
	jiathis_config.url = $(".cn .more").attr("href");
	jiathis_config.pic= $(".ct img").attr("src");
}
function setShare2() {
    var ds_counter = parseInt($('#ds_count').val());
	jiathis_config.title = "@金山词霸 #每日一句#"+json_data.ds[ds_counter].content+$(".yj_c").html()+$(".yj_b span").html();
	jiathis_config.url = $(".yj_b a").attr("href");
	jiathis_config.pic= $(".yj_i img").attr("src");
}
var jiathis_config = {
	appkey:{"tsina":"3034629400"}
}

var i2 = new Image(0,0);
counter = 'http://goto.www.iciba.com/3b87652ba0916c03c634d5db8558d494.php';
function rand(num) {
    return Math.floor(Math.random()*num)+1;
}
function clickCountIndex(liid) { 
    i2.src=counter+"?"+"sid=261&pid=2861&spid=0&loid=0&aid=8670&liid="+liid+"&pvid=0&uid=0&rnum="+rand();
    return true;
}

function loadJs(file) {
	var head = $("body").remove("script[role='reload']");
	$("<scri" + "pt>" + "</scr" + "ipt>").attr({ role: 'reload', src: file+"?"+Math.random(), type: 'text/javascript' }).appendTo(head);
}


//每日一次加载
function  load_word(){
    $('.ct img').attr('src', json_data.dw.pic );
    $('.ct .cn span').html( json_data.dw.cn );
    $('.ct .en').html( json_data.dw.en );
	$('.ct .more').html("["+json_data.dw.more+"]");
    $('.ct .more').attr("href", json_data.dw.link+"?from=pc2012" );
	$('.ct_t a').html( json_data.dw.title );
	$('.ct_t a').attr("href",json_data.dw.link);
	$('.ct a').eq(0).attr("href",json_data.dw.link+"?from=pc2012");

}
//四个链接的加载
function load_link(){
   
    $('.link a').eq(0).html( '<span class="d"></span>'+json_data.links[0].title+( json_data.links[0].isnew == 1  ? '<img alt="new" src="images/n.gif">' : '') );
    $('.link a').eq(1).html( '<span class="d"></span>'+json_data.links[1].title+( json_data.links[1].isnew == 1  ? '<img alt="new" src="images/n.gif">' : '') );
    $('.link a').eq(2).html( '<span class="d"></span>'+json_data.links[2].title+( json_data.links[2].isnew == 1  ? '<img alt="new" src="images/n.gif">' : '') );
    $('.link a').eq(3).html( '<span class="d"></span>'+json_data.links[3].title+( json_data.links[3].isnew == 1  ? '<img alt="new" src="images/n.gif">' : '') );
    $('.link a').eq(0).attr('href',json_data.links[0].link);
    $('.link a').eq(1).attr('href',json_data.links[1].link);
    $('.link a').eq(2).attr('href',json_data.links[2].link);
    $('.link a').eq(3).attr('href',json_data.links[3].link);
}
//每日一句
function load_ds(){
    var ds_counter = parseInt($('#ds_count').val());
    $('.yj_i img').attr('src',"pic/ds/"+json_data.ds[ds_counter].picture+"?from=pc2012");
    $('.time').html( json_data.ds[ds_counter].title );
	a_str = "";//每日一句链接
	a_str += '<a href="http://news.iciba.com/dailysentence/detail-'+json_data.ds[ds_counter].sid+'.html?from=pc2012" target="_blank" onClick="clickCountIndex(16)" class="yj_ec">'+json_data.ds[ds_counter].content+'</a>';
    a_str += '<a href="javascript:;" class="laba" onmouseover="asplay(\''+json_data.ds[ds_counter].tts+'\');" onmouseout ="clearTimeout(timer);"  onclick="asplay(\''+json_data.ds[ds_counter].tts+'\');" ></a>';
	a_str += '<a href="http://news.iciba.com/dailysentence/speak-'+json_data.ds[ds_counter].sid+'.html?from=pc2012" class="gendu" target="_blank"></a>';
	$('.yj_e').html( a_str );
	$('.yj_c').html( json_data.ds[ds_counter].note );
    $('.yj_b span').html( json_data.ds[ds_counter].translation );
    $('.yj_b a').attr('href','http://news.iciba.com/dailysentence/detail-'+json_data.ds[ds_counter].sid+'.html?from=pc2012');
	$('.yj_i a').attr('href','http://news.iciba.com/dailysentence/detail-'+json_data.ds[ds_counter].sid+'.html?from=pc2012');
	//动态生成标签
	if( json_data.ds[ds_counter].tags != 'undefined' ){
		var bqstr = "标签：";
		for( var t in json_data.ds[ds_counter].tags ){
		    bqstr += '<a href="http://news.iciba.com/dailysentence/nav'+t+'?from=pc2012#nav" target="_blank">'+json_data.ds[ds_counter].tags[t]+'</a>';
		}
	    $('.bq').html( bqstr );
	}else{
	    $('.bq').html( "" );
	}

    //方向键状态初始化
    if(ds_counter==6){
        $(".yjL").addClass("no");
		$(".yjL").html("");
		$(".yjL").attr("title","");
    }else{
	    $(".yjL").html("&lt;");
		$(".yjL").attr("title","上一篇");
	}
    if(ds_counter==0){
        $(".yjR").addClass("no");
		$(".yjR").html("");
		$(".yjR").attr("title","");
    }else{
	    $(".yjR").html("&gt;");
		$(".yjR").attr("title","下一篇");
	}

}

//左转转
function ds_left(){
    if(parseInt($('#ds_count').val())==6){
        return false;
    }else{
        $('#ds_count').val(parseInt($('#ds_count').val())+1);
        load_ds();
    }
}
//右转转
function ds_right(){
    if(parseInt($('#ds_count').val())==0){
        return false;
    }else{
        $('#ds_count').val(parseInt($('#ds_count').val())-1);
        load_ds();
    }
}


//注册导航动作

function load_ds_nav(){
    $('.yjL').click(function(){
        ds_left();          
    });
    $('.yjR').click(function(){
        ds_right();          
    });

}





function getFlashObject_top(movieName) {
    if (window.document[movieName]) {
        return window.document[movieName];
    }   
    if (navigator.appName.indexOf("Microsoft Internet")==-1) {
        if (document.embeds && document.embeds[movieName])
          return document.embeds[movieName];
    } else  {
        return document.getElementById(movieName);
    }   
}
var timer = null;
function player_callback(c) {
    var asound = getFlashObject_top("asound_top");
    if(asound){
        asound.SetVariable("f",c);
        asound.GotoFrame(1);
    }   
    return false;

}
function asplay(c){
    clearTimeout(timer);
    var mp3_1 = "player_callback('"+c+"')";
    timer = setTimeout(mp3_1, 100);
}