/**************************** No load and no save pages **************/
/**
var message="!";

function clickIE() { if (document.all) { return false;} }
function clickNS(e) {
    if (document.layers||(document.getElementById&&!document.all)) {
	if (e.which==2||e.which==3) {return false;}
    }
}

if (document.layers) {
    document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;
}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.onselect = document.onselectstart =  function(){ 
var el = event.srcElement
    if(el.tagName != 'INPUT' && el.tagName != 'TEXTAREA')
        return false 
        return true
} 

/******************** END NOLOAD SCRIP *************/
 
function wo(_wurl,_ww,_wh,_wscrl){

/***************
wurl: window URL
wh: window height
ww: window width
wsr: scrollbars 1 - yes, 0 - no
wresize: resizable 1- yes, 0 - no
***************/
if(screen.width){
    wpos_x = (screen.width-_ww)/2;
    if (wpos_x < 0){ wpos_x = 0;}
    wpos_y = (screen.height-_wh)/2;
    if (wpos_y < 0){ wpos_y = 0;}
    }else{
    wpos_x = 0;
    wpos_y = 0;
    }
// if(_wscrl==undefined){ _wscrl = 0;}
    wind_desc = window.open(_wurl,"","alwaysRaised=0,top="+wpos_y+",left="+wpos_x+",height="+_wh+",width="+_ww+",menubar=0,resizable=0,scrollbars="+_wscrl+",status=1");
    wind_desc.focus();
}

/*function wopen(_wurl,_wn,_ww,_wh,_wscrl){

/***************
wurl: window URL
wh: window height
ww: window width
wsr: scrollbars 1 - yes, 0 - no
***************/
/*if(screen.width){
wpos_x = (screen.width-_ww)/2;
if (wpos_x < 0){ wpos_x = 0;}
    wpos_y = (screen.height-_wh)/2;
    if (wpos_y < 0){ wpos_y = 0;}
    }else{
        wpos_x = 0;
        wpos_y = 0;
    }
// if(_wscrl==undefined){ _wscrl = 0
    if(_wn==""){ _wn = "w_test";}
    wind_desc = window.open(_wurl,_wn,"alwaysRaised=0,top="+wpos_y+",left="+wpos_x+",height="+_wh+",width="+_ww+",menubar=0,resizable=1,scrollbars="+_wscrl+",status=1");
    wind_desc.focus();
}
*/
function ajaxExecute(url, mode, value, place) {
    var now = new Date();
    var timestr = now.getTime();
    if(document.getElementById) {
	    var x = (window.ActiveXObject) ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest();
    }
    if(x) {
      x.onreadystatechange = function() {
      if(x.readyState == 4 && x.status == 200) {
        el = document.getElementById('BuildingList');
				el.innerHTML = '';
        el = document.getElementById(place);
        el.innerHTML = x.responseText;
      }
    };
		cityid = document.getElementById('cityid').value;
		streetid = document.getElementById('streetid').value;
    x.open('GET', url + '&mode=' + mode + '&StreetId=' + streetid + '&CityId=' + cityid + '&nocache=' + timestr, true);
    x.send(null);
    }
    return false;
}

function CheckForm(){
        var USER_NAME = new String();
        var AMOUNT = new String();
        USER_NAME = document.main_pay.USER_NAME.value;
        AMOUNT = document.main_pay.BILL_AMOUNT.value;
        var CHECK_MIND = document.main_pay.CHECK_MIND;
	var ERROR_MSG = "";
        if (USER_NAME.length < 4){
        ERROR_MSG += "Вы не указали (или не верно указали) имя пользователя!\n";
        }
        if (AMOUNT.length == 0){
            ERROR_MSG += "Вы не указали сумму пополнения!\n";
        }
        for (i=1; i <= USER_NAME.length; i++){
            var current_symbol = USER_NAME.substring(i-1, i);
            if (isNaN(current_symbol)){
                ERROR_MSG += "Недопустимый символ '" + current_symbol + "' в имени пользователя!\n";
            }
        }
        for (j=1; j <= AMOUNT.length; j++){
            var current_symbol = AMOUNT.substring(j-1, j);
            if (isNaN(current_symbol)){
                ERROR_MSG += "Недопустимый символ '" + current_symbol + "' в сумме пополнения!\n";
            }
        }
        if (CHECK_MIND.checked != true){
            ERROR_MSG += "Вы уверены в том что хотите оплатить контрактный логин? Тогда поставте галочку";
        }
        if (ERROR_MSG != ""){
            alert(ERROR_MSG);
        }
        if (ERROR_MSG != ""){
            return false;
        } else {
            return true;
    	}
}

