function stripHtml(htstring) {
    return htstring.replace(/(<([^>]+)>)/ig,""); 
}
function isEmail(str) {
  var supported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported) 
    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(str) && r2.test(str));
}
function isvoid(){
}

function SubmitActionTarget(form, action, target) {
		form.action=action;
		form.target=target;
		form.submit();
}
function SubmitActionTargetByID(form, action, target) {
		var objForm = document.getElementById(form);
		objForm.action=action;
		objForm.target=target;
		objForm.submit();
}
function popupWindow(urlPath,width,height){
		popWin=window.open(urlPath, 'PopWin', 'width='+width+',height='+height+',top=0,left=50, toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, status=no');
		if(typeof(popWin)=="object"){
			popWin.focus();
			popWin.moveTo(screen.availWidth/3,90);
		}
}
function popupWindow2(url) {
	window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=320,height=370,screenX=0,screenY=0,top=0,left=0');
}
function close_window()
{
	window.close();
}
function jumpToTarg(targ,urlPath){ 
  eval(targ+".location='"+urlPath+"'");
}
function historyGo(num){ 
  history.go(num);
}
function showHiddenArea(sid){	
	document.getElementById(sid).style.display = document.getElementById(sid).style.display == "none" ? "" : "none";
}
function DisplayField(sid){
	document.getElementById(sid).style.display =  "";
}
function unDisplayField(sid){
	document.getElementById(sid).style.display =  "none";
}
function enableField(sid){	
	document.getElementById(sid).disabled =  false;
}
function disableField(sid){
	document.getElementById(sid).disabled =  true;
}
function fillAddrPopUpForm(addrType, address_book_id, entry_street_address1, entry_street_address2, buz_code, postalcode, telephone, telephone_extend,intersection){
	document.create_other_address.addrType.value=addrType;
	document.create_other_address.address_book_id.value=address_book_id;
	document.create_other_address.entry_street_address1.value=entry_street_address1;
	document.create_other_address.entry_street_address2.value=entry_street_address2;
	document.create_other_address.buz_code.value=buz_code;
	document.create_other_address.postalcode.value=postalcode;
	document.create_other_address.telephone.value=telephone;
	document.create_other_address.telephone_extend.value=telephone_extend;
	document.create_other_address.street_intersection.value = intersection;
}
function win_center(div_id,div_width)
{
	var objDialog = document.getElementById(div_id);
	if(window.innerWidth)
	{
		var $mar_left = (window.innerWidth - div_width)/2;
	}else
	{
		var $mar_left = (document.body.offsetWidth - div_width)/2;
	}
	var $mar_left = $mar_left + "px";
	objDialog.style.left = $mar_left;
}
function win_center_height(div_id)
{
	var objDialog = document.getElementById(div_id);
	if(window.innerHeight)
	{
		var $mar_top = (window.innerHeight - objDialog.offsetHeight)/2;
	}
	var $mar_top = $mar_top + "px";
	objDialog.style.top = $mar_top;
}
function chkEnterSearch(form, ev, error)
{
	var code = ev.keyCode;
	if (code==13){
		GetMerchantsByName('merchants_name',error);
	}
}