function popup_image( url, width, height ) {
	if (!width) width = 900;
	if (!height) height = 800;
	wnd = window.open( url, "_blank", "width="+width+",height="+height+",status=0,toolbar=0,resizable=0,scrollbars=0,menubar=0");
	wnd.focus();
}

function popup_static_window( id, width, height ) {
	if (!width) width = 900;
	if (!height) height = 800;
	wnd = window.open( "/static_popup.php?id=" + id, "_blank", "width="+width+",height="+height+",status=1,toolbar=0,resizable=1,scrollbars=1,menubar=1");
	wnd.focus();
}

function popup_news_window( id, width, height ) {
	if (!width) width = 900;
	if (!height) height = 800;
	wnd = window.open( "/news_popup.php?id=" + id, "_blank", "width="+width+",height="+height+",status=1,toolbar=0,resizable=1,scrollbars=1,menubar=1");
	wnd.focus();
}

function __warning_empty( name ) {
	return ' - Поле \'' + name + '\' не может быть пустым или равняться нулю!\n';
}

function __warning_len( name, len ) {
	return ' - В поле \'' + name + '\' не может быть больше ' + len + ' символов!\n';
}

function __check( error, object ) {
	if ( error != '' ) { alert( 'Внимание!\n\n' + error ); return false; }
	else { return true; }
}

function checkRequest() {
	var error = '';
	var obj = document.request;
	if ( obj.uname.value == '' ) error += __warning_empty( 'Ваше имя' );
	if ( obj.uname.lenght > 254 ) error += __warning_len( 'Ваше имя', 254 );
	if ( obj.phone.value == '' ) error += __warning_empty( 'Контактный телефон' );
	if ( obj.phone.lenght > 254 ) error += __warning_len( 'Контактный телефон', 254 );
	
	var i=0;
	var utype = 0;
    while((i<obj.utype.length)&&(obj.utype[i].checked!=1)) {i++;}
   	if (i!=obj.utype.length) utype = obj.utype[i].value;
	
	if( utype == 2 ) {
	
		if ( obj.org_name.value == '' ) error += __warning_empty( 'Название организации' );
		if ( obj.org_name.lenght > 254 ) error += __warning_len( 'Название организации', 254 );
	
	}
	
	if ( obj.source.value == '0' ) error += __warning_empty( 'Источник информации о сайте' );
	
	return __check( error, obj );
}

