waitMsg='<img src="/i/progress.gif" align="left" width="16" height="16"> загружается форма...';
waitMsg2='<img src="/i/progress.gif" align="left" width="16" height="16"> подождите...';

function show_me(content){
	xy=getScrollXY();
	obj=document.getElementById("addEditBlock");
	obj.style["display"] = "block";
	obj.style["left"]=xy[0]+10+"px";
	obj.style["top"]=xy[1]+10+"px";
	
	document.getElementById("addEditForm").style["display"]="block";
	document.getElementById("addEditForm").innerHTML=content;

	var inTextAll = content
	// place it to your layer with id='subject_id'
	 /*
	extract all javascript <script></script> or <script language="javascript"></script> etc.
	from content, placed to innerHTML
	*/
	var inJs = new Array();
	inJs = inTextAll.split(/<script[^>]*>/);
	if (inJs && inJs.length >1) {
		for (var myivar=1; myivar<inJs.length; myivar++) {
			var inJs2 = new Array();
			inJs2 = inJs[myivar].match(/^([\s\S]*?\w*?[\s\S]*?)<\/script>/);
			if (inJs2[1]){
				// and with 'eval' your scripts will work properly
				eval(inJs2[1]);
				//alert(inJs2[1]);
			}
		}
	}
	//document.getElementById("catTree").innerHTML='asd';
}
function HideShow(arr){
	obj=document.getElementById(arr[0]+arr[1]);
	obj.style["border"]=obj.style["border"]?"":"1px dashed gray";
	obj.style["background"]=obj.style["background"]?"":"InactiveBorder";
}
function moder(arr){
	obj=document.getElementById(arr[0]+arr[1]);
	obj.style["display"]="none";
}
function setMeta(arr){
	obj=document.getElementById("keywords");
	//obj.value=unescape(arr);
	//obj.value=arr["keywords"];
	obj.value=arr[0];
	obj=document.getElementById("description");
	//obj.value=arr["description"];
	obj.value=arr[1];
}
function showLink(content){
	//alert(content);
	obj=document.getElementById("links");
	obj.innerHTML=content;
}
//function getMeDisc(arr){
//}

function getAddForm(mod){
	show_me(waitMsg)
	x_getAddForm(mod,show_me);
}
function getEditForm(mod,id){
	show_me(waitMsg)
	x_getEditForm(mod,id,show_me);
}
function getCommentForm(mod,id){
	x_getCommentForm(mod,id,show_me);
}
function setHide(mod,id){
	x_setHide(mod,id,HideShow);
}
function setModer(mod,id){
	x_setModer(mod,id,moder);
}
function create_meta(text){
	x_create_meta(text,setMeta);
}
//function getMeDisc(mod,id){
//	x_getMeDisc(mod,id,getMeDisc);
//}
function getLink(mod,id){
	obj=document.getElementById("links");
	obj.innerHTML="Подождите...";
	x_getLink(mod,id,showLink);
	//x_getAddForm(mod,show_me);
}

function getLinkSMS(comicsId,SMScode){
	obj=document.getElementById("links");
	obj.innerHTML=waitMsg2;
	x_getLinkSMS(comicsId,SMScode,showLink);
}

function ajaxtestreq(str){
	alert(str)
}
function ajaxtest(str){
	//alert(str)
	x_ajaxtestPhp(str,ajaxtestreq);
}