	function OpenWindow(sUrl,sWndName,nWidth,nHeight){
		var wnd = top.open( sUrl , sWndName, "scrollbars=0,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,top=100,left=100,width=" + nWidth +  ",height=" + nHeight );
		if(sUrl == ''){
			wnd.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
			wnd.document.write('<html xmlns="http://www.w3.org/1999/xhtml">');
			wnd.document.write('<head id="head">');
				wnd.document.write('<title>'+sWndName+'</title>');
				wnd.document.write('<meta http-equiv="Content-Type" content="text/html;windows-1251" />');
				wnd.document.write('<link rel="stylesheet" type="text/css" href="popup.css" />');
			wnd.document.write('</head>');
			wnd.document.write('<body>');
			// ...
			wnd.document.write('</body>');
			wnd.document.write('</html>');
		}
		document.onclick = function(){
			wnd.focus();
		};
		wnd.focus();
		return wnd;
	}
	
	function MM_openBrWindow(theURL,winName,features) { 
	  window.open(theURL,winName,features);
	}
	
	
	function MM_findObj(n, d) { //v4.0
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && document.getElementById) x=document.getElementById(n); return x;
	}
	
	//
	// Preview handling
	//  
	function previewDescription( sFrameName, sText )
	{	
		window.frames[ sFrameName ].document.clear();
		window.frames[ sFrameName ].document.write( '<html><body><table width="100%"><tr><td><pre style="font-family: arial,tahoma,verdana;">' + sText + '</pre></td></tr></table></body></html>' );
		window.frames[ "divDescriptionPreview" ].document.close();	
	}
	
	function previewPicture( sImageTagID, sImageFile ){
		$obj = document.getElementById(sImageTagID);
		$obj.src = sImageFile;
	}
	
	var checkflag = "false";
	function checking(field) {
		if (checkflag == "false") {
		for (i = 0; i < field.length; i++) {
			field[i].checked = true;}
			checkflag = "true";
			return "<?=$asRes[ 'DESELECTALL' ]?>"; 
		}else {
			for (i = 0; i < field.length; i++) {
			field[i].checked = false; }
			checkflag = "false";
			return "<?=$asRes[ 'SELECTALL' ]?>"; 
		}
	}
	
	function ValidateDelete(form){
		txt=form.action.options[form.action.selectedIndex].value
		option=txt
		if (option=="Delete"){
			if ( confirm( "<?=$asRes[ 'SURE_DELETE' ]?>" ) ) {return true;} else {return false;}
			return false;
		}else{
			return true;
		}
	}
	//Menu for translation
	
	var cm=null;
	document.onclick = new Function("show(null)")
	function getPos(el,sProp) {
		var iPos = 0
		while (el!=null) {
			iPos+=el["offset" + sProp]
			el = el.offsetParent
		}
		return iPos
	
	}
	
	function show(el,m) {
		if (m) {
			m.style.display='';
			m.style.pixelLeft = getPos(el,"Left")
			m.style.pixelTop = getPos(el,"Top") + el.offsetHeight-2
		}
		if ((m!=cm) && (cm)) cm.style.display='none'
		cm=m
	}
	
	function hide(el,m) {
		if (m) {
			m.style.display='none';
		}
		if ((m!=cm) && (cm)) cm.style.display='none'
		cm=m
	}
	
	function validateForm(frm,messege){
		var element = '';
		var error = false;
		var colorError = "1px solid #FF0000";
		var numelements = frm.elements.length;
		for(var i=0;i<numelements;i++){
			element = frm.elements[i];		
			if(element.className == 'on'){
				if(element.type == "checkbox" && element.checked == false){
					error = true;
					element.style.border = colorError;
				}
				if((element.type == 'text' || element.type == 'select-one' || element.type == 'textarea' || element.type == "password") && (element.value == "" || element.value == 0)){
					error = true;
					element.style.border = colorError;
				}
			}
		}
		if(error == true){
			alert(messege);
			return false;
		}else{
			return true;
		}
	}

	function openelement(elname){
		var obj = document.getElementById(elname);
		//if(obj.innerHTML) alert("This letter is empty!");
		if(obj.style.display != 'block'){
			obj.style.display = 'block';
		}else{
			obj.style.display = 'none';
		}
	}
	// activen grafick buttons //
	function activbutton(btn,act){
		var $src = btn.src;
		if(act){
			var spl = $src.split(".");
			spl[0] += "_on"; 
			btn.src = spl.join(".");
		}else{
			btn.src = $src.replace("_on","");
		}
	}
	// all checed box on form //
	function published(frm){
		var piblished = true;
		if(frm.ch.value == 1){
			piblished = false;
			frm.ch.value = 0;
		}else{
			var piblished = true;
			frm.ch.value = 1;
		}
		for(var i=0;i<frm.elements.length;i++){	
			if(frm.elements[i].type == "checkbox") frm.elements[i].checked = piblished;
		}
	}
	
	// redirect admin panel //
	function admin($path){
		document.onkeydown=function keyC(e){
			if(!ie){
				startLocation = e.which;
			}else{
				startLocation = event.keyCode;
			}
			if(startLocation == 113){
				window.location = $path;
			}
		}
	}

function cleanlocation(){
	var regexp = /www/;
	var locat = window.location+" ";
	if(regexp.test(window.location) != false) 
		window.location = locat.replace("www.","");
}
function addnumber(obj,messege){
	str = obj.value;
	obj.value = '';
	for(var i=0;i<str.length;i++){
		if(str.charAt(i) < "0" || str.charAt(i) > "9") {
			alert("("+str.charAt(i)+") "+messege);
			obj.style.border = '1px solid #FF0000';
			obj.select();
			return false;
		}
		obj.value += str.charAt(i);
	}
	return true;
}
//objcontextmenu
