function textOnFocus(field, str, text_color){
	if(field.value == str){
		field.value = '';
		field.style.color = text_color;
	}
}

function textOnBlur(field, str, text_color){
	if(field.value == ''){
		field.value = str;
		field.style.color = text_color;
	}
}

function active_right_tab(obj, name, tab_number){
	var curentTab = obj.id;
	var curent = curentTab;
	if(typeof(name)=='undefined')
		name = 'right_tab';
	for(var i = 1; i <= tab_number; i++) {
		$('#' + name +'_' + i).removeClass('active');
		$('#content_'+ name +'_'+ i).hide();
	}
	$('#' + curent).addClass('active');
	$('#content_' + curent).show();
}

function checkKeyword(o, form, str, str_return){
	if(jQuery.trim(o.value) == '' || jQuery.trim(o.value) == str || jQuery.trim(o.value) == 'Nhập số ĐT hư'){
		alert(str_return);
		o.value = '';
		o.focus();
		return false;
	}else{
		form.submit();
		return true;
	}
}

function resizeImage(obj){
	var width	= $(obj).attr('width');
	var height	= $(obj).attr('height');		
	var m_width		= 372;
	var m_height	= 336;
	var per = 0;
	if(width > height){
		per = (m_height * 100) / height;
		new_height = m_height;
		new_width = Math.round((width * per) / 100);
	}else{
		per = (m_width * 100) / width;
		new_width = m_width;
		new_height = Math.round((height * per) / 100);
	}
	$(obj).attr('width', new_width);
	$(obj).attr('height', new_height);
}

function changeImage(num, qty){
	for(var i = 1; i <= qty ; i++){
		$('#img_' + i).hide();		
	}	
	$('#img_' + num).show();
}
