jQuery(document).ready(function(jQuery) {
	jQuery("#currency, #ri_price_sort").selectBox();
	jQuery('.your_cart_bottom h2.title').click(function(){
		  if (jQuery(".content_your_cart_bottom").is(":hidden")) {
				jQuery(".content_your_cart_bottom").slideDown("slow");
				jQuery(this).addClass('down_arrow');
		  } else {
				jQuery(".content_your_cart_bottom").slideUp("slow");
				jQuery(this).removeClass('down_arrow');
		  }
		  return false;
	});
	//focus url
	var strCurrentURL = window.location.href;
	var strRoolURL = "/projects/dienhoavietnam/";
	var arrLinkObj = jQuery(".nav_menu li a");
	arrLinkObj.removeClass("current");
	arrLinkObj.each(function() {
		var objSelf = jQuery(this)
		if(strCurrentURL.indexOf(objSelf.attr("href")) >= 0 ) {
			if(objSelf.attr("href") != strRoolURL) {
				objSelf.addClass("current");
			}
			//alert(strCurrentURL.indexOf(strLastAccessUrl));
		} 
		if(window.location.pathname == strRoolURL && objSelf.attr("href") == strRoolURL) {
			objSelf.addClass("current");
		}
		
	});
	jQuery('.content_testimonials .slide_content') 
		.cycle({ 
		fx:     'fade',
		speed:  1000, 
		timeout: 0,
		next:   '.content_testimonials a.next_testimonials', 
		prev:   '.content_testimonials a.prev_testimonials'	
	});
	jQuery('.addServiceToCart').click(function(){
		jQuery(this).parent('form').submit();
	});

	jQuery(".preview img").thumbPopup({
		  imgSmallFlag: "/bmz_cache/3/",
		  imgLargeFlag: "/images/",
		  indicator: "/images/ajax-loader.gif"	
	});
	
	jQuery('#ri_price_sort').change(function(){
		var price_range = jQuery(this).val();
		var splitResult = price_range.split("-");
		if(splitResult[0] !== 'undefined' && splitResult[1] !== 'undefined') {
			jQuery('input[name=pfrom]').val(splitResult[0]);
			jQuery('input[name=pto]').val(splitResult[1]);
		}
	})
});
