///////////////////////////////////////////////////////////
// "Live Clock" script (3.0)
// By Mark Plachetta (astroboy@zip.com.au)
// http://www.zip.com.au/~astroboy/liveclock/
///////////////////////////////////////////////////////////

var LC_Style=[
	"Arial",			// clock font
	"2",				// font size
	"black",			// font colour
	"white",			// background colour
	"The time is: ",	// html before time
	"",					// html after time
	300,				// clock width
	1,					// 12(1) or 24(0) hour?
	1,					// update never(0) secondly(1) minutely(2)
	3,					// no date(0) dd/mm/yy(1) mm/dd/yy(2) DDDD MMMM(3) DDDD MMMM YYYY(4)
	0,					// abbreviate days/months yes(1) no(0)
	null				// gmt offset (null to disable)
];

///////////////////////////////////////////////////////////

var LC_IE=(document.all);
var LC_NS=(document.layers);
var LC_N6=(window.sidebar);
var LC_Old=(!LC_IE && !LC_NS && !LC_N6);

var LC_Clocks=new Array();

var LC_DaysOfWeek=[
	["Sunday","Sun"],
	["Monday","Mon"],
	["Tuesday","Tue"],
	["Wednesday","Wed"],
	["Thursday","Thu"],
	["Friday","Fri"],
	["Saturday","Sat"]
];

var LC_MonthsOfYear=[
	["January","Jan"],
	["February","Feb"],
	["March","Mar"],
	["April","Apr"],
	["May","May"],
	["June","Jun"],
	["July","Jul"],
	["August","Aug"],
	["September","Sep"],
	["October","Oct"],
	["November","Nov"],
	["December","Dec"]
];

var LC_ClockUpdate=[0,1000,60000];

///////////////////////////////////////////////////////////

function LC_CreateClock(c) {
	if(LC_IE||LC_N6){clockTags='<span id="'+c.Name+'" style="width:'+c.Width+'px;background-color:'+c.BackColor+'"></span>'}
	else if(LC_NS){clockTags='<ilayer width="'+c.Width+'" bgColor="'+c.BackColor+'" id="'+c.Name+'Pos"><layer id="'+c.Name+'"></layer></ilayer>'}

	if(!LC_Old){document.write(clockTags)}
	else{LC_UpdateClock(LC_Clocks.length-1)}
}

function LC_InitializeClocks(){
	LC_OtherOnloads();
	if(LC_Old){return}
	for(i=0;i<LC_Clocks.length;i++){
		LC_UpdateClock(i);
		if (LC_Clocks[i].Update) {
			eval('var '+LC_Clocks[i].Name+'=setInterval("LC_UpdateClock("+'+i+'+")",'+LC_ClockUpdate[LC_Clocks[i].Update]+')');
		}
	}
}

function LC_UpdateClock(Clock){
	var c=LC_Clocks[Clock];

	var t=new Date();
	if(!isNaN(c.GMT)){
	var offset=t.getTimezoneOffset();
	if(navigator.appVersion.indexOf('MSIE 3') != -1){offset=offset*(-1)}
		t.setTime(t.getTime()+offset*60000);
		t.setTime(t.getTime()+c.GMT*3600000);
	}
	var day=t.getDay();
	var md=t.getDate();
	var mnth=t.getMonth();
	var hrs=t.getHours();
	var mins=t.getMinutes();
	var secs=t.getSeconds();
	var yr=t.getYear();

	if(yr<1900){yr+=1900}

	if(c.DisplayDate>=3){
		md+="";
		abbrev="th";
		if(md.charAt(md.length-2)!=1){
			var tmp=md.charAt(md.length-1);
			if(tmp==1){abbrev="st"}
			else if(tmp==2){abbrev="nd"}
			else if(tmp==3){abbrev="rd"}
		}
		md+=abbrev;
	}

	var ampm="";
	if(c.Hour12==1){
		ampm="AM";
		if(hrs>=12){ampm="PM"; hrs-=12}
		if(hrs==0){hrs=12}
	}
	if(mins<=9){mins="0"+mins}
	if(secs<=9){secs="0"+secs}

	var html = '<font color="'+c.FntColor+'" face="'+c.FntFace+'" size="'+c.FntSize+'">';
	html+=c.OpenTags;
	html+=hrs+':'+mins;
	if(c.Update==1){html+=':'+secs}
	if(c.Hour12){html+=' '+ampm}
	if(c.DisplayDate==1){html+=' '+md+'/'+(mnth+1)+'/'+yr}
	if(c.DisplayDate==2){html+=' ('+LC_DaysOfWeek[day][c.Abbreviate]+', '+md+'/'+(mnth+1)+')'}
	if(c.DisplayDate>=3){html+=' on '+LC_DaysOfWeek[day][c.Abbreviate]+', '+md+' '+LC_MonthsOfYear[mnth][c.Abbreviate]}
	if(c.DisplayDate>=4){html+=' '+yr}
	html+=c.CloseTags;
	html+='</font>';

	if(LC_NS){
		var l=document.layers[c.Name+"Pos"].document.layers[c.Name].document;
		l.open();
		l.write(html);
		l.close();
	}else if(LC_N6||LC_IE){
		document.getElementById(c.Name).innerHTML=html;
	}else{
		document.write(html);
	}
}

function LiveClock(a,b,c,d,e,f,g,h,i,j,k,l){
	this.Name='LiveClock'+LC_Clocks.length;
	this.FntFace=a||LC_Style[0];
	this.FntSize=b||LC_Style[1];
	this.FntColor=c||LC_Style[2];
	this.BackColor=d||LC_Style[3];
	this.OpenTags=e||LC_Style[4];
	this.CloseTags=f||LC_Style[5];
	this.Width=g||LC_Style[6];
	this.Hour12=h||LC_Style[7];
	this.Update=i||LC_Style[8];
	this.Abbreviate=j||LC_Style[10];
	this.DisplayDate=k||LC_Style[9];
	this.GMT=l||LC_Style[11];
	LC_Clocks[LC_Clocks.length]=this;
	LC_CreateClock(this);
}

