function OpenCenterWindow( sUri, iWidth, iHeight )
{
        var sWindowName = 'win' + Math.floor( Math.random()*1000 )
        var iRealWidth = iWidth ? iWidth : 600
        var iRealHeight = iHeight ? iHeight : screen.height - 300

        var iLeft = Math.round( (screen.width-iRealWidth)/2 )
        var iTop =  Math.round( (screen.height-iRealHeight)/2 ) - 35

        var sWindowOptions = 'status=yes,menubar=no,toolbar=no'
        sWindowOptions += ',resizable=no,scrollbars=no,location=no'
        sWindowOptions += ',width='  + iRealWidth
        sWindowOptions += ',height=' + iRealHeight
        sWindowOptions += ',left='   + iLeft
        sWindowOptions += ',top='       + iTop

        var oWindow = window.open( sUri, sWindowName, sWindowOptions )
        oWindow.focus();
        return oWindow
}


function rmenu(pret){
	for(i=1;i<4;i++){
		document.getElementById("bsub"+i).className="sbutright";
		document.getElementById("rsub"+i).style.display="none";
	}
	document.getElementById("bsub"+pret).className="sbutright_pressed";
	document.getElementById("rsub"+pret).style.display="";
}
function ttt(){
	va = document.getElementById("srch").value;
	if(va=="поиск..."){
		document.getElementById("srch").value="";
	}
}
function ttt2(){
	va = document.getElementById("srch").value;
	if(va==""){
		document.getElementById("srch").value="поиск...";
	}
}
function tag(obj,ta,tagname){
ta.value+=obj.value;
if(obj.value=="<"+tagname+">")obj.value="</"+tagname+">";else obj.value="<"+tagname+">";
}
function ismaxlength(obj){
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
if (obj.getAttribute && obj.value.length>mlength)
obj.value=obj.value.substring(0,mlength)
}

function quot(id){
document.getElementById('fulltext').value+='[quote]'+document.getElementById('nm'+id).innerHTML+'[/quote_nm]'+document.getElementById('ans'+id).innerHTML+'[/quote]\n\n';
}

function rl(obj,t){
if(t==1){obj.className='blackbg';}
else {obj.className='whtbg';}
}
function rl2(obj,t){
if(t==1){obj.className='imcell3';}
else {obj.className='imcell';}
}

function AddBookmark() { 
window.external.addFavorite ('http://www.allposition.com' , 'www.allposition.com')
}

function tmp(){
if(document.getElementById('ch1').checked==true){
document.getElementById('checkb').innerHTML="<input type='button' class='field' value='Регистрация' onclick='nxt();'/>";
}
}
function nxt(){
document.location='index.php?action=join';
}

function chcl(n){
		if(document.getElementById("b"+n).className=="prct"){
			document.getElementById("b"+n).className="prct2";
		}
		else {
			document.getElementById("b"+n).className="prct";
		}

	}

function got(pr,tp){
	re=new Array();
		re[1]='photo';
		re[2]='video';
	document.getElementById("b"+pr).className="prc";
	window.location="index.php?action=region&id="+document.getElementById("hidreg").value+"&prc="+pr+"&type="+re[tp];
	
}


function alter(nu,act){
	document.getElementById("bb"+nu).innerHTML=act;
}

function otherreg(){

	document.getElementById("regsel").style.display="";
	document.getElementById("hidreg").value="";
	document.getElementById("selectedreg").style.display="none";
	document.getElementById("price").style.display="none";
}

function regsel(num,txt){
	document.getElementById("regsel").style.display="none";
	

	document.getElementById("hidreg").value=num;

	document.getElementById("selectedreg").style.display="";
	document.getElementById("price").style.display="";
	document.getElementById("selectedreg").innerHTML="Выбранный регион: <font class='titnm'>"+txt+"</font><br/><b class='selreg' onclick='otherreg();'><img src='imgs/arrow_left.png' alt='' style='vertical-align: middle;'/> выбрать другой регион</b>";
}
