function CheckRadio(theRadio){
    var theRadioLen = theRadio.length;
    var theRadioValue = false;
    if (theRadioLen == undefined){
        if (theRadio.checked){
            theRadioValue = theRadio.value;
        }
    }else{
        for (theRadioI=0;theRadioI<theRadioLen;theRadioI++){
            if (theRadio[theRadioI].checked){
                theRadioValue = theRadio[theRadioI].value;
                break;
            }
        }
    }
    return theRadioValue;
}

//==========================================
// 檢核Email格式是否正確
//==========================================
re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/

function EmailChk(Str) {
	if (re.test(Str.value)){
			return true;}
	else{
			return false;}}


function VoteCHK(form){
	form = document.form_vote;
	if(CheckRadio(form.vid)==false){
		alert('請選擇一個項目投票');
		form.vid[0].focus();
		return false;
	}else{
		form.submit();
	}
}

function Order(x)
{
	ff = document.getElementById("OrderEmail")
	if( ff.value == "" ){
		alert("請先輸入您的EMAIL !!");
		ff.focus();
		return;
	}else{
		if(EmailChk(ff)==false){
		alert('Email 格式錯誤，請重新輸入 !!');
		ff.focus();
		return false;}
	}
	w = window.open("/opaper/?mail="+ff.value+"&s="+x,"chkep","width=400,height=200,toolbar=0,Top=2000");
	w.focus();
}