function _( elementID ){
	return document.getElementById( elementID );
}

function addEvent(obj,name,func){   
	if(obj.addEventListener) {    
		obj.addEventListener(name, func, false);    
	}
	else if (obj.attachEvent) {    
		obj.attachEvent('on'+name, func); 
	}
	else {
		throw 'Error';
	}
}

function unselect( oObject ) {
	for ( i = 0; i < oObject.options.length; i++ ){
		if ( oObject.options[i].selected ){
			oObject.options[i].selected = false;
		}
	}
}


function openImage( iWidth, iHeight, sURL, sTitle ) {
	var newWin = window.open( '' , '', 'width='+ iWidth +', height='+ iHeight +', toolbar=no, scrollbars=no, resizable=no, status=no, left=' + (parseInt(screen.width)/2-iWidth/2) + ',top=' + (parseInt(screen.height)/2-iHeight/2));
	newWin.document.open();
	newWin.document.write( '<html><head><style type="text/css">body{margin: 0 auto;}</style></head><body><img src="'+ sURL +'"><script></script></body></html>' );	
	newWin.document.write( "<a href='http://www.liveinternet.ru/click' target=_blank><img src='http://counter.yadro.ru/hit?t44.2;r" + escape(document.referrer) + ((typeof(screen)=="undefined")?"":";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?screen.colorDepth:screen.pixelDepth)) + ";u" + escape(document.URL) + ";" + Math.random() + "' border=0 width=31 height=31 alt='' title='LiveInternet'><\/a>" );
	newWin.document.close();
}


function doSearch( oForm, evt ){
	var iKeyCode = ( evt.keyCode ? evt.keyCode : ( evt.charCode ? evt.charCode : ( evt.witch ? evt.witch : 0 ) ) );
	if ( iKeyCode == 13 ){
		window.location.href = 'search.php?search=' + _( 'searchStr' ).value
	}
}


function fontSizer( iTape ){
	sFieldID = 'bodyInv';
	if ( aPs = _( sFieldID ).getElementsByTagName( 'P' ) ){
		for ( i = 0; i < aPs.length; i++ ){
			if ( !aPs[i].style.fontSize ) aPs[i].style.fontSize = '12px';
			
			if ( iTape == 1 ){
				aPs[i].style.fontSize = parseInt( aPs[i].style.fontSize ) + 1 + 'px';
			} else {
				aPs[i].style.fontSize = parseInt( aPs[i].style.fontSize ) - 1 + 'px';
			}
		}
	}
	
	if ( iTape == 1 ){
		_( sFieldID ).style.fontSize = parseInt( _( sFieldID ).style.fontSize ) + 1 + 'px';
	} else {
		_( sFieldID ).style.fontSize = parseInt( _( sFieldID ).style.fontSize ) - 1 + 'px';
	}

	//alert(  );
}