﻿	function Vote(voteID)
	{
	    var txt1=document.all["VSIDText"].value;
	    var enctxt1=Encrypt(txt1);
	    var txt2=document.all["VSPassText"].value;
	    var passTxt=Encrypt(txt2);
	    var Answer=0;
	    if ((document.all['voteRadio1']!=null) && (document.all['voteRadio1'].checked)) Answer=1;
	    else if ((document.all['voteRadio2']!=null) && (document.all['voteRadio2'].checked)) Answer=2;
	    else if ((document.all['voteRadio3']!=null) && (document.all['voteRadio3'].checked)) Answer=3;
	    else if ((document.all['voteRadio4']!=null) && (document.all['voteRadio4'].checked)) Answer=4;
	    else if ((document.all['voteRadio5']!=null) && (document.all['voteRadio5'].checked)) Answer=5;
	    else if ((document.all['voteRadio6']!=null) && (document.all['voteRadio6'].checked)) Answer=6;
	    if (Answer != 0)
	    {
	        var url = "Vote.aspx?voteID=" + voteID + "&Answer=" + Answer + "&SID=" + enctxt1 + "&SPass=" + passTxt;
	        if ((txt1 != "") && (txt2 != "")) ajaxFunction("FVote", url, "0");
	    }
	    else alert('ابتدا يکی از گزينه ها را انتخاب کنيد');
	}

	function voteCheckKey(voteID)
	{
	    if (window.event.keyCode==13)
	    {
	        window.event.keyCode=0
	        var txt1=document.all["VSIDText"].value;
	        var enctxt1=Encrypt(txt1);
	        var txt2=document.all["VSPassText"].value;
	        var passTxt=Encrypt(txt2);
	        var Answer=0;
	        if ((document.all['voteRadio1']!=null) && (document.all['voteRadio1'].checked)) Answer=1;
	        else if ((document.all['voteRadio2']!=null) && (document.all['voteRadio2'].checked)) Answer=2;
	        else if ((document.all['voteRadio3']!=null) && (document.all['voteRadio3'].checked)) Answer=3;
	        else if ((document.all['voteRadio4']!=null) && (document.all['voteRadio4'].checked)) Answer=4;
	        else if ((document.all['voteRadio5']!=null) && (document.all['voteRadio5'].checked)) Answer=5;
	        else if ((document.all['voteRadio6']!=null) && (document.all['voteRadio6'].checked)) Answer=6;
	        if (Answer != 0)
	        {
	            var url = "Vote.aspx?voteID=" + voteID + "&Answer=" + Answer + "&SID=" + enctxt1 + "&SPass=" + passTxt;
	            if ((txt1 != "") && (txt2 != "")) ajaxFunction("FVote", url, "0");
	        }
	        else alert("ابتدا يکی از گزينه ها را انتخاب کنيد");
	    }
	}
	