function ShowWin(url,x,y,name,isscrollbars) {
	cx=screen.width / 2 - (x / 2);
	cy=(screen.height/2-(y/2));
    
    isscrollbars=(isscrollbars=="no")?"no":"yes";
	window.open(url,name,"toolbar=no,status=no,directories=no,menubar=no,resizable=yes,width="+x+",height="+y+",scrollbars="+isscrollbars+",top="+cy+",left="+cx);
}


function operators_box_show_hide(){
	var box = document.getElementById('operators_box');
	var button = document.getElementById('operators_box_button'); 
		
	if(box.style.display == 'none'){
		box.style.display = 'block'
		button.innerHTML = "- Скрыть список";
	}else{
		box.style.display = 'none'
		button.innerHTML = "+ Показать список";
	}
	return;
}



function operators_box_show_hide_sec(){
	var box = document.getElementById('operators_box');
	var button = document.getElementById('operators_box_button'); 
	var selector = document.getElementById('operators_box_selector'); 
		
	if(box.style.display == 'none'){
		box.style.display = 'block';
		selector.style.display = 'block';
		button.innerHTML = "- выбрать";
	}else{
		box.style.display = 'none';
		selector.style.display = 'none';
		button.innerHTML = "+ выбрать";
	}
	return;
}




function Selecter(Form, EName, S) {
    var f=Form;
    for ( i=0; i<f.length; i++ ) {
        if (f.elements[i].name==EName) {
            f.elements[i].checked=(S==1)?true:false;
        }
   }        
}


function MOver(MySrc,MyColor) { MySrc.style.cursor="auto"; MySrc.bgColor=MyColor; }
function MOut (MySrc,MyColor) { MySrc.style.cursor="auto"; MySrc.bgColor=MyColor; }



function Notepad(ID) {
    CookieName="notepad["+ID+"]";
    Obj=eval("document.tableForm.notepad_"+ID);

    
    CookieValue=getCookie(CookieName);
    if (CookieValue==1) {
        CookieValue=0;
    }
    else {
        CookieValue=1;
    }
    Obj.checked=(CookieValue==1)?true:false;

        
    
    CookieExpires=new Date();
    CookieExpires.setTime(CookieExpires.getTime()+8640000);
    CookieExpires=CookieExpires.toGMTString();


    CookieStr=CookieName+"="+CookieValue+";expires="+CookieExpires+";path=/;";
    document.cookie=CookieStr;
}



function getCookie(name) {
	var prefix = name + "="
	var cookieStartIndex = document.cookie.indexOf(prefix)
	if (cookieStartIndex == -1)
		return null
	var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
	if (cookieEndIndex == -1)
		cookieEndIndex = document.cookie.length
	return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
}






function ShowDivWindow(Name, Action, Width, Height, Text) {
    leerId=Name;
    LoadingHTML=Text;

    
//	cx=(screen.width/2)-(Width/2);
//    cy=(screen.height/2)-(Height);

	cx=100;
    cy=150;


    if ((navigator.userAgent.indexOf("MSIE 5.5")==-1) && (navigator.userAgent.indexOf("MSIE 6")==-1)) {
//      cx += 90;
      cy-= 117;
    }

   
    if (document.all) {
        var leerElem = document.all[leerId];

        if (LoadingHTML) { leerElem.innerHTML = LoadingHTML; }
        
        leerElem.style.left = cx;
        leerElem.style.top = cy;
        leerElem.style.visibility = ((Action=="show")?"visible":"hidden");
    }
    else if (document.getElementById) {
        var leerElem = document.getElementById(leerId);
        
        if (LoadingHTML) { leerElem.innerHTML = LoadingHTML; }
        
        leerElem.style.left = cx;
        leerElem.style.top = cy;
        leerElem.style.visibility = ((Action=="show")?"visible":"hidden");
    }
    else if (document.layers) {
        document.layers[leerId].left = cx;
        document.layers[leerId].top = cy;
        
        if (LoadingHTML) { 
            document.layers[leerId].document.open();
            document.layers[leerId].document.write(LoadingHTML);
            document.layers[leerId].document.close();
        }
        
        document.layers[leerId].visibility = ((Action=="show")?"show":"hide");
    }
}



function need_reg() {
	if (confirm("Доступ запрещён!\n\nПользователь - это демо аккаунт с ограниченными возможностями\nДля просмотра закрытых разделов сервера вам необходимо зарегистрироваться")) {
		document.location="/main/registration/";
	}
}

function need_pay() {
	alert("Внимание!\r\n\r\nВы не можете скачивать СПО до оплаты этой услуги.\r\n\r\nКомпания ЛайтСофт\r\nTel.: +7 (495) 745-60-08\r\nE-mail: allspo@lightsoft.ru\r\n");
}


function SelectDir(Form, EName) {
var f=Form;
var A=new Array(66,67,12,32,43,102,1,30,75,84,87,3);
Selecter(document.lForm,"countrys[]",0);
for (i=0; i<f.length; i++) {
if (f.elements[i].name==EName) {
for (j=0; j<A.length; j++) { 
if (f.elements[i].value==A[j]) { f.elements[i].checked=true; }
}
}
} 
}



function allspo_change_city(){
	var sel = document.getElementById('ct_sel');
	var url = sel.value;
	sel.value = '';
	window.location = url;
}




function allspo_first_voting_show(){
    var button = document.getElementById('allspo_first_voting_button');
    var body = document.getElementById('allspo_first_voting_body');
	var icon_plus = document.getElementById('allspo_first_voting_icon_plus');
	var icon_minus = document.getElementById('allspo_first_voting_icon_minus');
        		
    if(body.style.display == 'none'){
	    body.style.display = '';
	    button.title = 'скрыть опрос';
		icon_plus.style.display = 'none';
		icon_minus.style.display = '';
//		icon.alt = '-';
    }else{
	    body.style.display = 'none';
	    button.title = 'показать опрос';
		icon_plus.style.display = '';
		icon_minus.style.display = 'none';
//		icon.alt = '+';
    }
}

function loginFocus() {
	log = document.getElementById('login');
	setTimeout("log.focus()", 200);//FF does not wish to understand normally method focus ()
}