$(function(){

	   var back1 = $( ".back1" ).first();
	   var back_position = back1.position();

	
setTimeout( function(){ 
	$(".pre_con").fadeOut();

}  , 1000 );
  

$("a:not(.inactive)").click(function(){
	
		$(".pre_con").fadeIn();
});  


//alert('load');		
$(window).load(function () {
		$(".pre_con").fadeOut();

    

});

$(".search_option_item").click(function(){
	
	$("#search_cat").val($(this).attr('alt'));
	$(".search_options .dropdown-content").hide();
});

$("#search_btn").click(function(){

	search_text=$("#search_box").val().split("%20").join("");
	search_text=search_text.split(" ").join("");
	search_type=$(".search_options").val();
	if(search_text!=''){
	search_url=website_url+'/search/' + search_text + '/' + search_type;
	//alert(search_url);
	window.location.href = search_url;
	}else{
		alert("Insert Search Keyword");
	}
});


$("#search_btn2").click(function(){

	search_text=$("#search_box2").val().split("%20").join("");
	search_text=search_text.split(" ").join("");
	search_type=$(".search_options_tall").val();
	
	if(search_text!=''){
	search_url=website_url+'/search/' + search_text + '/' + search_type;
	alert(search_url);
	window.location.href = search_url;
	}else{
		alert("Insert Search Keyword");
	}
});



var menu_open=0;

$(".btn").click(function(){


if($(this).attr("menu_open")=="0"){
$(".sub_menu").css("display","none");	
$(".sub_menu").attr("menu_open","0");
$(".menu_header").attr("menu_open","0");
$(this).next("ul").css("display","block");	
$(this).attr("menu_open","1");
$(".btn").removeClass('menu_active');
$(this).addClass("menu_active");
}else{
	
$(this).next("ul").css("display","none");	
$(this).attr("menu_open","0");
$(this).removeClass('menu_active');
}
	
	
});





$('#search_box').keypress(function(event){
    var keycode = (event.keyCode ? event.keyCode : event.which);
    if(keycode == '13'){
		
		search_text=$("#search_box").val().split("%20").join("");
		search_text=search_text.split(" ").join("");
		search_type=$(".search_options").val();
		
		if(search_text!=''){
			search_url=website_url+'/search/' + search_text + '/' + search_type;
			//alert(search_url);
			window.location.href = search_url;

		}else{
			alert("Insert Search Keyword");
		}

    }
});


$('#search_box2').keypress(function(event){
    var keycode = (event.keyCode ? event.keyCode : event.which);
    if(keycode == '13'){
		
		search_text=$("#search_box2").val().split("%20").join("");
		search_text=search_text.split(" ").join("");
		search_type=$(".search_options_tall").val();
		
		if(search_text!=''){
			search_url=website_url+'/search/' + search_text + '/' + search_type;
			//alert(search_url);
			window.location.href = search_url;

		}else{
			alert("Insert Search Keyword");
		}

    }
	
});






	$(".sub").click(function(){
		
	if($(this).attr("status")=='opened'){
		$(this).parent().next().slideUp();	
		$(this).attr("status",'closed');
		$(this).removeClass('sub_close');
		$(this).addClass('sub_open');
		
	}else{

		$(this).parent().next().slideDown();	
		$(this).removeClass('sub_open');
		$(this).addClass('sub_close');	
		$(this).attr("status",'opened');
	}	
		
		
	});



	$(".nav_btn").click(function() {
		
	   $('body').animate({
			scrollTop:  $(".slider_part").offset().top
		}, 500);

	});




	$("#to_top").click(function() {
	   $('html').animate({
			scrollTop:  $(".full-page").offset().top
		}, 2000);
		
		$("#to_top").fadeOut();
	});


 //alert("Z");

	
});
