﻿// JScript 檔

function GetDataScript(UID){
    
    PageMethods.GetAllClass(UID);
   
  }
/*function DrawImage(ImgD,FitWidth,FitHeight){
	var image=new Image();
	image.src=ImgD.src;
	if(image.width>0 && image.height>0){
		if(image.width/image.height>= FitWidth/FitHeight){
			if(image.width>FitWidth){
				ImgD.width=FitWidth;
				ImgD.height=(image.height*FitWidth)/image.width;
			}else{
				ImgD.width=image.width;
				ImgD.height=image.height;
			}
		} else{
			if(image.height>FitHeight){
				ImgD.height=FitHeight;
				ImgD.width=(image.width*FitHeight)/image.height;
			}else{
				ImgD.width=image.width;
				ImgD.height=image.height;
			}
		}
	}
}*/
function moveBoard() { 
	var board = document.getElementById("board"); 
	if (board) {
	board.style.top = document.body.scrollTop; 		
	//board.style.right = -1 * document.body.scrollLeft; //for firefox only 
	board.style.left =380 //document.body.clientWidth + document.body.scrollLeft - board.offsetWidth;//for ie & firefox 	
	} 
} 

//window.onscroll = moveBoard; 
//window.onresize = moveBoard; 
/*
//圖片輪播 上一張
function FaceListBack(i)
{
	if(parseInt(FaceList.style.left)<16)
	{
		if(i==18)
		{
			i=1;
			Back.style.display='';
		}
		else
		{
			Back.style.display='none';
			i++;
			window.setTimeout('FaceList.style.left=parseInt(FaceList.style.left)+8;FaceListBack('+i+')',30);
		}
	}
	else
	{
		Back.style.display='';
	}
}
//圖片輪播 下一張
function FaceListNext(i)
{
	if(parseInt(FaceList.style.left)>-800)
	{
		if(i==18)
		{
			i=1;
			Next.style.display='';
		}
		else
		{
			Next.style.display='none';
			i++;
			window.setTimeout('FaceList.style.left=parseInt(FaceList.style.left)-8;FaceListNext('+i+')',30);
		}
	}
	else
	{
		Next.style.display='';
	}	
}
*/

function DrawImage(ImgD,iwidth,iheight){
    //參數(圖片,允許的寬度,允許的高度)
    var image=new Image();
    image.src=ImgD.src;
    if(image.width>0 && image.height>0){
    //flag=true;
    //alert(ImgD + "iwidth" + image.width  + "iheight" +image.height );
    if(image.width/image.height>= iwidth/iheight){
        if(image.width>iwidth){  
        ImgD.width=iwidth;
        ImgD.height=(image.height*iwidth)/image.width;
        }else{
        ImgD.width=image.width;  
        ImgD.height=image.height;
        }
        ImgD.alt=image.width+"×"+image.height;
        }
    else{
        if(image.height>iheight){  
        ImgD.height=iheight;
        ImgD.width=(image.width*iheight)/image.height;        
        }else{
        ImgD.width=image.width;  
        ImgD.height=image.height;
        }
        ImgD.alt=image.width+"×"+image.height;
        }
    }
} 
 function WinOpen(){
    //	window.open("http:www.yahoo.com.tw,"_self");
    }
function KeyCode(e){
	    if(document.event){if(e.which==13){WinOpen();return false;}}
	    // IE瀏覽器偵測鍵值的方式
	    else{if(e.keyCode==13){WinOpen();return false}}
	    // 網景及Mozilla系瀏覽器偵測鍵值的方式
    }
//取的超連結
function findTextNode(element)
			{
				var num = element.childNodes.length;

				for (var count = 0; count < num; count++)
				{
					var currentNode = element.childNodes[count];

					if (currentNode.nodeType == 3) /* its a text node */
					{
						return currentNode;
					}
					else if (currentNode.nodeType == 1) /* its an element node */
					{
						currentNode = findTextNode(currentNode);
						if (! (currentNode == null))
						{
							return currentNode;
						}		
					}	
				}
		
				return null;
			}
			
			/* searches for the first text node and replaces it */
			function replaceLinkText(newText, anchor)
			{
				if (anchor.childNodes)
				{
					var textNode = findTextNode(anchor);

					if (! (textNode == null))
					{
						textNode.nodeValue = newText;
					}
				}
			}

			function getLinkText(anchor)
			{  
				if (anchor.childNodes)
				{
					var textNode = findTextNode(anchor);

					if (! (textNode == null))
					{
						return textNode.nodeValue;
					}
				}
			}
