function ShowBild(sPicURL) {	window.open('/imagepreview.php?image='+sPicURL, '', 'resizable=1,HEIGHT=200,WIDTH=200, top=0, left=0, scrollbars=yes');}function inscript (input,text) {	if (input.value=="") {input.value=' '+text}}var ajax_metro = new Array();function getCityList_metro(sel){	var countryCode = sel.options[sel.selectedIndex].value;	document.getElementById('metro_fast').options.length = 0;	if(countryCode.length>0){		var index = ajax_metro.length;		ajax_metro[index] = new sack();		ajax_metro[index].requestFile = '/body/includes/library/city_metro.php?countryCode='+countryCode;		ajax_metro[index].onCompletion = function(){ createCities_metro(index) };		ajax_metro[index].runAJAX();	}}function createCities_metro(index){	var obj = document.getElementById('metro_fast');	eval(ajax_metro[index].response);	var e = document.getElementById('metro_look_fast');	if (ajax_metro[index].response=='') e.style.display = 'none';	else e.style.display = 'block';}function sack(file) {	this.xmlhttp = null;	this.resetData = function() {		this.method = "POST";  		this.queryStringSeparator = "?";		this.argumentSeparator = "&";		this.URLString = "";		this.encodeURIString = true;  		this.execute = false;  		this.element = null;		this.elementObj = null;		this.requestFile = file;		this.vars = new Object();		this.responseStatus = new Array(2);  	};	this.resetFunctions = function() {  		this.onLoading = function() { };  		this.onLoaded = function() { };  		this.onInteractive = function() { };  		this.onCompletion = function() { };  		this.onError = function() { };		this.onFail = function() { };	};	this.reset = function() {		this.resetFunctions();		this.resetData();	};	this.createAJAX = function() {		try {			this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");		} catch (e1) {			try {				this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");			} catch (e2) {				this.xmlhttp = null;			}		}		if (! this.xmlhttp) {			if (typeof XMLHttpRequest != "undefined") {				this.xmlhttp = new XMLHttpRequest();			} else {				this.failed = true;			}		}	};	this.setVar = function(name, value){		this.vars[name] = Array(value, false);	};	this.encVar = function(name, value, returnvars) {		if (true == returnvars) {			return Array(encodeURIComponent(name), encodeURIComponent(value));		} else {			this.vars[encodeURIComponent(name)] = Array(encodeURIComponent(value), true);		}	}	this.processURLString = function(string, encode) {		encoded = encodeURIComponent(this.argumentSeparator);		regexp = new RegExp(this.argumentSeparator + "|" + encoded);		varArray = string.split(regexp);		for (i = 0; i < varArray.length; i++){			urlVars = varArray[i].split("=");			if (true == encode){				this.encVar(urlVars[0], urlVars[1]);			} else {				this.setVar(urlVars[0], urlVars[1]);			}		}	}	this.createURLString = function(urlstring) {		if (this.encodeURIString && this.URLString.length) {			this.processURLString(this.URLString, true);		}		if (urlstring) {			if (this.URLString.length) {				this.URLString += this.argumentSeparator + urlstring;			} else {				this.URLString = urlstring;			}		}		// prevents caching of URLString		this.setVar("rndval", new Date().getTime());		urlstringtemp = new Array();		for (key in this.vars) {			if (false == this.vars[key][1] && true == this.encodeURIString) {				encoded = this.encVar(key, this.vars[key][0], true);				delete this.vars[key];				this.vars[encoded[0]] = Array(encoded[1], true);				key = encoded[0];			}			urlstringtemp[urlstringtemp.length] = key + "=" + this.vars[key][0];		}		if (urlstring){			this.URLString += this.argumentSeparator + urlstringtemp.join(this.argumentSeparator);		} else {			this.URLString += urlstringtemp.join(this.argumentSeparator);		}	}	this.runResponse = function() {		eval(this.response);	}	this.runAJAX = function(urlstring) {		if (this.failed) {			this.onFail();		} else {			this.createURLString(urlstring);			if (this.element) {				this.elementObj = document.getElementById(this.element);			}			if (this.xmlhttp) {				var self = this;				if (this.method == "GET") {					totalurlstring = this.requestFile + this.queryStringSeparator + this.URLString;					this.xmlhttp.open(this.method, totalurlstring, true);				} else {					this.xmlhttp.open(this.method, this.requestFile, true);					try {						this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")					} catch (e) { }				}				this.xmlhttp.onreadystatechange = function() {					switch (self.xmlhttp.readyState) {						case 1:							self.onLoading();							break;						case 2:							self.onLoaded();							break;						case 3:							self.onInteractive();							break;						case 4:							self.response = self.xmlhttp.responseText;							self.responseXML = self.xmlhttp.responseXML;							self.responseStatus[0] = self.xmlhttp.status;							self.responseStatus[1] = self.xmlhttp.statusText;							if (self.execute) {								self.runResponse();							}							if (self.elementObj) {								elemNodeName = self.elementObj.nodeName;								elemNodeName.toLowerCase();								if (elemNodeName == "input"								|| elemNodeName == "select"								|| elemNodeName == "option"								|| elemNodeName == "textarea") {									self.elementObj.value = self.response;								} else {									self.elementObj.innerHTML = self.response;								}							}							if (self.responseStatus[0] == "200") {								self.onCompletion();							} else {								self.onError();							}							self.URLString = "";							break;					}				};				this.xmlhttp.send(this.URLString);			}		}	};	this.reset();	this.createAJAX();}function active_filter_fast(max_select_metro) {    var e = document.getElementById('metro_fast');    var select='';    var count_select=0;    var count_select_all=0;    var error_select=false;    if (document.FastFindclub.type_url_fast.value==0) type_url_fast='all';    else type_url_fast=document.FastFindclub.type_url_fast.value;    if (document.FastFindclub.city_id_fast.value==0) {    	alert('Необходимо выбрать город');    	document.FastFindclub.city_id_fast.focus();    	return false;    }    else city_id_fast=document.FastFindclub.city_id_fast.value;    for(i=0;i<e.length;i++) {		if(e.options[i].selected==true) {	    	count_select++;	    	if (max_select_metro!=0){	    		if (count_select>max_select_metro) {	    			alert('Вы выбрали слишком много метро (максимум '+max_select_metro+')');     	    	    e.options[i].selected = false;                    for (var j = i; j < e.options.length; j++) {                    	if (e.options[j].selected) {                    		e.options[j].selected = false;                        }                    }     	    	    error_select=true;     	    	    break;     	    	}	    	}	    	if (select!='' && e.options[i].value!=0) select+=',';    		select+=e.options[i].value;    		count_select_all++;		}	}    if (select=='') select=0;    if (error_select==false) {    	Action = type_url_fast+'/'+city_id_fast+'/'+select+'/';        window.location.href = "/clubs/"+Action;    }    else return false;}function Auto_Password() { var e = document.getElementById('noautopass'); if(e.style.display == 'none') e.style.display = 'block'; else e.style.display = 'none'; return false;}function Look_Element(id_look,name_look,count_look) {	var e = document.getElementById(name_look+id_look);    if (count_look){    	for(i=1;i<(count_look+1);i++) {    		var e2 = document.getElementById(name_look+i);    		e2.style.display = 'none';	    }	    e.style.display = 'block';	} else{		if(e.style.display == 'none') e.style.display = 'block';        else e.style.display = 'none';	}    return false;}function Action_Club (club,look) {    var actions = document.getElementById('club_'+club);    if(!look) {    	actions.className="clubmenu_select"        actions.style.display = 'block';        actionstext="<div style=\"float:right\">[ <a href=\"#\" onClick=\"return Action_Club("+club+",1)\">отмена</a> ]</div><b>Выберите действие:</b> <div class=\"link_clubmenu\">[<a href=\"/club_"+club+".html\">просмотр</a>]&nbsp;&nbsp;[<a href=\"edit="+club+"\">редактировать</a>]&nbsp;&nbsp;";        actionstext+="[<a href=\"photo="+club+"\">фото</a>]&nbsp;&nbsp;";        actionstext+="<b>[<a href=\"adv="+club+"\" style=\"color:#E96002;\">реклама</a>]</b>&nbsp;&nbsp;";        actionstext+="[<a href=\"dell="+club+"\">удалить</a>]</div>";        actions.innerHTML=actionstext;    } else {    	actions.innerHTML='';    	actions.style.display = 'none';    }	return false;}var clear_id=0;function AddCommentary(id_comm,type_comment,id_db){    ClearForm=document.getElementById("comment_"+clear_id);	ClearForm.innerHTML="";	CommForm=document.getElementById("comment_"+id_comm);    CommForm.innerHTML="<div id=\"debug\">\                         <div class=\"debug\">\                         <h5 class=\"new_title_h1\">Новый комментарий</h5>\    	                 <form id=\"newComment\" action=\"\" method=\"post\">\                          <input name=\"action_type\" type=\"hidden\" value=\""+type_comment+"\">\    	                  <input name=\"commentary_id\" type=\"hidden\" value=\""+id_db+"\">\    	                  <input name=\"comm_level\" type=\"hidden\" value=\""+id_comm+"\">\                          <div class=\"form_element\">\             	           <h6>Заголовок:</h6>\		                   <input type=\"text\" class=\"i_text\" style=\"width:360px;\" name=\"msg_title\" maxlength=\"40\"\" />\                          </div>\                          <div class=\"form_element\">\             	           <h6>Комментарий: <b>*</b></h6>\             	           <textarea name=\"msg\" class=\"i_text\" style=\"height:80px;width:360px;\"></textarea>\                          </div>\                          <button id=\"submit_m\" class=button style=\"width:100px\" onclick=\"return newComment();\">Комментировать</button>\                         </form>\                        </div></div>";	clear_id=id_comm;	return false;}function insRow() {	var x=document.getElementById('telefon').insertRow(0)    var z=x.insertCell(0)    z.innerHTML="<td>+7 <input name=\"club_cod[]\" type=\"text\" value=\"\" style=\"width:30px;\"> <input name=\"club_telefon[]\" type=\"text\" value=\"\"> [ <a href=\"#\" onClick=\"deleteRow(this); return false;\">удалить</a> ]</td>"}function deleteRow(theCell) {	if( document.createElement && document.childNodes ) {		var thisRow = theCell.parentNode;        thisRow.parentNode.removeChild(thisRow);    }}function adv(type,look){	var duration_f = document['forms']['FormAdv']['duration[type'+type+']'];    var whe_look_f = document['forms']['FormAdv']['whe_look[type'+type+'][]'];    var summ_f = 0;    var summ_all = 0;    var type_f = new Array(1,2,3);        type_f[1] = new Array(7,31);        type_f[1][7]=700;        type_f[1][31]=900;        type_f[2] = new Array(7,31);        type_f[2][7]=400;        type_f[2][31]=600;        type_f[3] = new Array(7,31);        type_f[3][7]=300;        type_f[3][31]=500;	if (duration_f[0].checked==true) duration=7;	else duration=31;    if (look) {    	summ_f+=type_f[type][duration];    } else{    	for (i = 0; i < whe_look_f.length; i++){    		if (whe_look_f[i].checked==true) summ_f+=type_f[type][duration];        }    }    for (i = 1; i < 4; i++){    	duration_all = document['forms']['FormAdv']['duration[type'+i+']'];        whe_look_all = document['forms']['FormAdv']['whe_look[type'+i+'][]'];        if (duration_all[0].checked==true) duration=7;    	else duration=31;        if (i==3) {        	if (document.getElementById("adv_type"+3).checked==true) summ_all+=type_f[3][duration];        } else {        	for (j = 0; j < whe_look_all.length; j++){        		if (document.getElementById("adv_type"+i).checked==true) {        			if (whe_look_all[j].checked==true) summ_all+=type_f[i][duration];        		}            }        }    }    document.getElementById("summ_type"+type).innerHTML=summ_f+' руб.';    document.getElementById("summ_type_all").innerHTML='<h3>Сумма за рекламную компанию: <u>'+summ_all+' руб.</u></h3>';	return false;}function listadv() {	adv(1); adv(2);adv(3,1);}function Adv_Table (id_look) {	var e = document.getElementById('adv_'+id_look);	var img = document.getElementById('link_h'+id_look);	if (e.className=='adv_other') {		e.className='adv_other_p';		img.innerHTML='<img src="/images/filter_minus.gif" width="9" height="9" alt="" border="0">';	}	else {		e.className='adv_other';		img.innerHTML='<img src="/images/filter_plus.gif" width="9" height="9" alt="" border="0">';	}    return false;}