function pagenum(p, filename){
    document.forms["nav"].elements["page"].value = p;
    document.forms["nav"].elements["filename"].value = filename;
    document.forms["nav"].submit();
}

function my_confirm(to, what){
	if (confirm(what))
		document.location=to;
}
				
var foto_windows = new Array();
function open_foto(url, winname, width, height){
	foto_windows[foto_windows.length] = window.open(url,winname,'height='+height+',width='+width+',resizable=0,scrollbars=no,menubar=no,status=no');
	for(i = 0; foto_windows.length > i; i++){
		if(!foto_windows[i].closed)
			foto_windows[i].focus();
	}
}

function do_search(text){
	var search_line = document.getElementById('sline');
	search_line.value = text;
	document.forms['web'].submit();
}

function newWindow(url,w,h){
w = w + 18;
h = h + 27;
Win = window.open(url, "Win", "width=" + w + ",height=" + h + "location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0","top=0,left=0");}

function tableLinesOn(pos)
{
	if (!document.getElementById) return;
	var id1 = document.getElementById('id1' + pos );
	var id2 = document.getElementById('id2' + pos );
	var id3 = document.getElementById('id3' + pos );
	if(id1.className == 'number')
		id1.className = 'numberOn';
	if(id2.className == 'name')
		id2.className = 'nameOn';
	if(id3.className == 'price')
		id3.className = 'priceOn';
	}

function tableLinesOff(pos)
{
	if (!document.getElementById) return;
	var id1 = document.getElementById('id1' + pos );
	var id2 = document.getElementById('id2' + pos );
	var id3 = document.getElementById('id3' + pos );
	if(id1.className == 'numberOn')
		id1.className = 'number';
	if(id2.className == 'nameOn')
		id2.className = 'name';
	if(id3.className == 'priceOn')
		id3.className = 'price';
	
	}


function iform(flag)
{
	obj = document.getElementById('iForm');
	if(obj){
		if(flag)
		{
			obj.style.display = 'block';
			resizeIFrame();
				var url  = 'action.php3';
				var pars = 'action=form_stat&myrand='+Math.random();
				var myAjax = new Ajax.Request(url, {method: 'get', parameters: pars});
		}
		else
			obj.style.display = 'none';
	}
}

function resizeIFrame()
{
	var iForm = document.getElementById('iForm');
	var iContent = document.getElementById('iContent');
	var iFrame = document.getElementById('iFrame');
	
	if(iForm.style.display == 'block')
	{
		h = iForm.offsetHeight;
		w = iForm.offsetWidth;
		contentH = iContent.offsetHeight;
		contentW = iContent.offsetWidth;
		
		if(h - 40 <= contentH)
		{
			iContent.style.height = h - 40 + 'px';
			iFrame.style.height = h - 99 + 'px';
		}
		else if(h <= 720)
		{
			iContent.style.height = h - 40 + 'px';
			iFrame.style.height = h - 99 + 'px';
		}
		else
		{
			iContent.style.height = '680px';
			iFrame.style.height = '680px';
		}
		
		if(w - 40 <= contentW)
		{
			iContent.style.width = w - 40 + 'px';
			iFrame.style.width = w - 40 + 'px';
			iContent.style.left = '20px';
			iContent.style.marginLeft = 0;
		}
		else if(w <= 890)
		{
			iContent.style.width = w - 40 + 'px';
			iFrame.style.width = w - 40 + 'px';
			iContent.style.left = '20px';
			iContent.style.marginLeft = 0;
		}
		else
		{
			iContent.style.width = '850px';
			iFrame.style.width = '850px';
			iContent.style.left = '50%';
			iContent.style.marginLeft = '-425px';
		}
	}
	setTimeout("resizeIFrame()", 1000);
}



function tableClick(host, mode, pos)
{
	alert("aa1");
	alert(host + mode + pos);
	}

function form_test(objects,submitters)
	{
		this.checker=function()
	
		{
			good=0;
	
			total=0;
			for(var i=0;i<objects.length;i++)
	
			{
				obj=document.getElementById(objects[i]);
				if(obj.value!='')good++;
	
				total++;
	
			}
	
	
	
			good=(good!=total);
	
			for(var i=0;i<submitters.length;i++)
	
			{
	
				obj=document.getElementById(submitters[i]);
	
				obj.disabled=good;
	
			}
	
		}
	
		this.checker()
	
	
	
		for(var i=0;i<objects.length;i++)
	
		{
			obj=document.getElementById(objects[i]);
	
			obj.onkeyup=this.checker;
			obj.onchange=this.checker;
	
		}
	
	
	}