﻿function changeColor() {
    var PageNum = $('#lblColorMenu').html();
    alert(PageNum);
}

function showSelectedButton(cid) {

    $('#divDynamicRightMenu' + cid).css("background-image", "url('images/RightButtonBgSelected.png')");
}


var flagOpenCloseDynamicRightDiv = 0;

function openCloseDynamicRightDiv(id) 
{
        if ($('#divOpenClose' + id).is(':visible')) {
            $('#divOpenClose' + id).slideUp("slow");
        }
        else {
            $('[id^=divOpenClose]').slideUp("slow");
            $('#divOpenClose' + id).slideDown("slow");
        }
}


function sendEmail()
{
    //Ajax Function *******************************************
    $.ajax(
                   {
                       url: 'Ajax/SendMail.aspx?=&txtName=' + $('#txtName').val() + '&txtEmail=' + $('#txtEmail').val() + '&txtPhone=' + $('#txtPhone').val() + '&temp=' + Date(),
                       error: function() {
                           alert('Error in server');
                       },
                       success: function() {
                           alert("message send");
                           $('#txtName').val('');
                           $('#txtEmail').val('');
                           $('#txtPhone').val('');
                       }
                   }
                 );

}

var flagMusic = 0;
function PlayMusic() {
    if (flagMusic == 1) {
        
        flagMusic = 0;
        $.ajax(
                {
                    url: 'PlayMusic.aspx',
                    error: function() {
                        alert('Error');
                    },
                    success: function(res) {
                        $('#labelMusic').html(res);
                        $('#PlayMusic').html("<img src='images/MusicON.jpg' alt='השתק' border='0' width='120' height='23' />");
                    }

                }
            );
    }
    else {
        $('#labelMusic').html("");
        $('#PlayMusic').html("<img src='images/MusicOFF.jpg' alt='השתק' border='0' width='120' height='23'/>");
        flagMusic = 1;
    }
}

function txtValidate(e) {
    var k;
    document.all ? k = e.keyCode : k = e.which;

    if (k == 45 ||k==8)
        return true;
    return ((k >= 48 && k <= 58));
}


function formValidation() {
    $('#lblUserMSG').html("");

    valid = true;
    var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
    var address = $('#txtEmail').val();




    if ($('#txtEmail').val() == "") {
        $('#lblUserMSG').html("*אנא הכנס/י דואר אלקטרוני");
        valid = false;
    }
    else {
        if (reg.test(address) == false) {
            $('#lblUserMSG').html("*הדואר אלקטרוני שהוכנס שגוי");
            valid = false;
        }
        else {
            var strState = $('#txtFirstName').val();

            if (strState == "" || strState.length < 2) {
                $('#lblUserMSG').html("*אנא הכנס/י שם פרטי");
                valid = false;
            }
        }
    }


    if (valid == true) {
        $('#FormValid').val("true");
    }
    return valid;
} 
// / / / / / / / / / / gallery / / / / / / / / / / / 

function changeMainImageInGallary(id) {//פונקציה לטיפול בהחלפת התמונות בגלריה הגדולה

    var arrBigImage = $('#lblBigImageArray').html().split(',');

    $('#imageGallaryBig').attr("src", 'Pic/gallery/' + arrBigImage[id - 1]);

}

// / / / / / / / / / / / / / / / / / / / / / / / / /


///////////////

   
