function showDistrict(pi, t, idDiv)
{
	$.getJSON
	(
		HOST + '/ajax-common/show-district/?callback=?',
		{
			'pi' 	: pi ,
			't' 	: t
		},
		function(data)
		{
			$('#'+idDiv).html(data.html);
		}
	);
}

function showSize(ci, t, idDiv)
{
	$.getJSON
	(
		HOST + '/ajax-common/show-size/?callback=?',
		{
			'ci' 	: ci ,
			't' 	: t
		},
		function(data)
		{
			$('#'+idDiv).html(data.html);
		}
	);
}

function hideBlockUI()
{
	$.unblockUI();
	$('embed').show();
}

function displayError(v, id, hide)
{
	if(!hide)
	{
		hideBlockUI();
	}
	$('span.errMsg').hide();
	var spanId = (v==1) ? ('err_'+id) : ('exists_'+id);
	$('span#'+spanId).show();
	$('#'+id).select();
	$('#'+id).focus();
}

function refeshCaptcha(id)
{
	var e = document.getElementById(id);
	if(e)
	{
		var u = HOST + '/captcha.jpg?p=' + Math.random();
		e.src = u;
	}
}

function checkLengthContent(id, maxlength)
{
	var content = $('#'+id).val();
	if (content.length<=maxlength){
		return true;
	}
	return false;
}

function subContentByLength(id, maxlength)
{
	var e = $('#'+id);
	if (e)
	{
		e.val(e.val().substring(0, maxlength));
	}
}

function showMessageUI(msg, t, height)
{
	var h = height>0 ? height : 230;
	$.blockUI
	({
		message : msg ,
		css: 
		{
			border		: '5px solid #E0FD3E ',
			cursor		: 'pointer',
			top			:  ($(window).height() - 400)/2 + 'px',
			left		: ($(window).width() - 400)/2 + 'px',
			color 		: '#000000',
			width		: '400px',
			height		: h + 'px',
			textAlign	: 'left',
			padding		: '10px',
			fontSize	: '12px',
			lineHeight	: '1.5'
		}
	});
	if(t)
	{
		setTimeout('hideBlockUI()', t*1000)
	}
}

function checkHeaderSearch()
{
	var e = document.getElementById('frmSearchHeader');
	if(e)
	{
		if(e.k.value == e.k.defaultValue )
		{
			e.k.focus();
			return false;
		}
	}
	return true;
}

function changeSearchType(v)
{
	var e = document.getElementById('frmSearchHeader');
	if(e)
	{
		e.action = v;
	}
}

function showSubCate(id)
{
	$('ul.nav_cart').hide();
	$('ul#subof'+id).slideDown();
}


