﻿$(document).ready(function() {
    function makeSublist(parent, child, isSubselectOptional, childVal,valBefore, valAfret) {
        $("body").append("<select style='display:none' id='" + parent + child + "'></select>");
        $('#' + parent + child).html($("#" + child + " option"));

        var parentValue = $('#' + parent).attr('value');
        $('#' + child).html($("#" + parent + child + " .sub_" + parentValue).clone());

        childVal = (typeof childVal == "undefined") ? "" : childVal;
        $("#" + child).val(childVal).attr('selected', 'selected');
        $('#' + child).prepend("<option value='0' selected='selected'>" + valBefore + "</option>");

        $('#' + parent).change(function() {
            var parentValue = $('#' + parent).attr('value');
            $('#' + child).html($("#" + parent + child + " .sub_" + parentValue).clone());
            if (isSubselectOptional) $('#' + child).prepend("<option value='0' selected='selected'>" + valAfret + "</option>");
            $('#' + child).trigger("change");
            $('#' + child).focus();

        });
    }

    $(document).ready(function() {
        makeSublist('ctl00_Top_ctl00_DropDownList2', 'ctl00_Top_ctl00_DropDownList3', true, '', 'הכל', 'בחר תחום');
        makeSublist('ctl00_Top_ctl00_DropDownList1', 'ctl00_Top_ctl00_DropDownList2', true, '', 'הכל', 'בחר נושא');
        makeSublist('ctl00_Top_ctl00_DropDownList4', 'ctl00_Top_ctl00_DropDownList5', true, '', 'הכל', 'כל הערים');
    });


    $(".NameValue").defaultValue("שם");
    $(".EmailValue").defaultValue("אימייל");
    $(".PhoneValue").defaultValue("טלפון");
    $(".MobilValue").defaultValue("נייד");
    $(".StextValue").defaultValue("הערות");
    //$("#aspnetForm").validate();
});

//move right & left


function slideMoveRightPro() {
    var position = $(".js_cont").position();
    var position_left = position.left - 10;
    if (position_left > -$(".js_cont").attr("max-width")) $(".js_cont").css("left", position_left);
}
function slideMoveLeftPro() {
    var position = $(".js_cont").position();
    var position_left = position.left + 10;
     if (position_left < 10) $(".js_cont").css("left", position_left);
}



$(document).ready(function() {

    $("#slide_left").mouseover(function() {
        stop_interval_slideMoveRight = setInterval("slideMoveLeftPro()", 100);
        return false;
    });

    $("#slide_left").mouseout(function() {
        clearInterval(stop_interval_slideMoveRight);
        return false;
    });
    $("#slide_left").click(function() {
    return false;
    });

    $("#slide_right").mouseover(function() {
        stop_interval_slideMoveLeft = setInterval("slideMoveRightPro()", 100);
        return false;
    });
   
    $("#slide_right").mouseout(function() {
        clearInterval(stop_interval_slideMoveLeft);
        return false;
    });
   
    $("#slide_right").click(function() {
    return false;
    });
    
    $(".image").click(function() {
    
       var image = $(this).attr("rel");
        
       
        $(".image_inner").animate({ opacity: "0.0" }, 300, function() {
        $(".image_inner").html('<img   height="195px" width="432px" src="' + image  + '" />');        });
        $(".image_inner").animate({ opacity: "1.0" }, 300);
               
       
        return false;
    
    });
  
  
   }); 
