	$(document).ready(function() {
		$("a[rel=lightbox]").fancybox({
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
		});

		$(".vidbox").click(function() {
			$.fancybox({
					'padding'					: 0,
					'autoScale'				: false,
					'transitionIn'		: 'elastic',
					'transitionOut'		: 'elastic',
					'title'						: this.title,
					'width'						: 480,
					'height'					: 270,
					'href'						: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/')+'&amp;rel=0',
					'type'						: 'swf',
					'swf'							: {
					'wmode'						: 'transparent',
					'allowfullscreen'	: 'true'
					}
				});

			return false;
		});		

		$(".openPop").fancybox({
				'width'					: 440,
				'height'				: 325,
				'overlayOpacity' : 0.5,
				'overlayColor' : '#000',
				'padding'				: 0,
				'titleShow'				: false,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic'
		});

		$(".inFieldLabels label").inFieldLabels();
		
		/***** button hover change img  *************/
		$(".button").hover(function() {
		      $(this).attr("src", $(this).attr("src").split(".").join("_on.")); 
		}, function() {
		      $(this).stop(true,false); // prevents the creation of stacked actions
		      $(this).attr("src", $(this).attr("src").split("_on.").join("."));  // removes -hover from the name of the image
		});

		$(".boxImg img.img").hover(
			function() {
				$(this).stop().animate({"opacity": "0"}, "slow");
			},
			function() {
				$(this).stop().animate({"opacity": "1"}, "slow");
		});

		$(".blogPageListItemImg img.img").hover(
			function() {
				$(this).stop().animate({"opacity": "0"}, "slow");
			},
			function() {
				$(this).stop().animate({"opacity": "1"}, "slow");
		});

		/***** Menu dropdown  *************/
    $("#mainMenu ul li.menu_item").hover(function(){
        $(this).addClass(" menu_on");
        $('ul:first',this).slideDown('slow');
    }, function(){
        $(this).removeClass(" menu_on");
        $('ul:first',this).slideUp('slow');
    });

		/***** Send nl form  *************/
		$('#nlFrm').submit(function() {
			if (document.nlFrm.field_nl.value == ""){
				alert("נא למלא כתובת מייל");
				document.nlFrm.field_nl.focus();
				return false;
			}
			else if ((!isEmail(document.nlFrm.field_nl.value))){
				alert("נא למלא כתובת מייל תקינה");
				document.nlFrm.field_nl.focus();
				return false;
			}
			else{
				xmlHttp.onreadystatechange=function() {
					if(xmlHttp.readyState==4) {
						res = xmlHttp.responseText;
	//				alert(res);
						if (res == 1){
							$('#nlResponseText').html('תודה! פרטיך נשלחו בהצלחה');
						}
						else{
							$('#nlResponseText').html('ארעה שגיאה בשליחת הטופס! אנא נסה שנית');
						}
						$('#nlFrm input').val("");
						$('#nlResponseText').slideDown(300).delay(3000).slideUp(300);
					}
				}				url = "sendnl.asp?field_nl="+document.nlFrm.field_nl.value;				xmlHttp.open("POST",url,true);
				xmlHttp.send(null);  

				return false;
			}
		});
		
		/***** Send contact box form  *************/
		$('#contactBFrm').submit(function() {
			if (document.contactBFrm.field_name.value == ""){
				alert("נא למלא שם");
				document.contactBFrm.field_name.focus();
				return false;
			}
			else if (document.contactBFrm.field_email.value == ""){
				alert("נא למלא כתובת מייל");
				document.contactBFrm.field_email.focus();
				return false;
			}
			else if ((!isEmail(document.contactBFrm.field_email.value))){
				alert("נא למלא כתובת מייל תקינה");
				document.contactBFrm.field_email.focus();
				return false;
			}
			else{
				xmlHttp.onreadystatechange=function() {
					if(xmlHttp.readyState==4) {
						res = xmlHttp.responseText;
	//				alert(res);
						if (res == 1){
							$('#contactResponseText').html('תודה! פרטיך נשלחו בהצלחה');
						}
						else{
							$('#contactResponseText').html('ארעה שגיאה בשליחת הטופס! אנא נסה שנית');
						}
						$('#contactBFrm input').val("");
						$('#contactResponseText').slideDown(300).delay(3000).slideUp(300);
					}
				}				url = "sendcontactbox.asp?field_name="+document.contactBFrm.field_name.value+"&field_phone="+document.contactBFrm.field_phone.value+"&field_email="+document.contactBFrm.field_email.value+"&field_subject="+document.contactBFrm.field_subject.value+"&field_msg="+document.contactBFrm.field_msg.value;				xmlHttp.open("POST",url,true);
				xmlHttp.send(null);  

				return false;
			}
		});
		
	});
	

