function sendForm(fnum){
//alert (fnum);
	var sendok=1;
	re = /<|>|&lt;|&gt;/;
	var i;
	var fs;
	fs = eval('document.'+fnum+'.'+'length');
	for (i=0; i<fs; i++) {
		dfnv=eval('document.'+fnum+'.elements['+i+'].value');
		var input=dfnv;
		if (input.search(re)>-1) {
			k=input.length;
			for (n=0; n<=k; n++){
				input=input.replace(re, "");
				dfnv=input;
			}
			alert("Вы ввели недопустимый символ!");
			eval('document.'+fnum+'.elements['+i+'].focus()');
			sendok=0;
			return false;
		}
	}
	if(sendok==1){
		eval('document.'+fnum+'.submit()');
	}
}


function showImageX (pic, imgName, w, h){
	if(pic.length>0){
		if(navigator.appName!="Netscape"){
			document[imgName].src = pic;
//alert(document[imgName].src);
//document[imgName].visible=false;
//alert(document[imgName].width);
			if((document[imgName].width>w || document[imgName].height>h) || (document[imgName].width==85 && document[imgName].height==113)){
				var k_w=1;
				var k_h=1;
				if(document[imgName].width>document[imgName].height){
					k_w=document[imgName].width/w;
					document[imgName].width=document[imgName].width/k_w;
				}
				else{
					k_h=document[imgName].height/h;
					document[imgName].height=document[imgName].height/k_h;
				}
			}
		}
	}
}

function changeLocationExtern(layer,form,element){
	var url,index;
	if(document.layers && layer!=null){
		index = eval('document.'+layer+'.document.'+form+'.'+element+'.selectedIndex');
		url = eval('document.'+layer+'.document.'+form+'.'+element+'.options['+index+'].value');
	}	
	else{
		index = eval('document.'+form+'.'+element+'.selectedIndex');
		url = eval('document.'+form+'.'+element+'.options['+index+'].value');
	}	
	if (url != "")
		popup = window.open(url,'','scrollbars=yes,location=yes,resizable=yes,directories=yes,status=1,menubar=1,toolbar=yes');
}

function changeLocationIntern(layer,form,element){
	var url,index;
	if(document.layers && layer!=null){
		index = eval('document.'+layer+'.document.'+form+'.'+element+'.selectedIndex');
		url = eval('document.'+layer+'.document.'+form+'.'+element+'.options['+index+'].value');
	}	
	else{
		index = eval('document.'+form+'.'+element+'.selectedIndex');
		url = eval('document.'+form+'.'+element+'.options['+index+'].value');
	}	
	
	if (url != "")
		self.location.href = url;
}


function open_win(url,width,height)
{
if(!width) width="800";
if(!height) height="600";
 myWin= open(url, "window", "resizable=yes,width="+width+",height="+height+",top=100,left=100,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=no");
 myWin.focus();
};


/*function photo_window(w,h,url){
//	alert("a");
	bkv=window.open("/admins/inc/showphoto.php?"+url,"screen","resizable=0,width="+w+",height="+h+",top=50,left=100,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0");
	bkv.focus();
}*/


function chat_window_open(id){
//	alert("a");
	ch=window.open("/ch/"+id+"/","screen","resizable=0,width=480,height=290,top=100,left=150,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0");
	ch.focus();
}

function adminchat_window_open(s){
	//alert(s);
	ch=window.open("/admins/winonline/"+s,"screen"+s,"resizable=0,width=500,height=310,top=100,left=150,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0");
	ch.focus();
}

function photo_window(url,width,height)
{
   wfoto = open('/inc/image.php?src='+url, 'screen', 'resizable=yes,width='+width+',height='+height+',top=100,left=100,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=1')
   wfoto.focus();
}