/***********************************************
* Dynamic Ajax Content- ?Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
var loadedobjects=""
var rootdomain="http://"+window.location.hostname

function loadpage(page_request, containerid){
  if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
  document.getElementById(containerid).innerHTML=page_request.responseText
}

function ajaxpage(url, containerid){
  var page_request = false
  if (window.XMLHttpRequest) // if Mozilla, Safari etc
    page_request = new XMLHttpRequest()
  else if (window.ActiveXObject){ // if IE
    try {
      page_request = new ActiveXObject("Msxml2.XMLHTTP")
    }
    catch (e){
      try{
        page_request = new ActiveXObject("Microsoft.XMLHTTP")
      }
      catch (e){ alert ("GET FAIL");}
    }
  }
  else
    return false

    page_request.onreadystatechange=function(){
    loadpage(page_request, containerid)
    }
  url=addrandom(url);
  page_request.open('GET', url, true)
  page_request.send(null)
}

function addrandom(url){

  var ran_number=Math.floor(Math.random()*5000);
 var newUrl;
  qp=url.indexOf("?");
 if ( qp == -1  ){
    newUrl=url+"?"+ran_number;
 }else{
    newUrl=url+"&"+ran_number;
 }
 return newUrl;
}


function wrdiv(p_title,p_story_title,p_story_update,p_story_author,p_story,p_source_name){
var randn=Math.floor(Math.random()*11)
document.open();
document.writeln("<html>");
document.writeln("<head>");
document.writeln("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=big5\" >");
document.writeln("<title> "+p_title+" </title>");
document.writeln("<link href=\"/1024/css.css\" rel=\"stylesheet\" type=\"text/css\" >");
document.writeln("</head>");
document.writeln("<body leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">");
document.writeln("<table width=\"650\" height=\"61\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
document.writeln("<tr>");
document.writeln("<td width=\"195\" rowspan=\"2\" valign=\"top\"><img src=\"/1024/images/logo_udn.gif\" width=\"169\" height=\"52\" border=\"0\" usemap=\"#Map\"></td>");
document.writeln("<td width=\"505\" height=\"26\"><table border=\"0\" align=\"right\" cellpadding=\"0\" cellspacing=\"0\">");
document.writeln("<tr>");
document.writeln("<td height=\"26\" nowrap=\"nowrap\"><div align=\"right\" id=\"p_common_link\" class=\"common_link\"><a href=\"http://udn.com/NEWS/SITEMAP/index.htm\">網站總覽</a>│<a href=\"http://member.udn.com/member/login.jsp?site=news\">會員</a>∣<a href=\"http://udn.com\"><img src=\"/1024/images/s_t_1.gif\" alt=\"繁體\" width=\"16\" height=\"16\" border=\"0\" align=\"absmiddle\"></a><img src=\"/1024/images/arr_1.gif\" width=\"13\" height=\"16\" align=\"absmiddle\"><a href=\"javascript:;\" onClick=\"window.open('http://gb.udn.com/gb/'+window.location.href.substr(7,150))\"><img src=\"/1024/images/s_t_2.gif\" alt=\"簡體\" width=\"16\" height=\"16\" border=\"0\" align=\"absmiddle\"></a>∣<a href=\"http://udn.com/rss/index.html\"><img src=\"/1024/images/rss.gif\" alt=\"RSS服務\" width=\"34\" height=\"19\" border=\"0\" align=\"absmiddle\"></a></div></td>");
document.writeln("<td nowrap=\"nowrap\"><img src=\"/1024/images/spacer.gif\" width=\"10\" height=\"10\"></td>");
document.writeln("</tr>");
document.writeln("</table></td>");
document.writeln("</tr>");
document.writeln("<tr>");
document.writeln("<td>&nbsp;</td>");
document.writeln("</tr>");
document.writeln("</table>");
document.writeln("<table width=\"650\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
document.writeln("<tr>");
document.writeln("<td class=\"right_line\"><img src=\"/1024/images/spacer.gif\" width=\"11\" height=\"6\"></td>");
document.writeln("</tr>");
document.writeln("</table>");
document.writeln("<table width=\"650\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"9\" class=\"mainbg\">");
document.writeln("<tr>");
document.writeln("<td valign=\"top\"><table width=\"100%\" border=\"0\" cellpadding=\"10\" cellspacing=\"0\">");
//document.writeln("<table width=\"100%\" height=\"100%\" border=\"0\" cellpadding=\"10\" cellspacing=\"0\" class=\"border\">");
document.writeln("<tr>");
document.writeln(" <td valign=\"top\" bgcolor=\"#FFFFFF\"><table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"3\">");
document.writeln("<tr>");
document.writeln("<td width=\"130%\" class=\"story_title\"><div id=\"p_story_title\" >"+p_story_title+"</div></td>");
document.writeln("</tr>");
document.writeln("<tr>");
document.writeln("<td background=\"/1024/images/linedot.gif\"><img");
document.writeln("height=\"1\" src=\"/1024/images/linedot.gif\" width=\"1\"></td>");
document.writeln("</tr>");
document.writeln("<tr>");
document.writeln("<td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
document.writeln("<tr>");
document.writeln(" <td width=\"75%\" class=\"story_author\"><div id=\"p_story_author\">"+p_story_author+"</div></td>");
document.writeln("<td width=\"25%\" class=\"story_author\"><div id=\"p_story_update\" align=\"right\">"+p_story_update+"</div></td>");
document.writeln("</tr>");
document.writeln("</table></td>");
document.writeln("</tr>");
document.writeln("<tr>");
document.writeln("<td>&nbsp;</td>");
document.writeln("</tr>");
document.writeln("<tr>");
document.writeln("<td class=\"story\">");
document.writeln(" <div id=\"p_story\" > " + p_story + "</div>");
document.writeln("<p class=\"story\"><div id=\"p_source_name\" > "+p_source_name +" <span class=\"author\"><A href=\"http://udn.com/\" target=\"_blank\">@ </A><a href=\"http://udn.com/\" target=\"_blank\">http://udn.com/</a></span><a href=\"http://udn.com/\" target=\"_blank\" ><img src=\"/1024/images/logo_small.gif\" width=\"19\" height=\"19\" border=\"0\" align=\"absmiddle\"></a></p></div></td>");
document.writeln("</tr>");
document.writeln("</table></td>");
document.writeln("</tr>");
document.writeln(" </table></td>");
document.writeln("</tr>");
document.writeln("</table>");
document.writeln("<table width=\"650\" border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"0\">");
document.writeln("<tr class=\"mainbg\">");
document.writeln("<td colspan=\"2\"><div align=\"right\" id=\"p_bottom\"> <a href=\"#top\"><img src=\"/1024/images/top.gif\" alt=\"top\" width=\"45\" height=\"17\" border=\"0\"></a></div></td>");
document.writeln("</tr>");
document.writeln("<tr class=\"footerbg\">");
document.writeln("<td colspan=\"2\"><img src=\"/1024/images/spacer.gif\" width=\"11\" height=\"1\"></td>");
document.writeln("</tr>");
document.writeln("<tr>");
document.writeln("<td width=\"642\" class=\"footer\">&nbsp;</td>");
document.writeln("<td nowrap><span class=\"copyright\">聯合線上公司 著作權所有&copy; udn.com. All Rights Reserved.</span><br>");
document.writeln("</td>");
document.writeln("</tr>");
document.writeln("</table>");
document.writeln("<map name=\"Map2\">");
document.writeln("<area shape=\"poly\" coords=\"13,8,121,8,121,21,53,22,53,47,11,48,12,7\" href=\"http://udn.com\">");
document.writeln("<area shape=\"rect\" coords=\"57,24,161,49\" href=\"http://udn.com\"> ");
document.writeln("</map> ");
document.writeln("<iframe width=0 height=0 src=\"http://www.udn.com/fpr.html?u="+document.URL+"\" name=\"counter\"></iframe>");
document.writeln("</body>");
document.writeln("</html>");
document.close();

}
function fpr() {
p_title_obj=document.getElementsByTagName("title")[0];
p_title=p_title_obj.innerText;
p_story_title=document.getElementById("story_title").innerHTML;
p_story_update=document.getElementById("story_update").innerHTML;
p_story_author=document.getElementById("story_author").innerHTML;
p_story=document.getElementById("story").innerHTML;
p_source_name=document.getElementById("source_name").innerHTML;
   p_story=p_story.replace(/<\/P\>/g,' ')

 wrdiv(p_title, p_story_title,p_story_update,p_story_author,p_story,p_source_name,p_title);
}

function cpdiv (srcid ,destid){
 var srcobj,destobj;
 srcobj=document.getElementById(srcid);
 destobj=document.getElementById(destid);
 if(srcobj != null && destobj != null){
    destobj.innerHTML=srcobj.innerHTML;
 }
}

NS4=(document.layers);
IE4=(document.all);
NS7=(!document.all && document.getElementById);
ver4=(NS4||IE4);   
isMac=(navigator.appVersion.indexOf("Mac")!=-1);
isMenu=(NS7||NS4||(IE4 && !isMac));
isMenu =(true);
function switchOn(sMenu){return};
function switchOff(sMenu){return};
function makeTop(i){return};
function popUp(i,e){switchOn('menu'+i);};
function popDown(i){switchOff('menu'+i);};
function startIt(){return};   
if(!ver4) event=null;

var loadGradeState=false;

function loadGrading(m) {
 if(!loadGradeState){
  loadGradeState=true;
  ajaxpage('/NEWS/gradefarm.html', 'gradingarea');
 }
}

function loadFace() {
 if(!loadGradeState){
  loadGradeState=true;
  ajaxpage('/NEWS/facefarm.html', 'gradingarea');
 }
}

function submitGrading(frm){
 if(grad.rand.value==""){
        loadGradeState=false;
        alert("\275\320\277\351\244J\273{\303\322\275X!");
        return false;
 }
 return true;
}

function mvplay()
{

  player=document.getElementById("MediaPlayer");
 
  player.settings.volume = 35;

  if (player != null )    player.controls.play();
                       
}

var mvflag=0;
function mvplayfg()
{

  imgobj=document.getElementById("defaultimg");
  player=document.getElementById("MediaPlayer");
  player.settings.volume = 35;
  if (player != null )    player.controls.play();
  mvflag=1;
  if (imgobj  != null )  imgobj.style.display='none';
  player.style.display='block';

  mvplay();
}


function mvstop()
{
 if (mvflag== 1) return ;

player=document.getElementById("MediaPlayer");
imgobj=document.getElementById("defaultimg");

 if (player != null )      player.controls.stop(); 

if (imgobj  != null )  imgobj.style.display='none';
// 圖形停留時間
//setTimeout("player.style.display='block';", 3000);

player.settings.volume = 50;
player.style.display='block';

}


function mvctl()
{
 /* document.write("<img id=defaultimg style='display:none;' onclick=\"javascript:mvplayfg();\" src='http://g.udn.com/1024/images/initvideo.gif' />");
 player=document.getElementById("MediaPlayer"); 
  if (player != null )     player.settings.volume = 0;
  divobj=document.getElementById("defaultimg");
  cx=document.getElementById("MediaPlayer").style.left;
  cy=document.getElementById("MediaPlayer").style.top;
  cw=document.getElementById("MediaPlayer").style.width;
  ch=document.getElementById("MediaPlayer").style.height-20;
  var coverdiv = document.createElement('div');
  coverdiv.appendChild(divobj);
  divobj.style.display='block' ;
  coverdiv.id = 'coverimg';
  coverdiv.style.width = cw;
  coverdiv.style.height = ch;
  coverdiv.style.top=cy;
  coverdiv.style.z-index = 10;
  coverdiv.style.left=cx;
  document.getElementById("MediaPlayer").style.display='block'; */
}

