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 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) 788-74-17\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 loginFocus() {
	log = document.getElementById('login');
	setTimeout("log.focus()", 200);//FF does not wish to understand normally method focus ()
}
