function vpa_base()
{
	this.handlers=new Object();
	this.path=window.location.pathname.substr(1);
	this.parts=this.path.split('/');
	this.type=(this.parts.length>=1 && this.parts[0]!='') ? this.parts[0] : 'default';
	this.action=(this.parts.length>=2 && this.parts[1]!='') ? this.parts[1] : 'default';

	this.handler_func=function(type,action,func)
	{
		if (type=='') type='default';
		if (action=='') action='default';
		if (typeof this.handlers[type] !='object') this.handlers[type]=new Object();
		this.handlers[type][action]=func;
	}
	
	this.close=function()
	{
		try {
			var func_name=this.handlers[this.type][this.action];
			this[func_name]();
		} catch(e) {
		}
	}
	
	this.init=function()
	{
		// здесь мы а наследниках будем прописывать обработчики
	}
}

function vpa_user ()
{
	this.init=function()
	{
		//this.handler_func('service',	'projects',		'handler_init_slides');
		//this.handler_func('service',	'lease',		'handler_init_slides');
		//this.handler_func('service',	'buy',			'handler_init_slides');
		this.handler_func('news',		'new',			'handler_gallery');
	}
	
	this.handler_gallery=function()
	{
		init_galls();
	}
	
	this.handler_init_slides=function ()
	{
		im=new vpa_slide($('gal'));
		im.start();
	}
	
}
vpa_user.prototype = new vpa_base(); 


function open_img(obj)
{
	window.open('/image.html?'+window.im.src,'_blank','width=300, height=300,scrollbars=yes,resizable=yes');
	return false;
}

function init ()
{
	var base=new vpa_user();
	base.init();
	base.close();
	
	if ($('gal'))
	{
		im=new vpa_slide($('gal'));
		im.start();	
	}

}



setGlobalOnLoad(init);