﻿var redirectURL, redirectTime; function redirectToPage() { redirectURL = arguments[0]; redirectTime = arguments[1]; setTimeout("delayredirect()", redirectTime) } function delayredirect() { window.open(redirectURL, "_parent") } function clearAllFields() { var argsLength = arguments.length, i = 0; while (i < argsLength) { document.getElementById(arguments[i]).value = ""; i = i + 1 } return false } function GetDate(CtrlName) { var width = 270, height = 300, left = parseInt(screen.availWidth / 2 - width / 2), top = parseInt(screen.availHeight / 2 - height / 2), windowFeatures = "toolbar=no,scrollbars=no,status=no,resizable=no,menubar=no,location=no,width=" + width + ",height=" + height + ",status,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top; ChildWindow = window.open(baseURL + "UserAccounts/CalendarControl.aspx?sFormName=" + document.forms[0].name + "&sCtrlName=" + CtrlName, "PopUpCalendar", windowFeatures) } function CheckWindow() { ChildWindow.close() } function Close() { window.close() } function GetDisclosure() { var lbl = arguments[0]; ChildWindow = window.open("Disclosure.aspx?FormName=" + document.forms[0].name + "&lbl=" + lbl, "PopUpCalendar", "width=270,height=200,top=200,left=200,toolbars=no,scrollbars=yes,status=no,resizable=no") } function clickButton(event, buttonid) { var bt = document.getElementById(buttonid); if (event.keyCode == 13) { bt.click(); return false } } function allownumbers(e) { var key = window.event ? e.keyCode : e.which, keychar = String.fromCharCode(key), reg = new RegExp("[0-9.]"); if (key == 8) keychar = String.fromCharCode(key); if (key == 13) { key = 8; keychar = String.fromCharCode(key) } return reg.test(keychar) } function textBoxAlphaOnly() { var keyStroke = event.which ? event.which : window.event ? window.event.keyCode : -1, returnValue = false; if (keyStroke >= 65 && keyStroke <= 90 || keyStroke >= 97 && keyStroke <= 122) returnValue = true; if (window.event) window.event.returnValue = returnValue; return returnValue } function confirmDelete() { var showimge = document.getElementById(arguments[0]), fileupload = document.getElementById(arguments[1]), image = document.getElementById(arguments[2]), delteimagelnk = document.getElementById(arguments[3]), changeimagelnk = document.getElementById(arguments[4]), lblphoto = document.getElementById(arguments[5]), answer = confirm("நீக்கப்படும் புகைப்படம் திரும்ப பெற இயலாது. உங்கள் புகைப்படத்தை நீக்க வேண்டுமா?"); if (answer) { image.style.display = "none"; fileupload.style.display = "none"; delteimagelnk.style.display = "none"; changeimagelnk.style.display = "block"; showimge.value = "N~1" } } function changeiamge() { var fileupload = document.getElementById(arguments[0]), showimge = document.getElementById(arguments[1]), delteimagelnk = document.getElementById(arguments[2]), changeimagelnk = document.getElementById(arguments[3]); fileupload.style.display = "block"; changeimagelnk.style.display = "none"; delteimagelnk.style.display = "block"; showimge.value = "Y~1" }
function Get_Cookie(check_name) {
    var a_all_cookies = document.cookie.split(";"),
a_temp_cookie = "", cookie_name = "", cookie_value = "",
b_cookie_found = false; for (i = 0; i < a_all_cookies.length; i++) {
        a_temp_cookie = a_all_cookies[i].split("="); cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, "");
        if (cookie_name == check_name) {
            b_cookie_found = true;
            if (a_temp_cookie.length > 1) cookie_value = unescape(a_temp_cookie[1].replace(/^\s+|\s+$/g, ""));
            return cookie_value; break
        } a_temp_cookie = null; cookie_name = ""
    }
    if (!b_cookie_found) return null
}var value;

