 jQuery.noConflict(); 
	jQuery(document).ready(function($){
    	$('#close_newsletter').click(function(){
	    	$('#newsletter_box').hide('slow');
	    });
		$('#subscribeForm').submit(function(e){
			e.preventDefault();
			var email = $('#newsletter').val();
			bool = true;

			   if(email != '' && /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/.test(email)){

				   $('#newsletter').removeClass('validation-failed');

			   }else{

				   bool = false;

				   $('#newsletter').addClass('validation-failed');			   

			   }

			   if(bool == false){

				return false;   

			   }
			   $('#newsletter_box').show('slow');
			   $('#popup_newsletter').html('<h3 style="margin:10px;">loading...</h3>');
			$.post(posturl + 'newsletter/subscriber/new/',{email: email},function(text){
				$('#popup_newsletter').html('<h3 style="margin:10px;">' + text + '</h3>');
			});
		});
		$("#form_submit_ajax").click(function(e){

			   e.preventDefault();

			   is_submit = $(this).attr('is_submit');

			   if(is_submit != 'yes'){

				return false;   

			   }

			   full_name = $('#full_name').val();

			   email = $('#email').val();

			   how_you_feel = $('#how_you_feel').val();

			   bool = true;

			   if(full_name == ''){

				   bool = false;

				   $('#full_name').addClass('validation-failed');

			   }else{

				   $('#full_name').removeClass('validation-failed');

			   }

			   if(email != '' && /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/.test(email)){

				   $('#email').removeClass('validation-failed');

			   }else{

				   bool = false;

				   $('#email').addClass('validation-failed');			   

			   }

			   if(how_you_feel == ''){

				   bool = false;

				   $('#how_you_feel').addClass('validation-failed');

			   }else{

				   $('#how_you_feel').removeClass('validation-failed');

			   }

			   if(bool == false){

				return false;   

			   }

			   $('#form_submit_ajax').attr('is_submit', 'no');

			   $.post(posturl + 'contactus/index/feedback', {full_name : full_name, email : email, how_you_feel : how_you_feel}, function(text){

					$('#popup_form_feedback').html('<h3 style="margin:10px;">' + text + '</h3>');

					setTimeout(function(){$('#facebook_box').css('display:none;')}, 3000);

				});

			});
		$(".download-link").click(function(e){
			e.preventDefault();
			file_index = $(this).attr("href");
			file_id = $("#nfile-" + file_index).val();
			$("#nfile").val(file_id);
			
			document.getElementById('download_popup').style.display = 'block';
			//$("#download_popup").show();			
		});
		$(".download-link-blank").click(function(e){
			e.preventDefault();			
		});
		$(".download-link-close").click(function(e){
			e.preventDefault();
			$("#download_popup").hide();	
		});
		

		$("#popup_equiry_buttom").click(function(){ // Compare Menu in Navigator



		    $("#popup_equiry_box").toggle(1000);

		    $(".oacity_bg").show();

		 

	});

		$("#close_image").click(function(){ // Compare Menu in Navigator

          

		    $("#popup_equiry_box").toggle(1000);

		    $(".oacity_bg").hide();

		 

	});

			

		$("#email_friend").click(function(){ // Compare Menu in Navigator

            $("#popup_equiry_box2").toggle(1000);

		    $("#popup_equiry_box2 > .oacity_bg").show();

	});

		$("#close_image2").click(function(){ // Compare Menu in Navigator

		    $("#popup_equiry_box2").toggle(1000);

		    $("#popup_equiry_box2 >.oacity_bg").hide();

	});
			$("#open_facebook").click(function(){ // Compare Menu in Navigator

		    $("#facebook_box").toggle(1000);

		   // $("#facebook_box > .oacity_bg").show();

	});
		$("#pop_place_an_order").click(function(){ // Leftbar 



            $("#popup_equiry_box2_place_an_order").toggle(1000);

		    $("#popup_equiry_box2_place_an_order > .oacity_bg").show();

		 

	});
	$("#popup_equiry_box2_place_an_order #close_image2_order").click(function(){ // Compare Menu in Navigator

          

		    $("#popup_equiry_box2_place_an_order").toggle(1000);

		    $(" #popup_equiry_box2_place_an_order >.oacity_bg").hide();

	});

			$("#close_facebook").click(function(){ // Compare Menu in Navigator

          

		    $("#facebook_box").toggle(1000);

		   // $("#facebook_box >.oacity_bg").hide();

		 

	});

			

   //************* Bottom Small Slide Banner ************

  

var b_left2=0;//初始left

 begin_left2 = b_left2; //begin_left2 为开始移动时的left值

var imgages_number2;

var img_num2 = Math.ceil(imgages_number2/5); 

var img_width2 = 130*5; //每次移动宽度，即图片宽度

var total_long2 = -(img_width2*(img_num2-1)-begin_left2);//img_num2*img_width2;//总长度

var slide_img2 = null;  //setTimeout对象

var first_img2 = 0; //0 表示不是第一张图片，1表示第一张图片

var time_s2 = 5000; //没涨图片的间隔时间

//var no_slide = 0; //是否到达最后一张图片

var forword_click2 = 0;  // 是否点击下一张

var pre_click2 = 0;  // 是否点击前一张





function autoscroll_forward2(){

	

	//if(begin_left2 <=total_long2){clearTimeout(slide_img2); first_img2 =0; /*未到达第一张图片*/begin_left2+=img_width2;/*因为多加了一步，所以这里要减去一步*/}

//	  else {

//		  $("#slide_images").animate({ left:begin_left2+"px"},500,function(){ if(forword_click2 !=1 )begin_left2-=img_width2; forword_click2 = 0;});

//	      //first_img2 =0;

//		  slide_img2 = setTimeout(function(){autoscroll_forward2();},time_s2);

//		   first_img2 =0;//不是第一张图片

//	 }// 不会循环

   if(begin_left2 <total_long2){ begin_left2 = b_left2; }

	 

		  $("#small_slide").animate({ left:begin_left2+"px"},500,function(){ if(forword_click2 !=1 )begin_left2-=img_width2; forword_click2 = 0;});

	      //first_img2 =0;

		  slide_img2 = setTimeout(function(){autoscroll_forward2();},time_s2);

		   first_img2 =0;//不是第一张图片

	

	 

}

function autoscroll_back2(){

	

	if(begin_left2 >b_left2){  first_img2=1;/*已到达第一张图片*/ begin_left2-=img_width2;/*因为多退了一步，所以这里要加上一步*/}

	   else { 

	           $("#small_slide").animate({ left:begin_left2+"px"},500,function(){});

			    slide_img2 = setTimeout(function(){autoscroll_forward2();},time_s2);

			}

	  

	 

}

//slide_img2 = setTimeout(function(){autoscroll_forward2();},time_s2); //自动滑动

$('#arrow_forward2').bind('click', function() {

    clearTimeout(slide_img2);

    forword_click2 = 1; //

	if(begin_left2 >=total_long2){

		begin_left2-=img_width2;

		autoscroll_forward2();

	}

	

    });

$('#arrow_back2').bind('click', function() {

    clearTimeout(slide_img2);

	if(first_img2 !=1){begin_left2+=img_width2; autoscroll_back2();}



    });

 

//*************************



//*************************

});

   function getWindowsSize(width,height,id){
	if (window.innerWidth) winWidth = window.innerWidth;
		   else if ((document.body) && (document.body.clientWidth)) winWidth = document.body.clientWidth;
	
	if (window.innerHeight) winHeight = window.innerHeight;
		else if ((document.body) && (document.body.clientHeight));
		winHeight = document.body.clientHeight;
	
	if (document.documentElement  && document.documentElement.clientHeight && document.documentElement.clientWidth)
	{
		winHeight = document.documentElement.clientHeight;
		winWidth = document.documentElement.clientWidth;
	}
	
	
    topw   =   Math.ceil((winHeight   -   height)   /   2   ); 
	leftw   =   Math.ceil((winWidth   -   width)   /   2  );
	if(topw<0) topw=20;
	if(leftw<0) leftw=0;
	obj = document.getElementById(id);
    obj.style.left = leftw +"px";
    obj.style.top =topw +"px";	
}	
