var loadGradeState=false;
function loadGrading(m) {
 if(!loadGradeState){
  loadGradeState=true;
  ajaxpage('http://mag.udn.com/images/mag/face/gradefarm.html', 'gradingarea');
 }
}

function loadGradingTravel(m) {
 if(!loadGradeState){
  loadGradeState=true;
  ajaxpage('http://travel.udn.com/images/mag/travel/gradefarm_travel.html', 'gradingarea');
 }
}

function GetCookie(name) {
var cookieName = name + "=";
	if(document.cookie.length >0){
		position = document.cookie.indexOf(cookieName);
		if(position != -1){
			position = position + cookieName.length
			endPosition = document.cookie.indexOf(";",position);
			if(endPosition == -1)
				endPosition = document.cookie.length
		}
		return document.cookie.substring(position,endPosition);
	}else return null
}


function submitGrading(frm){
	//alert("cookie value:"+document.cookie);
	//alert("cookie value:"+GetCookie("authface"));
	if(grad.rand.value==""){
		loadGradeState=false;
		alert("請輸入認證碼!");
		return false;
	}else if( grad.rand.value != GetCookie("authface")){
		loadGradeState=false;
		alert("請輸入正確的認證碼!");
		return false;
	}
	return true;
}

function viewResult(frm){
	grad.action="http://dignews.udn.com/forum/postFromOther.jsp?view=1&face=-1";
	grad.submit();
}

function PushNews(frm){
	dignewsPush.action="http://dignews.udn.com/forum/postFromOther.jsp?push=1";
	dignewsPush.link_url.value      = document.grad.link_url.value;
	dignewsPush.category.value      = document.grad.category.value;
	dignewsPush.category_sub.value  = document.grad.category_sub.value;
	dignewsPush.article_topic.value = document.grad.article_topic.value;
	dignewsPush.link_website.value  = document.grad.link_website.value;
	dignewsPush.news_id.value       = document.grad.news_id.value;
	dignewsPush.submit();
}