function checkall()
{
var aa = document.getElementsByName("rows_id[0]");
for (var i=0; i<aa.length; i++)
{
if (!aa[i].getAttribute("state"))
{
aa[i].checked =document.getElementById('chkall').checked;
}
else
{
aa[i].checked = false;
}
}
}
function checkallbyname(sname)
{
var aa = document.getElementsByName(sname);
for (var i=0; i<aa.length; i++)
{
if (!aa[i].getAttribute("state"))
{
aa[i].checked =document.getElementById('chkall').checked;
}
else
{
aa[i].checked = false;
}
}
}
//function reverse_check(checkOBJ){
// $("input[@name=rows_id]").each(function(){
// $(this).attr("checked",!this.checked);
// });
//}
function submit_mult()
{
var in_id=in_ids();
if(in_id==''){
alert("请选择要操作的记录！");return false;
}
var aa = document.getElementsByName('actiontype');
for (var i=0; i<aa.length; i++)
{
if(aa[i].checked)
{
document.search_form.actiontype.value = aa[i].value;
if(aa[i].value == 'setblockface')
{
var id_arr = in_id.split(',');
if(id_arr.length != 1)
{
alert("只可设置一张图片作为该小区的封面图！");
return false;
}
}
}
}
if(document.search_form.actiontype.value==''){
alert("请选择要操作的动作！");
return false;
}
document.search_form.actionid.value= in_ids();
var arr = document.search_form.actionid.value.split(',');
var n=0;
for(var j=0;j<arr.length;j++)
{
if(arr[j]>0) n++;
}
if(document.search_form.actiontype.value=='multdel')
{
if(confirm('确定要删除所选'+n+'条记录吗？')) document.search_form.submit();
}
else if(document.search_form.actiontype.value=='setface')
{
if(n == 1)
{
if(confirm('确定要该图片为小区封面吗？')) document.search_form.submit();
}
else
{
alert('只能设置一张图片为该小区封面！');
return false;
}
}
else
{
document.search_form.submit();
}
}
function submit_mult_new()
{
var bb = document.getElementById('changetype').value;
in_id=in_ids();
if(in_id==''){
alert("请选择要操作的记录！");exit;
}
var aa = document.getElementsByName('actiontype');
for (var i=0; i<aa.length; i++)
{
if(aa[i].checked) document.search_form.actiontype.value=aa[i].value;
}
//alert(document.getElementById('changetype').options[document.getElementById("changetype").selectedIndex].value);
//var m=document.getElementById("changetype").selectedIndex;
// if(m!=null){
//alert(m);
// }
// alert(document.getElementById('changetype').value);
if(document.search_form.actiontype.value=='' && document.getElementById('changetype').value=='' ){
alert("请选择要操作的动作！");
return false;
}else if(document.search_form.actiontype.value!=''){
submit_mult();
return false;
}else if(document.search_form.actiontype.value=='' && document.getElementById('changetype').value!=''){
var sel = confirm('是否对选中的记录做批量修改类型？')
if(sel==true){
document.search_form.actionid.value= in_ids();
document.search_form.changetype1.value= document.getElementById('changetype').value;
document.search_form.submit();
}else{
return false;
}
}
}
function agentTel()
{
var telno;
if( telno = prompt( '输入电话号码:', '' ))
{
var url = 'sell_manage.php';
var pars = 'actiontype=agentTel&esta=-2&telno='+telno;
var myAjax = new Ajax.Updater('agentTel', url, {method: 'get', parameters: pars});
}
return false;
}
function delagentTel()
{
var telno;
if( telno = prompt( '输入电话号码:', '' ))
{
var url = 'sell_manage.php';
var pars = 'actiontype=delagentTel&telno='+telno;
var myAjax = new Ajax.Updater('agentTel', url, {method: 'get', parameters: pars});
}
return false;
}
function in_ids(){
var len;
var aa;
var xlength = document.getElementById('get_col_num').value; //2
var y = document.getElementsByName('rows_id[0]'); //13
var ss = new Array(xlength);
for ( j=0; j<xlength; j++)
{
ss[j]='';
}
for (var i=0; i<y.length; i++)
{
if (y[i].checked)
{
for (var j=0; j<xlength; j++)
{
aa=document.getElementsByName('rows_id['+j+']');
ss[j] =ss[j] + aa[i].value +',';
}
}
}
for ( j=0; j<xlength; j++)
{
len=ss[j].length - 1;
if (j==(xlength-1))ss[j]=ss[j].substring(0,len);
}
return ss;
}
function submit_all(actiontype){
var arr = new Array();
$("table").find("input:checked[@name=rows_id]").each(function(i) {
arr[i]=$(this).val();
});
arr=unique(arr);
var ids=arr.join(",");
if(ids) {
if(actiontype=="multrealdel2") {
if (confirm("确定要删除选定的记录吗？"))
{
document.getElementById('multdelbtn').disabled=true;
document.action_form.actiontype.value=actiontype;
document.action_form.actionid.value=ids;
document.action_form.submit();
}
}
if(actiontype=="multrealdel") {
if (confirm("确定要删除选定的记录吗？"))
{
document.getElementById('multdelbtn').disabled=true;
document.search_form.actiontype.value=actiontype;
document.search_form.actionid.value=ids;
document.search_form.submit();
}
}
if(actiontype=="refresh") {
if (confirm("确定要刷新选定的记录吗？"))
{
document.getElementById('refreshbtn').disabled=true;
document.action_form.actiontype.value=actiontype;
document.action_form.actionid.value=ids;
document.action_form.submit();
}
}
if(actiontype=="change_esta") {
if (confirm("确定要把选定的记录打为失效吗？"))
{
document.getElementById('change_esta').disabled=true;
document.action_form.actiontype.value=actiontype;
document.action_form.actionid.value=ids;
document.action_form.submit();
}
}
if(actiontype=="movesell") {
window.open("move.php?tbl=sell&ids="+ids,'','width=400,height=100,scrollbars=no');
}
if(actiontype=="moverent") {
window.open("move.php?tbl=rent&ids="+ids,'','width=400,height=100,scrollbars=no');
}
} else {
alert("请先选定信息！");
}
return false;
}
function clickdel(id,pg)
{
if (confirm("确定要删除该记录吗？"))
{
document.search_form.actiontype.value="realdel";
document.search_form.actionid.value=id;
document.search_form.pg.value=pg;
document.search_form.submit();
}
return false;
}
function clickdel_tel(id,pg)
{
if (confirm("确定要删除该记录吗？"))
{
document.search_form.actiontype.value="del";
document.search_form.actionid.value=id;
document.search_form.pg.value=pg;
document.search_form.submit();
}
return false;
}
function clickdel2(id,pg)
{
if (confirm("确定要删除该记录吗？"))
{
document.search_form.act.value="realdel";
document.search_form.authid.value=id;
document.search_form.pg.value=pg;
document.search_form.submit();
}
return false;
}
function upcreate2(id)
{
if (confirm("确定要再发布该记录吗？"))
{
document.action_form.actiontype.value="upcreate";
document.action_form.actionid.value=id;
document.action_form.submit();
}
return false;
}
function clickdel_expire_sell()
{
if (confirm("确定要删除所有出售房源过期记录吗？"))
{
document.action_form.actiontype.value="del_expire";
document.action_form.submit();
}
return false;
}
function clickdel_expire_rent()
{
if (confirm("确定要删除所有出租房源过期记录吗？"))
{
document.action_form.actiontype.value="del_expire";
document.action_form.submit();
}
return false;
}
/*去掉数组重复项----------------*/
function unique(data){
data = data || [];
var a = {};
len = data.length;
for (var i=0; i<len;i++){
var v = data[i];
if (typeof(a[v]) == 'undefined'){
a[v] = 1;
}
}
data.length=0;
for (var i in a){
data[data.length] = i;
}
return data;
}
function clickalt(id)
{
document.search_form.actiontype.value="alt";
document.search_form.actionid.value=id;
document.search_form.submit();
return false;
}
function clickalt2(id)
{
document.search_form.actiontype.value='alt2';
document.search_form.actionid.value=id;
document.search_form.submit();
return false;
}
//好房热卖
function clickalt_recommend(id)
{
document.search_form.actiontype.value="alt_recommend";
document.search_form.actionid.value=id;
document.search_form.submit();
return false;
}
function clickalt_cancel(id)
{
document.search_form.actiontype.value="alt_cancel";
document.search_form.actionid.value=id;
document.search_form.submit();
return false;
}
function clicktop(id,args)
{
document.search_form.actiontype.value="top";
document.search_form.actionid.value=id;
document.search_form.args.value=args;
document.search_form.submit();
return false;
}
//---------------------------------------------纪经人权限组的JS控制
function delete_group(id,theRow)
{
if (confirm("确定要删除该记录吗？"))
{
var Row=theRow.parentNode;
while(Row.tagName.toLowerCase()!="tr")
{
Row=Row.parentNode;
}
Row.parentNode.removeChild(Row);//删除行
if(id!='insert'){
document.action_form.actiontype.value="delete_group";
document.action_form.actionid.value=id;
document.action_form.submit();
}
}
return false;
}
function sumit_group()
{
if (confirm("您的操作将会对系统造成一定的混乱，真的确定要提交吗？"))
{
document.modify_form.submit();
}
return false;
}
function synchronous_submit()
{
if (confirm("您的操作将会对系统造成一定的混乱，真的确定要提交吗？"))
{
document.action_form.actiontype.value='synchronous';
document.action_form.submit();
}
return false;
}
function import_telno()
{
if (confirm('你确定要导入全部有效经纪人的电话号码？')) {
document.search_form.actiontype.value = 'import_brokertelno';
document.search_form.submit();
}
return false;
}
function sendmail_selected(){
document.search_form.actionid.value = in_ids();
var actionids = document.search_form.actionid.value;
var arr = document.search_form.actionid.value.split(',');
var n=arr.length;
if (confirm('确定要推送所选'+n+'条记录吗？')) {
document.search_form.action ='mail_action.php';
document.search_form.actiontypet.value ='sendmail';
document.search_form.submit();
return true;
}else{
return false;
}
}
function thaw(id,rowid,uptbl)
{
if (confirm("确定要解冻该记录吗？"))
{
document.search_form.actiontype.value="thaw";
document.search_form.actionid.value=id;
document.search_form.rowid.value=rowid;
document.search_form.uptbl.value=uptbl;
document.search_form.submit();
}
return false;
}
function refuse(id)
{
if (confirm("确定要拒绝该记录吗？"))
{
document.search_form.actiontype.value="refuse";
document.search_form.actionid.value=id;
document.search_form.submit();
}
return false;
} 