//	=========================	//
//		育官專用自定Java頁		//
//	=========================	//

function MsgLink( file , msg )
{
	if(confirm(msg))
	{
		eval("location='"+ file +"'");
	}
}

function GoLink( file )
{
	eval("location='"+file+"'");
}
  
function PopLink( page , width , height )
{
	window.open( page, "go_link" , "toolbar=no,scrollbars=yes,width=" + (width + 10) + ",height=" + height + ",resizable=yes");
}


/***********************************************************************************************
/*
使用方法：
onclick="CheckALLCheckBox( this , '<%=楊兄的GridView的ID.ClientID %>' , 0 );"

第一個參數是checkbox本身,
第二個參數是GridView的ClientID,
第三個參數是要全選的checkbox所在的RowCell數.

*/
function CheckALLCheckBox( getCheckBox , getGridViewClientID , getColumnNumber )
{
	var CheckTo;
	//實現全選checkbox的選擇狀態
	getCheckBox.checked == true ? CheckTo = true : CheckTo = false;
	getCheckBox.checked = CheckTo;
	//使用getElementById方法來找尋GridView, 用這個方法才能在IE、FireFox通用
	var objectGridView = document.getElementById(getGridViewClientID);
	
	//取得GridView的Row數量
	var RowCount = objectGridView.rows.length;
	
	//執行迴圈，遍歷所有的GridViewRow
	for (var NowRowCount = 0 ; NowRowCount < RowCount ; NowRowCount++)
	{
		//取得Row裡指定的cells裡面的input型的物件
		var getInput = objectGridView.rows[NowRowCount].cells[getColumnNumber].getElementsByTagName("input");
		
		if(getInput[0].type == "checkbox")//如果物件第一個型態是checkbox就執行
		{
			//getInput[0].checked == true ? getInput[0].checked = false : getInput[0].checked = true;
			getInput[0].checked = CheckTo;
		}
	}
}

/**************************************************************************************************/

//function YY_checkform() { //v4.65
function CheckIfEmail(email)
{
invalid = "";
if ( email.length== 0)
return true;
if (!email)
invalid = "請輸入您的Email地址。";
else {
if ( (email.indexOf("@") == -1) || (email.indexOf(".") == -1) )
invalid += "\\n\\nEmail地址不合法。應當包含\'@\'和\'.\'；例如(\'.com\')。請檢查後再遞交。";
if (email.indexOf("your email here") > -1)
invalid += "\\n\\nEmail地址不合法，請檢測您的Email地址，在域名內應當包含\'@\'和\'.\'；例如(\'.com\')。";



if (email.indexOf("\\\\") > -1)
invalid += "\\n\\nEmail地址不合法，含有非法字符(\\\\)。";
if (email.indexOf("/") > -1)
invalid += "\\n\\nEmail地址不合法，含有非法字符(/)。";
if (email.indexOf("\'") > -1)
invalid += "\\n\\nEmail地址不合法，含有非法字符(\')。";
if (email.indexOf("!") > -1)
invalid += "\\n\\nEmail地址不合法，含有非法字符(!)。";



if ( (email.indexOf(",") > -1) || (email.indexOf(";") > -1) )
invalid += "\\n\\n只輸入一個Email地址，不要含有分號和逗號。";
if (email.indexOf("?subject") > -1)
invalid += "\\n\\n不要加入\'?subject=...\'。";
}
if (invalid == "")
{
return true;
}
else
{
alert("輸入的Email可能包含錯誤：" + invalid);
return false;}
}

function IsEMail(name) // E-mail值檢測
{
if ( !IsEnglish(name) )
{
	return false;	
}

var i = name.indexOf("@");
var j = name.lastIndexOf("@");

if ( i == -1 ) { return false; }
if ( i != j ) { return false; }
if ( i == name.length ) { return false; }
return true;
}

function IsEnglish(name) //英文值檢測
{
if(name.length == 0) { return false; }
	for(i = 0; i < name.length; i++)
	{ 
		if(name.charCodeAt(i) > 128)
		{
			return false;
		}
	}
return true;
}


//--------------------------------------------------------取得大小再彈出圖片====
var imgObj;
function checkImg(theURL,winName){
  if (typeof(imgObj) == "object"){
    if ((imgObj.width != 0) && (imgObj.height != 0)){
		
		if (imgObj.width > 1150 || imgObj.height > 1150){
			OpenFullSizeWindow(theURL,winName, ",width=" + ((imgObj.width/2)+20) + ",height=" + ((imgObj.height/2)+30));
		} else {
			OpenFullSizeWindow(theURL,winName, ",width=" + (imgObj.width+20) + ",height=" + (imgObj.height+30));
		}
		
	} else {
      setTimeout("checkImg('" + theURL + "','" + winName + "')", 100)
	}
  }
}

function OpenFullSizeWindow(theURL,winName,features) {
  var aNewWin, sBaseCmd;
  sBaseCmd = "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,";
  if (features == null || features == ""){
    imgObj = new Image();
    imgObj.src = theURL;
    checkImg(theURL, winName)
  }
  else{
    aNewWin = window.open(theURL,winName, sBaseCmd + features);
    aNewWin.focus();
  }
}
//--------------------------------------------------------取得大小再彈出圖片====