function showNormal(input){
	$('#'+input+"~span.error_tip").remove();
	$('#'+input).removeClass('error_input');
}

function hideMessage(input){
	$('#'+input+"~span.pub_msg").remove();
}
function showMessage(input,tip){
	var html = '<span class="pub_msg">'+tip+'</span>';
	$(html).appendTo($('#'+input)[0].parentNode);
}

function showError(input,error){
	showNormal(input);
	var html = ' <span class="error_tip">'+error+'</span>';
	$('#'+input).addClass('error_input');
	$(html).appendTo($('#'+input)[0].parentNode);
}
function checkInput(input,focus){
	var reg = new RegExp($('#'+input).attr('exp'));
	if (reg.test($('#'+input).val())){
		showNormal(input);
		return true;
	} else {
		showError(input,$('#'+input).attr('error'));
		if (focus) $('#'+input).focus();
		return false;
	}
}

function showSiteDialog(){
	$('#submitForm').html($('#siteForm').html());
	resetinput();
	$('#dTitle').html('+提交公司信息');
	sendType = 'suggest';
	hideMessage('site_submitor');
	showDialog(420);
}
function showDialog(height){
	$('#dialogTitle').show();
	$('#dialogOverlay').show();
	$('#dialogContainer').show();
	if (height){
		$('#dialogContainer').css('height',height+'px');
		$('#dialogOverlay').css('height',height+50+'px');
	}
	
}
function closeDialog(){
	$('#dialogOverlay').fadeOut('600');
	$('#dialogContainer').fadeOut('700');
}

function resetinput(){
	$('#submitForm select,#submitForm input,#submitForm textarea').each(function(index,el){
		el.id = el.id.substr(4);
		if (el.type == 'text' || el.TagName == 'TEXTAREA'){
			$(el).focus(function(el){$(this).addClass('input_focus');});
			$(el).blur(function(el){$(this).removeClass('input_focus');});
		}
	});
}

