﻿var reff = "";
$(document).ready(function(){
    $(".Logo").click(function(){
        window.location = 'http://www.zivltd.com/';    
    })
    $(".M1").hover(function(){
        $(this).css("background-position" , "-61px -2273px");
        $(".M1Txt a").css("color","#fff");
    },function(){
        $(this).css("background-position" , "-61px -1305px");
        $(".M1Txt a").css("color","#a1a1a1");
    })
    $(".M2").hover(function(){
        $(this).css("background-position" , "-61px -2031px");
        $(".M2Txt a").css("color","#fff");   
    },function(){
        $(this).css("background-position" , "-61px -1063px");
        $(".M2Txt a").css("color","#a1a1a1");
    })
    $(".M3").hover(function(){
        $(this).css("background-position" , "-61px -1789px");  
        $(".M3Txt a").css("color","#fff");
    },function(){
        $(this).css("background-position" , "-61px -821px");
        $(".M3Txt a").css("color","#a1a1a1");
    })
    $(".M4").hover(function(){
        $(this).css("background-position" , "-61px -1547px");   
        $(".M4Txt a").css("color","#fff");
    },function(){
        $(this).css("background-position" , "-61px -579px");
        $(".M4Txt a").css("color","#a1a1a1");
    })  
    $(".InputNum").keypress(function(e) {
        if (e.whice != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) return false;
    })    
    $(".M1").click(function(){
        window.location = 'Branches.aspx';
    })  
    $(".M2").click(function(){
        window.location = 'Ziv_Effeti.aspx';
    })  
    $(".M3").click(function(){
        window.location = 'Gallery.aspx';
    })  
    $(".M4").click(function(){
        window.location = 'Tryme.aspx';
    })          
    $(".Qline").live("click", function(){
          $.post("Handlers/RenderTryMeScreens.ashx",
              {pageCounter : $("#pageCounter").html(), questionNum : $(this).attr("num") + " - " + $(this).attr("id")}, 
              function(data) {
                  $("#QuestionBlock").html(data).show();
              }); 
     });

	$('.scroll-paneS').jScrollPane();
	$('.scroll-pane').jScrollPane();
	$('.scroll-paneL').jScrollPane();
	$('.scroll-paneXL').jScrollPane();
})
function ContactUsFormSubmit(action, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) {
    var flag = true;
    $(".CheckField").each(function(i) {
        if (typeof $(this).attr("regex") != 'undefined') {
            var regex = new RegExp($(this).attr("regex"));
            if ($(this).attr("class").indexOf("required") != -1) {
                if (!(regex).test($(this).val())) {
                    $(this).addClass("RedBorder");
                    flag = false;
                }
                else $(this).removeClass("RedBorder");
            }
            else // IF IT NOT A REQUIRED FIELD
            {
                if ($(this).val().length > 0) {
                    if (!(regex).test($(this).val())) {
                        $(this).addClass("RedBorder");
                        flag = false;
                    }
                    else $(this).removeClass("RedBorder");
                }
            }
        }
    })
    if (flag) {
        if (action == "ContactForm")
        {
            $("#SendBtn").attr("onclick", "");
            $.post("Handlers/SendMail.ashx",
                { action: "ContactForm", FullName: $("#FullName").val(), Phone: $("#Phone").val(), Email: $("#Email").val(), reff: $("#reff").val() },
              function(data) {
                  $("#ContactCont").html("<div class='R'>תודה על יצירת הקשר, אנו נחזור אליכם בהקדם</div>");
                  $("#ContactCont").append("<img height='1' width='1' style='border-style:none;' alt='' src='http://www.googleadservices.com/pagead/conversion/1053191677/?value=1&amp;label=cu2XCJHdSRD925n2Aw&amp;guid=ON&amp;script=0'/>");
              });
         }
         else if (action = "TryMeForm")
         { 
            $("#SendBtn").attr("onclick", "");
            $.post("Handlers/SendMail.ashx", 
                 {action : "TryMeForm",FullName : $("#FullName").val(), Phone : $("#Phone").val(), Email : $("#Email").val(), a1:a1, a2:a2, a3:a3, a4:a4, a5:a5, a6:a6, a7:a7, a8:a8, a9:a9, a10:a10, a11:a11, a12:a12, tryMeReff : $("#tryMeReff").val()},
              function(data) {
                  $("#QuestionBlock").html("<div class='R'>תודה לך, אנו מצפים לראותך בסניף</div>");
              });
         }
    
    }
}
function RenderTryMeScreens(pageCounter, questionNum)
{
        
      $.post("Handlers/RenderTryMeScreens.ashx",
      {pageCounter : pageCounter, questionNum : questionNum}, 
      function(data) {
          $("#QuestionBlock").html(data).show();
      }); 
}


// architects

function showArchitectByCity(city) {
    window.location = "architects.aspx?city=" + city;
}