var xmlHttp; var xmlHttpNews; var xmlHttpD; var xmlHttpDB; var xmlHttpDIS; var xmlHttpFun; var myImage = new Image(); var myImage2 = new Image(); var loadingImage = new Image(); loadingImage.src = "http://www.chien-ming.com/img/loading.gif"; var blankImage = new Image(); blankImage.src = "http://www.chien-ming.com/img/blank.png"; var current1 = 56; var max1 = 56; var current2 = 56; var max2 = 56; var current3 = 33; var max3 = 33; var adClick = 0; function OpenMLBLive() { window.open( "http://mlb.mlb.com/mlb/gameday/y2007/gd.html?2007_10_04_nyamlb_clemlb_1", "myWindow", "status = yes, height = 600, width = 980, resizable = no, menubar = no, location = no" ) } function LoadGallery() { //document.picture.src = loadingImage.src; document.picture.style.width= 16; document.picture.style.height = 16; document.picture.src = loadingImage.src; myImage = new Image(); //myImage.src = "http://www.chien-ming.com/photo/new/w" + current1 + ".jpg?sid="+Math.random(); myImage.src = "http://www.chien-ming.com/photo/new/w" + current1 + ".jpg?sid="+Math.random(); WaitUntilLoaded(); } function WaitUntilLoaded() { if(!myImage.complete) { setTimeout("WaitUntilLoaded();",1000); } else { var wbound = 350; var hbound = 260; var currentw = 0; var currenth = 0; document.picture.src = blankImage.src; if( myImage.width <= wbound && myImage.height <= hbound) { document.picture.style.width= myImage.width; document.picture.style.height = myImage.height; } else { if( myImage.height > hbound) { document.picture.style.width = myImage.width * hbound / myImage.height ; document.picture.style.height = hbound; currentw = myImage.width * hbound / myImage.height ; currenth = hbound ; } else { document.picture.style.width= myImage.width; document.picture.style.height = myImage.height; currentw = myImage.width; currenth = myImage.height; } if( currentw > wbound) { document.picture.style.height = currenth * wbound / currentw ; document.picture.style.width = wbound; } } document.picture.src = myImage.src; current1 = current1 - 1; if(current1 == 0 ) { current1 = max1; } } } function LoadNewPhotos() { document.picture2.src = loadingImage.src; document.picture2.style.width= 16; document.picture2.style.height = 16; myImage2 = new Image(); //myImage2.src = "http://www.chien-ming.com/photo/new/w" + current2 + ".jpg?sid="+Math.random(); myImage2.src = "http://www.chien-ming.com/photo/new/w" + current2 + ".jpg?sid="+Math.random(); WaitUntilLoaded2(); } function WaitUntilLoaded2() { if(!myImage2.complete) { setTimeout("WaitUntilLoaded2();",1000); } else { var wbound = 660; var hbound = 420; var currentw = 0; var currenth = 0; document.picture2.src = blankImage.src; if( myImage2.width <= wbound && myImage2.height <= hbound) { document.picture2.style.width= myImage2.width; document.picture2.style.height = myImage2.height; } else { if( myImage2.height > hbound) { document.picture2.style.width = myImage2.width * hbound / myImage2.height ; document.picture2.style.height = hbound; currentw = myImage2.width * hbound / myImage2.height ; currenth = hbound ; } else { document.picture2.style.width= myImage2.width; document.picture2.style.height = myImage2.height; currentw = myImage2.width; currenth = myImage2.height; } if( currentw > wbound) { document.picture2.style.height = currenth * wbound / currentw ; document.picture2.style.width = wbound; } } document.picture2.src = myImage2.src; current2 = current2 - 1; if(current2 == 0 ) { current2 = max2; } } } function LoadGamePhotos() { document.picture3.src = loadingImage.src; document.picture3.style.width= 16; document.picture3.style.height = 16; myImage3 = new Image(); //myImage3.src = "http://www.chien-ming.com/photo/game/w" + current3 + ".jpg?sid="+Math.random(); myImage3.src = "http://www.chien-ming.com/photo/game/w" + current3 + ".jpg?sid="+Math.random(); WaitUntilLoaded3(); } function WaitUntilLoaded3() { if(!myImage3.complete) { setTimeout("WaitUntilLoaded3();",1000); } else { var wbound = 660; var hbound = 420; var currentw = 0; var currenth = 0; document.picture3.src = blankImage.src; if( myImage3.width <= wbound && myImage3.height <= hbound) { document.picture3.style.width= myImage3.width; document.picture3.style.height = myImage3.height; } else { if( myImage3.height > hbound) { document.picture3.style.width = myImage3.width * hbound / myImage3.height ; document.picture3.style.height = hbound; currentw = myImage3.width * hbound / myImage3.height ; currenth = hbound ; } else { document.picture3.style.width= myImage3.width; document.picture3.style.height = myImage3.height; currentw = myImage3.width; currenth = myImage3.height; } if( currentw > wbound) { document.picture3.style.height = currenth * wbound / currentw ; document.picture3.style.width = wbound; } } document.picture3.src = myImage3.src; current3 = current3 - 1; if(current3 == 0 ) { current3 = max3; } } } function timer() { LoadDiscussB(); setTimeout("timer()", 7000); } function LoadDiscuss() { var url="loadd.php" url=url+"?sid="+Math.random() xmlHttpD=GetXmlHttpObject() xmlHttpD.onreadystatechange=LoadDiscussCallBack xmlHttpD.open("GET",url,true) xmlHttpD.send(null) } function LoadDiscussCallBack() { if (xmlHttpD.readyState==4 || xmlHttpD.readyState=="complete") { if( (xmlHttpD.responseText != "") && (xmlHttpD.responseText != null )) { if(xmlHttpD.responseText == "first") { var discuss = document.getElementById("discuss"); discuss.innerHTML = '
目前還沒有人發表, 你是第一個, 請發表你的高見
'; } else { var discuss = document.getElementById("discuss"); if( document.getElementById('first') ) { discuss.removeChild(document.getElementById('first') ); } var node = document.createElement('div'); node.innerHTML = xmlHttpD.responseText; discuss.insertBefore(node, discuss.firstChild); } } } } function LoadDiscussB() { var url="loadd.php" url=url+"?sid="+Math.random() xmlHttpDB=GetXmlHttpObject() xmlHttpDB.onreadystatechange=LoadDiscussBCallBack xmlHttpDB.open("GET",url,true) xmlHttpDB.send(null) } function LoadDiscussBCallBack() { if (xmlHttpDB.readyState==4 || xmlHttpDB.readyState=="complete") { if( (xmlHttpDB.responseText != "") && (xmlHttpDB.responseText != null )) { if(xmlHttpDB.responseText == "first") { var discuss = document.getElementById("discuss"); discuss.innerHTML = '
目前還沒有人發表, 你是第一個, 請發表你的高見
'; } else { var discuss = document.getElementById("discuss"); if( document.getElementById('first') ) { discuss.removeChild(document.getElementById('first') ); } var node = document.createElement('div'); node.innerHTML = xmlHttpDB.responseText; discuss.insertBefore(node, discuss.firstChild); } } } } function Discuss(author, message) { if(author == "") { alert("你忘了輸入你的綽號"); } if(message == "") { alert("你忘了輸入你要說的話"); } var url="discuss.php"; url=url+"?author="+encodeURIComponent(author); url=url+"&message="+encodeURIComponent(message); url=url+"&sid="+Math.random(); xmlHttpDIS=GetXmlHttpObject(); xmlHttpDIS.onreadystatechange=DisCallBack xmlHttpDIS.open("GET",url,true); xmlHttpDIS.send(null); document.getElementById("message").value=""; RefreshAd(); } function DisCallBack() { if (xmlHttpDIS.readyState==4 || xmlHttpDIS.readyState=="complete") { LoadDiscuss(); } } function FunPost(funinput) { if(funinput == "") { alert("你忘了輸入"); } else { var url="funpost.php"; url=url+"?funinput="+encodeURIComponent(funinput); url=url+"&sid="+Math.random(); xmlHttpFun=GetXmlHttpObject(); xmlHttpFun.onreadystatechange=FunPostCallBack xmlHttpFun.open("GET",url,true); xmlHttpFun.send(null); document.getElementById("funinput").value=""; } RefreshAd(); } function FunPostCallBack() { if (xmlHttpFun.readyState==4 || xmlHttpFun.readyState=="complete") { var funresult = document.getElementById('funresult'); funresult.innerHTML = xmlHttpFun.responseText; } } function UnLoadNews() { if(document.getElementById("article")) { var newscontent = document.getElementById("newscontent"); var node = document.getElementById("article"); newscontent.removeChild(node); } } function LoadNews(newsurl) { var url=newsurl; url=url+"?sid="+Math.random(); xmlHttpNews=GetXmlHttpObject(); xmlHttpNews.onreadystatechange=LoadNewsCallBack; xmlHttpNews.open("GET",url,true); xmlHttpNews.send(null); } function LoadNewsCallBack() { if (xmlHttpNews.readyState==4 || xmlHttpNews.readyState=="complete") { if( !document.getElementById("article") ) { var newscontent = document.getElementById("newscontent"); var node = document.createElement('div'); node.id = "article"; node.innerHTML = xmlHttpNews.responseText; newscontent.appendChild(node); } else { var node = document.getElementById("article"); node.innerHTML = xmlHttpNews.responseText; } } } function LoadVideo2(HASH) { var video = document.getElementById("video"); videoframe = ''; video.innerHTML = videoframe; } function LoadVideo(key) { //tube = document.getElementById("tube"); //if(tube!=null) //{ // tube.unMute(); //} var videoview = document.getElementById("videoview"); videoview.innerHTML = ""; if( !document.getElementById("tubeOuter2") ) { var tubeOuter1 = document.createElement('div'); tubeOuter1.id = "tubeOuter1"; var tubehead = document.createElement('embed'); tubehead.id = "tubehead"; tubehead.src = "http://www.chien-ming.com/swf/video_play_head.swf"; tubehead.width = "490"; tubehead.height = "21"; tubeOuter1.appendChild(tubehead); var tubeOuter2 = document.createElement('div'); tubeOuter2.id = "tubeOuter2"; var tube = document.createElement('embed'); tube.src = "http://www.youtube.com/v/" + key + "&autoplay=1"; tube.width = "490"; tube.height = "403"; tubeOuter2.appendChild(tube) videoview.appendChild(tubeOuter1); videoview.appendChild(tubeOuter2); } else { var tubeOuter2 = document.getElementById('tubeOuter2'); videoview.removeChild(tubeOuter2); var tubeOuter2 = document.createElement('div'); tubeOuter2.id = "tubeOuter2"; var tube = document.createElement('embed'); tube.id = "tube"; tube.src = "http://www.youtube.com/v/" + key + "&autoplay=1"; tube.width = "490"; tube.height = "403"; tubeOuter2.appendChild(tube) videoview.appendChild(tubeOuter2); } location.href = '#top' } function UnLoadVideo() { var videoview = document.getElementById("videoview"); if(document.getElementById("tubeOuter1")) { videoview.removeChild(document.getElementById("tubeOuter1")); } if(document.getElementById("tubeOuter2")) { videoview.removeChild(document.getElementById("tubeOuter2")); } } function RefreshAd() { /* if(adClick == 0) { var frame = window.frames['adsense']; var ad = frame.document.getElementById("ad"); ad.style.left = -176; adClick = 1; } else if(adClick == 1) { var frame = window.frames['adsense']; var ad = frame.document.getElementById("ad"); ad.style.left = -346; adClick = 2; } else if( adClick == 2) { var frame = window.frames['adsense']; var form = frame.document.forms['adsense_form']; form.submit(); adClick = 0; } */ } function loadCallBack() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { var adsense = document.getElementById("adsense"); //adsense.innerHTML = xmlHttp.responseText; adsense.reload(); } } function GetXmlHttpObject() { var obj=null; try { // Firefox, Opera 8.0+, Safari obj=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { obj=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { obj=new ActiveXObject("Microsoft.XMLHTTP"); } } return obj; } function MyAlert(msg) { if( !document.getElementById('AlertBox') ) { var AlertBox = document.createElement("div"); AlertBox.id = "AlertBox"; var AlertContent = document.createElement("div"); AlertContent.id = "AlertContent"; AlertBox.style.left = document.body.offsetWidth / 2 - 150; AlertBox.style.top = document.body.offsetHeight /2 - 120; AlertContent.style.left = document.body.offsetWidth /2 +10 -150; AlertContent.style.top = document.body.offsetHeight /2 +10 -120; AlertContent.innerHTML = '
' + msg + '
'; document.body.appendChild( AlertContent ); document.body.appendChild( AlertBox ); } setTimeout("HideAlert()", 3000); } function KeyPressHander2(author, message, e) { if (typeof e == 'undefined') e = window.event; var theCode = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode; if (theCode == 13) { if(author != "" && message != "") { Discuss(author, message); } else { if(author == "") { alert("你忘了輸入你的綽號"); } else { alert("你忘了輸入你要說的話"); } } return false; } else return true; } function KeyPressHander3(funinput, e) { if (typeof e == 'undefined') e = window.event; var theCode = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode; if (theCode == 13) { if(funinput != "") { FunPost(funinput); } else { alert("你忘了輸入"); } return false; } else return true; } function AddEmotion(num) { document.getElementById("message").value += "[" + num + "]" }