function Trim(strVal) { var strMatch = strVal.match(/^\s*(\S+(\s+\S+)*)\s*$/); result = (strMatch == null) ? "" : strMatch[1]; return result; } function isEmail(objObject){ var regEmail, strValue; regEmail = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/; strValue = objObject.value; if (objObject.value == "") return true; if(! regEmail.test(strValue)){ //objObject.focus(); return false; } return true; } function NewWindow(url,ht,wd,sc,rs,name){ l = (screen.width) ? (screen.width-wd)/2 : 0; t = (screen.height) ? (screen.height-ht)/2 : 0; param = "height=" + ht + ",width=" + wd + ",top=" + t + ",left=" + l + ",location=no,toolbar=no,status=no,menubar=no,scrollbars=" + sc + ",resizable=" + rs + ",copyhistory=no"; oc_infowin=window.open(url,name,param); if (oc_infowin != null){ oc_infowin.opener = self; } oc_infowin.focus(); } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i -1; i--) { if(theForm.rdoPOLL_VAL[i].checked == true){ strAnswer = theForm.rdoPOLL_VAL[i].value; i = -1; } } var myRandom = parseInt(Math.random()*99999999); str_url = "ajax-action.php?rand=" + myRandom + "&id=" + theForm.hidPOLL_QUESTION_ID.value + "&answer=" + strAnswer + "&action=poll"; xmlHTTP.open("GET", str_url, true); xmlHTTP.onreadystatechange = doCHECKPOLLRESPONSE; xmlHTTP.send(null); return false; } function doCHECKPOLLRESPONSE(){ if(xmlHTTP.readyState == 4){ if(xmlHTTP.status == 200){ var aryResponse = xmlHTTP.responseText.split('|'); var strResponse = aryResponse[0]; document.getElementById("pollform").style.display = "none"; var theForm = document.getElementById('frmPOLL'); theForm.reset(); if(strResponse.toString() == "success"){ document.getElementById("pollresult").style.display = "block"; document.getElementById("ans1").innerHTML = aryResponse[2] + "%"; document.getElementById("ans2").innerHTML = aryResponse[3] + "%"; document.getElementById("ans3").innerHTML = aryResponse[4] + "%"; } if(strResponse.toString() == "failed"){ alert("An error occured while submission.\nPlease try again."); return false; } } }else{ document.getElementById("poll_wait").style.display = "block"; document.getElementById("poll_wait").innerHTML = "Please wait..."; } } function doRELOADPOLL(){ document.getElementById("pollresult").style.display = "none"; document.getElementById("poll_wait").style.display = "none"; document.getElementById("pollform").style.display = "block"; document.getElementById("poll_submit").style.display = "block"; return false; } /********************************************************/ function doSUBMITCOMMENTS(){ var theForm = document.frmCOMMENTS; if(Trim(theForm.txtFULL_NAME.value).length == 0){ alert("Please enter your full name."); theForm.txtFULL_NAME.focus(); return false; } if(Trim(theForm.txtCITY_NAME.value).length == 0){ alert("Please enter your city name."); theForm.txtCITY_NAME.focus(); return false; } if(Trim(theForm.txaCOMMENTS.value).length == 0){ alert("Please enter your comment."); theForm.txaCOMMENTS.focus(); return false; } if(Trim(theForm.txaCOMMENTS.value).length > 4000){ alert("Please enter only 4000 characters\nin your comment."); theForm.txaCOMMENTS.focus(); return false; } theForm.hidACTION.value = "SubmitFightersComment"; theForm.action = 'form-action.php'; return true; } function doSUBMITDADASCOMMENTS(){ var theForm = document.frmCOMMENTS; if(Trim(theForm.txtFULL_NAME.value).length == 0){ alert("Please enter your full name."); theForm.txtFULL_NAME.focus(); return false; } if(Trim(theForm.txtCITY_NAME.value).length == 0){ alert("Please enter your city name."); theForm.txtCITY_NAME.focus(); return false; } if(Trim(theForm.txaCOMMENTS.value).length == 0){ alert("Please enter your comment."); theForm.txaCOMMENTS.focus(); return false; } if(Trim(theForm.txaCOMMENTS.value).length > 4000){ alert("Please enter only 4000 characters\nin your comment."); theForm.txaCOMMENTS.focus(); return false; } theForm.hidACTION.value = "SubmitDadasComment"; theForm.action = 'form-action.php'; return true; } /********************************************************/ var previous_selected_id = 0; function doASSIGNVALUE(fighter_id, fighter_name){ var theForm = document.frmCONTEST; if(Trim(fighter_id).length > 0){ if(previous_selected_id > 0){ for(i=1; i<=12; i++){ if(previous_selected_id != fighter_id){ theForm.hidCONTESTANT_ID.value = parseInt(fighter_id); theForm.hidCONTESTANT_NAME.value = fighter_name.toString(); document.getElementById("content_aimg_" + parseInt(fighter_id)).style.display = "none"; document.getElementById("content_dimg_" + parseInt(fighter_id)).style.display = "block"; document.getElementById("content_dimg_" + parseInt(fighter_id)).style.paddingRight = "0px"; document.getElementById("content_dimg_" + parseInt(fighter_id)).style.paddingLeft = "12px"; document.getElementById("content_dimg_" + parseInt(previous_selected_id)).style.display = "none"; document.getElementById("content_aimg_" + parseInt(previous_selected_id)).style.display = "block"; document.getElementById("content_aimg_" + parseInt(previous_selected_id)).style.paddingRight = "0px"; document.getElementById("content_aimg_" + parseInt(previous_selected_id)).style.paddingLeft = "12px"; theForm.txtEMAIL_ADDRESS.focus(); previous_selected_id = fighter_id; } } }else{ theForm.hidCONTESTANT_ID.value = parseInt(fighter_id); theForm.hidCONTESTANT_NAME.value = fighter_name.toString(); document.getElementById("content_aimg_" + parseInt(fighter_id)).style.display = "none"; document.getElementById("content_dimg_" + parseInt(fighter_id)).style.display = "block"; document.getElementById("content_dimg_" + parseInt(fighter_id)).style.paddingRight = "0px"; document.getElementById("content_dimg_" + parseInt(fighter_id)).style.paddingLeft = "12px"; theForm.txtEMAIL_ADDRESS.focus(); if(previous_selected_id == 0){ previous_selected_id = fighter_id; } } } } function doSUBMITCONTEST(){ var theForm = document.frmCONTEST; if(Trim(theForm.hidCONTESTANT_ID.value).length > 0){ if(Trim(theForm.txtEMAIL_ADDRESS.value).length <= 0){ alert("Please enter your email address."); theForm.txtEMAIL_ADDRESS.focus(); return false; } if(isEmail(theForm.txtEMAIL_ADDRESS) == false) { alert("Please enter your appropriate email address.\ne.g. you@yourdomain.com"); theForm.txtEMAIL_ADDRESS.focus(); return false; } if(Trim(theForm.txtCITY_NAME.value).length <= 0){ alert("Please enter your city name."); theForm.txtCITY_NAME.focus(); return false; } if(Trim(theForm.txtMOBILE_NO.value).length <= 0){ alert("Please enter your city name."); theForm.txtMOBILE_NO.focus(); return false; } }else{ alert("Please select contestant from above list."); return false; } theForm.hidACTION.value = "SubmitContestInfo"; theForm.action = 'form-action.php'; return true; }