var eexTimeId = "";
function showEnlargeExampleLayerF(obj, pron, exam )
{
	var layerObj = document.getElementById("EnlargeCNLayer");
	layerObj.getElementsByTagName("li")[0].innerHTML = pron;
	layerObj.getElementsByTagName("li")[1].innerHTML = exam;

	layerObj.style.display = "block";
	layerObj.style.top = (obj.offsetTop + 6 * obj.offsetHeight + 40 )+"px";
	layerObj.style.left = obj.offsetLeft +"px";
	clearTimeout(eexTimeId);
}
function hideEnlargeLayerF(){	hideEnlargeLayer("EnlargeCNLayer");	}
function hideEnlargeLayer(layerName){	document.getElementById(layerName).style.display = "none";}
function setHideEnlargeLayer() { eexTimeId = setTimeout("hideEnlargeLayerF()",0); }
function JSAddFavorite()
{
        if ( window.sidebar && "object" == typeof( window.sidebar ) && "function" == typeof( window.sidebar.addPanel ) )
        {window.sidebar.addPanel( '句酷', 'http://www.jukuu.com/', '' );}
        else if ( document.all && "object" == typeof( window.external ) )
        {window.external.addFavorite( 'http://www.jukuu.com/', '句酷' );}
}

function RmdSent( sid )
{
	rmd = "#rmd_"+sid;
	report = "#report_"+sid;

	rm = "rmd_"+sid;
	re = "report_"+sid;
	$.get("dormd.php",{id:sid}, 
		function(data){
			$(rmd).html("<font color=#FF5809>好评("+data+")</font>");
			var html = document.getElementById( re ).innerHTML;
			var rs = /差评\(\d+\)/g;
			var r = html.match(rs);
			$(report).html("<font color=#FF5809>"+r[0]+"</font>");
		}
	);
}
function ReportSent( sid )
{
	report = "#report_"+sid;
	rmd = "#rmd_"+sid;
	
	rm = "rmd_"+sid;
	re = "report_"+sid;
	$.get("doreport.php",{id:sid}, 
		function(data){
			$(report).html("<font color=#FF5809>差评("+data+")</font>");
			var html = document.getElementById( rm ).innerHTML;
			var rs = /好评\(\d+\)/g;
			var r = html.match(rs);
			$(rmd).html("<font color=#FF5809>"+r[0]+"</font>");
		}					
	);
	
}

function ModifyWebUrl( uid )
{
	if( document.frm2.weburl.disabled == true)
	{
		document.frm2.weburl.disabled = false;
		document.getElementById( "modify" ).innerHTML = "保存";
	}else{
		var weburl = $.trim(document.frm2.weburl.value);
		weburl = weburl.replace("http://", "");
		if(weburl == "")
		{
			alert("主页为空");
			return;
		}
		$.get("doModifyWebUrl.php",{uid:uid,url:weburl},
				function(data){
					if(data == "OK"){
						document.frm2.weburl.disabled = true;
						document.getElementById( "modify" ).innerHTML = "修改";
					}else{
						alert("修改主页有错误");
						return;
					}
				}					
		     );
	}
}

function AddSent( strName )
{
        if(strName == "" )
        {
                window.open("login.php");
                return;
        }
        var strChr = $.trim($("#chr").val());
        var strEng = $.trim($("#eng").val());
	var weburl = $.trim(document.frm2.weburl.value);
	weburl = weburl.replace("http://", "");
        var patrn = /(\w+ ){2}/;
        if(strChr == "" || strEng == "" || !patrn.test(strEng)  || patrn.test(strChr) )
        {
                alert("提交例句中含有非法字符");
                return;
        }
        $.get("dosubmit.php",
                {chr:strChr,eng:strEng,name:strName,url:weburl},
                function(data){
                        if(data == "OK"){
                                window.location.href = "success.php";
                        }else{
                                alert("提交例句有误");
                        }
                }
        );
}
function logout()
{
        $("#topmsg").html('<?php echo $arrMsg[1] ?>');
        $.get("dologout.php",
                function (data){
                        if (data == "OK"){
                        }
                }
        );
}
function insertaudio( a ){
        document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="20" height="20" id="FlashVars" align="middle">'+
                '<param name="allowScriptAccess" value="sameDomain" wmode="transparent"/>'+
                '<param name="movie" value="/images/audio.swf" wmode="transparent"/>'+
                '<param name="FlashVars" value="word=' + a + '" wmode="transparent"/>'+
                '<param name="quality" value="high" wmode="transparent"/>'+
                '<param name="bgcolor" value="#ffffff" wmode="transparent"/>'+
                '<embed src="/images/audio.swf" width="20" height="20" align="middle" quality="high" bgcolor="#ffffff" name="FlashVars" allowScriptAccess="sameDomain" FlashVars="word=' + a +'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" play="false" /></object>');
}

