<!--

// convert from utf
  //------------------------------
  
  	_eng_=new Array(
  		96,	49,	50,	51,	52,	53,	54,	55,	56,	57,	48,	45,	61,	92,	113,	119,	101,	114,	116,	121,	117,	105,	111,	112,	91,	93,	97,	115,	100,	102,	103,	104,	106,	107,	108,	59,	39,	122,	120,	99,	118,	98,	110,	109,	44,	46,	47,	126,	33,	64,	35,	36,	37,	94,	38,	42,	40,	41,	95,	43,	124,	81,	87,	69,	82,	84,	89,	85,	73,	79,	80,	123,	125,	65,	83,	68,	70,	71,	72,	74,	75,	76,	58,	34,	90,	88,	67,	86,	66,	78,	77,	60,	62,	63,	
  		''
  	);
  
  	_standart_=new Array(
  		96,	49,	50,	51,	52,	53,	54,	55,	56,	57,	48,	45,	61,	92,	216,	223,	196,	210,	212,	218,	214,	201,	207,	208,	91,	93,	192,	211,	195,	215,	194,	228,	227,	202,	203,	59,	39,	198,	225,	221,	197,	193,	205,	204,	44,	46,	47,	126,	33,	64,	35,	36,	37,	94,	38,	42,	40,	41,	95,	43,	124,	81,	224,	69,	217,	200,	89,	85,	73,	79,	80,	123,	125,	65,	219,	68,	70,	71,	72,	209,	75,	76,	58,	34,	222,	88,	220,	86,	66,	78,	77,	60,	62,	63,	
  		''
  	);
  
  	_utf8_=new Array(
  		96,	49,	50,	51,	52,	53,	54,	55,	56,	57,	48,	45,	61,	92,	4325,	4332,	4308,	4320,	4322,	4327,	4323,	4312,	4317,	4318,	91,	93,	4304,	4321,	4307,	4324,	4306,	4336,	4335,	4313,	4314,	59,	39,	4310,	4334,	4330,	4309,	4305,	4316,	4315,	44,	46,	47,	126,	33,	64,	35,	36,	37,	94,	38,	42,	40,	41,	95,	43,	124,	81,	4333,	69,	4326,	4311,	89,	85,	73,	79,	80,	123,	125,	65,	4328,	68,	70,	71,	72,	4319,	75,	76,	58,	34,	4331,	88,	4329,	86,	66,	78,	77,	60,	62,	63,	
  		''
  	);
  
  
	ganlageba=new Array('','ganlageba_eng','ganlageba_rus');
	var mmm=new Array(); 

	met=new Array("_eng_","_standart_","_utf8_");
//------------------------------
   function aris(chcode, mas)
   {
		for(j=0;j<mas.length;j++)
		{
			if(mas[j]==chcode)
			{
				return (j);
			}
		}
      return (-1);
   }
//------------------------------
   function gadaikvane(objsaidan, objsad, saidani, sadi, ganlageba) 
   {
		st=eval(objsaidan).value;
		st1="";
		saidan=eval(saidani);
		sad=eval(sadi);
		var extramas=new Array();
		for(i=0;i<st.length;i++)
		{
			ch=st.charAt(i);
            if(extramas[ch])
			{
				st1+=extramas[ch];
				}
				else 
				{
            		chc=ch.charCodeAt(0);
            		chi=aris(chc,saidan);
            		if(chi!=-1)
					{
                    	if(ganlageba==1)
						{
							chi=ganlageba_1_2[chi];
						}
                    	if(ganlageba==2)
						{
							chi=ganlageba_2_1[chi];
						}
						newchar=String.fromCharCode(sad[chi]);
                    	st1+=newchar;
						extramas[ch]=newchar;
             		} 
					else
					{
						st1+=ch;
						extramas[ch]=ch;
					}
				}
		}
       eval(objsad).value=st1;
	}
//------------------------------

// gadaikvane(stringdata, stringdata, met[2], met[0], 0)

// log out
function log_out()
{
	lg = confirm("log out ?","");
	if(lg)
	{
		window.location.href = "logout.php";
	}
}

// text level
function txt_level()
{
	//
	var num_reg = /^([0-9]){0,10}$/;
	var f = document.form1;
	var error = "";
	//
	if(f.a1.value == "")
	{
		error = error + "title (global)\n";
	}
	//
	/*
	for(i=1;i<=5;i++)
	{
		if(document.form1.elements['t'+i])
		{
			if(document.form1.elements['t'+i].value == "")
			{
				error = error + "title "+i+"\n";
			}
		}
	}
	*/
	//
	if(f.a9.value != "")
	{
		if(!num_reg.test(f.a9.value))
		{
			error = error + "width\n";
		}
	}
	//
	if(f.a10.value != "")
	{
		if(!num_reg.test(f.a10.value))
		{
			error = error + "height\n";
		}
	}
	//
	if(f.a11.value != "")
	{
		if(!num_reg.test(f.a11.value))
		{
			error = error + "border\n";
		}
	}
	//
	if(error)
	{
		alert(error);
	}
	else
	{
		yesno = confirm("ok ?","");
		if(yesno)
		{
			f.submit();
		}
	}
}