///////////////////////////////////////////////////////////

LC_OtherOnloads=(window.onload)?window.onload:new Function;
function getcommentinfo2(){
  if(userList.length<=0||conList.length<=0){
    return ;
  }
  var str="";
  for(i=0;i<userList.length;i++){
    str+="<div class=\"comm_js_title\"><strong>Name:</strong> "+userList[i]+"</div><div class=\"comm_js_content\">"+conList[i]+"</div>";
  }
  document.getElementById("commentinfoDiv2").innerHTML=str;
}
// JavaScript Document
function playFlash(flashid){
    var fpic =document.getElementById(flashid).getElementsByTagName("img");
	var flink =document.getElementById(flashid).getElementsByTagName("a");
	var texts =document.getElementById(flashid).getElementsByTagName("a");
	var pic_width="280";     var pic_height="210"; 	var button_pos=fpic.length;
	var stop_time=6000; 	 
	var txtcolor="dddddd";
	var bgcolor="000000";
	var imag=new Array();
	var link=new Array();
	var text=new Array();

	var flashUrl = 'http://images.mmosite.com/12sky2/images/flash/viewer.swf';


   for(var i=0;i<fpic.length;i++){
   imag[i]=fpic[i].src;
   }  

	var swf_height=pic_height;
	var pics="", links="", texts="";
	for(var i=0; i<imag.length; i++){
		pics=pics+("|"+imag[i]);
		links=links+("|"+flink[i]);
		
				//links=links+("|"+flink[i*2]);
		
		links = links.replace(/(&)/g,"+");
		texts=texts+("|"+text[i]);
		//alert(flink[i*2]);
	}
	
	pics=pics.substring(1);
	links=links.substring(1);
	texts=texts.substring(1);
	
	
	var flash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ pic_width +'" height="' + pic_height +'" /><param name="allowScriptAccess" value="always" />';
	flash = flash + '<param name="movie" value="'+ flashUrl +'" />';
	flash = flash + '<param name="quality" value="high" />';
	flash = flash + '<param name="menu" value="false" />';
	flash = flash + '<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&picwidth='+pic_width+'&picheight='+pic_height+'&txtcolor='+txtcolor+'&bgcolor='+bgcolor+'&button_pos='+button_pos+'&stop_time='+stop_time+'">';
    flash = flash + '<param name="wmode" value="transparent" />';
	flash = flash + '<embed wmode="transparent" src="' + flashUrl + '" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&picwidth='+pic_width+'&picheight='+pic_height+'&txtcolor='+txtcolor+'&bgcolor='+bgcolor+'&button_pos='+button_pos+'&stop_time='+stop_time+'" quality="high" width="'+ pic_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"allowScriptAccess="always"  />';
	flash = flash + '</object>';
	document.writeln(flash); 
	//document.writeln(links+"<br />"); 
}
function drag(E,B){var A=B.clientX;startY=B.clientY;var _=E.offsetLeft;origY=E.offsetTop;var D=A-_;deltaY=startY-origY;E.style.cursor="move";if(document.addEventListener){document.addEventListener("mousemove",$,true);document.addEventListener("mouseup",C,true)}else if(document.attachEvent){document.attachEvent("onmousemove",$);document.attachEvent("onmouseup",C)}function $($){if(!$)$=window.event;E.style.left=($.clientX-D)+"px";E.style.top=($.clientY-deltaY)+"px";if($.stopPropagation)$.stopPropagation();else $.cancelBubble=true}function C(_){if(!_)_=window.event;E.style.cursor="default";if(document.removeEventListener){document.removeEventListener("mouseup",C,true);document.removeEventListener("mousemove",$,true)}else if(document.detachEvent){document.detachEvent("onmousemove",$);document.detachEvent("onmouseup",C)}}}
var xmlhttp=false;
var status="";
var _loadNow="Loading...Please Wait...";
var _loadDeny="An error occurs when loading this page!";
function createXMLHttp(){
  if(window.XMLHttpRequest){
    xmlhttp=new XMLHttpRequest();
  }else {
    if(window.ActiveXObject){
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
  return xmlhttp;
}
function hiddenSkillDetails(){
  document.getElementById("edit").style.display="none";
}
function GetData(divid,skill_id){
  document.getElementById(divid).style.display="block";
  /* 获取屏幕中心位置 */
  var clientWidth=document.documentElement.clientWidth;
  var scrollTop=document.documentElement.scrollTop;
  document.getElementById(divid).style.position="absolute";
  document.getElementById(divid).style.top=400+scrollTop+"px";
  document.getElementById(divid).style.left=(parseInt(clientWidth/2)-350)+"px";
  createXMLHttp();
  document.getElementById(divid).innerHTML="";
  var url="/skills/details/"+skill_id+".shtml";
  xmlhttp.open("GET",url,true);
  xmlhttp.onreadystatechange=function(){
    if(xmlhttp.readyState==4){
      if(xmlhttp.status==200){
        document.getElementById(divid).innerHTML="<div id=\"movebar\" class=\"movebar\" onMouseDown=\"drag(this.parentNode, event);\"><span onClick=\"hiddenSkillDetails();\">x   </span></div><br>"+xmlhttp.responseText;
        //document.getElementById(divid).style.display = "block";
      }else {
        document.getElementById(divid).innerHTML=_loadDeny;
      }
    }else {
      document.getElementById(divid).innerHTML=_loadNow;
    }
  };
  xmlhttp.send(null);
}