var head;var beform;var middle;var before;var bot;var SEPARATOR=" | ";var DivRem="x"var sz="";var disp=1;var lastLabel=null;var req=null;head="<html><head><title>";headEND="</title><script type=\"text/javascript\" src=\"../bs_windows\"></script></head><body style=\"margin:0px\"><center>";befort="<br><img  border=0 onclick=\"window.close()\" src=\"";befortEND="\" >";middle="<input type=button value=\"\u0423\u0434\u0430\u043B\u0438\u0442\u044C\" onclick='TryDelElement(\"";middle2="<br><input type=button value=\"\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C\" onclick='TryRestElement(\"";middle3="<br>";before="\", window.opener.document);'><br><input type=text id=newname value=\"";last="\"><input type=button value=\"\u041F\u0435\u0440\u0435\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u0442\u044C\" onclick='replaceStrings();renameElement(\"";end="\", window.opener.document, (document.getElementById(\"newname\").value+\" \"+document.getElementById(\"sz\").value), \"";lastend="\");'><input type=hidden id=sz value=\"";reallylastend="</center></body></html>";reallylastend0="\">";before2="</center></body></html>";// function concat(name, desc, doc, fname, style, sz){if (style=="rw") {	if (doc.getElementById(name).className!="dePhoto")		return (head+desc+headEND+middle+name+before+desc+last+name+end+desc+" "+sz+lastend+sz+reallylastend0+befort+fname+befortEND+reallylastend);	 else		return (head+desc+headEND+middle2+name+before+desc+last+name+end+desc+" "+sz+lastend+sz+reallylastend0+befort+fname+befortEND+reallylastend);		} else 		return (head+desc+headEND+befort+fname+befortEND+before2);}function showPhoto(wname, desc, height, width, name, fname, style){	sz=desc.substring(desc.indexOf("["), desc.length);	desc=desc.substring(0, desc.indexOf("[")-1);	n=window.open("" , wname, 'width='+width+",height="+height+",scrollbars=yes,resizable=yes");	n.document.close();	n.document.clear();	n.document.write(concat(name, desc,document, fname, style, sz));	n.document.close();	n.resizeTo(width, height);	n.moveTo(0,0);	n.focus();	}function TryDelElement(name, doc){	doc.getElementById("Ns_tmpDeletePhotos").value+="\n"+name;	doc.getElementById(name).className="dePhoto";	window.close();}	function TryRestElement(name, doc){	var  tmp=doc.getElementById("Ns_tmpDeletePhotos").value;	if (tmp.indexOf(name)!=-1){		doc.getElementById("Ns_tmpDeletePhotos").value=tmp.substring(0, tmp.indexOf(name)-1)+						tmp.substring(tmp.indexOf(name)+name.length, tmp.length);	doc.getElementById(name).className="avPhoto";	}	window.close();}	function addOption(pr, selname){var newCat = prompt( pr, "");var newOpt = new Option(newCat, newCat, false, true);//var catField = document.getElementById(selname); //- \u043F\u043E\u0447\u0435\u043C\u0443-\u0442\u043E \u0442\u0430\u043A \u043D\u0435 \u0440\u0430\u0431\u043E\u0442\u0430\u0435\u0442..var catField = document.forms[0].elements[selname];if ((newCat != null) && (newCat != "")) {	catField.options[catField.options.length] = newOpt;}}function renameElement(name, doc, descr, olddescr){	var tmp=(doc.getElementById("Ns_photo_list").value);//	alert("searching for: "+olddescr+" in "+tmp+"\n result is "+tmp.indexOf(olddescr));// \u0421\u044E\u0434\u0430 \u0432\u043F\u0438\u0441\u0430\u0442\u044C \u0442\u0435\u043A\u0441\u0442 \u043F\u0435\u0440\u0435\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u044Folddescr=tmp.substring(tmp.lastIndexOf("\n", tmp.indexOf(name))+1, ( tmp.indexOf("\n", tmp.indexOf(name)) !=-1 ? tmp.indexOf("\n", tmp.indexOf(name)):tmp.length));//alert("olddescr: " +olddescr);	if (tmp.indexOf(olddescr)!=-1){		doc.getElementById("Ns_photo_list").value=tmp.substring(0, tmp.indexOf(olddescr))+ // \u041D\u0430\u0447\u0430\u043B\u043E \u0442\u0435\u043A\u0441\u0442\u0430						descr+SEPARATOR+name + // \u043D\u043E\u0432\u044B\u0439 \u0442\u0435\u043A\u0441\u0442						tmp.substring(tmp.indexOf(olddescr)+olddescr.length, tmp.length); // \u043A\u043E\u043D\u0435\u0446 \u0442\u0435\u043A\u0441\u0442\u0430	doc.getElementById(name).className="rePhoto";	doc.getElementById(name).innerHTML=descr;	}	window.close();//+"\n will changed to: "+descr); }function replaceStrings(){	symbols='|[]<>\"';	for (var i=0; i<symbols.length; i++){		while (document.getElementById("newname").value.indexOf(symbols.charAt(i))!=-1){		document.getElementById("newname").value=document.getElementById("newname").value.replace(symbols[i]," ");		}	}}function drawPopupString(parent, result, text){	domain=document.URL.substring(document.URL.indexOf("//")+2, document.URL.indexOf("/", document.URL.indexOf("//")+2));	url="http://"+domain+text;	text="\u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0434\u0430\u043D\u043D\u044B\u0445 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430";	lastLabel=result;//	loadXMLDoc(url)	text="<a href=\"#\" onclick=\"closePopup('"+result+"');return false;\"><img align=right valign=top src=/biser.nsf/close.gif?OpenImageResource></a>"+text;	document.getElementById(result).style.left=document.getElementById(parent).style.left;	document.getElementById(result).style.top=document.getElementById(parent).style.top;	document.getElementById(result).style.width="500";	document.getElementById(result).innerHTML=text;	document.getElementById(result).style.visibility = "visible";	document.getElementById(result).style.display="block";	loadXMLDoc(url)		}function drawPopStr(parent, result, text){if(DivRem!="x"){	document.getElementById(DivRem).style.visibility="hidden";	document.getElementById(DivRem).style.display="none";}	DivRem=result;	domain=document.URL.substring(document.URL.indexOf("//")+2, document.URL.indexOf("/", document.URL.indexOf("//")+2));	url="http://"+domain+text;	text="\u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0434\u0430\u043D\u043D\u044B\u0445 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430";	lastLabel=result;	text="<a href=\"#\" onclick=\"closePopup('"+result+"');return false;\"><img align=right valign=top src=/biser.nsf/close.gif?OpenImageResource></a>"+text;	document.getElementById(result).style.left="150px";	document.getElementById(result).style.top=document.getElementById(parent).style.top;	document.getElementById(result).style.width="500";		document.getElementById(result).innerHTML=text;	document.getElementById(result).style.visibility = "visible";	document.getElementById(result).style.display="block";	loadXMLDoc(url)	}	function closePopup(result){	document.getElementById(result).style.visibility="hidden";	document.getElementById(result).style.display="none";	req=null;	DivRem="x";	}function loadXMLDoc(url) {    // XMLHttpRequest \u0432\u0435\u0440\u0441\u0438\u044F    if (window.XMLHttpRequest) {        req = new XMLHttpRequest();        req.onreadystatechange = processReqChange;        req.open("GET", url, true);        req.send(null);    // IE/Windows ActiveX \u0432\u0435\u0440\u0441\u0438\u044F    } else if (window.ActiveXObject) {        req = new ActiveXObject("Microsoft.XMLHTTP");        if (req) {            req.onreadystatechange = processReqChange;            req.open("GET", url, true);            req.send();        }    }}function loadXMLDoc2(url) {    // XMLHttpRequest \u0432\u0435\u0440\u0441\u0438\u044F	document.getElementById(lastLabel).innerHTML=".. \u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0434\u0430\u043D\u043D\u044B\u0445 ..";    if (window.XMLHttpRequest) {        req = new XMLHttpRequest();        req.onreadystatechange = processReqChange2;        req.open("GET", url, true);        req.send(null);    // IE/Windows ActiveX \u0432\u0435\u0440\u0441\u0438\u044F    } else if (window.ActiveXObject) {        req = new ActiveXObject("Microsoft.XMLHTTP");        if (req) {            req.onreadystatechange = processReqChange;            req.open("GET", url, true);            req.send();        }    }}function processReqChange() {    if (req.readyState == 4) {        if (req.status == 200) {        	if (lastLabel!=null){		display(req.responseText);  		}        } 		else {        }    }    disp="";}function processReqChange2() {    if (req.readyState == 4) {        if (req.status == 200) {  	if (lastLabel!=null){		display2(req.responseText)		}        } 		else {        }    }}function display2(text){	text=text.substring(text.indexOf("<input type=\"hidden\" name=\"__Click\" value=\"0\">")+46,text.indexOf("</form>", text.indexOf("<form action=\"\">")+17));	text=text.replace(/[\t\r]/,"<br>");	document.getElementById(lastLabel).innerHTML=text;}function display(text){	text=text.substring(text.indexOf("<form action=\"\">")+16,text.indexOf("</form>", text.indexOf("<form action=\"\">")+17));	text="<a href=\"#\" onclick=\"closePopup('"+lastLabel+"');return false;\"><img align=right valign=top src=/biser.nsf/close.gif?OpenImageResource></a>"+text;	document.getElementById(lastLabel).innerHTML=text;}function loadhtmlintodiv(divname,url){	var disp=2;	lastLabel=divname;	loadXMLDoc2(url);}
