﻿function ValidateExperience() {

    if (document.getElementById("ExperienceForm_NameTextBox").value == "") {
        radalert("<div style=\"text-align:right\">שם - שדה חובה</div>", 250, 100);
        return false;
    }

    if (document.getElementById("ExperienceForm_EmailTextBox").value == "") {
        radalert("<div style=\"text-align:right\">אימייל - שדה חובה</div>", 250, 100);
        return false;
    }

    if (IsEmail(document.getElementById("ExperienceForm_EmailTextBox")) == "error") {
        radalert("<div style=\"text-align:right\">אימייל לא תקין</div>", 250, 100);
        return false;
    }

    if (document.getElementById("ExperienceForm_MessageTextBox").value == "") {
        radalert("<div style=\"text-align:right\">תיאור החוויה - שדה חובה</div>", 250, 100);
        return false;
    }


    if (document.getElementById("ExperienceForm_SendButton") != null) {
        document.getElementById("ExperienceForm_SendButton").click();
    }
}

function ValidateYouTube() {

    if (document.getElementById("YouTubeForm_NameTextBox").value == "") {
        radalert("<div style=\"text-align:right\">שם - שדה חובה</div>", 250, 100);
        return false;
    }

    if (document.getElementById("YouTubeForm_EmailTextBox").value == "") {
        radalert("<div style=\"text-align:right\">אימייל - שדה חובה</div>", 250, 100);
        return false;
    }

    if (IsEmail(document.getElementById("YouTubeForm_EmailTextBox")) == "error") {
        radalert("<div style=\"text-align:right\">אימייל לא תקין</div>", 250, 100);
        return false;
    }

    if (document.getElementById("YouTubeForm_YouTubeLinkTextBox").value == "") {
        radalert("<div style=\"text-align:right\">קישור לסרט מאתר יוטיוב - שדה חובה</div>", 250, 100);
        return false;
    }


    if (document.getElementById("YouTubeForm_SendButton") != null) {
        document.getElementById("YouTubeForm_SendButton").click();
    }
}

function ValidateContactUs() {

    if (document.getElementById("ContactUsForm_NameTextBox").value == "") {
        radalert("<div style=\"text-align:right\">שם - שדה חובה</div>", 250, 100);
        return false;
    }

    if (document.getElementById("ContactUsForm_EmailTextBox").value == "") {
        radalert("<div style=\"text-align:right\">אימייל - שדה חובה</div>", 250, 100);
        return false;
    }

    if (IsEmail(document.getElementById("ContactUsForm_EmailTextBox")) == "error") {
        radalert("<div style=\"text-align:right\">אימייל לא תקין</div>", 250, 100);
        return false;
    }

    if (document.getElementById("ContactUsForm_MessageTextBox").value == "") {
        radalert("<div style=\"text-align:right\">תיאור הפניה - שדה חובה</div>", 250, 100);
        return false;
    }


    if (document.getElementById("ContactUsForm_SendButton") != null) {
        document.getElementById("ContactUsForm_SendButton").click();
    }
}

function ClearExperienceForm() {
    document.getElementById("ExperienceForm_NameTextBox").value = "";
    document.getElementById("ExperienceForm_EmailTextBox").value = "";
    document.getElementById("ExperienceForm_MessageTextBox").value = "";
    ShowMessage('תודה שבחרת לשתף אותנו בחוויה', 200);
}

function ClearExperienceFormDialog() {
    document.getElementById("ExperienceForm_NameTextBox").value = "";
    document.getElementById("ExperienceForm_EmailTextBox").value = "";
    document.getElementById("ExperienceForm_MessageTextBox").value = "";
    closeWin();
}

function ClearYouTubeForm() {
    document.getElementById("YouTubeForm_NameTextBox").value = "";
    document.getElementById("YouTubeForm_EmailTextBox").value = "";
    document.getElementById("YouTubeForm_YouTubeLinkTextBox").value = "";
    document.getElementById("YouTubeForm_MessageTextBox").value = "";
    ShowMessage('תודה ששלחת לנו סרטון וידאו', 200);
}

function ClearYouTubeFormDialog() {
    document.getElementById("YouTubeForm_NameTextBox").value = "";
    document.getElementById("YouTubeForm_EmailTextBox").value = "";
    document.getElementById("YouTubeForm_YouTubeLinkTextBox").value = "";
    document.getElementById("YouTubeForm_MessageTextBox").value = "";
    closeWin();
}

function ClearContactUsFormDialog() {
    document.getElementById("ContactUsForm_NameTextBox").value = "";
    document.getElementById("ContactUsForm_EmailTextBox").value = "";
    document.getElementById("ContactUsForm_MessageTextBox").value = "";
    closeWin();
}

function GetRadWindow() {
    var oWindow = null;
    if (window.radWindow) oWindow = window.radWindow;
    else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
    return oWindow;
    
}

function closeWin() {
    setTimeout('GetRadWindow().close();', 1000);
}

function CloseExperienceDialog() {
    ShowMessage('תודה שבחרת לשתף אותנו בחוויה', 200);
}

function CloseYouTubeDialog() {
    ShowMessage('תודה ששלחת לנו סרטון וידאו', 200);
}

function CloseContactUsDialog() {
    ShowMessage('תודה שפנית אלינו', 200);
}

function Survey() {
    document.getElementById("SekerDiv").style.display = "none";
    document.getElementById("ResultDiv").style.display = "block";
}

function ShowInfo() {
    ShowImage("<img src=\"Images/Common/YoutubeGuide.jpg\" alt=\"\" />");
}