jQuery.noConflict();
jQuery(document).ready(function(){

	jQuery('.product-line,.tooltip,#success,.answer').hide();

// ************ Contact Form Script Start
	
	jQuery('#submit').click(function(){
		var error = false;
		jQuery('#ajaxform .error').hide(); //if error visibile, hide on new click
		
		var firstName = jQuery('input#firstName').val();
                    if (firstName == "" || firstName == " ") {
                        jQuery('input#firstName').focus().before('<div class="error">Please enter your First Name</div>');
                        error = true;
                    }
		var lastName = jQuery('input#lastName').val();
                    if (lastName == "" || lastName == " ") {
                        jQuery('input#lastName').focus().before('<div class="error">Please enter your Last Name</div>');
                        error = true;
                    }
		var phone = jQuery('input#phone').val();
                    if (phone == "" || phone == " ") {
                        jQuery('input#phone').focus().before('<div class="error">Please enter your Phone</div>');
                        error = true;
                    }
		var address1 = jQuery('input#address1').val();
                    if (address1 == "" || address1 == " ") {
                        jQuery('input#address1').focus().before('<div class="error">Please enter your Address</div>');
                        error = true;
                    }
		var zip = jQuery('input#zip').val();
                    if (zip == "" || zip == " ") {
                        jQuery('input#zip').focus().before('<div class="error">Please enter your Zip Code</div>');
                        error = true;
                    }
		var email_test = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
        var email = jQuery('input#email').val();
                    if (email == "" || email == " ") {
                        jQuery('input#email').focus().before('<div class="error">Please enter your Email</div>');
                        error = true;
                    } else if (!email_test.test(email)) {
                        jQuery('input#email').select().before('<div class="error">Please enter a valid email</div>');
                        error = true;
                    }
		if (error == false) {
		var data_string = jQuery('form#ajaxform').serialize();
                    jQuery.ajax({
                        type: "POST",
                        url: "email.php",
                        data: data_string,
                        success: function() {
                            jQuery('#success').fadeIn();
							jQuery(':input','#ajaxform')
							.not(':button, :submit, :reset, :hidden')
							.val('')
							.removeAttr('checked')
							.removeAttr('selected');
                        }//end success function
                    }); //end ajax call
		}			
    return false;
					
    });

// *********** Support Scripts Start
	jQuery('li a.ask').click(function() {
		jQuery('li a.open').next('.answer').slideUp();
		jQuery('li a.open').removeClass('open');
		if (jQuery(this).is('.open')) 
		{ jQuery(this).removeClass('open').next('.answer').slideUp();
		}
		else
		{
		jQuery(this).addClass('open').next('.answer').slideDown();
		}
		return false;
	});
	
// *********** Showroom Scripts Start

	jQuery('.product-row li').click(function() {
		jQuery('.product-row li.showed .product-line').slideUp();
		jQuery('.product-row li.showed a').removeClass('active')
		jQuery('.product-row li.showed').removeClass('showed');
		jQuery(this).children('.product-line').slideDown();
		jQuery(this).addClass('showed');
		jQuery(this).children('a').addClass('active');
		return false;
	});
	
	jQuery('.products li.one').mouseenter(function() {
		jQuery(this).children('.tooltip').fadeIn();
	});
	jQuery('.products li.one').mouseleave(function() {
		jQuery(this).children('.tooltip').fadeOut();
	});
	
	jQuery('.products li.two').mouseenter(function() {
		jQuery(this).children('.tooltip').fadeIn();
	});
	jQuery('.products li.two').mouseleave(function() {
		jQuery(this).children('.tooltip').fadeOut();
	});
	
	jQuery('.products li.three').mouseenter(function() {
		jQuery(this).children('.tooltip').fadeIn();
	});
	jQuery('.products li.three').mouseleave(function() {
		jQuery(this).children('.tooltip').fadeOut();
	});
	
	jQuery('.products li.four').mouseenter(function() {
		jQuery(this).children('.tooltip').fadeIn();
	});
	jQuery('.products li.four').mouseleave(function() {
		jQuery(this).children('.tooltip').fadeOut();
	});
	
 // ************ General Script StartF
	
	var hhome = jQuery('#home').height();	
	var habout = jQuery('#about').height();	
	var hmodules = jQuery('#modules').height();
	var hservice = jQuery('#service').height();
	var hsupport = jQuery('#support').height();
	var hcontact = jQuery('#contact').height();
	var hshowroom = jQuery('#showroom').height();	
	
	jQuery('a.home').click(function(){
		jQuery('.container').animate({left: "0px"}, 500);
		jQuery('#content-scroller').animate({height: hhome}, 400);		
		return false	
	});
	jQuery('a.about').click(function(){
		jQuery('.container').animate({left: "-1080px"}, 500);
		jQuery('#content-scroller').animate({height: habout}, 400);		
		return false	
	});
	jQuery('a.modules').click(function(){
		jQuery('.container').animate({left: "-2160px"}, 500);
		jQuery('#content-scroller').animate({height: hmodules}, 400);		
		return false	
	});
	jQuery('a.service').click(function(){
		jQuery('.container').animate({left: "-3240px"}, 500);
		jQuery('#content-scroller').animate({height: hservice}, 400);		
		return false	
	});
	jQuery('a.support').click(function(){
		jQuery('.container').animate({left: "-4320px"}, 500);
		jQuery('#content-scroller').animate({height: hsupport}, 400);		
		return false	
	});
	jQuery('a.contact').click(function(){
		jQuery('.container').animate({left: "-5400px"}, 500);
		jQuery('#content-scroller').animate({height: hcontact}, 400);		
		return false	
	});
	jQuery('a.showroom').click(function(){
		jQuery('.container').animate({left: "-6480px"}, 500);
		jQuery('#content-scroller').animate({height: hshowroom}, 400);		
		return false	
	});
	jQuery('a.show').click(function(){
		jQuery('.container').animate({left: "-6480px"}, 500);
		jQuery('#content-scroller').animate({height: hshowroom}, 400);		
		return false	
	});
	
	// ********************* Modules Galleries   ****************************** //
	
	
	jQuery('#gallery1').click(function(){
			jQuery.fancybox([
				'http://www.ehrez.com/img/app1.jpg',
				'http://www.ehrez.com/img/app2.jpg',
				'http://www.ehrez.com/img/app3.jpg'
			], {
				'type'              : 'image'
			});
	});
	
	jQuery('#gallery2').click(function(){
			jQuery.fancybox([
				'http://www.ehrez.com/img/pat1.jpg',
				'http://www.ehrez.com/img/pat2.jpg',
				'http://www.ehrez.com/img/pat3.jpg'
			], {
				'type'              : 'image'
			});
	});
	
		jQuery('#gallery3').click(function(){
			jQuery.fancybox([
				'http://www.ehrez.com/img/clin1.jpg',
				'http://www.ehrez.com/img/clin2.jpg',
				'http://www.ehrez.com/img/clin3.jpg'
			], {
				'type'              : 'image'
			});
	});
	
		jQuery('#gallery4').click(function(){
			jQuery.fancybox([
				'http://www.ehrez.com/img/pres1.jpg',
				'http://www.ehrez.com/img/pres2.jpg',
				'http://www.ehrez.com/img/pres3.jpg'
			], {
				'type'              : 'image'
			});
	});
	
		jQuery('#gallery5').click(function(){
			jQuery.fancybox([
				'http://www.ehrez.com/img/bil1.jpg',
				'http://www.ehrez.com/img/bil2.jpg',
				'http://www.ehrez.com/img/bil3.jpg'
			], {
				'type'              : 'image'
			});
	});

		jQuery('#gallery6').click(function(){
			jQuery.fancybox([
				'http://www.ehrez.com/img/rep1.jpg',
				'http://www.ehrez.com/img/rep2.jpg',
				'http://www.ehrez.com/img/rep3.jpg'
			], {
				'type'              : 'image'
			});
	});
	
		jQuery('#gallery7').click(function(){
			jQuery.fancybox([
				'http://www.ehrez.com/img/main1.jpg',
				'http://www.ehrez.com/img/main2.jpg',
				'http://www.ehrez.com/img/main3.jpg'
			], {
				'type'              : 'image'
			});
	});
	
});
