function add_contact(id){
   if(id.length>0){
        uploader_init();
        uploader_go(id);
   }
}

function clUploadData ( thesrc ) {
        this.src = thesrc;
        this.src += "?";
        this.type = "text/javascript";
        this.oldScript  = document.createElement("SCRIPT");
        this.oldScript.type = this.type;
        this.callId = 0;
        
        document.body.appendChild(this.oldScript);
        this.upload = function ( theparams ) {
                var tParams = theparams || "";
                var newScript = document.createElement("SCRIPT");
                newScript.type = this.type;
                newScript.src  = this.src + tParams;
    document.body.replaceChild(newScript,this.oldScript);
                this.oldScript = newScript;
        }
}


function uploader_init () {
   uploader = new clUploadData('javascript.php');
}

function uploader_go (src) {
        uploader.upload(src);
}


function select_all_ls(z){
         document.getElementById("select_all").title=(z)?"Снять выделение":"Выделить все";
         for(i=0;i<document.delall.length;i++){
             if(document.delall.elements[i].type=="checkbox"&&document.delall.elements[i].name=="ids[]")
                 document.delall.elements[i].checked=z;
         }
}

function fnChoiceRegion(id) {

       var cover_div=document.getElementById("Region");
       cover_div.style.display =(id==1)?'block':'none';
}

function close_div(id) {
	var d = get_by_id(id);
	if (d) {
		d.innerHTML = '';
		d.style.top = -999;
		d.style.left = -999;
		d.id="";
	}
}

function get_by_id(id) {
	var itm = null;
	if (document.getElementById){
		itm = document.getElementById(id);
	}
	else if (document.all){
		itm = document.all[id];
	}
	else if (document.layers){
		itm = document.layers[id];
	}
	return itm;
}