// text photo
function txt_photo()
{
	//
	var num_reg = /^([0-9]){0,10}$/;
	var f = document.form1;
	var error = "";
	//
	for(i=1;i<=5;i++)
	{
		if(document.form1.elements['t'+i])
		{
			if(document.form1.elements['t'+i].value == "")
			{
				error = error + "title "+i+"\n";
			}
		}
	}
	//
	if(f.a9.value != "")
	{
		if(!num_reg.test(f.a9.value))
		{
			error = error + "width\n";
		}
	}
	//
	if(f.a10.value != "")
	{
		if(!num_reg.test(f.a10.value))
		{
			error = error + "height\n";
		}
	}
	//
	if(error)
	{
		alert(error);
	}
	else
	{
		yesno = confirm("ok ?","");
		if(yesno)
		{
			f.submit();
		}
	}
}

// delete photo
function delete_photo(cid)
{
	de = confirm("delete ?","");
	if(de)
	{
		window.location.href = "photo.php?id="+cid+"&event=delete";
	}
}

// text page
function txt_page()
{
	//
	var num_reg = /^([0-9]){0,10}$/;
	var f = document.form1;
	var c1 = f.c1.options[f.c1.selectedIndex].value;
	var error = "";
	//
	if(f.a1.value == "")
	{
		error = error + "title (global)\n";
	}
	//
	for(i=1;i<=5;i++)
	{
		if(document.form1.elements['t'+i])
		{
			if(document.form1.elements['t'+i].value == "")
			{
				error = error + "title "+i+"\n";
			}
		}
	}
	//
	//
	if(f.a9.value != "")
	{
		if(!num_reg.test(f.a9.value))
		{
			error = error + "width\n";
		}
	}
	//
	if(f.a10.value != "")
	{
		if(!num_reg.test(f.a10.value))
		{
			error = error + "height\n";
		}
	}
	//
	if(f.a11.value != "")
	{
		if(!num_reg.test(f.a11.value))
		{
			error = error + "border\n";
		}
	}
	//
	if(!num_reg.test(f.level1.value))
	{
		error = error + "menu 1\n";
	}
	//
	if(!num_reg.test(f.level2.value))
	{
		error = error + "menu 2\n";
	}
	//
	if(!num_reg.test(f.level3.value))
	{
		error = error + "menu 3\n";
	}
	//
	if(f.level3.value != 0)
	{
		if(c1 != 1)
		{
			error = error + "page type\n";
		}
	}
	//
	if(error)
	{
		alert(error);
	}
	else
	{
		yesno = confirm("ok ?","");
		if(yesno)
		{
			f.submit();
		}
	}
}

// change level
function change_level()
{
	/*
	var f = document.form1;
	var sel = f.a2.options[f.a2.selectedIndex].value;
	//
	if(sel == 1)
	{
		f.c2.disabled = true;
		f.c3.disabled = true;
	}
	//
	if(sel == 2)
	{
		f.c2.disabled = false;
		f.c3.disabled = true;
	}
	//
	if(sel == 3)
	{
		f.c2.disabled = false;
		f.c3.disabled = false;
	}
	*/
}

// hidden status
function hidden_status(cid, status, event, page)
{
	var cstatus = 0;
	//
	if(status == 1)
	{
		cstatus = 0;
	}
	//
	if(status == 0)
	{
		cstatus = 1;
	}
	//
	window.location.href = page+'.php?id='+cid+'&status='+cstatus+'&event='+event+'&page='+page;
}

// delete page
function delete_page(cid, event, page)
{
	yesno = confirm("delete ?","");
	if(yesno)
	{
		window.location.href = page+'.php?id='+cid+'&event='+event+'&page='+page;
	}
}

