function NewWindow(mypage, myname, w, h, myscroll) {
	var winl = (screen.width - w) / 4;
	var wint = (screen.height - h) / 4;
	var newWindow
	winprops = 'height='+h+',width='+w+',top=0,left=0,scrollbars='+myscroll;
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
	win.focus();
}

function delbutton(pressbutton) {
	document.adminForm.act_do.value=pressbutton;
	try {
		document.adminForm.onsubmit();
		}
	catch(e){}
	document.adminForm.submit();
}

function checkAll( n, fldName ) {
  if (!fldName) {
     fldName = 'cb';
  }
	var f = document.adminForm;
	var c = f.toggle.checked;
	var n2 = 0;
	for (i=0; i < n; i++) {
		cb = eval( 'f.' + fldName + '' + i );
		if (cb) {
			cb.checked = c;
			n2++;
		}
	}
	
	if (c) {
		document.adminForm.boxchecked.value = n2;
	} else {
		document.adminForm.boxchecked.value = 0;
	}
}

function submitbutton(pressbutton) {
	submitform(pressbutton);
}

function isChecked(isitchecked){
	if (isitchecked == true){
		document.adminForm.boxchecked.value++;
	}
	else {
		document.adminForm.boxchecked.value--;
	}
}

function submitform(pressbutton){
	document.adminForm.action.value=pressbutton;
	try {
		document.adminForm.onsubmit();
		}
	catch(e){}
	document.adminForm.submit();
}

function SubmitEditorForm()
{
	document.forms[0].submit() ;
}
	
function clearALl() {
	document.getElementById("dat").value="";
	}

function reload(form,path)
{
var val=form.cat.options[form.cat.options.selectedIndex].value;
self.location=path + '.php?action=add&cat=' + val ;
}

function ordby(form,path,tb)
{
var val=form.section_id.options[form.section_id.options.selectedIndex].value;
self.location=path + '.php?action=edit&section_id=' + val +'&table='+tb;
}

function ordbycat(form,path,sect_id,tb)
{
var val=form.cat_id.options[form.cat_id.options.selectedIndex].value;
self.location=path + '.php?action=edit&section_id='+sect_id+'&cat_id='+val +'&table='+tb;
}

function deteImage(path,img)
{
self.location=path + '.php?action=deletephoto&id=' + img ;
}

function deteImageParent(path,sect_id,img,entr_id,$tbl)
{
self.location=path + '.php?action=deletephoto&section_id='+sect_id+'&cat_id='+img+'&form[id]='+entr_id+'&table='+$tbl;
}

function deteFormatImage(path,img,filenam,field)
{
self.location=path + '.php?action=deletephoto&id='+img+'&filaname='+filenam+'&field='+field;
}

//real estate
function ordbyloccat(form,path)
{
var val=form.cat_id.options[form.cat_id.options.selectedIndex].value;
self.location=path + '.php?action=edit&cat_id=' + val ;
}


function ordbySearch(form,path,sect){
	var val=form.cat_id.options[form.cat_id.options.selectedIndex].value;
	form.section_id.value = sect;
	form.loc_id.value = val;
	form.act_do.value = 'change_loc';
	form.submit();
}

function ordbyUpdateSearch(form,path,id){
	var val=form.cat_id.options[form.cat_id.options.selectedIndex].value;
	form.loc_id.value = val;
	form.act_do.value = 'change_loc_by_id';
	form.submit();
}



function ordbyAdminUpdateSearch(form,path,id){
	var val=form.locRootId.options[form.locRootId.options.selectedIndex].value;
	form.loc_id.value = val;
	form.act_do.value = 'change_loc_by_id';
	form.submit();
}




