// Input revolve
function check_input_focus(node,def)	{ if(node.value==def) node.value=''; return; }
function check_input_blur(node,def)	{ if(node.value=='') node.value=def; return; }

// Pop-up
function general_popup(href,wname,wini,width,height)
	{
	if(wini=='auto') wini="status=0,toolbar=0,menubar=0,resizable=0,scrollbars=no";
	windowimg=window.open(href,wname,((wini.length?(wini+','):'')+'width='+width+',height='+height));
	wh=window.innerHeight;
	if(wh==0 || typeof(wh)=="undefined") wh=document.documentElement.clientHeight;
	if(wh==0 || typeof(wh)=="undefined") wh=document.body.clientHeight;
	windowimg.moveTo((document.body.clientWidth-width)/2,(wh-height)/2);
	return;
	}
	
// Other
function get_window_height()
	{
	var wh1=window.innerHeight;
	var wh2=document.documentElement.clientHeight;
	var wh3=document.body.clientHeight;
	if(typeof(wh1)=="undefined") wh1=0;
	if(typeof(wh2)=="undefined") wh2=0;
	if(typeof(wh3)=="undefined") wh3=0;
	return Math.max(wh1,wh2,wh3);
	}
	
// Fake file uploads
var W3CDOM = (document.createElement && document.getElementsByTagName);
function initFileUploads() {
	if (!W3CDOM) return;
	var fakeFileUpload = document.createElement('div');
	fakeFileUpload.className = 'fakefile';
	fakeFileUpload.appendChild(document.createElement('input'));
	var image = document.createElement('img');
	image.src='/img/button_select.gif';
	fakeFileUpload.appendChild(image);
	var x = document.getElementsByTagName('input');
	for (var i=0;i<x.length;i++) {
		if (x[i].type != 'file') continue;
		if (x[i].parentNode.className != 'fileinputs') continue;
		x[i].className = 'file hidden';
		var clone = fakeFileUpload.cloneNode(true);
		x[i].parentNode.appendChild(clone);
		x[i].relatedElement = clone.getElementsByTagName('input')[0];
		x[i].relatedElement.value = "Что у вас получилось?";
		x[i].onchange = x[i].onmouseout = function () {
			this.relatedElement.value = this.value;//"Ню-ню...";
		}
	}
}
