﻿function RegisterMember(url, ContainerID, _nameid, _surnameid, _passwordid, _repasswordid, _emailid, normalbgcolor, errbgcolor, normalcolor, errcolor) {
    $(ContainerID + ' .hata').hide();
    $("#" + _repasswordid).css("background-color", normalbgcolor);
    $("#" + _repasswordid).css("color", normalcolor);
    if ($("#" + _passwordid).val() != $("#" + _repasswordid).val()) {
        $("#" + _repasswordid).css("background-color", errbgcolor);
        $("#" + _repasswordid).css("color", errcolor);
        return false;
    }
    $.ajax({
        type: "POST",
        url: url,
        data: "{ Name:'" + $("#" + _nameid).val() + "',SurName:'" + $("#" + _surnameid).val() + "',Password:'" + $("#" + _passwordid).val() + "',EMail:'" + $("#" + _emailid).val() + "'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (msg) {
            $(ContainerID + ' .hata').text(msg.d);
            $(ContainerID + ' .hata').show();
        },
        error: function (msg) {
        }
    });
}

function LoginMember(url, ContainerID, _emailid, _passwordid) {
    $(ContainerID + ' .hata').hide();
    $.ajax({
        type: "POST",
        url: url,
        data: "{ EMail:'" + $("#" + _emailid).val() + "',Password:'" + $("#" + _passwordid).val() + "'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (msg) {
            if (msg.d == "true") { document.location.href = "/"; }
            else {
                $(ContainerID + ' .hata').text(msg.d);
                $(ContainerID + ' .hata').show();
            }
        },
        error: function (msg) {
        }
    });
}
function RememberMember(url, ContainerID, _emailid) {
    $(ContainerID + ' .hata').hide();
    $.ajax({
        type: "POST",
        url: url,
        data: "{ EMail:'" + $("#" + _emailid).val() + "'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (msg) {
            $(ContainerID + ' .hata').text(msg.d);
            $(ContainerID + ' .hata').show();
        },
        error: function (msg) {
        }
    });
}
function SuggestFriend(cid, url, ContainerID, _namesurnameid, _emailid, _messageid) {
    $(ContainerID + ' .hata').hide();
    $.ajax({
        type: "POST",
        url: url,
        data: "{ CID:" + cid + ",NameSurname:'" + $("#" + _namesurnameid).val() + "',EMail:'" + $("#" + _emailid).val() + "',Message:'" + $("#" + _messageid).val() + "'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (msg) {
            $(ContainerID + ' .hata').text(msg.d);
            $(ContainerID + ' .hata').show();
        },
        error: function (msg) {
        }
    });
    $("#" + _namesurnameid).val("");
    $("#" + _emailid).val("");
    $("#" + _messageid).val("");
}
function AddComment(ContainerID, MessageID, SecureCodeID, CID, url, SecureImageControlID) {
    $(ContainerID + ' .hata').show();
    $(ContainerID + ' .hata').text("");
    if (CheckForm(ContainerID, 'white', '#E7E7E7', 'black', 'black')) {
        $.ajax({
            type: "POST",
            url: url,
            data: "{ ContentID:" + CID + " ,Message:'" + $("#" + MessageID).val() + "',SecureCode:'" + $("#" + SecureCodeID).val() + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (msg) {
                $(ContainerID + ' .hata').text(msg.d);
                if (msg.d == "Yorumunuz değerlendirilmek üzere sisteme kaydedildi.") $("#" + MessageID + '').val("");
            },
            error: function (msg) {
            }
        });
        $("#" + SecureCodeID + '').val("");
        $("#" + SecureImageControlID).attr("src", "/Page/Images/SecureCode.aspx?frm=Comment&t=" + new Date().getTime());
    }
}
function AddCommentPhoto(ContainerID, MessageID, SecureCodeID, PGPID, url, SecureImageControlID) {
    $(ContainerID + ' .hata').show();
    $(ContainerID + ' .hata').text("");
    if (CheckForm(ContainerID, 'white', '#E7E7E7', 'black', 'black')) {
        $.ajax({
            type: "POST",
            url: url,
            data: "{ PhotoID:" + PGPID + " ,Message:'" + $("#" + MessageID).val() + "',SecureCode:'" + $("#" + SecureCodeID).val() + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (msg) {
                $(ContainerID + ' .hata').text(msg.d);
                if (msg.d == "Yorumunuz değerlendirilmek üzere sisteme kaydedildi.") $("#" + MessageID + '').val("");
            },
            error: function (msg) {
            }
        });
        $("#" + SecureCodeID + '').val("");
        $("#" + SecureImageControlID).attr("src", "/Page/Images/SecureCode.aspx?frm=Comment&t=" + new Date().getTime());
    }
}

function SetRating(ContentID) {
    var ContentID = ContentID;
    $('.star').rating({
        callback: function (value, link) {
            $.ajax({
                type: "POST",
                url: "/Content/WebService/ClientSiteWebService.asmx/ContentVoteAdd",
                data: "{ ContentID:" + ContentID + ",Vote:" + value + " }",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (msg) {
                    $('.star').attr("disabled", "disabled");
                },
                error: function (msg) {
                }
            });

        }
    });
}

function GetGallery(type,controlobj) {
    try {
        $(".fp_gal_select ul li").attr("class", "");
        $(controlobj).parent().attr("class", "active");
        $.ajax({
            type: "POST",
            url: "/Content/WebService/ClientSiteWebService.asmx/GetGallery",
            data: "{ Type:" + type + "}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (msg) {
                var lst = new Array();
                lst = msg.d;
                if (lst[0].length == 0) return false;
                else {
                    $("#mygallery .belt").html(lst[1]);
                    $("#mygallery .belt").css("width", lst[0]);
                    $("#mygallery .belt").css("left", "0px");
                    //stepcarousel.stepTo("mygallery", 0);
                }
            },
            error: function (msg) {
            }
        });

    } catch (e) {

    }
}

function ChangeCaption(url, imageurl, title, summary, HplCaptionImageID, ImgCaptionID, HplTitleID, HplCaptionSummaryID) {
    try {
        $("#" + HplCaptionImageID).attr("href", url);
        $("#" + HplTitleID).attr("href", url);
        $("#" + HplCaptionSummaryID).attr("href", url);

        $("#" + ImgCaptionID).attr("src", imageurl);
        $("#" + HplTitleID).html(title)
        $("#" + HplCaptionSummaryID).html(summary)
    } catch (e) {

    }
}


var slidertimer;

function SliderStart(nextpage, interval) {
    slidertimer = setTimeout("SliderNextPage('" + nextpage + "')", interval);
}
function SliderNextPage(pageuri) {
    SliderStop();
    document.location.href = pageuri;
}
function SliderStop() {
    clearTimeout(slidertimer);
}
function ChangeSlideTime(pageuri) {
    SliderStop();
    document.location.href = pageuri;
}

function StopSlideTime(pageuri) {
    SliderStop();
    document.location.href = pageuri;
}
