function updateseccode(width, height,tips) {
	if(!tips) {
	$('seccodeimg').innerHTML = '<img id="seccode" onclick="updateseccode()" width="' + seccodedata[0] + '" height="' + seccodedata[1] + '" src="/capcha.php?rnd=' + Math.random() + '" style="cursor:pointer;" alt="" /><em class="tips"> '+unescape('%u5982%u679C%u770B%u4E0D%u6E05%u9A8C%u8BC1%u7801%uFF0C%u8BF7%u70B9%u56FE%u7247%u5237%u65B0')+'</em>';
	}else {
	$('seccodeimg').innerHTML = '<img id="seccode" onclick="updateseccode('+width+','+height+','+tips+')" width="' + seccodedata[0] + '" height="' + seccodedata[1] + '" src="/capcha.php?rnd=' + Math.random() + '" style="cursor:pointer;" alt="" />';
	}
}
function formToRequestString(form_obj)
{
    var query_string='';
    var and='';
    for (var i=0;i<form_obj.length ;i++ )
    {
        e=form_obj[i];
        
        if (e.name) {
            if (e.type=='select-one') {
                element_value=e.options[e.selectedIndex].value;
            } else if (e.type=='select-multiple') {
                for (var n=0;n<e.length;n++) {
                    var op=e.options[n];
                    if (op.selected) {
                        query_string+=and+e.name+'='+encodeURIComponent(op.value);
                        and="&"
                    }
                }
                continue;
            } else if (e.type=='checkbox' || e.type=='radio') {
                if (e.checked==false) {   
                    continue;   
                }   
                element_value=e.value;
            } else if (typeof e.value != 'undefined') {
                element_value=e.value;
            } else {
                continue;
            }
            query_string+=and+e.name+'='+encodeURIComponent(element_value);
            and="&"
        }

    }
    return query_string;
}
function addBookmark(title,url) {
if (window.sidebar && "object" == typeof( window.sidebar ) && "function" == typeof( window.sidebar.addPanel ) ) { 
window.sidebar.addPanel(title, url,""); 
} else if(document.all) {
window.external.AddFavorite( url, title);
} else if( window.opera && window.print ) {
return true;
}
}

function checkSubmit(theform,page) {
      var isok = Validator.Validate(theform,3);
      if(isok) {
	     theform.submit();
	  }else {
	     return false;
	  }
}
function showCredit(creditvalue) {
	  if(creditvalue == 3) {
		  $('message').require = 'false';
	  }else {
		   $('message').require = 'true';
	  }
}
function checkSubmitConfirm(theform,page,str) {
      var isok = Validator.Validate(theform,3);
      if(isok) {
         if(confirm(str)) {
            theform.submit();
         }
	     
	  }else {
	     return false;
	  }
}
function checkSubmitmode(theform,page,mode) {
      var isok = Validator.Validate(theform,mode);
      if(isok) {
	     theform.submit();
	  }else {
	     return false;
	  }
}

function removescript(s) {
	return s.replace(/<script.*?>.*?<\/script>/ig, '');
}

function reversecheckbox(itemname,checkstatus) {
	var inps = document.getElementsByName(itemname);
	for(var i=0;i<inps.length;i++){
		 inps[i].checked = !inps[i].checked;
	}
}

function IocOpenDlg(mywindow,strurl,width,height)
{
 var strDialogFeatures = "status=no;center=yes;help=no;dialogWidth="+width+";dialogHeight="+height+";scroll=yes;resize=no";
 var args = new Array();
 args[args.length] = mywindow;
 var result = this.showModalDialog(strurl,args,strDialogFeatures);
 return result;
}

function getSecondHtml(param,func,retid,htmlid,distype)
{
var url = 'ajax.php';
var pars =  'action=house&sub=area&parentid=' + param+'&retid='+htmlid+'&distype='+distype;
var myAjax = new Ajax.Request(
url,
{
method: 'post',
parameters: pars,
onComplete: function(s){
								var result = s.responseText;
								$(retid).innerHTML = result;
							}

});
}

function autosuggest(q_url,q_value,retid) {
var url = 'ajax.php';
var pars =  q_url+q_value;
var myAjax = new Ajax.Request(
url,
{
method: 'post',
parameters: pars,
onComplete: function(s){
								var result = s.responseText;
								var e = $(retid);
								if(result!=""){
									e.innerHTML = result;
									e.style.display="block";
								}else {
									e.style.display="none";
								}
							}

});
}