// change level
function change_level_new(upd, cid, ln, event, page, elem, elemnum)
{
	var lnum = new Number(ln);
	var elemnum = new Number(elemnum);
	var ln2 = new Number();
	//
	var elemnumup =  1;
	//
	if(upd == "up")
	{
		if(ln != 1)
		{
			if(elemnum != 1)
			{
				elemnumup = elemnum - 1;
				elemstr = new String(elem+elemnumup);
				if(document.form1.elements[elemstr])
				{
					ln2 = document.form1.elements[elem+elemnumup].value;
					var ln2 = new Number(ln2);
					ln2 = ln2 - 1;
					window.location.href = page+'.php?id='+cid+'&event='+event+'&page='+page+'&ln='+ln2;
				}
			}
		}
		//else
		//{
		//	alert("No change");
		//}
	}
	if(upd == "down")
	{
		elemnumup = elemnum + 1;
		elemstr = new String(elem+elemnumup);
		if(document.form1.elements[elemstr])
		{
			ln2 = document.form1.elements[elem+elemnumup].value;
			var ln2 = new Number(ln2);
			ln2 = ln2 + 1;
			window.location.href = page+'.php?id='+cid+'&event='+event+'&page='+page+'&ln='+ln2;
		}
	}
}

// change level
function change_level(upd, cid, ln, event, page, elem, elemnum)
{
	var lnum = new Number(ln);
	var ln2 = new Number();
	if(upd == "up")
	{
		if(ln != 1)
		{
			ln2 = lnum - 1;
			window.location.href = page+'.php?id='+cid+'&event='+event+'&page='+page+'&ln='+ln2;
		}
		else
		{
			alert("No change");
		}
	}
	if(upd == "down")
	{
		ln2 = lnum + 1;
		window.location.href = page+'.php?id='+cid+'&event='+event+'&page='+page+'&ln='+ln2;
	}
}

// delete photo
function delete_photo(cid)
{
	de = confirm("delete ?","");
	if(de)
	{
		window.location.href = "photo.php?id="+cid+"&event=delete";
	}
}

// user
function txt_user()
{
	//
	var num_reg = /^([0-9a-zA-Z]){0,20}$/;
	var f = document.form1;
	var error = "";
	//
	if(f.a1.value == "")
	{
		error = error + "username\n";
	}
	//
	if(f.a2.value == "")
	{
		error = error + "password 1\n";
	}
	//
	if(f.a3.value == "")
	{
		error = error + "password 2\n";
	}
	//
	if(f.a2.value != f.a3.value)
	{
		error = error + "change password\n";
	}
	//
	if(error)
	{
		alert(error);
	}
	else
	{
		yesno = confirm("ok ?","");
		if(yesno)
		{
			f.submit();
		}
	}
}

// news page
function txt_news()
{
	//
	var num_reg = /^([0-9]){0,10}$/;
	var f = document.form1;
	var error = "";
	//
	if(f.a1.value == "")
	{
		error = error + "title (global)\n";
	}
	//
	for(i=1;i<=5;i++)
	{
		if(document.form1.elements['t'+i])
		{
			if(document.form1.elements['t'+i].value == "")
			{
				error = error + "title "+i+"\n";
			}
		}
	}
	//
	//
	if(f.a9.value != "")
	{
		if(!num_reg.test(f.a9.value))
		{
			error = error + "width\n";
		}
	}
	//
	if(f.a10.value != "")
	{
		if(!num_reg.test(f.a10.value))
		{
			error = error + "height\n";
		}
	}
	//
	if(f.a11.value != "")
	{
		if(!num_reg.test(f.a11.value))
		{
			error = error + "border\n";
		}
	}
	//
	if(error)
	{
		alert(error);
	}
	else
	{
		yesno = confirm("ok ?","");
		if(yesno)
		{
			f.submit();
		}
	}
}

// banner page
function txt_banner()
{
	//
	var num_reg = /^([0-9]){0,10}$/;
	var f = document.form1;
	var error = "";
	//
	if(f.a1.value == "")
	{
		error = error + "title (global)\n";
	}
	//
	if(f.photo.value == "")
	{
		//error = error + "photo\n";
	}
	//
	if(f.a9.value != "")
	{
		if(!num_reg.test(f.a9.value))
		{
			error = error + "width\n";
		}
	}
	//
	if(f.a10.value != "")
	{
		if(!num_reg.test(f.a10.value))
		{
			error = error + "height\n";
		}
	}
	//
	if(f.a11.value != "")
	{
		if(!num_reg.test(f.a11.value))
		{
			error = error + "border\n";
		}
	}
	//
	if(error)
	{
		alert(error);
	}
	else
	{
		yesno = confirm("ok ?","");
		if(yesno)
		{
			f.submit();
		}
	}
}

