var ie=(document.all && document.all.item && !window.opera)?1:0;

function checkf() {
	a=checkf.arguments;
	form=a[0];
	noerror=true;
	for (i=1;i<a.length;i++) if (form[a[i]].value.length==0) noerror=false;
		if (!noerror) alert('Не заполены все требуемые поля!');
	return noerror;
}

function MM_findObj(n, d) { 
  	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 && d.getElementById) 
		x=d.getElementById(n); 
	return x;
}
function ShowMail(user, domain1, domain2) {
	var email = user+'&#64;'+domain1+'&#46;'+domain2;
	if (ShowMail.arguments[3]) name = ShowMail.arguments[3];
	else name = email;
	document.writeln('<a href="mailto:'+email+'">'+name+'</a>');
}

function OpenPrint(link_name) {
	window.open("/view/"+link_name, "OpenPrint", "scrollbars=1, resizable=1, width=600, height=500").focus();
}

function show_div(id)
{
	if (!divs||print_id == id) return true;
	for (key in divs){
		Obj = MM_findObj(divs[key]);
		Obj.className = 'invisible';
		Obj2 = MM_findObj('a_'+divs[key]);
		Obj2.className = 'pmenu';
		Obj3 = MM_findObj('img_'+key);
		Obj3.src = 'images/icons/'+icons[key]+'.gif';
		if (divs[key] == id) 
			gotid = key;
	}
	obj = MM_findObj(id);
	if (obj) {
		obj.className='visible'; 
		obj2 = MM_findObj('a_'+id);
		obj2.className = 'pmenu_';
		obj3 = MM_findObj('img_'+gotid);
		obj3.src = 'images/icons/'+icons[gotid]+'_.gif';
		window.location = '#info';
		return false;
	}
	else return true;
}

function SetHiddenVar(variable,val) {
	var forma = document.forms['search'];
	forma.elements[variable].value = val;
	forma.submit();
	return false;
}

function changeItemOver(obj, name){
	obj.src = 'images/menu/'+name+'_.gif';
}
function changeItemOut(obj, name){
	obj.src = 'images/menu/'+name+'.gif';
}

var options = Array();
function show_option(id){

 for(i in options) 
  {
 	document.all[i].style.display = 'none'; 
  }

 options[id] = 1;
 document.all[id].style.display = 'block';
 return false;
}

function openImage(image, title) {
	window.open("/popup.php?img="+image+"&title="+title, "popupimage", "scrollbars=0, resizable=1, width=520, height=450, top="+(screen.height/2-225)+", left="+(screen.width/2-260)).focus();
}
function rusoft() {
  window.open('http://www.rusoft.ru');
}
