function PreloadImages(){
	var myimages = new Array();
	for (i = 0; i < PreloadImages.arguments.length; i++) {
		if(PreloadImages.arguments[i]) {
			myimages[i]=new Image();
			myimages[i].src=PreloadImages.arguments[i];	}
	}
}

function getMonthName(month) {
	var arr_months = ['января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря'];
	return arr_months[month];
}

function format_date(str) { // формат даты должен быть ДД*ММ*ГГ[ГГ]
	var format_str, d_year, d_month, d_day;
	if(str) {
		d_day = (str.substring(0, 2))-0;
		d_month = (str.substring(3, 5))-0;
		d_year = str.substring(6, str.length);
		if(d_day && d_month) {
			format_str = d_day + ' ' + getMonthName(d_month-1) + ' ' + d_year;
		}
		else {
			format_str = str;
		}
		return(format_str);
	}
}

function addListener( oObj, sEvent, oFunc )
{
	try {
		if ( document.attachEvent )
			oObj.attachEvent( 'on' + sEvent, oFunc );
		else if ( document.addEventListener )
			oObj.addEventListener( sEvent, oFunc, true );
		else
			eval( oObj + '.on' + sEvent + '=' + oFunc );
	 } catch ( e ) { }
}

function open_photo(photo_path, photo_title){
	var op, s = '';
	op = 'width=600,height=400,screenX=170,screenY=250,left=170,top=250,resizable=1,menubar=0,toolbar=0,location=0,status=0';
	s += '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
	s += '<head>';
	s += '<title>' + photo_title + '<\/title>';
	s += '<script type="text\/javascript">';
	s += 'function resize_img() {';
	s += 'var w = document.getElementById("img").width;';
	s += 'var h = document.getElementById("img").height;';
	s += 'if (!(document.all)) { self.resizeTo(w, h + 50); } else { self.resizeTo((w + 12),(h + 31)); }';
	s += '}';
	s += '<\/script>';
	s += '<style type="text/css">';
	s += 'body, html { width: 100%; height: 100%; margin: 0; padding: 0; background: #FFF; }';
	s += 'table { width: 100%; height: 100%; border-collapse: collapse; border-spacing: 0; }';
	s += 'td { text-align: center; vertical-align: middle; padding: 0;}';
	s += '<\/style>';
	s += '<\/head>';
	s += '<body onload="resize_img();"><table><tr><td>';
	s += '<a href="#" onclick="self.close(); return(false);"><img id="img" src=' + photo_path + ' border="0" alt="' + photo_title + '" title="' + photo_title + '"><\/a>';
	s += '<\/td><\/tr><\/table><\/body>';
	s += '<\/html>';
	var win_op = window.open('','open_photo', op);
	win_op.document.open();
	win_op.document.write(s);
	win_op.document.close();
	win_op.focus();
}

function my_escape(s){
	if(!s) return('');
	return(s.replace(String.fromCharCode(39), '&#39;'));
}