function PollClick() {
    var e = document.getElementsByName("rbpoll"),
res = arguments[0], btn = document.getElementsByName("btnpoll"),
val = "", pollid = arguments[1]; for (i = 0; i < e.length; i++)
        if (e[i].checked) val = e[i].value;
    var value1 = pollid, retncookie = Get_Cookie("dashKey");
    if (retncookie == null || retncookie == "") if (val != "") {
        createpollHttp();
        var url = "poll.ajax?type=home&spolloption=" + val;
        pollHttp.onreadystatechange = function () { RespondQueryPoll(pollHttp, res) }; pollHttp.open("GET", url, true);
        pollHttp.send(null); SetPollCookie("dashKey", value1)
    }
    else alert("Choose an Option To Vote");
    else if (val != "") {
        createpollHttp();
        url = "poll.ajax?sExistspoll=" + val; pollHttp.onreadystatechange = function () { RespondExistsPoll(pollHttp, res) };
        pollHttp.open("GET", url, true);
        pollHttp.send(null)
    }
    else alert("Choose an Option To Vote")
}

function PollClick_elec() {
    var e = document.getElementsByName("rbpoll"),
     res = arguments[0], btn = document.getElementsByName("btnpoll"),
val = "",
 pollid = arguments[1];

    for (i = 0; i < e.length; i++)
        if (e[i].checked)
        val = e[i].value;
    var value2 = pollid,
retncookie = Get_Cookie("ElectionPoll"); if (retncookie == null || retncookie == "") if (val != "") {
        createpollHttp();
        var url = "poll.ajax?type=election&spolloption=" + val; pollHttp.onreadystatechange = function() {
            RespondQueryPoll(pollHttp, res)
        }; pollHttp.open("GET", url, true); pollHttp.send(null);
        SetPollCookie("ElectionPoll", value2)
    }
    else
        alert("Choose an Option To Vote");
    else if (val != "") {
        //createpollHttp(); url = "poll.ajax?sExistspoll=" + val;
        //pollHttp.onreadystatechange = function() {
         //   RespondExistsPoll(pollHttp, res)
        //}; pollHttp.open("GET", url, true); pollHttp.send(null)
        alert('உங்கள் பதிவு, பதிவு செய்யப்பட்டுள்ளது');
    }
    else alert("Choose an Option To Vote")
}
function PollClick_Pledge() {
    var e = document.getElementsByName("rbpoll"),
     res = arguments[0], btn = document.getElementsByName("btnpoll"),
val = "",
 pollid = arguments[1];
    for (i = 0; i < e.length; i++)
        if (e[i].checked)
        val = e[i].value;
    var value3 = pollid,
retncookie = Get_Cookie("ElectionPledge"); if (retncookie == null || retncookie == "") if (val != "") {
        createpollHttp();
        var url = "poll.ajax?type=pledge&spolloption=" + val; pollHttp.onreadystatechange = function() {
            RespondQueryPoll(pollHttp, res)
        }; pollHttp.open("GET", url, true); pollHttp.send(null);
        SetPollCookie("ElectionPledge", value3)
    }
    else
        alert("Choose an Option To Vote");
    else if (val != "") {
       // createpollHttp(); url = "poll.ajax?sExistspoll=" + val;
       // pollHttp.onreadystatechange = function() {
       //     RespondExistsPoll(pollHttp, res)
        //}; pollHttp.open("GET", url, true); pollHttp.send(null)
        alert('உங்கள் பதிவு, பதிவு செய்யப்பட்டுள்ளது');
    }
    else alert("Choose an Option To Vote")
}


function RecommendCount() {
    var cntId;
    var artId;
    var recmddivId = document.getElementById(arguments[2]);
    cntId = document.getElementById(arguments[0]);
    artId = arguments[1];
    var rcmdCookie = Get_Cookie("Recommend"+artId);
    if (rcmdCookie == null || rcmdCookie == "") {
        createXMLHttp();
        var url;
        url = "Recommend.ajax?rcmdcnt=" + artId + "&num=" + Math.random(100000);

        XmlHttp.onreadystatechange = function () {
            if (XmlHttp.readyState == 4) {
                if (XmlHttp.status == 200) {

                    var cntIdArray = cntId.id.split("_");
                    var cntId1Val;
                    var cntId1;
                    var recmdivIdArray = recmddivId.id.split("_");
                    var recmddivId1val;
                    var recmddivId1;

                    if (cntIdArray[2] == "Link1") {
                        cntId1Val = cntIdArray[0] + "_" + cntIdArray[1] + "_Link2_" + cntIdArray[3];
                        recmddivId1val = recmdivIdArray[0] + "_" + recmdivIdArray[1] + "_Link2_" + recmdivIdArray[3];
                    }
                    else {
                        cntId1Val = cntIdArray[0] + "_" + cntIdArray[1] + "_Link1_" + cntIdArray[3];
                        recmddivId1val = recmdivIdArray[0] + "_" + recmdivIdArray[1] + "_Link1_" + recmdivIdArray[3];
                    }
                    cntId1 = document.getElementById(cntId1Val);
                    recmddivId1 = document.getElementById(recmddivId1val);
                    cntId.innerHTML = XmlHttp.responseText;
                    cntId1.innerHTML = XmlHttp.responseText;
                    recmddivId.className = "mouseoutrcmd";
                    recmddivId1.className = "mouseoutrcmd";


                }
            }
        };
        XmlHttp.open("GET", url, true);
        XmlHttp.send(null);
        SetCountCookie("Recommend"+artId, artId, 1);
    }
}