// ipage page
function txt_ipage()
{
	//
	var num_reg = /^([0-9]){0,10}$/;
	var f = document.form1;
	var c1 = f.c1.options[f.c1.selectedIndex].value;
	var c2 = f.c2.options[f.c2.selectedIndex].value;
	var c3 = f.c3.options[f.c3.selectedIndex].value;
	var error = "";
	//
	if(f.a1.value == "")
	{
		error = error + "title (global)\n";
	}
	//
	for(i=1;i<=5;i++)
	{
		if(document.form1.elements['t'+i])
		{
			if(document.form1.elements['t'+i].value == "")
			{
				error = error + "title "+i+"\n";
			}
		}
	}
	if(c1 == "")
	{
		error = error + "menu 1 \n";
	}
	//
	if(c3 != "")
	{
		if(c2 == "")
		{
			error = error + "menu 2 \n";
		}
	}
	//
	if(f.a9.value != "")
	{
		if(!num_reg.test(f.a9.value))
		{
			error = error + "width\n";
		}
	}
	//
	if(f.a10.value != "")
	{
		if(!num_reg.test(f.a10.value))
		{
			error = error + "height\n";
		}
	}
	//
	if(f.a11.value != "")
	{
		if(!num_reg.test(f.a11.value))
		{
			error = error + "border\n";
		}
	}
	//
	if(error)
	{
		alert(error);
	}
	else
	{
		yesno = confirm("ok ?","");
		if(yesno)
		{
			f.submit();
		}
	}
}

// func edit city
function func_edit_city()
{
	//
	var num_reg = /^([0-9]){0,10}$/;
	var abc_reg = /^([a-zA-Z]){0,70}$/;
	var abc2_reg = /^([a-z]){0,70}$/;
	var f = document.form1;
	var error = "";
	//
	if(f.t1.value == "")
	{
		error = error + "title (georgian)\n";
	}
	//
	if(!abc_reg.test(f.t2.value))
	{
		error = error + "title (english)\n";
	}
	//
	if(!abc2_reg.test(f.c1.value))
	{
		error = error + "folder\n";
	}
	//
	if(error)
	{
		alert(error);
	}
	else
	{
		yesno = confirm("ok ?","");
		if(yesno)
		{
			f.submit();
		}
	}
}

// func edit moderators
function func_edit_moderators()
{
	//
	var num_reg = /^([0-9]){0,10}$/;
	var abc_reg = /^([a-zA-Z0-9]){0,70}$/;
	var abc2_reg = /^([a-z]){0,70}$/;
	var f = document.form1;
	var error = "";
	//
	if(!abc_reg.test(f.t1.value))
	{
		error = error + "username\n";
	}
	//
	if(!abc_reg.test(f.t1.value))
	{
		error = error + "password\n";
	}
	//
	if(error)
	{
		alert(error);
	}
	else
	{
		yesno = confirm("ok ?","");
		if(yesno)
		{
			f.submit();
		}
	}
}

// func edit screen
function func_edit_screen()
{
	//
	var num_reg = /^([0-9]){0,10}$/;
	var abc_reg = /^([a-zA-Z]){0,70}$/;
	var abc2_reg = /^([a-z]){0,70}$/;
	var f = document.form1;
	var error = "";
	//
	if(f.eventb.value == "add")
	{
		if(f.img1.value == "")
		{
			error = error + "image\n";
		}
	}
	//
	if(error)
	{
		alert(error);
	}
	else
	{
		yesno = confirm("ok ?","");
		if(yesno)
		{
			f.submit();
		}
	}
}

// func edit info
function func_edit_info()
{
	//
	var num_reg = /^([0-9]){0,10}$/;
	var abc_reg = /^([a-zA-Z]){0,70}$/;
	var abc2_reg = /^([a-z]){0,70}$/;
	var f = document.form1;
	var error = "";
	//
	if(f.t1.value == "")
	{
		error = error + "text (geo)\n";
	}
	//
	if(f.t2.value == "")
	{
		error = error + "text (eng)\n";
	}
	//
	if(error)
	{
		alert(error);
	}
	else
	{
		yesno = confirm("ok ?","");
		if(yesno)
		{
			f.submit();
		}
	}
}

// func edit events
function func_edit_events()
{
	//
	var num_reg = /^([0-9]){0,10}$/;
	var abc_reg = /^([a-zA-Z]){0,70}$/;
	var abc2_reg = /^([a-z]){0,70}$/;
	var f = document.form1;
	var error = "";
	//
	if(f.t1.value == "")
	{
		error = error + "title (geo)\n";
	}
	//
	if(f.t2.value == "")
	{
		error = error + "title (eng)\n";
	}
	//
	if(f.a1.value == "")
	{
		error = error + "text (geo)\n";
	}
	//
	if(f.a2.value == "")
	{
		error = error + "text (eng)\n";
	}
	//
	if(f.c5.value == "")
	{
		error = error + "time\n";
	}
	//
	if(error)
	{
		alert(error);
	}
	else
	{
		yesno = confirm("ok ?","");
		if(yesno)
		{
			f.submit();
		}
	}
}

// -->