function in_array(string, array){
   for (var i = 0; i < array.length; i++){
	  if(array[i] == string){
		 return true;
	  }
   }
	return false;
}

function printMode(){
	var hash  = window.location.hash;
	if( hash != '#print')
		window.location.hash = 'print';
	$('.mcl, .mcr, .footer .lnk, #slidesBox, .hdr').hide();
	$('#printModeClose').show();
	$('body').addClass('print');
	window.print();
}

function printModeClose(){
	window.location.hash = '';
//	window.location.href = location_href;
	$('.mcl, .mcr, .footer .lnk, #slidesBox, .hdr').show();
	$('#printModeClose').hide();
	$('body').removeClass('print');
}
$(document).ready(function(){	
	
	var search_keywords = $('#search_keywords');
	search_keywords.focus(function(){
		if( Trim($(this).val()) == 'Từ khóa tìm kiếm...' )
			$(this).val('');
	}).blur(function(){
		if( Trim($(this).val()) == '' )
			$(this).val('Từ khóa tìm kiếm...');
	});
	
	$('.navbar li').mouseover(function(){
		$(this).addClass('h').find('ul:first').stop().show();
	}).mouseleave(function(){
		$(this).removeClass('h').find('ul:first').stop().hide();
	});
	
	$('.catLs li').mouseover(function(){
		$(this).addClass('h').find('ul:first').stop().show();
	}).mouseleave(function(){
		$(this).removeClass('h').find('ul:first').stop().hide();
	});
	
	$('#sucuritiy_code_refresh, #sucuritiy_code_img').click(function(){
		$('#sucuritiy_code_img').attr('src', $('#sucuritiy_code_img').attr('src')+'?'+Math.random() )
	});
	
	var hash  = window.location.hash;
	if( hash == '#print')
		printMode();
		
	$('#print_page').click(function(){
		printMode();		
	});
	
	$('#printModeClose').click(function(){
		printModeClose();		
	});
	
	
});