function SetCountCookie(c_name,value,exdays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}

function ThumbsCount() {
     var ThumbsCntID;
     ThumbsCntID = arguments[0] + 'Cnt';
   var thumbsImgdiv=document.getElementById(arguments[0]);
    var ThumbsCnt = document.getElementById(ThumbsCntID);
    var artId = arguments[1];
    var commentId = arguments[2];
    var Thumbsval = arguments[3];

    var cookievalue = artId + "_" + commentId;

    var thumbsCookie = Get_Cookie("ThumbsCnt" + commentId);
   
    if (thumbsCookie != cookievalue) {
        createXMLHttp();
        var url;
        url = "Thumbs.ajax?thumbscnt=" + artId + "&cmdId=" + commentId + "&thumbValue=" + Thumbsval + "&num=" + Math.random(100000);

        XmlHttp.onreadystatechange = function () {
            if (XmlHttp.readyState == 4) {
                if (XmlHttp.status == 200) {
                    var thumbsImgdivArray = thumbsImgdiv.id.split("_");
                    var anotherImgId;
                    var anotherImgIddiv;
                    if (thumbsImgdivArray[3] == "ThumbsDown" || thumbsImgdivArray[3] == "ThumbsUp") {
                        if (thumbsImgdivArray[3] == "ThumbsDown") {
                            anotherImgId = (thumbsImgdivArray[0] + "_" + thumbsImgdivArray[1] + "_" + thumbsImgdivArray[2] + "_ThumbsUp");
                            anotherImgIddiv = (document.getElementById(anotherImgId));
                            anotherImgIddiv.className = "cursorNone";
                            thumbsImgdiv.className = "cursorNone";
                        }
                        else {
                            anotherImgId = (thumbsImgdivArray[0] + "_" + thumbsImgdivArray[1] + "_" + thumbsImgdivArray[2] + "_ThumbsDown");
                            anotherImgIddiv = (document.getElementById(anotherImgId));
                            anotherImgIddiv.className = "cursorNone";
                            thumbsImgdiv.className = "cursorNone";
                        }
                    }
                    else {
                        if (thumbsImgdivArray[5] == "ReplyThumbsDown") {
                            anotherImgId = (thumbsImgdivArray[0] + "_" + thumbsImgdivArray[1] + "_" + thumbsImgdivArray[2] + "_" + thumbsImgdivArray[3] + "_" + thumbsImgdivArray[4] + "_ReplyThumbsUp");
                            anotherImgIddiv = (document.getElementById(anotherImgId));
                            anotherImgIddiv.className = "cursorNone";
                            thumbsImgdiv.className = "cursorNone";
                        }
                        else {
                            anotherImgId = (thumbsImgdivArray[0] + "_" + thumbsImgdivArray[1] + "_" + thumbsImgdivArray[2] + "_" + thumbsImgdivArray[3] + "_" + thumbsImgdivArray[4] + "_ReplyThumbsDown");
                            anotherImgIddiv = (document.getElementById(anotherImgId));
                            anotherImgIddiv.className = "cursorNone";
                            thumbsImgdiv.className = "cursorNone";
                        }

                        
                    }
                    ThumbsCnt.innerHTML = XmlHttp.responseText;



                }
            }
        };
        XmlHttp.open("GET", url, true);
        XmlHttp.send(null);

        SetThumbsCookie("ThumbsCnt" + commentId, cookievalue, 1);
    }


}
function SetThumbsCookie(c_name, value, exdays) {
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + exdays);
    var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
    document.cookie =c_name + "=" + c_value;
}