function createmvobj(mediaurl,mh,mw,wrap){
           objstr='<OBJECT id=MediaPlayer CLASSID="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" '+
                  ' CODEBASE="http://www.microsoft.com/ntserver/netshow/download/en/nsmp2inf.cab#Version=5,1,51,415" '+
                  ' standby="Loading Microsoft Windows Media Player components..." '+
                  ' TYPE="application/x-oleobject" height="'+mh+'" width="'+mw+'" >'+
                  '<PARAM NAME="AutoStart" VALUE="false">'+
                  '<PARAM NAME="UIMode" VALUE="full">'+
                  '<PARAM NAME="enableContextMenu" VALUE="1">'+
                  '<PARAM NAME="stretchToFit" VALUE="true">'+
                  '<PARAM NAME="url" VALUE="'+mediaurl+'">'+
                  '</OBJECT>';
                  var a=document.getElementById('mv');
                  if ( wrap != 1 )  a.innerHTML=a.innerHTML+objstr;
                  else  a.innerHTML=objstr;
}
function createmvadobj(mediaurl,mh,mw,wrap){
           objstr='<OBJECT id=MediaPlayer CLASSID="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" '+
                  ' CODEBASE="http://www.microsoft.com/ntserver/netshow/download/en/nsmp2inf.cab#Version=5,1,51,415" '+
                  ' standby="Loading Microsoft Windows Media Player components..." '+
                  ' TYPE="application/x-oleobject" height="'+mh+'" width="'+mw+'" >'+
                  '<PARAM NAME="AutoStart" VALUE="false">'+
                  '<PARAM NAME="UIMode" VALUE="full">'+
                  '<PARAM NAME="enableContextMenu" VALUE="1">'+
                  '<PARAM NAME="stretchToFit" VALUE="true">'+
                  '<PARAM NAME="url" VALUE="'+mediaurl+'">'+
                  '</OBJECT>';
                  var a=document.getElementById('mv');
                  if ( wrap != 1 )  a.innerHTML=a.innerHTML+objstr;
                  else  a.innerHTML=objstr;
}
function mvctlbyjs(){
              var imgobj= document.getElementById('defaultimg');
              imgobj.style.display='none';
              var brobj= document.getElementById('defaultimgbr');
              brobj.style.display='none';
              var mediaobj = document.getElementById('MediaPlayer');
              mediaobj.style.width=240;
              mediaobj.style.height=220;
              mvplay();
              mediaobj.detachEvent('PlayStateChange',mvctlbyjs)
}

function mvctlbyadjs(){
              var imgobj= document.getElementById('defaultimg');
              imgobj.style.display='none';
              var brobj= document.getElementById('defaultimgbr');
              brobj.style.display='none';
              var mediaobj = document.getElementById('MediaPlayer');
              mediaobj.style.width=320;
              mediaobj.style.height=285;
              mvplay();
              mediaobj.detachEvent('PlayStateChange',mvctlbyadjs)
}

var wrap=0; //for firefox
