diff --git a/install/sql/incremental/upd_0012.sql b/install/sql/incremental/upd_0012.sql
new file mode 100644
index 0000000000000000000000000000000000000000..2ba957f8d9c9d9e39bb5f8dde0c0d82fff5c110b
--- /dev/null
+++ b/install/sql/incremental/upd_0012.sql
@@ -0,0 +1,173 @@
+--
+-- Table structure for table `openvz_ip`
+--
+
+CREATE TABLE IF NOT EXISTS `openvz_ip` (
+  `ip_address_id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `sys_userid` int(11) NOT NULL DEFAULT '0',
+  `sys_groupid` int(11) NOT NULL DEFAULT '0',
+  `sys_perm_user` varchar(5) DEFAULT NULL,
+  `sys_perm_group` varchar(5) DEFAULT NULL,
+  `sys_perm_other` varchar(5) DEFAULT NULL,
+  `server_id` int(11) NOT NULL DEFAULT '0',
+  `ip_address` varchar(15) DEFAULT NULL,
+  `vm_id` int(11) NOT NULL DEFAULT '0',
+  `reserved` varchar(255) NOT NULL DEFAULT 'n',
+  PRIMARY KEY (`ip_address_id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;
+
+--
+-- Dumping data for table `openvz_ip`
+--
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `openvz_ostemplate`
+--
+
+CREATE TABLE IF NOT EXISTS `openvz_ostemplate` (
+  `ostemplate_id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `sys_userid` int(11) NOT NULL DEFAULT '0',
+  `sys_groupid` int(11) NOT NULL DEFAULT '0',
+  `sys_perm_user` varchar(5) DEFAULT NULL,
+  `sys_perm_group` varchar(5) DEFAULT NULL,
+  `sys_perm_other` varchar(5) DEFAULT NULL,
+  `template_name` varchar(255) DEFAULT NULL,
+  `template_file` varchar(255) NOT NULL,
+  `server_id` int(11) NOT NULL DEFAULT '0',
+  `allservers` varchar(255) NOT NULL DEFAULT 'y',
+  `active` varchar(255) NOT NULL DEFAULT 'y',
+  `description` text,
+  PRIMARY KEY (`ostemplate_id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;
+
+--
+-- Dumping data for table `openvz_ostemplate`
+--
+
+INSERT INTO `openvz_ostemplate` (`ostemplate_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `template_name`, `template_file`, `server_id`, `allservers`, `active`, `description`) VALUES(1, 1, 1, 'riud', 'riud', '', 'Debian minimal', 'debian-minimal-x86', 1, 'y', 'y', 'Debain minmal image.');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `openvz_template`
+--
+
+CREATE TABLE IF NOT EXISTS `openvz_template` (
+  `template_id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `sys_userid` int(11) NOT NULL DEFAULT '0',
+  `sys_groupid` int(11) NOT NULL DEFAULT '0',
+  `sys_perm_user` varchar(5) DEFAULT NULL,
+  `sys_perm_group` varchar(5) DEFAULT NULL,
+  `sys_perm_other` varchar(5) DEFAULT NULL,
+  `template_name` varchar(255) DEFAULT NULL,
+  `diskspace` int(11) NOT NULL DEFAULT '0',
+  `traffic` int(11) NOT NULL DEFAULT '-1',
+  `bandwidth` int(11) NOT NULL DEFAULT '-1',
+  `ram` int(11) NOT NULL DEFAULT '0',
+  `ram_burst` int(11) NOT NULL DEFAULT '0',
+  `cpu_units` int(11) NOT NULL DEFAULT '1000',
+  `cpu_num` int(11) NOT NULL DEFAULT '4',
+  `cpu_limit` int(11) NOT NULL DEFAULT '400',
+  `io_priority` int(11) NOT NULL DEFAULT '4',
+  `active` varchar(255) NOT NULL DEFAULT 'y',
+  `description` text,
+  `numproc` varchar(255) DEFAULT NULL,
+  `numtcpsock` varchar(255) DEFAULT NULL,
+  `numothersock` varchar(255) DEFAULT NULL,
+  `vmguarpages` varchar(255) DEFAULT NULL,
+  `kmemsize` varchar(255) DEFAULT NULL,
+  `tcpsndbuf` varchar(255) DEFAULT NULL,
+  `tcprcvbuf` varchar(255) DEFAULT NULL,
+  `othersockbuf` varchar(255) DEFAULT NULL,
+  `dgramrcvbuf` varchar(255) DEFAULT NULL,
+  `oomguarpages` varchar(255) DEFAULT NULL,
+  `privvmpages` varchar(255) DEFAULT NULL,
+  `lockedpages` varchar(255) DEFAULT NULL,
+  `shmpages` varchar(255) DEFAULT NULL,
+  `physpages` varchar(255) DEFAULT NULL,
+  `numfile` varchar(255) DEFAULT NULL,
+  `avnumproc` varchar(255) DEFAULT NULL,
+  `numflock` varchar(255) DEFAULT NULL,
+  `numpty` varchar(255) DEFAULT NULL,
+  `numsiginfo` varchar(255) DEFAULT NULL,
+  `dcachesize` varchar(255) DEFAULT NULL,
+  `numiptent` varchar(255) DEFAULT NULL,
+  `swappages` varchar(255) DEFAULT NULL,
+  `hostname` varchar(255) DEFAULT NULL,
+  `nameserver` varchar(255) DEFAULT NULL,
+  `create_dns` varchar(1) NOT NULL DEFAULT 'n',
+  `capability` varchar(255) DEFAULT NULL,
+  PRIMARY KEY (`template_id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;
+
+--
+-- Dumping data for table `openvz_template`
+--
+
+INSERT INTO `openvz_template` (`template_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `template_name`, `diskspace`, `traffic`, `bandwidth`, `ram`, `ram_burst`, `cpu_units`, `cpu_num`, `cpu_limit`, `io_priority`, `active`, `description`, `numproc`, `numtcpsock`, `numothersock`, `vmguarpages`, `kmemsize`, `tcpsndbuf`, `tcprcvbuf`, `othersockbuf`, `dgramrcvbuf`, `oomguarpages`, `privvmpages`, `lockedpages`, `shmpages`, `physpages`, `numfile`, `avnumproc`, `numflock`, `numpty`, `numsiginfo`, `dcachesize`, `numiptent`, `swappages`, `hostname`, `nameserver`, `create_dns`, `capability`) VALUES(1, 1, 1, 'riud', 'riud', '', 'small', 10, -1, -1, 256, 512, 1000, 4, 400, 4, 'y', '', '999999:999999', '7999992:7999992', '7999992:7999992', '65536:65536', '2147483646:2147483646', '214748160:396774400', '214748160:396774400', '214748160:396774400', '214748160:396774400', '65536:65536', '131072:131072', '999999:999999', '65536:65536', '0:2147483647', '23999976:23999976', '180:180', '999999:999999', '500000:500000', '999999:999999', '2147483646:2147483646', '999999:999999', '256000:256000', 'v{VEID}.test.tld', '8.8.8.8 8.8.4.4', 'n', '');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `openvz_traffic`
+--
+
+CREATE TABLE IF NOT EXISTS `openvz_traffic` (
+  `veid` int(11) NOT NULL,
+  `traffic_date` date NOT NULL,
+  `traffic_bytes` bigint(32) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`veid`,`traffic_date`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Dumping data for table `openvz_traffic`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `openvz_vm`
+--
+
+CREATE TABLE IF NOT EXISTS `openvz_vm` (
+  `vm_id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `sys_userid` int(11) NOT NULL DEFAULT '0',
+  `sys_groupid` int(11) NOT NULL DEFAULT '0',
+  `sys_perm_user` varchar(5) DEFAULT NULL,
+  `sys_perm_group` varchar(5) DEFAULT NULL,
+  `sys_perm_other` varchar(5) DEFAULT NULL,
+  `server_id` int(11) NOT NULL DEFAULT '0',
+  `veid` int(10) unsigned NOT NULL,
+  `ostemplate_id` int(11) NOT NULL DEFAULT '0',
+  `template_id` int(11) NOT NULL DEFAULT '0',
+  `ip_address` varchar(255) NOT NULL,
+  `hostname` varchar(255) DEFAULT NULL,
+  `vm_password` varchar(255) DEFAULT NULL,
+  `start_boot` varchar(255) NOT NULL DEFAULT 'y',
+  `active` varchar(255) NOT NULL DEFAULT 'y',
+  `active_until_date` date NOT NULL,
+  `description` text,
+  `diskspace` int(11) NOT NULL DEFAULT '0',
+  `traffic` int(11) NOT NULL DEFAULT '-1',
+  `bandwidth` int(11) NOT NULL DEFAULT '-1',
+  `ram` int(11) NOT NULL DEFAULT '0',
+  `ram_burst` int(11) NOT NULL DEFAULT '0',
+  `cpu_units` int(11) NOT NULL DEFAULT '1000',
+  `cpu_num` int(11) NOT NULL DEFAULT '4',
+  `cpu_limit` int(11) NOT NULL DEFAULT '400',
+  `io_priority` int(11) NOT NULL DEFAULT '4',
+  `nameserver` varchar(255) NOT NULL DEFAULT '8.8.8.8 8.8.4.4',
+  `create_dns` varchar(1) NOT NULL DEFAULT 'n',
+  `capability` text NOT NULL,
+  `config` mediumtext NOT NULL,
+  PRIMARY KEY (`vm_id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;
+
+--
+-- Dumping data for table `openvz_vm`
+--
+
+-- --------------------------------------------------------
diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql
index 69507c0f291804771ef94dc4d483548ed8d99510..81d61efa303f200bede5e0942f9651e61fa756d9 100644
--- a/install/sql/ispconfig3.sql
+++ b/install/sql/ispconfig3.sql
@@ -792,6 +792,180 @@ CREATE TABLE `monitor_data` (
 
 -- --------------------------------------------------------
 
+--
+-- Table structure for table `openvz_ip`
+--
+
+CREATE TABLE IF NOT EXISTS `openvz_ip` (
+  `ip_address_id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `sys_userid` int(11) NOT NULL DEFAULT '0',
+  `sys_groupid` int(11) NOT NULL DEFAULT '0',
+  `sys_perm_user` varchar(5) DEFAULT NULL,
+  `sys_perm_group` varchar(5) DEFAULT NULL,
+  `sys_perm_other` varchar(5) DEFAULT NULL,
+  `server_id` int(11) NOT NULL DEFAULT '0',
+  `ip_address` varchar(15) DEFAULT NULL,
+  `vm_id` int(11) NOT NULL DEFAULT '0',
+  `reserved` varchar(255) NOT NULL DEFAULT 'n',
+  PRIMARY KEY (`ip_address_id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;
+
+--
+-- Dumping data for table `openvz_ip`
+--
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `openvz_ostemplate`
+--
+
+CREATE TABLE IF NOT EXISTS `openvz_ostemplate` (
+  `ostemplate_id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `sys_userid` int(11) NOT NULL DEFAULT '0',
+  `sys_groupid` int(11) NOT NULL DEFAULT '0',
+  `sys_perm_user` varchar(5) DEFAULT NULL,
+  `sys_perm_group` varchar(5) DEFAULT NULL,
+  `sys_perm_other` varchar(5) DEFAULT NULL,
+  `template_name` varchar(255) DEFAULT NULL,
+  `template_file` varchar(255) NOT NULL,
+  `server_id` int(11) NOT NULL DEFAULT '0',
+  `allservers` varchar(255) NOT NULL DEFAULT 'y',
+  `active` varchar(255) NOT NULL DEFAULT 'y',
+  `description` text,
+  PRIMARY KEY (`ostemplate_id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;
+
+--
+-- Dumping data for table `openvz_ostemplate`
+--
+
+INSERT INTO `openvz_ostemplate` (`ostemplate_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `template_name`, `template_file`, `server_id`, `allservers`, `active`, `description`) VALUES(1, 1, 1, 'riud', 'riud', '', 'Debian minimal', 'debian-minimal-x86', 1, 'y', 'y', 'Debain minmal image.');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `openvz_template`
+--
+
+CREATE TABLE IF NOT EXISTS `openvz_template` (
+  `template_id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `sys_userid` int(11) NOT NULL DEFAULT '0',
+  `sys_groupid` int(11) NOT NULL DEFAULT '0',
+  `sys_perm_user` varchar(5) DEFAULT NULL,
+  `sys_perm_group` varchar(5) DEFAULT NULL,
+  `sys_perm_other` varchar(5) DEFAULT NULL,
+  `template_name` varchar(255) DEFAULT NULL,
+  `diskspace` int(11) NOT NULL DEFAULT '0',
+  `traffic` int(11) NOT NULL DEFAULT '-1',
+  `bandwidth` int(11) NOT NULL DEFAULT '-1',
+  `ram` int(11) NOT NULL DEFAULT '0',
+  `ram_burst` int(11) NOT NULL DEFAULT '0',
+  `cpu_units` int(11) NOT NULL DEFAULT '1000',
+  `cpu_num` int(11) NOT NULL DEFAULT '4',
+  `cpu_limit` int(11) NOT NULL DEFAULT '400',
+  `io_priority` int(11) NOT NULL DEFAULT '4',
+  `active` varchar(255) NOT NULL DEFAULT 'y',
+  `description` text,
+  `numproc` varchar(255) DEFAULT NULL,
+  `numtcpsock` varchar(255) DEFAULT NULL,
+  `numothersock` varchar(255) DEFAULT NULL,
+  `vmguarpages` varchar(255) DEFAULT NULL,
+  `kmemsize` varchar(255) DEFAULT NULL,
+  `tcpsndbuf` varchar(255) DEFAULT NULL,
+  `tcprcvbuf` varchar(255) DEFAULT NULL,
+  `othersockbuf` varchar(255) DEFAULT NULL,
+  `dgramrcvbuf` varchar(255) DEFAULT NULL,
+  `oomguarpages` varchar(255) DEFAULT NULL,
+  `privvmpages` varchar(255) DEFAULT NULL,
+  `lockedpages` varchar(255) DEFAULT NULL,
+  `shmpages` varchar(255) DEFAULT NULL,
+  `physpages` varchar(255) DEFAULT NULL,
+  `numfile` varchar(255) DEFAULT NULL,
+  `avnumproc` varchar(255) DEFAULT NULL,
+  `numflock` varchar(255) DEFAULT NULL,
+  `numpty` varchar(255) DEFAULT NULL,
+  `numsiginfo` varchar(255) DEFAULT NULL,
+  `dcachesize` varchar(255) DEFAULT NULL,
+  `numiptent` varchar(255) DEFAULT NULL,
+  `swappages` varchar(255) DEFAULT NULL,
+  `hostname` varchar(255) DEFAULT NULL,
+  `nameserver` varchar(255) DEFAULT NULL,
+  `create_dns` varchar(1) NOT NULL DEFAULT 'n',
+  `capability` varchar(255) DEFAULT NULL,
+  PRIMARY KEY (`template_id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;
+
+--
+-- Dumping data for table `openvz_template`
+--
+
+INSERT INTO `openvz_template` (`template_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `template_name`, `diskspace`, `traffic`, `bandwidth`, `ram`, `ram_burst`, `cpu_units`, `cpu_num`, `cpu_limit`, `io_priority`, `active`, `description`, `numproc`, `numtcpsock`, `numothersock`, `vmguarpages`, `kmemsize`, `tcpsndbuf`, `tcprcvbuf`, `othersockbuf`, `dgramrcvbuf`, `oomguarpages`, `privvmpages`, `lockedpages`, `shmpages`, `physpages`, `numfile`, `avnumproc`, `numflock`, `numpty`, `numsiginfo`, `dcachesize`, `numiptent`, `swappages`, `hostname`, `nameserver`, `create_dns`, `capability`) VALUES(1, 1, 1, 'riud', 'riud', '', 'small', 10, -1, -1, 256, 512, 1000, 4, 400, 4, 'y', '', '999999:999999', '7999992:7999992', '7999992:7999992', '65536:65536', '2147483646:2147483646', '214748160:396774400', '214748160:396774400', '214748160:396774400', '214748160:396774400', '65536:65536', '131072:131072', '999999:999999', '65536:65536', '0:2147483647', '23999976:23999976', '180:180', '999999:999999', '500000:500000', '999999:999999', '2147483646:2147483646', '999999:999999', '256000:256000', 'v{VEID}.test.tld', '8.8.8.8 8.8.4.4', 'n', '');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `openvz_traffic`
+--
+
+CREATE TABLE IF NOT EXISTS `openvz_traffic` (
+  `veid` int(11) NOT NULL,
+  `traffic_date` date NOT NULL,
+  `traffic_bytes` bigint(32) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`veid`,`traffic_date`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Dumping data for table `openvz_traffic`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `openvz_vm`
+--
+
+CREATE TABLE IF NOT EXISTS `openvz_vm` (
+  `vm_id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `sys_userid` int(11) NOT NULL DEFAULT '0',
+  `sys_groupid` int(11) NOT NULL DEFAULT '0',
+  `sys_perm_user` varchar(5) DEFAULT NULL,
+  `sys_perm_group` varchar(5) DEFAULT NULL,
+  `sys_perm_other` varchar(5) DEFAULT NULL,
+  `server_id` int(11) NOT NULL DEFAULT '0',
+  `veid` int(10) unsigned NOT NULL,
+  `ostemplate_id` int(11) NOT NULL DEFAULT '0',
+  `template_id` int(11) NOT NULL DEFAULT '0',
+  `ip_address` varchar(255) NOT NULL,
+  `hostname` varchar(255) DEFAULT NULL,
+  `vm_password` varchar(255) DEFAULT NULL,
+  `start_boot` varchar(255) NOT NULL DEFAULT 'y',
+  `active` varchar(255) NOT NULL DEFAULT 'y',
+  `active_until_date` date NOT NULL,
+  `description` text,
+  `diskspace` int(11) NOT NULL DEFAULT '0',
+  `traffic` int(11) NOT NULL DEFAULT '-1',
+  `bandwidth` int(11) NOT NULL DEFAULT '-1',
+  `ram` int(11) NOT NULL DEFAULT '0',
+  `ram_burst` int(11) NOT NULL DEFAULT '0',
+  `cpu_units` int(11) NOT NULL DEFAULT '1000',
+  `cpu_num` int(11) NOT NULL DEFAULT '4',
+  `cpu_limit` int(11) NOT NULL DEFAULT '400',
+  `io_priority` int(11) NOT NULL DEFAULT '4',
+  `nameserver` varchar(255) NOT NULL DEFAULT '8.8.8.8 8.8.4.4',
+  `create_dns` varchar(1) NOT NULL DEFAULT 'n',
+  `capability` text NOT NULL,
+  `config` mediumtext NOT NULL,
+  PRIMARY KEY (`vm_id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;
+
+--
+-- Dumping data for table `openvz_vm`
+--
+
+-- --------------------------------------------------------
+
 --
 -- Table structure for table `proxy_reverse`
 --
diff --git a/interface/lib/lang/en.lng b/interface/lib/lang/en.lng
index f2969404bbf9b7fcec9b9f07ebe76974478da7dd..6ea7d9b7929600c0516c9437bd0a2faeda005635 100644
--- a/interface/lib/lang/en.lng
+++ b/interface/lib/lang/en.lng
@@ -36,7 +36,7 @@ $wb['top_menu_help'] = 'Help';
 $wb['top_menu_billing'] = 'Billing';
 $wb['top_menu_domain'] = 'Domains';
 $wb['top_menu_dashboard'] = 'Home';
-$wb['top_menu_vm'] = 'VM';
+$wb['top_menu_vm'] = 'VServer';
 $wb['toolsarea_head_txt'] = 'Tools';
 $wb['latest_news_txt'] = 'Latest news';
 ?>
diff --git a/interface/web/client/client_edit.php b/interface/web/client/client_edit.php
index ddeabc47d2f370410acd59d0dbd17b280eab511d..4581397534e2e63ee86e8517391e8666129cae4e 100644
--- a/interface/web/client/client_edit.php
+++ b/interface/web/client/client_edit.php
@@ -161,7 +161,7 @@ class page_action extends tform_actions {
 		// Create the controlpaneluser for the client
 		//Generate ssh-rsa-keys
 		exec('ssh-keygen -t rsa -C '.$username.'-rsa-key-'.time().' -f /tmp/id_rsa -N ""');
-		$app->db->query("UPDATE client SET created_at = ".time().", id_rsa = '".file_get_contents('/tmp/id_rsa')."', ssh_rsa = '".file_get_contents('/tmp/id_rsa.pub')."' WHERE client_id = ".$this->id);
+		$app->db->query("UPDATE client SET created_at = ".time().", id_rsa = '".$app->db->quote(@file_get_contents('/tmp/id_rsa'))."', ssh_rsa = '".$app->db->quote(@file_get_contents('/tmp/id_rsa.pub'))."' WHERE client_id = ".$this->id);
 		exec('rm -f /tmp/id_rsa /tmp/id_rsa.pub');
 		
 		// Create the controlpaneluser for the client
diff --git a/interface/web/themes/default/icons/x32/drawer.png b/interface/web/themes/default/icons/x32/drawer.png
new file mode 100644
index 0000000000000000000000000000000000000000..9a1f2147c8febb182765f9570c24d8c47e5b54b9
Binary files /dev/null and b/interface/web/themes/default/icons/x32/drawer.png differ
diff --git a/interface/web/vm/form/openvz_ip.tform.php b/interface/web/vm/form/openvz_ip.tform.php
new file mode 100644
index 0000000000000000000000000000000000000000..ced86746c40313f9bb0d908f18bc113b6e38dc40
--- /dev/null
+++ b/interface/web/vm/form/openvz_ip.tform.php
@@ -0,0 +1,112 @@
+<?php
+
+/*
+	Form Definition
+
+	Tabledefinition
+
+	Datatypes:
+	- INTEGER (Forces the input to Int)
+	- DOUBLE
+	- CURRENCY (Formats the values to currency notation)
+	- VARCHAR (no format check, maxlength: 255)
+	- TEXT (no format check)
+	- DATE (Dateformat, automatic conversion to timestamps)
+
+	Formtype:
+	- TEXT (Textfield)
+	- TEXTAREA (Textarea)
+	- PASSWORD (Password textfield, input is not shown when edited)
+	- SELECT (Select option field)
+	- RADIO
+	- CHECKBOX
+	- CHECKBOXARRAY
+	- FILE
+
+	VALUE:
+	- Wert oder Array
+
+	Hint:
+	The ID field of the database table is not part of the datafield definition.
+	The ID field must be always auto incement (int or bigint).
+
+
+*/
+
+$form["title"] 			= "Openvz IP address";
+$form["description"] 	= "";
+$form["name"] 			= "openvz_ip";
+$form["action"]			= "openvz_ip_edit.php";
+$form["db_table"]		= "openvz_ip";
+$form["db_table_idx"]	= "ip_address_id";
+$form["db_history"]		= "yes";
+$form["tab_default"]	= "main";
+$form["list_default"]	= "openvz_ip_list.php";
+$form["auth"]			= 'yes'; // yes / no
+
+$form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
+$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
+$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
+$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
+$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
+
+$form["tabs"]['main'] = array (
+	'title' 	=> "IP address",
+	'width' 	=> 100,
+	'template' 	=> "templates/openvz_ip_edit.htm",
+	'fields' 	=> array (
+	##################################
+	# Begin Datatable fields
+	##################################
+		'server_id' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'SELECT',
+			'default'	=> '',
+			'datasource'	=> array ( 	'type'	=> 'SQL',
+										'querystring' => 'SELECT server_id,server_name FROM server WHERE mail_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+										'keyfield'=> 'server_id',
+										'valuefield'=> 'server_name'
+									 ),
+			'value'		=> ''
+		),
+		'ip_address' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'ISIPV4',
+														'errmsg'=> 'ip_error_wrong'),
+										1 => array (	'type'	=> 'UNIQUE',
+														'errmsg'=> 'ip_error_unique'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'separator'	=> '',
+			'width'		=> '15',
+			'maxlength'	=> '15',
+			'rows'		=> '',
+			'cols'		=> ''
+		),
+		'vm_id' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'SELECT',
+			'default'	=> '',
+			'datasource'	=> array ( 	'type'	=> 'SQL',
+										'querystring' => 'SELECT vm_id,hostname FROM openvz_vm WHERE {AUTHSQL} ORDER BY hostname',
+										'keyfield'=> 'vm_id',
+										'valuefield'=> 'hostname'
+									 ),
+			'value'		=> array(0 => '- Not assigned -')
+		),
+		'reserved' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'CHECKBOX',
+			'default'	=> 'n',
+			'value'		=> array(0 => 'n',1 => 'y')
+		),
+	##################################
+	# ENDE Datatable fields
+	##################################
+	)
+);
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/vm/form/openvz_ostemplate.tform.php b/interface/web/vm/form/openvz_ostemplate.tform.php
new file mode 100644
index 0000000000000000000000000000000000000000..279a9a5de0c539d6275590b5f7504c4d379b57c5
--- /dev/null
+++ b/interface/web/vm/form/openvz_ostemplate.tform.php
@@ -0,0 +1,124 @@
+<?php
+
+/*
+	Form Definition
+
+	Tabledefinition
+
+	Datatypes:
+	- INTEGER (Forces the input to Int)
+	- DOUBLE
+	- CURRENCY (Formats the values to currency notation)
+	- VARCHAR (no format check, maxlength: 255)
+	- TEXT (no format check)
+	- DATE (Dateformat, automatic conversion to timestamps)
+
+	Formtype:
+	- TEXT (Textfield)
+	- TEXTAREA (Textarea)
+	- PASSWORD (Password textfield, input is not shown when edited)
+	- SELECT (Select option field)
+	- RADIO
+	- CHECKBOX
+	- CHECKBOXARRAY
+	- FILE
+
+	VALUE:
+	- Wert oder Array
+
+	Hint:
+	The ID field of the database table is not part of the datafield definition.
+	The ID field must be always auto incement (int or bigint).
+
+
+*/
+
+$form["title"] 			= "Openvz OS-Template";
+$form["description"] 	= "";
+$form["name"] 			= "openvz_ostemplate";
+$form["action"]			= "openvz_ostemplate_edit.php";
+$form["db_table"]		= "openvz_ostemplate";
+$form["db_table_idx"]	= "ostemplate_id";
+$form["db_history"]		= "yes";
+$form["tab_default"]	= "main";
+$form["list_default"]	= "openvz_ostemplate_list.php";
+$form["auth"]			= 'yes'; // yes / no
+
+$form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
+$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
+$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
+$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
+$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
+
+$form["tabs"]['main'] = array (
+	'title' 	=> "Template",
+	'width' 	=> 100,
+	'template' 	=> "templates/openvz_ostemplate_edit.htm",
+	'fields' 	=> array (
+	##################################
+	# Begin Datatable fields
+	##################################
+		'template_name' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'template_name_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'template_file' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'template_file_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'server_id' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'SELECT',
+			'default'	=> '',
+			'datasource'	=> array ( 	'type'	=> 'SQL',
+										'querystring' => 'SELECT server_id,server_name FROM server WHERE mail_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+										'keyfield'=> 'server_id',
+										'valuefield'=> 'server_name'
+									 ),
+			'value'		=> ''
+		),
+		'allservers' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'CHECKBOX',
+			'default'	=> 'y',
+			'value'		=> array(0 => 'n',1 => 'y')
+		),
+		'active' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'CHECKBOX',
+			'default'	=> 'y',
+			'value'		=> array(0 => 'n',1 => 'y')
+		),
+		'description' => array (
+			'datatype'	=> 'TEXT',
+			'formtype'	=> 'TEXTAREA',
+			'default'	=> '',
+			'value'		=> '',
+			'separator'	=> '',
+			'width'		=> '',
+			'maxlength'	=> '',
+			'rows'		=> '10',
+			'cols'		=> '30'
+		),
+	##################################
+	# ENDE Datatable fields
+	##################################
+	)
+);
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/vm/form/openvz_template.tform.php b/interface/web/vm/form/openvz_template.tform.php
new file mode 100644
index 0000000000000000000000000000000000000000..845d2bcfecc592b9f5c4e0f4bb1fd4c8e8aa1c09
--- /dev/null
+++ b/interface/web/vm/form/openvz_template.tform.php
@@ -0,0 +1,462 @@
+<?php
+
+/*
+	Form Definition
+
+	Tabledefinition
+
+	Datatypes:
+	- INTEGER (Forces the input to Int)
+	- DOUBLE
+	- CURRENCY (Formats the values to currency notation)
+	- VARCHAR (no format check, maxlength: 255)
+	- TEXT (no format check)
+	- DATE (Dateformat, automatic conversion to timestamps)
+
+	Formtype:
+	- TEXT (Textfield)
+	- TEXTAREA (Textarea)
+	- PASSWORD (Password textfield, input is not shown when edited)
+	- SELECT (Select option field)
+	- RADIO
+	- CHECKBOX
+	- CHECKBOXARRAY
+	- FILE
+
+	VALUE:
+	- Wert oder Array
+
+	Hint:
+	The ID field of the database table is not part of the datafield definition.
+	The ID field must be always auto incement (int or bigint).
+
+
+*/
+
+$form["title"] 			= "Openvz Template";
+$form["description"] 	= "";
+$form["name"] 			= "openvz_template";
+$form["action"]			= "openvz_template_edit.php";
+$form["db_table"]		= "openvz_template";
+$form["db_table_idx"]	= "template_id";
+$form["db_history"]		= "yes";
+$form["tab_default"]	= "main";
+$form["list_default"]	= "openvz_template_list.php";
+$form["auth"]			= 'yes'; // yes / no
+
+$form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
+$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
+$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
+$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
+$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
+
+$form["tabs"]['main'] = array (
+	'title' 	=> "Template",
+	'width' 	=> 100,
+	'template' 	=> "templates/openvz_template_edit.htm",
+	'fields' 	=> array (
+	##################################
+	# Begin Datatable fields
+	##################################
+		'template_name' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'template_name_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'diskspace' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'diskspace_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'ram' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'ram_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'ram_burst' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'ram_burst_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'cpu_units' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'cpu_units_error_empty'),
+									),
+			'default'	=> '1000',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'cpu_num' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'cpu_num_error_empty'),
+									),
+			'default'	=> '4',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'cpu_limit' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'cpu_limit_error_empty'),
+									),
+			'default'	=> '400',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'io_priority' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'io_priority_error_empty'),
+									),
+			'default'	=> '4',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'hostname' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'create_dns' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'CHECKBOX',
+			'default'	=> 'y',
+			'value'		=> array(0 => 'n',1 => 'y')
+		),
+		'nameserver' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'template_nameserver_error_empty'),
+									),
+			'default'	=> '8.8.8.8 8.8.4.4',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'active' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'CHECKBOX',
+			'default'	=> 'y',
+			'value'		=> array(0 => 'n',1 => 'y')
+		),
+		'description' => array (
+			'datatype'	=> 'TEXT',
+			'formtype'	=> 'TEXTAREA',
+			'default'	=> '',
+			'value'		=> '',
+			'separator'	=> '',
+			'width'		=> '',
+			'maxlength'	=> '',
+			'rows'		=> '10',
+			'cols'		=> '30'
+		),
+	##################################
+	# ENDE Datatable fields
+	##################################
+	)
+);
+
+$form["tabs"]['advanced'] = array (
+	'title' 	=> "Advanced",
+	'width' 	=> 100,
+	'template' 	=> "templates/openvz_template_advanced_edit.htm",
+	'fields' 	=> array (
+	##################################
+	# Begin Datatable fields
+	##################################
+		'numproc' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'numproc_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'numtcpsock' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'numtcpsock_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'numothersock' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'numothersock_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'vmguarpages' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'vmguarpages_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'kmemsize' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'kmemsize_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'tcpsndbuf' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'tcpsndbuf_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'tcprcvbuf' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'tcprcvbuf_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'othersockbuf' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'othersockbuf_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'dgramrcvbuf' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'dgramrcvbuf_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'oomguarpages' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'oomguarpages_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'privvmpages' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'privvmpages_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'lockedpages' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'lockedpages_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'shmpages' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'shmpages_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'physpages' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'physpages_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'numfile' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'numfile_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'avnumproc' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'avnumproc_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'numflock' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'numflock_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'numpty' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'numpty_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'numsiginfo' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'numsiginfo_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'dcachesize' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'dcachesize_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'numiptent' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'numiptent_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'swappages' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'swappages_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'capability' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+	##################################
+	# ENDE Datatable fields
+	##################################
+	)
+);
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/vm/form/openvz_vm.tform.php b/interface/web/vm/form/openvz_vm.tform.php
new file mode 100644
index 0000000000000000000000000000000000000000..75b36c1cad77be4b3f4e68ec99fc0fe67e69cc01
--- /dev/null
+++ b/interface/web/vm/form/openvz_vm.tform.php
@@ -0,0 +1,297 @@
+<?php
+
+/*
+	Form Definition
+
+	Tabledefinition
+
+	Datatypes:
+	- INTEGER (Forces the input to Int)
+	- DOUBLE
+	- CURRENCY (Formats the values to currency notation)
+	- VARCHAR (no format check, maxlength: 255)
+	- TEXT (no format check)
+	- DATE (Dateformat, automatic conversion to timestamps)
+
+	Formtype:
+	- TEXT (Textfield)
+	- TEXTAREA (Textarea)
+	- PASSWORD (Password textfield, input is not shown when edited)
+	- SELECT (Select option field)
+	- RADIO
+	- CHECKBOX
+	- CHECKBOXARRAY
+	- FILE
+
+	VALUE:
+	- Wert oder Array
+
+	Hint:
+	The ID field of the database table is not part of the datafield definition.
+	The ID field must be always auto incement (int or bigint).
+
+
+*/
+
+$form["title"] 			= "Openvz virtual server";
+$form["description"] 	= "";
+$form["name"] 			= "openvz_vm";
+$form["action"]			= "openvz_vm_edit.php";
+$form["db_table"]		= "openvz_vm";
+$form["db_table_idx"]	= "vm_id";
+$form["db_history"]		= "yes";
+$form["tab_default"]	= "main";
+$form["list_default"]	= "openvz_vm_list.php";
+$form["auth"]			= 'yes'; // yes / no
+
+$form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
+$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
+$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
+$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
+$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
+
+$form["tabs"]['main'] = array (
+	'title' 	=> "Virtual server",
+	'width' 	=> 100,
+	'template' 	=> "templates/openvz_vm_edit.htm",
+	'fields' 	=> array (
+	##################################
+	# Begin Datatable fields
+	##################################
+		'server_id' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'SELECT',
+			'default'	=> '',
+			'datasource'	=> array ( 	'type'	=> 'SQL',
+										'querystring' => 'SELECT server_id,server_name FROM server WHERE mail_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+										'keyfield'=> 'server_id',
+										'valuefield'=> 'server_name'
+									 ),
+			'value'		=> ''
+		),
+		'ostemplate_id' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'SELECT',
+			'default'	=> '',
+			'datasource'	=> array ( 	'type'	=> 'SQL',
+										'querystring' => 'SELECT ostemplate_id,template_name FROM openvz_ostemplate WHERE {AUTHSQL} ORDER BY template_name',
+										'keyfield'=> 'ostemplate_id',
+										'valuefield'=> 'template_name'
+									 ),
+			'value'		=> ''
+		),
+		'template_id' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'SELECT',
+			'default'	=> '',
+			'datasource'	=> array ( 	'type'	=> 'SQL',
+										'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE {AUTHSQL} ORDER BY template_name',
+										'keyfield'=> 'template_id',
+										'valuefield'=> 'template_name'
+									 ),
+			'value'		=> ''
+		),
+		'ip_address' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'SELECT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'ip_address_error_empty'),
+									),
+			'default'	=> '',
+			'datasource'	=> array ( 	'type'	=> 'SQL',
+										'querystring' => "SELECT ip_address FROM openvz_ip WHERE reserved = 'n' AND (vm_id = 0 or vm_id = '{RECORDID}') AND {AUTHSQL} ORDER BY ip_address",
+										'keyfield'=> 'ip_address',
+										'valuefield'=> 'ip_address'
+									 ),
+			'value'		=> ''
+		),
+		'hostname' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'hostname_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'vm_password' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'vm_password_error_empty'),
+									),
+			'default'	=> $app->auth->get_random_password(10),
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'start_boot' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'CHECKBOX',
+			'default'	=> 'y',
+			'value'		=> array(0 => 'n',1 => 'y')
+		),
+		'active' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'CHECKBOX',
+			'default'	=> 'y',
+			'value'		=> array(0 => 'n',1 => 'y')
+		),
+		'active_until_date' => array (
+			'datatype'	=> 'DATE',
+			'formtype'	=> 'TEXT',
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'description' => array (
+			'datatype'	=> 'TEXT',
+			'formtype'	=> 'TEXTAREA',
+			'default'	=> '',
+			'value'		=> '',
+			'separator'	=> '',
+			'width'		=> '',
+			'maxlength'	=> '',
+			'rows'		=> '10',
+			'cols'		=> '30'
+		),
+	##################################
+	# ENDE Datatable fields
+	##################################
+	)
+);
+
+$form["tabs"]['advanced'] = array (
+	'title' 	=> "Advanced",
+	'width' 	=> 100,
+	'template' 	=> "templates/openvz_vm_advanced_edit.htm",
+	'fields' 	=> array (
+	##################################
+	# Begin Datatable fields
+	##################################
+		'veid' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'veid_error_empty'),
+										1 => array (	'type'	=> 'UNIQUE',
+														'errmsg'=> 'veid_error_unique'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'create_dns' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'CHECKBOX',
+			'default'	=> 'y',
+			'value'		=> array(0 => 'n',1 => 'y')
+		),
+		'diskspace' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'diskspace_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'ram' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'ram_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'ram_burst' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'ram_burst_error_empty'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'cpu_units' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'cpu_units_error_empty'),
+									),
+			'default'	=> '1000',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'cpu_num' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'cpu_num_error_empty'),
+									),
+			'default'	=> '4',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'cpu_limit' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'cpu_limit_error_empty'),
+									),
+			'default'	=> '400',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'io_priority' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'io_priority_error_empty'),
+									),
+			'default'	=> '4',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'nameserver' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'template_nameserver_error_empty'),
+									),
+			'default'	=> '8.8.8.8 8.8.4.4',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'capability' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+	##################################
+	# ENDE Datatable fields
+	##################################
+	)
+);
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/vm/lib/admin.conf.php b/interface/web/vm/lib/admin.conf.php
new file mode 100644
index 0000000000000000000000000000000000000000..a45d4403455c5c46f438046f088398e241cbc3d9
--- /dev/null
+++ b/interface/web/vm/lib/admin.conf.php
@@ -0,0 +1,2 @@
+<?php
+?>
\ No newline at end of file
diff --git a/interface/web/vm/lib/lang/en_openvz_ip.lng b/interface/web/vm/lib/lang/en_openvz_ip.lng
new file mode 100644
index 0000000000000000000000000000000000000000..98d5c98e8735548b4dec2f94a9b757ea710ab785
--- /dev/null
+++ b/interface/web/vm/lib/lang/en_openvz_ip.lng
@@ -0,0 +1,6 @@
+<?php
+$wb["server_id_txt"] = 'Hostserver';
+$wb["ip_address_txt"] = 'IP address';
+$wb["vm_id_txt"] = 'Virtual server';
+$wb["reserved_txt"] = 'Reserved';
+?>
\ No newline at end of file
diff --git a/interface/web/vm/lib/lang/en_openvz_ip_list.lng b/interface/web/vm/lib/lang/en_openvz_ip_list.lng
new file mode 100644
index 0000000000000000000000000000000000000000..e326e69b0f1bf500868c1aa36dd9f241bba0ad68
--- /dev/null
+++ b/interface/web/vm/lib/lang/en_openvz_ip_list.lng
@@ -0,0 +1,6 @@
+<?php
+$wb["list_head_txt"] = 'OpenVZ IP addresses';
+$wb["server_id_txt"] = 'Server';
+$wb["ip_address_txt"] = 'IP address';
+$wb["reserved_txt"] = 'Reserved';
+?>
\ No newline at end of file
diff --git a/interface/web/vm/lib/lang/en_openvz_ostemplate.lng b/interface/web/vm/lib/lang/en_openvz_ostemplate.lng
new file mode 100644
index 0000000000000000000000000000000000000000..3e31fc3bb570e3a7200d7c732e960524417ea25d
--- /dev/null
+++ b/interface/web/vm/lib/lang/en_openvz_ostemplate.lng
@@ -0,0 +1,8 @@
+<?php
+$wb["template_name_txt"] = 'Template name';
+$wb["template_file_txt"] = 'Template filename';
+$wb["server_id_txt"] = 'Server';
+$wb["allservers_txt"] = 'Exists on all servers';
+$wb["active_txt"] = 'Active';
+$wb["description_txt"] = 'Description';
+?>
\ No newline at end of file
diff --git a/interface/web/vm/lib/lang/en_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/en_openvz_ostemplate_list.lng
new file mode 100644
index 0000000000000000000000000000000000000000..93dafbe63c7ff386069340fdb8bfb5e9c38ba6e2
--- /dev/null
+++ b/interface/web/vm/lib/lang/en_openvz_ostemplate_list.lng
@@ -0,0 +1,7 @@
+<?php
+$wb["list_head_txt"] = 'OpenVZ OSTemplate';
+$wb["active_txt"] = 'Active';
+$wb["template_name_txt"] = 'Template name';
+$wb["server_id_txt"] = 'Server';
+$wb["allservers_txt"] = 'Exists on all servers';
+?>
\ No newline at end of file
diff --git a/interface/web/vm/lib/lang/en_openvz_template.lng b/interface/web/vm/lib/lang/en_openvz_template.lng
new file mode 100644
index 0000000000000000000000000000000000000000..a2619f192db42db6ba0d50252877a6722fb3691a
--- /dev/null
+++ b/interface/web/vm/lib/lang/en_openvz_template.lng
@@ -0,0 +1,60 @@
+<?php
+$wb["numproc_txt"] = 'Numproc';
+$wb["numtcpsock_txt"] = 'Numtcpsock';
+$wb["numothersock_txt"] = 'Numothersock';
+$wb["vmguarpages_txt"] = 'Vmguarpages';
+$wb["kmemsize_txt"] = 'Kmemsize';
+$wb["tcpsndbuf_txt"] = 'Tcpsndbuf';
+$wb["tcprcvbuf_txt"] = 'Tcprcvbuf';
+$wb["othersockbuf_txt"] = 'Othersockbuf';
+$wb["dgramrcvbuf_txt"] = 'Dgramrcvbuf';
+$wb["oomguarpages_txt"] = 'Oomguarpages';
+$wb["privvmpages_txt"] = 'Privvmpages';
+$wb["lockedpages_txt"] = 'Lockedpages';
+$wb["shmpages_txt"] = 'Shmpages';
+$wb["physpages_txt"] = 'Physpages';
+$wb["numfile_txt"] = 'Numfile';
+$wb["avnumproc_txt"] = 'Avnumproc';
+$wb["numflock_txt"] = 'Numflock';
+$wb["numpty_txt"] = 'Numpty';
+$wb["numsiginfo_txt"] = 'Numsiginfo';
+$wb["dcachesize_txt"] = 'Dcachesize';
+$wb["numiptent_txt"] = 'Numiptent';
+$wb["swappages_txt"] = 'Swappages';
+$wb["hostname_txt"] = 'Hostname';
+$wb["nameserver_txt"] = 'Nameserver(s)';
+$wb["nameserver_desc_txt"] = '(separated by whitespace)';
+$wb["capability_txt"] = 'Capability';
+$wb["template_name_txt"] = 'Template name';
+$wb["diskspace_txt"] = 'Diskspace';
+$wb["ram_txt"] = 'RAM (guaranteed)';
+$wb["ram_burst_txt"] = 'RAM (burst)';
+$wb["cpu_units_txt"] = 'CPU units';
+$wb["cpu_num_txt"] = 'CPU cores';
+$wb["cpu_limit_txt"] = 'CPU limit %';
+$wb["io_priority_txt"] = 'I/O priority';
+$wb["active_txt"] = 'Active';
+$wb["description_txt"] = 'Description';
+$wb["numproc_desc_txt"] = 'Number of processes and threads.';
+$wb["numtcpsock_desc_txt"] = 'Number of TCP sockets.';
+$wb["numothersock_desc_txt"] = 'Number of sockets other than TCP.';
+$wb["vmguarpages_desc_txt"] = 'Memory allocation guarantee, in pages.';
+$wb["kmemsize_desc_txt"] = 'Size of unswappable kernel memory, allocated for processes in this container.';
+$wb["tcpsndbuf_desc_txt"] = 'Total size of TCP send buffers.';
+$wb["tcprcvbuf_desc_txt"] = 'Total size of TCP receive buffers.';
+$wb["othersockbuf_desc_txt"] = 'Total size of UNIX-domain socket buffers, UDP and other datagram protocol send buffers.';
+$wb["dgramrcvbuf_desc_txt"] = 'Receive buffers of UDP and other datagram protocols.';
+$wb["oomguarpages_desc_txt"] = 'The guaranteed amount of memory for the case the memory is "over-booked" (out-of-memory kill guarantee), in pages.';
+$wb["privvmpages_desc_txt"] = 'Memory allocation limit, in pages.';
+$wb["lockedpages_desc_txt"] = 'Process pages not allowed to be swapped out (pages locked by mlock(2)).';
+$wb["shmpages_desc_txt"] = 'Total size of shared memory (IPC, shared anonymous mappings and tmpfs objects), in pages.';
+$wb["physpages_desc_txt"] = 'Total number of RAM pages used by processes.';
+$wb["numfile_desc_txt"] = 'Number of open files.';
+$wb["numflock_desc_txt"] = 'Number of file locks.';
+$wb["numpty_desc_txt"] = 'Number of pseudo-terminals.';
+$wb["numsiginfo_desc_txt"] = 'Number of siginfo structures.';
+$wb["dcachesize_desc_txt"] = 'Total size of dentry and inode structures locked in memory.';
+$wb["numiptent_desc_txt"] = 'Number of NETFILTER (IP packet filtering) entries.';
+$wb["swappages_desc_txt"] = 'Amount of swap space to show in container.';
+$wb["create_dns_txt"] = 'Create DNS for hostname';
+?>
\ No newline at end of file
diff --git a/interface/web/vm/lib/lang/en_openvz_template_list.lng b/interface/web/vm/lib/lang/en_openvz_template_list.lng
new file mode 100644
index 0000000000000000000000000000000000000000..28a149ae4f16c307e75733c5b9e475d862f20120
--- /dev/null
+++ b/interface/web/vm/lib/lang/en_openvz_template_list.lng
@@ -0,0 +1,5 @@
+<?php
+$wb["list_head_txt"] = 'OpenVZ Virtual Machine Template';
+$wb["active_txt"] = 'Active';
+$wb["template_name_txt"] = 'Template name';
+?>
\ No newline at end of file
diff --git a/interface/web/vm/lib/lang/en_openvz_vm.lng b/interface/web/vm/lib/lang/en_openvz_vm.lng
new file mode 100644
index 0000000000000000000000000000000000000000..ac350b0b22434505e6a5d0c0d117e1d9ecc6cdd5
--- /dev/null
+++ b/interface/web/vm/lib/lang/en_openvz_vm.lng
@@ -0,0 +1,25 @@
+<?php
+$wb["diskspace_txt"] = 'Diskspace';
+$wb["ram_txt"] = 'RAM (guaranteed)';
+$wb["ram_burst_txt"] = 'RAM (burst)';
+$wb["cpu_units_txt"] = 'CPU units';
+$wb["cpu_num_txt"] = 'CPU number';
+$wb["cpu_limit_txt"] = 'CPU limit';
+$wb["io_priority_txt"] = 'I/O priority';
+$wb["nameserver_txt"] = 'Nameserver(s)';
+$wb["nameserver_desc_txt"] = '(separated by whitespace)';
+$wb["capability_txt"] = 'Capability';
+$wb["server_id_txt"] = 'Hostserver';
+$wb["ostemplate_id_txt"] = 'OSTemplate';
+$wb["template_id_txt"] = 'Template';
+$wb["ip_address_txt"] = 'IP address';
+$wb["hostname_txt"] = 'Hostname';
+$wb["vm_password_txt"] = 'VM Password';
+$wb["start_boot_txt"] = 'Start at boot';
+$wb["active_txt"] = 'Active';
+$wb["description_txt"] = 'Description';
+$wb["client_group_id_txt"] = 'Client';
+$wb["veid_txt"] = 'VEID';
+$wb["create_dns_txt"] = 'Create DNS for hostname';
+$wb["active_until_date_txt"] = 'Active until date';
+?>
\ No newline at end of file
diff --git a/interface/web/vm/lib/lang/en_openvz_vm_list.lng b/interface/web/vm/lib/lang/en_openvz_vm_list.lng
new file mode 100644
index 0000000000000000000000000000000000000000..f0f133625d493ee3574b733417a66f4d3a8d65d3
--- /dev/null
+++ b/interface/web/vm/lib/lang/en_openvz_vm_list.lng
@@ -0,0 +1,10 @@
+<?php
+$wb["list_head_txt"] = 'Virtual server';
+$wb["active_txt"] = 'Active';
+$wb["server_id_txt"] = 'Hostserver';
+$wb["ostemplate_id_txt"] = 'OSTemplate';
+$wb["template_id_txt"] = 'Template';
+$wb["hostname_txt"] = 'Hostname';
+$wb["ip_address_txt"] = 'IP address';
+$wb["veid_txt"] = 'VEID';
+?>
\ No newline at end of file
diff --git a/interface/web/vm/lib/module.conf.php b/interface/web/vm/lib/module.conf.php
new file mode 100644
index 0000000000000000000000000000000000000000..5d0e2c80a7e5dd143a0ba8eb76bc502e4a89dd00
--- /dev/null
+++ b/interface/web/vm/lib/module.conf.php
@@ -0,0 +1,67 @@
+<?php
+
+$module['name'] 		= 'vm';
+$module['title'] 		= 'top_menu_vm';
+$module['template'] 	= 'module.tpl.htm';
+$module['startpage'] 	= 'vm/openvz_vm_list.php';
+$module['tab_width']    = '';
+
+//**** Templates menu
+$items = array();
+
+$items[] = array( 'title' 	=> 'Virtual Servers',
+				  'target' 	=> 'content',
+				  'link'	=> 'vm/openvz_vm_list.php',
+				  'html_id' => 'openvz_vm_list');
+
+$items[] = array( 'title' 	=> 'OS Templates',
+				  'target' 	=> 'content',
+				  'link'	=> 'vm/openvz_ostemplate_list.php',
+				  'html_id' => 'openvz_ostemplate_list');
+
+$items[] = array( 'title' 	=> 'VM Templates',
+				  'target' 	=> 'content',
+				  'link'	=> 'vm/openvz_template_list.php',
+				  'html_id' => 'openvz_template_list');
+				  
+$items[] = array( 'title' 	=> 'IP addresses',
+				  'target' 	=> 'content',
+				  'link'	=> 'vm/openvz_ip_list.php',
+				  'html_id' => 'openvz_ip_list');
+
+if(count($items))
+{
+	$module['nav'][] = array(	'title'	=> 'OpenVZ',
+								'open' 	=> 1,
+								'items'	=> $items);
+}
+
+
+//**** Statistics menu
+/*
+$items = array();
+
+$items[] = array( 'title' 	=> 'Traffic',
+				  'target' 	=> 'content',
+				  'link'	=> 'vm/traffic_stats.php',
+				  'html_id' => 'vm_traffic_stats');
+
+$items[] = array( 'title' 	=> 'Vserver monitor',
+				  'target' 	=> 'content',
+				  'link'	=> 'vm/traffic_stats.php',
+				  'html_id' => 'vm_traffic_stats');
+				  
+if(count($items))
+{
+	$module['nav'][] = array(	'title'	=> 'Statistics',
+								'open' 	=> 1,
+								'items'	=> $items);
+}
+*/
+
+
+
+
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/vm/list/openvz_ip.list.php b/interface/web/vm/list/openvz_ip.list.php
new file mode 100644
index 0000000000000000000000000000000000000000..09a21faec8daecb5ea489371a7d4457e7ffafdf1
--- /dev/null
+++ b/interface/web/vm/list/openvz_ip.list.php
@@ -0,0 +1,100 @@
+<?php
+
+/*
+	Datatypes:
+	- INTEGER
+	- DOUBLE
+	- CURRENCY
+	- VARCHAR
+	- TEXT
+	- DATE
+*/
+
+
+
+// Name of the list
+$liste["name"] 				= "openvz_ip";
+
+// Database table
+$liste["table"] 			= "openvz_ip";
+
+// Index index field of the database table
+$liste["table_idx"]			= "ip_address_id";
+
+// Search Field Prefix
+$liste["search_prefix"] 	= "search_";
+
+// Records per page
+$liste["records_per_page"] 	= 15;
+
+// Script File of the list
+$liste["file"]				= "openvz_ip_list.php";
+
+// Script file of the edit form
+$liste["edit_file"]			= "openvz_ip_edit.php";
+
+// Script File of the delete script
+$liste["delete_file"]		= "openvz_ip_del.php";
+
+// Paging Template
+$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+
+// Enable authe
+$liste["auth"]				= "yes";
+
+
+/*****************************************************
+* Suchfelder
+*****************************************************/
+
+$liste["item"][] = array(	'field'		=> "server_id",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "SELECT",
+							'op'		=> "like",
+							'prefix'	=> "",
+							'suffix'	=> "",
+							'datasource'	=> array ( 	'type'	=> 'SQL',
+														'querystring' => 'SELECT server_id, server_name FROM server WHERE vserver_server = 1 ORDER BY server_name',
+														'keyfield'=> 'server_id',
+														'valuefield'=> 'server_name'
+									 				  ),
+							'width'		=> "",
+							'value'		=> "");
+
+$liste["item"][] = array(	'field'		=> "vm_id",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "SELECT",
+							'op'		=> "like",
+							'prefix'	=> "",
+							'suffix'	=> "",
+							'datasource'	=> array ( 	'type'	=> 'SQL',
+										'querystring' => 'SELECT vm_id,hostname FROM openvz_vm WHERE {AUTHSQL} ORDER BY hostname',
+										'keyfield'=> 'vm_id',
+										'valuefield'=> 'hostname'
+									 ),
+							'width'		=> "",
+							'value'		=> "");
+							
+$liste["item"][] = array(	'field'		=> "ip_address",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "TEXT",
+							'op'		=> "like",
+							'prefix'	=> "%",
+							'suffix'	=> "%",
+							'width'		=> "",
+							'value'		=> "");
+
+$liste["item"][] = array(	'field'		=> "reserved",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "SELECT",
+							'op'		=> "=",
+							'prefix'	=> "",
+							'suffix'	=> "",
+							'width'		=> "",
+							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+ 
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/vm/list/openvz_ostemplate.list.php b/interface/web/vm/list/openvz_ostemplate.list.php
new file mode 100644
index 0000000000000000000000000000000000000000..721885ed07af7d83de90023587e2ef693776388b
--- /dev/null
+++ b/interface/web/vm/list/openvz_ostemplate.list.php
@@ -0,0 +1,94 @@
+<?php
+
+/*
+	Datatypes:
+	- INTEGER
+	- DOUBLE
+	- CURRENCY
+	- VARCHAR
+	- TEXT
+	- DATE
+*/
+
+
+
+// Name of the list
+$liste["name"] 				= "openvz_ostemplate";
+
+// Database table
+$liste["table"] 			= "openvz_ostemplate";
+
+// Index index field of the database table
+$liste["table_idx"]			= "ostemplate_id";
+
+// Search Field Prefix
+$liste["search_prefix"] 	= "search_";
+
+// Records per page
+$liste["records_per_page"] 	= 15;
+
+// Script File of the list
+$liste["file"]				= "openvz_ostemplate_list.php";
+
+// Script file of the edit form
+$liste["edit_file"]			= "openvz_ostemplate_edit.php";
+
+// Script File of the delete script
+$liste["delete_file"]		= "openvz_ostemplate_del.php";
+
+// Paging Template
+$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+
+// Enable authe
+$liste["auth"]				= "yes";
+
+
+/*****************************************************
+* Suchfelder
+*****************************************************/
+
+$liste["item"][] = array(	'field'		=> "active",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "SELECT",
+							'op'		=> "=",
+							'prefix'	=> "",
+							'suffix'	=> "",
+							'width'		=> "",
+							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array(	'field'		=> "template_name",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "TEXT",
+							'op'		=> "like",
+							'prefix'	=> "%",
+							'suffix'	=> "%",
+							'width'		=> "",
+							'value'		=> ""); 
+
+$liste["item"][] = array(	'field'		=> "server_id",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "SELECT",
+							'op'		=> "like",
+							'prefix'	=> "",
+							'suffix'	=> "",
+							'datasource'	=> array ( 	'type'	=> 'SQL',
+														'querystring' => 'SELECT server_id, server_name FROM server WHERE vserver_server = 1 ORDER BY server_name',
+														'keyfield'=> 'server_id',
+														'valuefield'=> 'server_name'
+									 				  ),
+							'width'		=> "",
+							'value'		=> "");
+
+$liste["item"][] = array(	'field'		=> "allservers",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "SELECT",
+							'op'		=> "=",
+							'prefix'	=> "",
+							'suffix'	=> "",
+							'width'		=> "",
+							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/vm/list/openvz_template.list.php b/interface/web/vm/list/openvz_template.list.php
new file mode 100644
index 0000000000000000000000000000000000000000..48d13eda2a30bfbc485e6a589ac2084d7f239f15
--- /dev/null
+++ b/interface/web/vm/list/openvz_template.list.php
@@ -0,0 +1,70 @@
+<?php
+
+/*
+	Datatypes:
+	- INTEGER
+	- DOUBLE
+	- CURRENCY
+	- VARCHAR
+	- TEXT
+	- DATE
+*/
+
+
+
+// Name of the list
+$liste["name"] 				= "openvz_template";
+
+// Database table
+$liste["table"] 			= "openvz_template";
+
+// Index index field of the database table
+$liste["table_idx"]			= "template_id";
+
+// Search Field Prefix
+$liste["search_prefix"] 	= "search_";
+
+// Records per page
+$liste["records_per_page"] 	= 15;
+
+// Script File of the list
+$liste["file"]				= "openvz_template_list.php";
+
+// Script file of the edit form
+$liste["edit_file"]			= "openvz_template_edit.php";
+
+// Script File of the delete script
+$liste["delete_file"]		= "openvz_template_del.php";
+
+// Paging Template
+$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+
+// Enable authe
+$liste["auth"]				= "yes";
+
+
+/*****************************************************
+* Suchfelder
+*****************************************************/
+
+$liste["item"][] = array(	'field'		=> "active",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "SELECT",
+							'op'		=> "=",
+							'prefix'	=> "",
+							'suffix'	=> "",
+							'width'		=> "",
+							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array(	'field'		=> "template_name",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "TEXT",
+							'op'		=> "like",
+							'prefix'	=> "%",
+							'suffix'	=> "%",
+							'width'		=> "",
+							'value'		=> ""); 
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/vm/list/openvz_vm.list.php b/interface/web/vm/list/openvz_vm.list.php
new file mode 100644
index 0000000000000000000000000000000000000000..0d9c5e6280816e94a518db416cbab2ab78cf4678
--- /dev/null
+++ b/interface/web/vm/list/openvz_vm.list.php
@@ -0,0 +1,129 @@
+<?php
+
+/*
+	Datatypes:
+	- INTEGER
+	- DOUBLE
+	- CURRENCY
+	- VARCHAR
+	- TEXT
+	- DATE
+*/
+
+
+
+// Name of the list
+$liste["name"] 				= "openvz_vm";
+
+// Database table
+$liste["table"] 			= "openvz_vm";
+
+// Index index field of the database table
+$liste["table_idx"]			= "vm_id";
+
+// Search Field Prefix
+$liste["search_prefix"] 	= "search_";
+
+// Records per page
+$liste["records_per_page"] 	= 15;
+
+// Script File of the list
+$liste["file"]				= "openvz_vm_list.php";
+
+// Script file of the edit form
+$liste["edit_file"]			= "openvz_vm_edit.php";
+
+// Script File of the delete script
+$liste["delete_file"]		= "openvz_vm_del.php";
+
+// Paging Template
+$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+
+// Enable authe
+$liste["auth"]				= "yes";
+
+
+/*****************************************************
+* Suchfelder
+*****************************************************/
+
+$liste["item"][] = array(	'field'		=> "active",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "SELECT",
+							'op'		=> "=",
+							'prefix'	=> "",
+							'suffix'	=> "",
+							'width'		=> "",
+							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+$liste["item"][] = array(	'field'		=> "veid",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "TEXT",
+							'op'		=> "==",
+							'prefix'	=> "",
+							'suffix'	=> "",
+							'width'		=> "",
+							'value'		=> "");
+							
+$liste["item"][] = array(	'field'		=> "server_id",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "SELECT",
+							'op'		=> "like",
+							'prefix'	=> "",
+							'suffix'	=> "",
+							'datasource'	=> array ( 	'type'	=> 'SQL',
+														'querystring' => 'SELECT server_id, server_name FROM server WHERE vserver_server = 1 ORDER BY server_name',
+														'keyfield'=> 'server_id',
+														'valuefield'=> 'server_name'
+									 				  ),
+							'width'		=> "",
+							'value'		=> "");
+
+$liste["item"][] = array(	'field'		=> "ostemplate_id",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "SELECT",
+							'op'		=> "like",
+							'prefix'	=> "",
+							'suffix'	=> "",
+							'datasource'	=> array ( 	'type'	=> 'SQL',
+										'querystring' => 'SELECT ostemplate_id,template_name FROM openvz_ostemplate WHERE {AUTHSQL} ORDER BY template_name',
+										'keyfield'=> 'ostemplate_id',
+										'valuefield'=> 'template_name'
+									 ),
+							'width'		=> "",
+							'value'		=> "");
+							
+$liste["item"][] = array(	'field'		=> "template_id",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "SELECT",
+							'op'		=> "like",
+							'prefix'	=> "",
+							'suffix'	=> "",
+							'datasource'	=> array ( 	'type'	=> 'SQL',
+										'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE {AUTHSQL} ORDER BY template_name',
+										'keyfield'=> 'template_id',
+										'valuefield'=> 'template_name'
+									 ),
+							'width'		=> "",
+							'value'		=> "");
+							
+$liste["item"][] = array(	'field'		=> "hostname",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "TEXT",
+							'op'		=> "like",
+							'prefix'	=> "%",
+							'suffix'	=> "%",
+							'width'		=> "",
+							'value'		=> "");
+
+$liste["item"][] = array(	'field'		=> "ip_address",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "TEXT",
+							'op'		=> "like",
+							'prefix'	=> "",
+							'suffix'	=> "%",
+							'width'		=> "",
+							'value'		=> "");
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/vm/openvz_ip_del.php b/interface/web/vm/openvz_ip_del.php
new file mode 100644
index 0000000000000000000000000000000000000000..ce4ce276eb920ed09ebe4bcab9ae373fcf057d9e
--- /dev/null
+++ b/interface/web/vm/openvz_ip_del.php
@@ -0,0 +1,58 @@
+<?php
+
+/*
+Copyright (c) 2005 - 2010, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    * Neither the name of ISPConfig nor the names of its contributors
+      may be used to endorse or promote products derived from this software without
+      specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/openvz_ip.list.php";
+$tform_def_file = "form/openvz_ip.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+//* Check permissions for module
+$app->auth->check_module_permissions('vm');
+
+$app->uses('tpl,tform');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+	
+}
+
+$page = new page_action;
+$page->onDelete()
+
+?>
diff --git a/interface/web/vm/openvz_ip_edit.php b/interface/web/vm/openvz_ip_edit.php
new file mode 100644
index 0000000000000000000000000000000000000000..7a792448ef361cc4f00063e39451a6ddf7e214aa
--- /dev/null
+++ b/interface/web/vm/openvz_ip_edit.php
@@ -0,0 +1,58 @@
+<?php
+/*
+Copyright (c) 2005 - 2010, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    * Neither the name of ISPConfig nor the names of its contributors
+      may be used to endorse or promote products derived from this software without
+      specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$tform_def_file = "form/openvz_ip.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+//* Check permissions for module
+$app->auth->check_module_permissions('vm');
+
+// Loading classes
+$app->uses('tpl,tform');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+	
+}
+
+$page = new page_action;
+$page->onLoad();
+
+?>
\ No newline at end of file
diff --git a/interface/web/vm/openvz_ip_list.php b/interface/web/vm/openvz_ip_list.php
new file mode 100644
index 0000000000000000000000000000000000000000..7f67ceca42b5ba56ba82a714915f7341588970bd
--- /dev/null
+++ b/interface/web/vm/openvz_ip_list.php
@@ -0,0 +1,54 @@
+<?php
+
+/*
+Copyright (c) 2005 - 2010, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    * Neither the name of ISPConfig nor the names of its contributors
+      may be used to endorse or promote products derived from this software without
+      specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/openvz_ip.list.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+//* Check permissions for module
+$app->auth->check_module_permissions('vm');
+
+$app->uses('listform_actions');
+
+// $app->listform_actions->SQLOrderBy = 'ORDER BY company_name, contact_name, client_id';
+// $app->listform_actions->SQLExtWhere = "limit_client = 0";
+$app->listform_actions->onLoad();
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/vm/openvz_ostemplate_del.php b/interface/web/vm/openvz_ostemplate_del.php
new file mode 100644
index 0000000000000000000000000000000000000000..dec96f541877e923beb3f065f6cbb237e2dcfec0
--- /dev/null
+++ b/interface/web/vm/openvz_ostemplate_del.php
@@ -0,0 +1,58 @@
+<?php
+
+/*
+Copyright (c) 2005 - 2010, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    * Neither the name of ISPConfig nor the names of its contributors
+      may be used to endorse or promote products derived from this software without
+      specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/openvz_ostemplate.list.php";
+$tform_def_file = "form/openvz_ostemplate.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+//* Check permissions for module
+$app->auth->check_module_permissions('vm');
+
+$app->uses('tpl,tform');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+	
+}
+
+$page = new page_action;
+$page->onDelete()
+
+?>
diff --git a/interface/web/vm/openvz_ostemplate_edit.php b/interface/web/vm/openvz_ostemplate_edit.php
new file mode 100644
index 0000000000000000000000000000000000000000..09a959811c876e416cb84cf03310c85b1c3e8add
--- /dev/null
+++ b/interface/web/vm/openvz_ostemplate_edit.php
@@ -0,0 +1,58 @@
+<?php
+/*
+Copyright (c) 2005 - 2010, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    * Neither the name of ISPConfig nor the names of its contributors
+      may be used to endorse or promote products derived from this software without
+      specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$tform_def_file = "form/openvz_ostemplate.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+//* Check permissions for module
+$app->auth->check_module_permissions('vm');
+
+// Loading classes
+$app->uses('tpl,tform');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+	
+}
+
+$page = new page_action;
+$page->onLoad();
+
+?>
\ No newline at end of file
diff --git a/interface/web/vm/openvz_ostemplate_list.php b/interface/web/vm/openvz_ostemplate_list.php
new file mode 100644
index 0000000000000000000000000000000000000000..f6f2a70622a621f47f69c299fd26a7d8f6f56a52
--- /dev/null
+++ b/interface/web/vm/openvz_ostemplate_list.php
@@ -0,0 +1,54 @@
+<?php
+
+/*
+Copyright (c) 2005 - 2010, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    * Neither the name of ISPConfig nor the names of its contributors
+      may be used to endorse or promote products derived from this software without
+      specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/openvz_ostemplate.list.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+//* Check permissions for module
+$app->auth->check_module_permissions('vm');
+
+$app->uses('listform_actions');
+
+// $app->listform_actions->SQLOrderBy = 'ORDER BY company_name, contact_name, client_id';
+// $app->listform_actions->SQLExtWhere = "limit_client = 0";
+$app->listform_actions->onLoad();
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/vm/openvz_template_del.php b/interface/web/vm/openvz_template_del.php
new file mode 100644
index 0000000000000000000000000000000000000000..3b672e7dd6665db9d3c96403a4b0965e0681ef24
--- /dev/null
+++ b/interface/web/vm/openvz_template_del.php
@@ -0,0 +1,58 @@
+<?php
+
+/*
+Copyright (c) 2005 - 2010, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    * Neither the name of ISPConfig nor the names of its contributors
+      may be used to endorse or promote products derived from this software without
+      specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/openvz_template.list.php";
+$tform_def_file = "form/openvz_template.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+//* Check permissions for module
+$app->auth->check_module_permissions('vm');
+
+$app->uses('tpl,tform');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+	
+}
+
+$page = new page_action;
+$page->onDelete()
+
+?>
diff --git a/interface/web/vm/openvz_template_edit.php b/interface/web/vm/openvz_template_edit.php
new file mode 100644
index 0000000000000000000000000000000000000000..2c1247a29976f2e0f8abe5409062c1e5a22e8787
--- /dev/null
+++ b/interface/web/vm/openvz_template_edit.php
@@ -0,0 +1,76 @@
+<?php
+/*
+Copyright (c) 2005 - 2010, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    * Neither the name of ISPConfig nor the names of its contributors
+      may be used to endorse or promote products derived from this software without
+      specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$tform_def_file = "form/openvz_template.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+//* Check permissions for module
+$app->auth->check_module_permissions('vm');
+
+// Loading classes
+$app->uses('tpl,tform');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+	
+	function onAfterInsert() {
+		global $app,$conf;
+		
+		$guar_ram = $this->dataRecord['ram']*256;
+		$burst_ram = $this->dataRecord['ram_burst']*256;
+		$sql = "UPDATE openvz_template SET shmpages = '$guar_ram:$guar_ram',vmguarpages = '$guar_ram:$guar_ram', oomguarpages = '$guar_ram:$guar_ram',privvmpages = '$burst_ram:$burst_ram' WHERE template_id = $this->id";
+		$app->db->query($sql);
+	}
+	
+	function onAfterUpdate() {
+		global $app,$conf;
+		
+		$guar_ram = $this->dataRecord['ram']*256;
+		$burst_ram = $this->dataRecord['ram_burst']*256;
+		$sql = "UPDATE openvz_template SET shmpages = '$guar_ram:$guar_ram',vmguarpages = '$guar_ram:$guar_ram', oomguarpages = '$guar_ram:$guar_ram',privvmpages = '$burst_ram:$burst_ram' WHERE template_id = $this->id";
+		$app->db->query($sql);
+	}
+	
+}
+
+$page = new page_action;
+$page->onLoad();
+
+?>
\ No newline at end of file
diff --git a/interface/web/vm/openvz_template_list.php b/interface/web/vm/openvz_template_list.php
new file mode 100644
index 0000000000000000000000000000000000000000..0f47764316969bf504416d83b0070040cf962bf8
--- /dev/null
+++ b/interface/web/vm/openvz_template_list.php
@@ -0,0 +1,54 @@
+<?php
+
+/*
+Copyright (c) 2005 - 2010, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    * Neither the name of ISPConfig nor the names of its contributors
+      may be used to endorse or promote products derived from this software without
+      specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/openvz_template.list.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+//* Check permissions for module
+$app->auth->check_module_permissions('vm');
+
+$app->uses('listform_actions');
+
+// $app->listform_actions->SQLOrderBy = 'ORDER BY company_name, contact_name, client_id';
+// $app->listform_actions->SQLExtWhere = "limit_client = 0";
+$app->listform_actions->onLoad();
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/vm/openvz_vm_del.php b/interface/web/vm/openvz_vm_del.php
new file mode 100644
index 0000000000000000000000000000000000000000..c8d8e196af6032dd1150643fba8a07d5e2c36a55
--- /dev/null
+++ b/interface/web/vm/openvz_vm_del.php
@@ -0,0 +1,58 @@
+<?php
+
+/*
+Copyright (c) 2005 - 2010, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    * Neither the name of ISPConfig nor the names of its contributors
+      may be used to endorse or promote products derived from this software without
+      specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/openvz_vm.list.php";
+$tform_def_file = "form/openvz_vm.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+//* Check permissions for module
+$app->auth->check_module_permissions('vm');
+
+$app->uses('tpl,tform');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+	
+}
+
+$page = new page_action;
+$page->onDelete()
+
+?>
diff --git a/interface/web/vm/openvz_vm_edit.php b/interface/web/vm/openvz_vm_edit.php
new file mode 100644
index 0000000000000000000000000000000000000000..451bc01eec9728ed5a6803066f08bb90547800dc
--- /dev/null
+++ b/interface/web/vm/openvz_vm_edit.php
@@ -0,0 +1,328 @@
+<?php
+/*
+Copyright (c) 2005 - 2010, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    * Neither the name of ISPConfig nor the names of its contributors
+      may be used to endorse or promote products derived from this software without
+      specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$tform_def_file = "form/openvz_vm.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+//* Check permissions for module
+$app->auth->check_module_permissions('vm');
+
+// Loading classes
+$app->uses('tpl,tform');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+	function onShowEnd() {
+		global $app, $conf;
+
+		//* Client: If the logged in user is not admin and has no sub clients (no rseller)
+		if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+
+			//* Reseller: If the logged in user is not admin and has sub clients (is a rseller)
+		} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+			
+			// Get the limits of the client
+			$client_group_id = $_SESSION["s"]["user"]["default_group"];
+			$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+			
+			
+			// Fill the client select field
+			$sql = "SELECT groupid, name FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY name";
+			$records = $app->db->queryAllRecords($sql);
+			$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']);
+			$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contact_name'].'</option>';
+			$tmp_data_record = $app->tform->getDataRecord($this->id);
+			if(is_array($records)) {
+				foreach( $records as $rec) {
+					$selected = @($rec["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':'';
+					$client_select .= "<option value='$rec[groupid]' $selected>$rec[name]</option>\r\n";
+				}
+			}
+			$app->tpl->setVar("client_group_id",$client_select);
+
+			//* Admin: If the logged in user is admin
+		} else {
+
+			// Fill the client select field
+			$sql = "SELECT groupid, name FROM sys_group WHERE client_id > 0 ORDER BY name";
+			$clients = $app->db->queryAllRecords($sql);
+			$client_select = "<option value='0'></option>";
+			$tmp_data_record = $app->tform->getDataRecord($this->id);
+			if(is_array($clients)) {
+				foreach( $clients as $client) {
+					$selected = @($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':'';
+					$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
+				}
+			}
+			$app->tpl->setVar("client_group_id",$client_select);
+
+		}
+		
+		if($this->id > 0) {
+			//* we are editing a existing record
+			$app->tpl->setVar("edit_disabled", 1);
+			$app->tpl->setVar("server_id_value", $this->dataRecord["server_id"]);
+			$app->tpl->setVar("ostemplate_id_value", $this->dataRecord["ostemplate_id"]);
+		} else {
+			$app->tpl->setVar("edit_disabled", 0);
+		}
+
+		parent::onShowEnd();
+	}
+
+	function onSubmit() {
+		global $app, $conf;
+
+		// Clients may not set the client_group_id, so we unset them if user is not a admin and the client is not a reseller
+		if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) unset($this->dataRecord["client_group_id"]);
+
+		parent::onSubmit();
+	}
+
+	function onAfterInsert() {
+		global $app, $conf;
+
+		// make sure that the record belongs to the clinet group and not the admin group when admin inserts it
+		// also make sure that the user can not delete domain created by a admin
+		if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
+			$client_group_id = intval($this->dataRecord["client_group_id"]);
+			$app->db->query("UPDATE openvz_vm SET sys_groupid = $client_group_id WHERE vm_id = ".$this->id);
+		}
+		if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) {
+			$client_group_id = intval($this->dataRecord["client_group_id"]);
+			$app->db->query("UPDATE openvz_vm SET sys_groupid = $client_group_id WHERE vm_id = ".$this->id);
+		}
+		
+		// Set the VEID
+		$tmp = $app->db->queryOneRecord('SELECT MAX(veid) + 1 as newveid FROM openvz_vm');
+		$veid = ($tmp['newveid'] > 100)?$tmp['newveid']:101;
+		$app->db->query("UPDATE openvz_vm SET veid = ".$veid." WHERE vm_id = ".$this->id);
+		unset($tmp);
+		
+		// Apply template values to the advanced tab settings
+		$this->applyTemplate();
+		
+		// Set the IP address
+		$app->db->query("UPDATE openvz_ip SET vm_id = ".$this->id." WHERE ip_address = '".$this->dataRecord['ip_address']."'");
+		
+		// Create the OpenVZ config file and store it in config field
+		$this->makeOpenVZConfig();
+		
+		// Create the DNS record
+		$this->createDNS();
+		
+	}
+
+	function onAfterUpdate() {
+		global $app, $conf;
+
+		// make sure that the record belongs to the clinet group and not the admin group when a admin inserts it
+		// also make sure that the user can not delete domain created by a admin
+		if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
+			$client_group_id = intval($this->dataRecord["client_group_id"]);
+			$app->db->query("UPDATE openvz_vm SET sys_groupid = $client_group_id WHERE vm_id = ".$this->id);
+		}
+		if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) {
+			$client_group_id = intval($this->dataRecord["client_group_id"]);
+			$app->db->query("UPDATE openvz_vm SET sys_groupid = $client_group_id WHERE vm_id = ".$this->id);
+		}
+		
+		if(isset($this->dataRecord["ostemplate_id"]) && $this->oldDataRecord["ostemplate_id"] != $this->dataRecord["ostemplate_id"]) {
+			$this->applyTemplate();
+		}
+		
+		// Set the IP address
+		if(isset($this->dataRecord['ip_address'])) $app->db->query("UPDATE openvz_ip SET vm_id = ".$this->id." WHERE ip_address = '".$this->dataRecord['ip_address']."'");
+		
+		// Create the OpenVZ config file and store it in config field
+		$this->makeOpenVZConfig();
+		
+		// Create the DNS record
+		if((isset($this->dataRecord['hostname']) && $this->dataRecord['hostname'] != $this->oldDataRecord['hostname']) 
+		or (isset($this->dataRecord['create_dns']) && $this->dataRecord['create_dns'] != $this->oldDataRecord['create_dns'])) {
+			$this->createDNS();
+		}
+		
+	}
+	
+	function onAfterDelete() {
+		global $app, $conf;
+		
+		//* Release all IP addresses which are assigned to this VM
+		$app->db->query("UPDATE openvz_ip SET vm_id = 0 WHERE vm_id = '".$this->id."'");
+		
+	}
+	
+	function applyTemplate() {
+		global $app, $conf;
+		
+		$tpl = $app->db->queryOneRecord("SELECT * FROM openvz_template WHERE template_id = ".$this->dataRecord["template_id"]);
+		
+		$sql = "UPDATE openvz_vm SET ";
+		$sql .= "diskspace = '".$tpl['diskspace']."', ";
+		$sql .= "ram = '".$tpl['ram']."', ";
+		$sql .= "ram_burst = '".$tpl['ram_burst']."', ";
+		$sql .= "cpu_units = '".$tpl['cpu_units']."', ";
+		$sql .= "cpu_num = '".$tpl['cpu_num']."', ";
+		$sql .= "cpu_limit = '".$tpl['cpu_limit']."', ";
+		$sql .= "io_priority = '".$tpl['io_priority']."', ";
+		$sql .= "nameserver = '".$tpl['nameserver']."', ";
+		$sql .= "create_dns = '".$tpl['create_dns']."', ";
+		$sql .= "capability = '".$tpl['capability']."' ";
+		$sql .= "WHERE vm_id = ".$this->id;
+		$app->db->query($sql);
+		
+	}
+	
+	function makeOpenVZConfig() {
+		global $app, $conf;
+		
+		$vm = $app->tform->getDataRecord($this->id);
+		$vm_template = $app->db->queryOneRecord("SELECT * FROM openvz_template WHERE template_id = ".$vm['template_id']);
+		$burst_ram = $vm['ram_burst']*256;
+		$guar_ram = $vm['ram']*256;
+		
+		$tpl = new tpl();
+		$tpl->newTemplate('templates/openvz.conf.tpl');
+		
+		$onboot = ($vm['start_boot'] == 'y')?'yes':'no';
+		$tpl->setVar('onboot',$onboot);
+		
+		$tpl->setVar('kmemsize',$vm_template['kmemsize']);
+		$tpl->setVar('lockedpages',$vm_template['lockedpages']);
+		$tpl->setVar('privvmpages',$burst_ram.':'.$burst_ram);
+		$tpl->setVar('shmpages',$guar_ram.':'.$guar_ram);
+		$tpl->setVar('numproc',$vm_template['numproc']);
+		$tpl->setVar('physpages',$vm_template['physpages']);
+		$tpl->setVar('vmguarpages',$guar_ram.':'.$guar_ram);
+		$tpl->setVar('oomguarpages',$guar_ram.':'.$guar_ram);
+		$tpl->setVar('numtcpsock',$vm_template['numtcpsock']);
+		$tpl->setVar('numflock',$vm_template['numflock']);
+		$tpl->setVar('numpty',$vm_template['numpty']);
+		$tpl->setVar('numsiginfo',$vm_template['numsiginfo']);
+		$tpl->setVar('tcpsndbuf',$vm_template['tcpsndbuf']);
+		$tpl->setVar('tcprcvbuf',$vm_template['tcprcvbuf']);
+		$tpl->setVar('othersockbuf',$vm_template['othersockbuf']);
+		$tpl->setVar('dgramrcvbuf',$vm_template['dgramrcvbuf']);
+		$tpl->setVar('numothersock',$vm_template['numothersock']);
+		$tpl->setVar('dcachesize',$vm_template['dcachesize']);
+		$tpl->setVar('numfile',$vm_template['numfile']);
+		$tpl->setVar('avnumproc',$vm_template['avnumproc']);
+		$tpl->setVar('numiptent',$vm_template['numiptent']);
+		
+		$diskspace = $vm['diskspace']*1048576;
+		$diskinodes = $vm['diskspace']*524288;
+		
+		$tpl->setVar('diskspace',$diskspace.":".$diskspace);
+		$tpl->setVar('diskinodes',$diskinodes.":".$diskinodes);
+		$tpl->setVar('io_priority',$vm['io_priority']);
+		
+		$tpl->setVar('cpu_num',$vm['cpu_num']);
+		$tpl->setVar('cpu_units',$vm['cpu_units']);
+		$tpl->setVar('cpu_limit',$vm['cpu_limit']);
+		
+		$hostname = str_replace('{VEID}',$vm['veid'],$vm['hostname']);
+		
+		$tpl->setVar('hostname',$hostname);
+		$tpl->setVar('ip_address',$vm['ip_address']);
+		$tpl->setVar('nameserver',$vm['nameserver']);
+		$tpl->setVar('capability',$vm['capability']);
+		
+		$tmp = $app->db->queryOneRecord("SELECT template_file FROM openvz_ostemplate WHERE ostemplate_id = ".$vm['ostemplate_id']);
+		$tpl->setVar('ostemplate',$tmp['template_file']);
+		unset($tmp);
+		
+		$openvz_config = $app->db->quote($tpl->grab());
+		$app->db->query("UPDATE openvz_vm SET config = '".$openvz_config."' WHERE vm_id = ".$this->id);
+		
+		unset($tpl);
+		
+	}
+	
+	function createDNS() {
+		global $app, $conf;
+		
+		$vm = $app->tform->getDataRecord($this->id);
+		
+		if($vm['create_dns'] != 'y') return;
+		
+		$full_hostname = str_replace('{VEID}',$vm['veid'],$vm['hostname']);
+		$hostname_parts = explode('.',$full_hostname);
+		$hostname = $hostname_parts[0];
+		unset($hostname_parts[0]);
+		$zone = implode('.',$hostname_parts);
+		unset($hostname_parts);
+		
+		// Find the dns zone
+		$zone_rec = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE origin = '$zone.'");
+		$rr_rec = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = '".$zone_rec['id']."' AND name = '$hostname'");
+		
+		if($zone_rec['id'] > 0) {
+			$ip_address = $vm['ip_address'];
+			$sys_userid = $zone_rec['sys_userid'];
+			$sys_groupid = $zone_rec['sys_groupid'];
+			$server_id = $zone_rec['server_id'];
+			$dns_soa_id = $zone_rec['id'];
+			
+			if($rr_rec['id'] > 0) {
+				$app->uses('validate_dns');
+				$app->db->datalogUpdate('dns_rr', "data = '$ip_address'", 'id', $rr_rec['id']);
+				$serial = $app->validate_dns->increase_serial($zone_rec['serial']);
+				$app->db->datalogUpdate('dns_soa', "serial = '$serial'", 'id', $zone_rec['id']);
+			} else {
+				$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `zone`, `name`, `type`, `data`, `aux`, `ttl`, `active`) VALUES 
+				('$sys_userid', '$sys_groupid', 'riud', 'riud', '', '$server_id', '$dns_soa_id', '$hostname', 'A', '$ip_address', '0', '3600', 'Y')";
+				$dns_rr_id = $app->db->datalogInsert('dns_rr', $insert_data, 'id');
+			}
+			
+		}
+		
+		
+		
+		
+	}
+
+}
+
+$page = new page_action;
+$page->onLoad();
+
+?>
\ No newline at end of file
diff --git a/interface/web/vm/openvz_vm_list.php b/interface/web/vm/openvz_vm_list.php
new file mode 100644
index 0000000000000000000000000000000000000000..874feabbfab4791d23b5d115faa4441cba8f93d4
--- /dev/null
+++ b/interface/web/vm/openvz_vm_list.php
@@ -0,0 +1,54 @@
+<?php
+
+/*
+Copyright (c) 2005 - 2010, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    * Neither the name of ISPConfig nor the names of its contributors
+      may be used to endorse or promote products derived from this software without
+      specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/openvz_vm.list.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+//* Check permissions for module
+$app->auth->check_module_permissions('vm');
+
+$app->uses('listform_actions');
+
+// $app->listform_actions->SQLOrderBy = 'ORDER BY company_name, contact_name, client_id';
+// $app->listform_actions->SQLExtWhere = "limit_client = 0";
+$app->listform_actions->onLoad();
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/vm/templates/openvz.conf.tpl b/interface/web/vm/templates/openvz.conf.tpl
new file mode 100644
index 0000000000000000000000000000000000000000..c4c82c00cb81f2e1229b956c65c15a32998bef9e
--- /dev/null
+++ b/interface/web/vm/templates/openvz.conf.tpl
@@ -0,0 +1,48 @@
+
+# Template version
+VERSION="2"
+
+# Parameters
+ONBOOT="{tmpl_var name='onboot'}"
+KMEMSIZE="{tmpl_var name='kmemsize'}"
+LOCKEDPAGES="{tmpl_var name='lockedpages'}"
+PRIVVMPAGES="{tmpl_var name='privvmpages'}"
+SHMPAGES="{tmpl_var name='shmpages'}"
+NUMPROC="{tmpl_var name='numproc'}"
+PHYSPAGES="{tmpl_var name='physpages'}"
+VMGUARPAGES="{tmpl_var name='vmguarpages'}"
+OOMGUARPAGES="{tmpl_var name='oomguarpages'}"
+NUMTCPSOCK="{tmpl_var name='numtcpsock'}"
+NUMFLOCK="{tmpl_var name='numflock'}"
+NUMPTY="{tmpl_var name='numpty'}"
+NUMSIGINFO="{tmpl_var name='numsiginfo'}"
+TCPSNDBUF="{tmpl_var name='tcpsndbuf'}"
+TCPRCVBUF="{tmpl_var name='tcprcvbuf'}"
+OTHERSOCKBUF="{tmpl_var name='othersockbuf'}"
+DGRAMRCVBUF="{tmpl_var name='dgramrcvbuf'}"
+NUMOTHERSOCK="{tmpl_var name='numothersock'}"
+DCACHESIZE="{tmpl_var name='dcachesize'}"
+NUMFILE="{tmpl_var name='numfile'}"
+AVNUMPROC="{tmpl_var name='avnumproc'}"
+NUMIPTENT="{tmpl_var name='numiptent'}"
+
+DISKSPACE="{tmpl_var name='diskspace'}"
+DISKINODES="{tmpl_var name='diskinodes'}"
+QUOTAUGIDLIMIT="10000"
+IOPRIO="{tmpl_var name='io_priority'}"
+QUOTATIME="0"
+
+CPUS="{tmpl_var name='cpu_num'}"
+CPUUNITS="{tmpl_var name='cpu_units'}"
+CPULIMIT="{tmpl_var name='cpu_limit'}"
+
+VE_ROOT="/vz/root/$VEID"
+VE_PRIVATE="/vz/private/$VEID"
+OSTEMPLATE="{tmpl_var name='ostemplate'}"
+ORIGIN_SAMPLE="vps.basic"
+HOSTNAME="{tmpl_var name='hostname'}"
+IP_ADDRESS="{tmpl_var name='ip_address'}"
+NAMESERVER="{tmpl_var name='nameserver'}"
+MEMINFO="pages:256000"
+
+CAPABILITY="{tmpl_var name='capability'}"
diff --git a/interface/web/vm/templates/openvz_ip_edit.htm b/interface/web/vm/templates/openvz_ip_edit.htm
new file mode 100644
index 0000000000000000000000000000000000000000..97ce3893bfc823b544e8aedc60970169991d3974
--- /dev/null
+++ b/interface/web/vm/templates/openvz_ip_edit.htm
@@ -0,0 +1,40 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+<p><tmpl_var name="list_desc_txt"></p>
+
+<div class="panel panel_openvz_ip">
+
+  <div class="pnl_formsarea">
+    <fieldset class="inlineLabels"><legend>IP address</legend>
+      <div class="ctrlHolder">
+      	<label for="server_id">{tmpl_var name='server_id_txt'}</label>
+        <select name="server_id" id="server_id" class="selectInput">
+					{tmpl_var name='server_id'}
+				</select>
+      </div>
+      <div class="ctrlHolder">
+      	<label for="ip_address">{tmpl_var name='ip_address_txt'}</label>
+        <input name="ip_address" id="ip_address" value="{tmpl_var name='ip_address'}" size="15" maxlength="15" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="vm_id">{tmpl_var name='vm_id_txt'}</label>
+        <select name="vm_id" id="vm_id" class="selectInput">
+					{tmpl_var name='vm_id'}
+				</select>
+      </div>
+      <div class="ctrlHolder">
+				<p class="label">{tmpl_var name='reserved_txt'}</p>
+					<div class="multiField">
+						{tmpl_var name='reserved'}
+					</div>
+			</div>
+    </fieldset>
+
+    <input type="hidden" name="id" value="{tmpl_var name='id'}">
+
+    <div class="buttonHolder buttons">
+      <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','vm/openvz_ip_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
+      <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('vm/openvz_ip_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
+    </div>
+  </div>
+  
+</div>
diff --git a/interface/web/vm/templates/openvz_ip_list.htm b/interface/web/vm/templates/openvz_ip_list.htm
new file mode 100644
index 0000000000000000000000000000000000000000..5c7c567a0ef6421775f342adad182cc237c17853
--- /dev/null
+++ b/interface/web/vm/templates/openvz_ip_list.htm
@@ -0,0 +1,58 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+
+<div class="panel panel_list_openvz_ip">
+
+  <div class="pnl_toolsarea">
+    <fieldset><legend>{tmpl_var name="toolsarea_head_txt"}</legend>
+      <div class="buttons">
+        <button class="iconstxt icoAdd" type="button" onClick="loadContent('vm/openvz_ip_edit.php');">
+          <span>{tmpl_var name="add_new_record_txt"}</span>
+        </button>
+      </div>
+    </fieldset>
+  </div>
+
+  <div class="pnl_listarea">
+    <fieldset><legend><tmpl_var name="list_head_txt"></legend>
+      <table class="list">
+        <thead>
+          <tr>
+            <th class="tbl_col_server_id" scope="col"><tmpl_var name="server_id_txt"></th>
+            <th class="tbl_col_vm_id" scope="col"><tmpl_var name="vm_id_txt"></th>
+            <th class="tbl_col_ip_address" scope="col"><tmpl_var name="ip_address_txt"></th>
+            <th class="tbl_col_reserved" scope="col"><tmpl_var name="reserved_txt"></th>
+            <th class="tbl_col_buttons" scope="col">&nbsp;</th>
+          </tr>
+          <tr>
+            <td class="tbl_col_server_id"><select name="search_server_id" onChange="submitForm('pageForm','vm/openvz_ip_list.php');">{tmpl_var name='search_server_id'}</select></td>
+            <td class="tbl_col_vm_id"><select name="search_vm_id" onChange="submitForm('pageForm','vm/openvz_ip_list.php');">{tmpl_var name='search_vm_id'}</select></td>
+            <td class="tbl_col_ip_address"><input type="text" name="search_ip_address" value="{tmpl_var name='search_ip_address'}" /></td>
+            <td class="tbl_col_reserved"><select name="search_reserved" onChange="submitForm('pageForm','vm/openvz_ip_list.php');">{tmpl_var name='search_reserved'}</select></td>
+            <td class="tbl_col_buttons"><div class="buttons"><button type="button" class="icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onClick="submitForm('pageForm','vm/openvz_ip_list.php');"><span>{tmpl_var name="filter_txt"}</span></button></div></td>
+          </tr>
+        </thead>
+        <tbody>
+          <tmpl_loop name="records">
+          <tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
+            <td class="tbl_col_server_id"><a href="#" onClick="loadContent('vm/openvz_ip_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="server_id"}</a></td>
+            <td class="tbl_col_vm_id"><a href="#" onClick="loadContent('vm/openvz_ip_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="vm_id"}</a></td>
+            <td class="tbl_col_ip_address"><a href="#" onClick="loadContent('vm/openvz_ip_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="ip_address"}</a></td>
+            <td class="tbl_col_reserved"><a href="#" onClick="loadContent('vm/openvz_ip_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="reserved"}</a></td>
+            <td class="tbl_col_buttons">
+              <div class="buttons icons16">    
+                <a class="icons16 icoDelete" href="javascript: del_record('vm/openvz_ip_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span>{tmpl_var name='delete_txt'}</span></a>
+              </div>
+            </td>
+          </tr>
+          </tmpl_loop>
+        </tbody>
+        <tfoot>
+          <tr>
+            <td class="tbl_footer tbl_paging" colspan="5"><tmpl_var name="paging"></td>
+          </tr>
+        </tfoot>
+      </table>
+    </fieldset>
+  </div>
+
+</div>
diff --git a/interface/web/vm/templates/openvz_ostemplate_edit.htm b/interface/web/vm/templates/openvz_ostemplate_edit.htm
new file mode 100644
index 0000000000000000000000000000000000000000..a0e070c51099a23dc7eae10678ec0cb579d32ce0
--- /dev/null
+++ b/interface/web/vm/templates/openvz_ostemplate_edit.htm
@@ -0,0 +1,48 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+<p><tmpl_var name="list_desc_txt"></p>
+
+<div class="panel panel_openvz_ostemplate">
+
+  <div class="pnl_formsarea">
+    <fieldset class="inlineLabels"><legend>Domain</legend>
+      <div class="ctrlHolder">
+      	<label for="template_name">{tmpl_var name='template_name_txt'}</label>
+        <input name="template_name" id="template_name" value="{tmpl_var name='template_name'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+	  <div class="ctrlHolder">
+      	<label for="template_file">{tmpl_var name='template_file_txt'}</label>
+        <input name="template_file" id="template_file" value="{tmpl_var name='template_file'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="server_id">{tmpl_var name='server_id_txt'}</label>
+        <select name="server_id" id="server_id" class="selectInput">
+					{tmpl_var name='server_id'}
+				</select>
+      </div>
+      <div class="ctrlHolder">
+				<p class="label">{tmpl_var name='allservers_txt'}</p>
+					<div class="multiField">
+						{tmpl_var name='allservers'}
+					</div>
+			</div>
+      <div class="ctrlHolder">
+				<p class="label">{tmpl_var name='active_txt'}</p>
+					<div class="multiField">
+						{tmpl_var name='active'}
+					</div>
+			</div>
+      <div class="ctrlHolder">
+      	<label for="description">{tmpl_var name='description_txt'}</label>
+        <textarea name="description" id="description" rows='10' cols='30'>{tmpl_var name='description'}</textarea>
+      </div>
+    </fieldset>
+
+    <input type="hidden" name="id" value="{tmpl_var name='id'}">
+
+    <div class="buttonHolder buttons">
+      <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','vm/openvz_ostemplate_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
+      <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('vm/openvz_ostemplate_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
+    </div>
+  </div>
+  
+</div>
diff --git a/interface/web/vm/templates/openvz_ostemplate_list.htm b/interface/web/vm/templates/openvz_ostemplate_list.htm
new file mode 100644
index 0000000000000000000000000000000000000000..10b83d50862e44714409dc0b1b49aeac9e0d614c
--- /dev/null
+++ b/interface/web/vm/templates/openvz_ostemplate_list.htm
@@ -0,0 +1,58 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+
+<div class="panel panel_list_openvz_ostemplate">
+
+  <div class="pnl_toolsarea">
+    <fieldset><legend>{tmpl_var name="toolsarea_head_txt"}</legend>
+      <div class="buttons">
+        <button class="iconstxt icoAdd" type="button" onClick="loadContent('vm/openvz_ostemplate_edit.php');">
+          <span>{tmpl_var name="add_new_record_txt"}</span>
+        </button>
+      </div>
+    </fieldset>
+  </div>
+
+  <div class="pnl_listarea">
+    <fieldset><legend><tmpl_var name="list_head_txt"></legend>
+      <table class="list">
+        <thead>
+          <tr>
+            <th class="tbl_col_active" scope="col"><tmpl_var name="active_txt"></th>
+            <th class="tbl_col_template_name" scope="col"><tmpl_var name="template_name_txt"></th>
+            <th class="tbl_col_server_id" scope="col"><tmpl_var name="server_id_txt"></th>
+            <th class="tbl_col_allservers" scope="col"><tmpl_var name="allservers_txt"></th>
+            <th class="tbl_col_buttons" scope="col">&nbsp;</th>
+          </tr>
+          <tr>
+            <td class="tbl_col_active"><select name="search_active" onChange="submitForm('pageForm','vm/openvz_ostemplate_list.php');">{tmpl_var name='search_active'}</select></td>
+            <td class="tbl_col_template_name"><input type="text" name="search_template_name" value="{tmpl_var name='search_template_name'}" /></td>
+            <td class="tbl_col_server_id"><select name="search_server_id" onChange="submitForm('pageForm','vm/openvz_ostemplate_list.php');">{tmpl_var name='search_server_id'}</select></td>
+            <td class="tbl_col_allservers"><select name="search_allservers" onChange="submitForm('pageForm','vm/openvz_ostemplate_list.php');">{tmpl_var name='search_allservers'}</select></td>
+            <td class="tbl_col_buttons"><div class="buttons"><button type="button" class="icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onClick="submitForm('pageForm','vm/openvz_ostemplate_list.php');"><span>{tmpl_var name="filter_txt"}</span></button></div></td>
+          </tr>
+        </thead>
+        <tbody>
+          <tmpl_loop name="records">
+          <tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
+            <td class="tbl_col_active"><a href="#" onClick="loadContent('vm/openvz_ostemplate_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="active"}</a></td>
+            <td class="tbl_col_template_name"><a href="#" onClick="loadContent('vm/openvz_ostemplate_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="template_name"}</a></td>
+            <td class="tbl_col_server_id"><a href="#" onClick="loadContent('vm/openvz_ostemplate_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="server_id"}</a></td>
+            <td class="tbl_col_allservers"><a href="#" onClick="loadContent('vm/openvz_ostemplate_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="allservers"}</a></td>
+            <td class="tbl_col_buttons">
+              <div class="buttons icons16">    
+                <a class="icons16 icoDelete" href="javascript: del_record('vm/openvz_ostemplate_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span>{tmpl_var name='delete_txt'}</span></a>
+              </div>
+            </td>
+          </tr>
+          </tmpl_loop>
+        </tbody>
+        <tfoot>
+          <tr>
+            <td class="tbl_footer tbl_paging" colspan="5"><tmpl_var name="paging"></td>
+          </tr>
+        </tfoot>
+      </table>
+    </fieldset>
+  </div>
+
+</div>
diff --git a/interface/web/vm/templates/openvz_template_advanced_edit.htm b/interface/web/vm/templates/openvz_template_advanced_edit.htm
new file mode 100644
index 0000000000000000000000000000000000000000..1f7e19d00e11338b93b794b34cbd9710bf1668bf
--- /dev/null
+++ b/interface/web/vm/templates/openvz_template_advanced_edit.htm
@@ -0,0 +1,110 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+<p><tmpl_var name="list_desc_txt"></p>
+
+<div class="panel panel_openvz_template">
+
+  <div class="pnl_formsarea">
+    <fieldset class="inlineLabels"><legend>Advanced</legend>
+      <div class="ctrlHolder">
+      	<label for="numproc">{tmpl_var name='numproc_txt'}</label>
+        <input name="numproc" id="numproc" value="{tmpl_var name='numproc'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="numtcpsock">{tmpl_var name='numtcpsock_txt'}</label>
+        <input name="numtcpsock" id="numtcpsock" value="{tmpl_var name='numtcpsock'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="numothersock">{tmpl_var name='numothersock_txt'}</label>
+        <input name="numothersock" id="numothersock" value="{tmpl_var name='numothersock'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="vmguarpages">{tmpl_var name='vmguarpages_txt'}</label>
+        <input name="vmguarpages" id="vmguarpages" value="{tmpl_var name='vmguarpages'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="kmemsize">{tmpl_var name='kmemsize_txt'}</label>
+        <input name="kmemsize" id="kmemsize" value="{tmpl_var name='kmemsize'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="tcpsndbuf">{tmpl_var name='tcpsndbuf_txt'}</label>
+        <input name="tcpsndbuf" id="tcpsndbuf" value="{tmpl_var name='tcpsndbuf'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="tcprcvbuf">{tmpl_var name='tcprcvbuf_txt'}</label>
+        <input name="tcprcvbuf" id="tcprcvbuf" value="{tmpl_var name='tcprcvbuf'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="othersockbuf">{tmpl_var name='othersockbuf_txt'}</label>
+        <input name="othersockbuf" id="othersockbuf" value="{tmpl_var name='othersockbuf'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="dgramrcvbuf">{tmpl_var name='dgramrcvbuf_txt'}</label>
+        <input name="dgramrcvbuf" id="dgramrcvbuf" value="{tmpl_var name='dgramrcvbuf'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="oomguarpages">{tmpl_var name='oomguarpages_txt'}</label>
+        <input name="oomguarpages" id="oomguarpages" value="{tmpl_var name='oomguarpages'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="privvmpages">{tmpl_var name='privvmpages_txt'}</label>
+        <input name="privvmpages" id="privvmpages" value="{tmpl_var name='privvmpages'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="lockedpages">{tmpl_var name='lockedpages_txt'}</label>
+        <input name="lockedpages" id="lockedpages" value="{tmpl_var name='lockedpages'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="shmpages">{tmpl_var name='shmpages_txt'}</label>
+        <input name="shmpages" id="shmpages" value="{tmpl_var name='shmpages'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="physpages">{tmpl_var name='physpages_txt'}</label>
+        <input name="physpages" id="physpages" value="{tmpl_var name='physpages'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="numfile">{tmpl_var name='numfile_txt'}</label>
+        <input name="numfile" id="numfile" value="{tmpl_var name='numfile'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+	  <div class="ctrlHolder">
+      	<label for="avnumproc">{tmpl_var name='avnumproc_txt'}</label>
+        <input name="avnumproc" id="avnumproc" value="{tmpl_var name='avnumproc'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="numflock">{tmpl_var name='numflock_txt'}</label>
+        <input name="numflock" id="numflock" value="{tmpl_var name='numflock'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="numpty">{tmpl_var name='numpty_txt'}</label>
+        <input name="numpty" id="numpty" value="{tmpl_var name='numpty'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="numsiginfo">{tmpl_var name='numsiginfo_txt'}</label>
+        <input name="numsiginfo" id="numsiginfo" value="{tmpl_var name='numsiginfo'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="dcachesize">{tmpl_var name='dcachesize_txt'}</label>
+        <input name="dcachesize" id="dcachesize" value="{tmpl_var name='dcachesize'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="numiptent">{tmpl_var name='numiptent_txt'}</label>
+        <input name="numiptent" id="numiptent" value="{tmpl_var name='numiptent'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="swappages">{tmpl_var name='swappages_txt'}</label>
+        <input name="swappages" id="swappages" value="{tmpl_var name='swappages'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+	  <div class="ctrlHolder">
+      	<label for="capability">{tmpl_var name='capability_txt'}</label>
+        <input name="capability" id="capability" value="{tmpl_var name='capability'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+    </fieldset>
+
+    <input type="hidden" name="id" value="{tmpl_var name='id'}">
+
+    <div class="buttonHolder buttons">
+      <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','vm/openvz_template_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
+      <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('vm/openvz_template_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
+    </div>
+  </div>
+  
+</div>
diff --git a/interface/web/vm/templates/openvz_template_edit.htm b/interface/web/vm/templates/openvz_template_edit.htm
new file mode 100644
index 0000000000000000000000000000000000000000..09d49e458d8e1243270339cfbb0a8a34ccd8a7de
--- /dev/null
+++ b/interface/web/vm/templates/openvz_template_edit.htm
@@ -0,0 +1,74 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+<p><tmpl_var name="list_desc_txt"></p>
+
+<div class="panel panel_openvz_template">
+
+  <div class="pnl_formsarea">
+    <fieldset class="inlineLabels"><legend>Template</legend>
+      <div class="ctrlHolder">
+      	<label for="template_name">{tmpl_var name='template_name_txt'}</label>
+        <input name="template_name" id="template_name" value="{tmpl_var name='template_name'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="diskspace">{tmpl_var name='diskspace_txt'}</label>
+        <input name="diskspace" id="diskspace" value="{tmpl_var name='diskspace'}" size="30" maxlength="255" type="text" class="textInput formLengthLimit" /> &nbsp;GB
+			</div>
+      <div class="ctrlHolder">
+      	<label for="ram">{tmpl_var name='ram_txt'}</label>
+        <input name="ram" id="ram" value="{tmpl_var name='ram'}" size="30" maxlength="255" type="text" class="textInput formLengthLimit" /> &nbsp;MB
+			</div>
+      <div class="ctrlHolder">
+      	<label for="ram_burst">{tmpl_var name='ram_burst_txt'}</label>
+        <input name="ram_burst" id="ram_burst" value="{tmpl_var name='ram_burst'}" size="30" maxlength="255" type="text" class="textInput formLengthLimit" /> &nbsp;MB
+			</div>
+      <div class="ctrlHolder">
+      	<label for="cpu_units">{tmpl_var name='cpu_units_txt'}</label>
+        <input name="cpu_units" id="cpu_units" value="{tmpl_var name='cpu_units'}" size="30" maxlength="255" type="text" class="textInput formLengthLimit" />&nbsp;(8 - 500000)
+			</div>
+      <div class="ctrlHolder">
+      	<label for="cpu_num">{tmpl_var name='cpu_num_txt'}</label>
+        <input name="cpu_num" id="cpu_num" value="{tmpl_var name='cpu_num'}" size="30" maxlength="255" type="text" class="textInput formLengthLimit" />&nbsp;(1 - 64)
+			</div>
+      <div class="ctrlHolder">
+      	<label for="cpu_limit">{tmpl_var name='cpu_limit_txt'}</label>
+        <input name="cpu_limit" id="cpu_limit" value="{tmpl_var name='cpu_limit'}" size="30" maxlength="255" type="text" class="textInput formLengthLimit" />&nbsp;(10 - 6400)
+			</div>
+      <div class="ctrlHolder">
+      	<label for="io_priority">{tmpl_var name='io_priority_txt'}</label>
+        <input name="io_priority" id="io_priority" value="{tmpl_var name='io_priority'}" size="30" maxlength="255" type="text" class="textInput formLengthLimit" />&nbsp;(0 - 7)
+			</div>
+	  <div class="ctrlHolder">
+      	<label for="hostname">{tmpl_var name='hostname_txt'}</label>
+        <input name="hostname" id="hostname" value="{tmpl_var name='hostname'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+	  <div class="ctrlHolder">
+				<p class="label">{tmpl_var name='create_dns_txt'}</p>
+					<div class="multiField">
+						{tmpl_var name='create_dns'}
+					</div>
+			</div>
+      <div class="ctrlHolder">
+      	<label for="nameserver">{tmpl_var name='nameserver_txt'}</label>
+        <input name="nameserver" id="nameserver" value="{tmpl_var name='nameserver'}" size="30" maxlength="255" type="text" class="textInput" />&nbsp;{tmpl_var name='nameserver_desc_txt'}
+			</div>
+      <div class="ctrlHolder">
+				<p class="label">{tmpl_var name='active_txt'}</p>
+					<div class="multiField">
+						{tmpl_var name='active'}
+					</div>
+			</div>
+      <div class="ctrlHolder">
+      	<label for="description">{tmpl_var name='description_txt'}</label>
+        <textarea name="description" id="description" rows='10' cols='30'>{tmpl_var name='description'}</textarea>
+      </div>
+    </fieldset>
+
+    <input type="hidden" name="id" value="{tmpl_var name='id'}">
+
+    <div class="buttonHolder buttons">
+      <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','vm/openvz_template_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
+      <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('vm/openvz_template_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
+    </div>
+  </div>
+  
+</div>
diff --git a/interface/web/vm/templates/openvz_template_list.htm b/interface/web/vm/templates/openvz_template_list.htm
new file mode 100644
index 0000000000000000000000000000000000000000..b6ffe2bb1299a6f543175da8951e79861e3ee958
--- /dev/null
+++ b/interface/web/vm/templates/openvz_template_list.htm
@@ -0,0 +1,52 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+
+<div class="panel panel_list_openvz_template">
+
+  <div class="pnl_toolsarea">
+    <fieldset><legend>{tmpl_var name="toolsarea_head_txt"}</legend>
+      <div class="buttons">
+        <button class="iconstxt icoAdd" type="button" onClick="loadContent('vm/openvz_template_edit.php');">
+          <span>{tmpl_var name="add_new_record_txt"}</span>
+        </button>
+      </div>
+    </fieldset>
+  </div>
+
+  <div class="pnl_listarea">
+    <fieldset><legend><tmpl_var name="list_head_txt"></legend>
+      <table class="list">
+        <thead>
+          <tr>
+            <th class="tbl_col_active" scope="col"><tmpl_var name="active_txt"></th>
+            <th class="tbl_col_template_name" scope="col"><tmpl_var name="template_name_txt"></th>
+            <th class="tbl_col_buttons" scope="col">&nbsp;</th>
+          </tr>
+          <tr>
+            <td class="tbl_col_active"><select name="search_active" onChange="submitForm('pageForm','vm/openvz_template_list.php');">{tmpl_var name='search_active'}</select></td>
+            <td class="tbl_col_template_name"><input type="text" name="search_template_name" value="{tmpl_var name='search_template_name'}" /></td>
+            <td class="tbl_col_buttons"><div class="buttons"><button type="button" class="icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onClick="submitForm('pageForm','vm/openvz_template_list.php');"><span>{tmpl_var name="filter_txt"}</span></button></div></td>
+          </tr>
+        </thead>
+        <tbody>
+          <tmpl_loop name="records">
+          <tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
+            <td class="tbl_col_active"><a href="#" onClick="loadContent('vm/openvz_template_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="active"}</a></td>
+            <td class="tbl_col_template_name"><a href="#" onClick="loadContent('vm/openvz_template_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="template_name"}</a></td>
+            <td class="tbl_col_buttons">
+              <div class="buttons icons16">    
+                <a class="icons16 icoDelete" href="javascript: del_record('vm/openvz_template_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span>{tmpl_var name='delete_txt'}</span></a>
+              </div>
+            </td>
+          </tr>
+          </tmpl_loop>
+        </tbody>
+        <tfoot>
+          <tr>
+            <td class="tbl_footer tbl_paging" colspan="3"><tmpl_var name="paging"></td>
+          </tr>
+        </tfoot>
+      </table>
+    </fieldset>
+  </div>
+
+</div>
diff --git a/interface/web/vm/templates/openvz_vm_advanced_edit.htm b/interface/web/vm/templates/openvz_vm_advanced_edit.htm
new file mode 100644
index 0000000000000000000000000000000000000000..36981a882c3d590c5a13720731c1b69a0b2b633b
--- /dev/null
+++ b/interface/web/vm/templates/openvz_vm_advanced_edit.htm
@@ -0,0 +1,64 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+<p><tmpl_var name="list_desc_txt"></p>
+
+<div class="panel panel_openvz_vm">
+
+  <div class="pnl_formsarea">
+    <fieldset class="inlineLabels"><legend>Advanced</legend>
+      <div class="ctrlHolder">
+      	<label for="veid">{tmpl_var name='veid_txt'}</label>
+        <input name="veid" id="veid" value="{tmpl_var name='veid'}" size="30" maxlength="255" type="text" class="textInput formLengthLimit" />
+			</div>
+	  <div class="ctrlHolder">
+				<p class="label">{tmpl_var name='create_dns_txt'}</p>
+					<div class="multiField">
+						{tmpl_var name='create_dns'}
+					</div>
+			</div>
+	  <div class="ctrlHolder">
+      	<label for="diskspace">{tmpl_var name='diskspace_txt'}</label>
+        <input name="diskspace" id="diskspace" value="{tmpl_var name='diskspace'}" size="30" maxlength="255" type="text" class="textInput formLengthLimit" /> &nbsp;GB
+			</div>
+      <div class="ctrlHolder">
+      	<label for="ram">{tmpl_var name='ram_txt'}</label>
+        <input name="ram" id="ram" value="{tmpl_var name='ram'}" size="30" maxlength="255" type="text" class="textInput formLengthLimit" /> &nbsp;MB
+			</div>
+      <div class="ctrlHolder">
+      	<label for="ram_burst">{tmpl_var name='ram_burst_txt'}</label>
+        <input name="ram_burst" id="ram_burst" value="{tmpl_var name='ram_burst'}" size="30" maxlength="255" type="text" class="textInput formLengthLimit" /> &nbsp;MB
+			</div>
+      <div class="ctrlHolder">
+      	<label for="cpu_units">{tmpl_var name='cpu_units_txt'}</label>
+        <input name="cpu_units" id="cpu_units" value="{tmpl_var name='cpu_units'}" size="30" maxlength="255" type="text" class="textInput formLengthLimit" />&nbsp;(8 - 500000)
+			</div>
+      <div class="ctrlHolder">
+      	<label for="cpu_num">{tmpl_var name='cpu_num_txt'}</label>
+        <input name="cpu_num" id="cpu_num" value="{tmpl_var name='cpu_num'}" size="30" maxlength="255" type="text" class="textInput formLengthLimit" />&nbsp;(1 - 64)
+			</div>
+      <div class="ctrlHolder">
+      	<label for="cpu_limit">{tmpl_var name='cpu_limit_txt'}</label>
+        <input name="cpu_limit" id="cpu_limit" value="{tmpl_var name='cpu_limit'}" size="30" maxlength="255" type="text" class="textInput formLengthLimit" />&nbsp;(10 - 6400)
+			</div>
+      <div class="ctrlHolder">
+      	<label for="io_priority">{tmpl_var name='io_priority_txt'}</label>
+        <input name="io_priority" id="io_priority" value="{tmpl_var name='io_priority'}" size="30" maxlength="255" type="text" class="textInput formLengthLimit" />&nbsp;(0 - 7)
+			</div>
+      <div class="ctrlHolder">
+      	<label for="nameserver">{tmpl_var name='nameserver_txt'}</label>
+        <input name="nameserver" id="nameserver" value="{tmpl_var name='nameserver'}" size="30" maxlength="255" type="text" class="textInput" />&nbsp;{tmpl_var name='nameserver_desc_txt'}
+			</div>
+      <div class="ctrlHolder">
+      	<label for="capability">{tmpl_var name='capability_txt'}</label>
+        <input name="capability" id="capability" value="{tmpl_var name='capability'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+    </fieldset>
+
+    <input type="hidden" name="id" value="{tmpl_var name='id'}">
+
+    <div class="buttonHolder buttons">
+      <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','vm/openvz_vm_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
+      <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('vm/openvz_vm_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
+    </div>
+  </div>
+  
+</div>
diff --git a/interface/web/vm/templates/openvz_vm_edit.htm b/interface/web/vm/templates/openvz_vm_edit.htm
new file mode 100644
index 0000000000000000000000000000000000000000..2f8ac77a65c3184ddf78325273375d3358fdc075
--- /dev/null
+++ b/interface/web/vm/templates/openvz_vm_edit.htm
@@ -0,0 +1,104 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+<p><tmpl_var name="list_desc_txt"></p>
+
+<div class="panel panel_openvz_vm">
+
+  <div class="pnl_formsarea">
+    <fieldset class="inlineLabels"><legend>Settings</legend>
+	  <tmpl_if name="is_admin">
+      <div class="ctrlHolder">
+		<tmpl_if name="edit_disabled">
+		<label for="server_id_disabled">{tmpl_var name='server_id_txt'}</label>
+		<select name="server_id_disabled" id="server_id_disabled" class="selectInput" disabled="disabled">
+		  {tmpl_var name='server_id'}
+		</select>
+		<input type="hidden" name="server_id" value="{tmpl_var name='server_id_value'}" />
+		<tmpl_else>
+		<label for="server_id">{tmpl_var name='server_id_txt'}</label>
+        <select name="server_id" id="server_id" class="selectInput" onChange="loadOptionInto('ip_address','sites/ajax_get_ip.php?server_id='+document.getElementById('server_id').value)">
+		  {tmpl_var name='server_id'}
+		</select>
+		</tmpl_if>
+      </div>
+      <div class="ctrlHolder">
+      	<label for="client_group_id">{tmpl_var name='client_group_id_txt'}</label>
+        <select name="client_group_id" id="client_group_id" class="selectInput">
+					{tmpl_var name='client_group_id'}
+				</select>
+      </div>
+      </tmpl_if>
+	  <tmpl_if name="is_reseller">
+      <div class="ctrlHolder">
+      	<label for="client_group_id">{tmpl_var name='client_group_id_txt'}</label>
+        <select name="client_group_id" id="client_group_id" class="selectInput">
+					{tmpl_var name='client_group_id'}
+				</select>
+      </div>
+      </tmpl_if>
+	  <tmpl_if name="edit_disabled">
+      <div class="ctrlHolder">
+      	<label for="ostemplate_id_disabled">{tmpl_var name='ostemplate_id_txt'}</label>
+        <select name="ostemplate_id_disabled" id="ostemplate_id_disabled" class="selectInput" disabled="disabled">
+					{tmpl_var name='ostemplate_id'}
+				</select>
+      </div>
+	  <input type="hidden" name="ostemplate_id" value="{tmpl_var name='ostemplate_id_value'}">
+	  <tmpl_else>
+	  <div class="ctrlHolder">
+      	<label for="ostemplate_id">{tmpl_var name='ostemplate_id_txt'}</label>
+        <select name="ostemplate_id" id="ostemplate_id" class="selectInput">
+					{tmpl_var name='ostemplate_id'}
+				</select>
+      </div>
+	  </tmpl_if>
+      <div class="ctrlHolder">
+      	<label for="template_id">{tmpl_var name='template_id_txt'}</label>
+        <select name="template_id" id="template_id" class="selectInput">
+					{tmpl_var name='template_id'}
+				</select>
+      </div>
+      <div class="ctrlHolder">
+      	<label for="ip_address">{tmpl_var name='ip_address_txt'}</label>
+        <select name="ip_address" id="ip_address" class="selectInput">
+					{tmpl_var name='ip_address'}
+				</select>
+      </div>
+      <div class="ctrlHolder">
+      	<label for="hostname">{tmpl_var name='hostname_txt'}</label>
+        <input name="hostname" id="hostname" value="{tmpl_var name='hostname'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="vm_password">{tmpl_var name='vm_password_txt'}</label>
+        <input name="vm_password" id="vm_password" value="{tmpl_var name='vm_password'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+				<p class="label">{tmpl_var name='start_boot_txt'}</p>
+					<div class="multiField">
+						{tmpl_var name='start_boot'}
+					</div>
+			</div>
+      <div class="ctrlHolder">
+				<p class="label">{tmpl_var name='active_txt'}</p>
+					<div class="multiField">
+						{tmpl_var name='active'}
+					</div>
+			</div>
+	  <div class="ctrlHolder">
+      	<label for="active_until_date">{tmpl_var name='active_until_date_txt'}</label>
+        <input name="active_until_date" id="active_until_date" value="{tmpl_var name='active_until_date'}" size="30" maxlength="255" type="text" class="textInput formLengthDate" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="description">{tmpl_var name='description_txt'}</label>
+        <textarea name="description" id="description" rows='5' cols='30' style='height:60px;'>{tmpl_var name='description'}</textarea>
+      </div>
+    </fieldset>
+
+    <input type="hidden" name="id" value="{tmpl_var name='id'}">
+
+    <div class="buttonHolder buttons">
+      <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','vm/openvz_vm_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
+      <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('vm/openvz_vm_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
+    </div>
+  </div>
+  
+</div>
diff --git a/interface/web/vm/templates/openvz_vm_list.htm b/interface/web/vm/templates/openvz_vm_list.htm
new file mode 100644
index 0000000000000000000000000000000000000000..6c08b31e59a250ab7b67b6e68c0fa8b9c53e89d0
--- /dev/null
+++ b/interface/web/vm/templates/openvz_vm_list.htm
@@ -0,0 +1,67 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+
+<div class="panel panel_list_openvz_vm">
+
+  <div class="pnl_toolsarea">
+    <fieldset><legend>{tmpl_var name="toolsarea_head_txt"}</legend>
+      <div class="buttons">
+        <button class="iconstxt icoAdd" type="button" onClick="loadContent('vm/openvz_vm_edit.php');">
+          <span>{tmpl_var name="add_new_record_txt"}</span>
+        </button>
+      </div>
+    </fieldset>
+  </div>
+
+  <div class="pnl_listarea">
+    <fieldset><legend><tmpl_var name="list_head_txt"></legend>
+      <table class="list">
+        <thead>
+          <tr>
+            <th class="tbl_col_active" scope="col"><tmpl_var name="active_txt"></th>
+            <th class="tbl_col_veid" scope="col"><tmpl_var name="veid_txt"></th>
+            <th class="tbl_col_server_id" scope="col"><tmpl_var name="server_id_txt"></th>
+            <th class="tbl_col_ostemplate_id" scope="col"><tmpl_var name="ostemplate_id_txt"></th>
+            <th class="tbl_col_template_id" scope="col"><tmpl_var name="template_id_txt"></th>
+            <th class="tbl_col_hostname" scope="col"><tmpl_var name="hostname_txt"></th>
+            <th class="tbl_col_ip_address" scope="col"><tmpl_var name="ip_address_txt"></th>
+            <th class="tbl_col_buttons" scope="col">&nbsp;</th>
+          </tr>
+          <tr>
+            <td class="tbl_col_active"><select name="search_active" onChange="submitForm('pageForm','vm/openvz_vm_list.php');">{tmpl_var name='search_active'}</select></td>
+            <td class="tbl_col_veid"><input type="text" name="search_veid" style="width:40px;" value="{tmpl_var name='search_veid'}" /></td>
+            <td class="tbl_col_server_id"><select name="search_server_id" onChange="submitForm('pageForm','vm/openvz_vm_list.php');">{tmpl_var name='search_server_id'}</select></td>
+            <td class="tbl_col_ostemplate_id"><select name="search_ostemplate_id" onChange="submitForm('pageForm','vm/openvz_vm_list.php');">{tmpl_var name='search_ostemplate_id'}</select></td>
+            <td class="tbl_col_template_id"><select name="search_template_id" onChange="submitForm('pageForm','vm/openvz_vm_list.php');">{tmpl_var name='search_template_id'}</select></td>
+            <td class="tbl_col_hostname"><input type="text" name="search_hostname" value="{tmpl_var name='search_hostname'}" /></td>
+            <td class="tbl_col_ip_address"><input type="text" name="search_ip_address" style="width:80px;" value="{tmpl_var name='search_ip_address'}" /></td>
+            <td class="tbl_col_buttons"><div class="buttons"><button type="button" class="icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onClick="submitForm('pageForm','vm/openvz_vm_list.php');"><span>{tmpl_var name="filter_txt"}</span></button></div></td>
+          </tr>
+        </thead>
+        <tbody>
+          <tmpl_loop name="records">
+          <tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
+            <td class="tbl_col_active"><a href="#" onClick="loadContent('vm/openvz_vm_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="active"}</a></td>
+            <td class="tbl_col_veid"><a href="#" onClick="loadContent('vm/openvz_vm_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="veid"}</a></td>
+            <td class="tbl_col_server_id"><a href="#" onClick="loadContent('vm/openvz_vm_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="server_id"}</a></td>
+            <td class="tbl_col_ostemplate_id"><a href="#" onClick="loadContent('vm/openvz_vm_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="ostemplate_id"}</a></td>
+            <td class="tbl_col_template_id"><a href="#" onClick="loadContent('vm/openvz_vm_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="template_id"}</a></td>
+            <td class="tbl_col_hostname"><a href="#" onClick="loadContent('vm/openvz_vm_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="hostname"}</a></td>
+            <td class="tbl_col_ip_address"><a href="#" onClick="loadContent('vm/openvz_vm_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="ip_address"}</a></td>
+            <td class="tbl_col_buttons">
+              <div class="buttons icons16">    
+                <a class="icons16 icoDelete" href="javascript: del_record('vm/openvz_vm_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span>{tmpl_var name='delete_txt'}</span></a>
+              </div>
+            </td>
+          </tr>
+          </tmpl_loop>
+        </tbody>
+        <tfoot>
+          <tr>
+            <td class="tbl_footer tbl_paging" colspan="8"><tmpl_var name="paging"></td>
+          </tr>
+        </tfoot>
+      </table>
+    </fieldset>
+  </div>
+
+</div>
diff --git a/server/cron_daily.php b/server/cron_daily.php
index 8ea43956e6ebf53552d9a3294a90079061033c99..2d12f2ce8938fa1601a794ef4cd145b251919b01 100644
--- a/server/cron_daily.php
+++ b/server/cron_daily.php
@@ -392,6 +392,27 @@ if ($app->dbmaster == $app->db) {
 	}
 
 
+}
+
+
+#######################################################################################################
+// deactivate virtual servers (run only on the "master-server")
+#######################################################################################################
+
+if ($app->dbmaster == $app->db) {
+	$current_date = date('Y-m-d');
+
+	//* Check which virtual machines have to be deactivated
+	$sql = "SELECT * FROM openvz_vm WHERE active = 'y' AND active_until_date != '0000-00-00' AND active_until_date < '$current_date'";
+	$records = $app->db->queryAllRecords($sql);
+	if(is_array($records)) {
+		foreach($records as $rec) {
+			$app->dbmaster->datalogUpdate('openvz_vm', "active = 'n'", 'vm_id', $rec['vm_id']);
+			$app->log('Virtual machine active date expired. Disabling VM '.$rec['veid'],LOGLEVEL_DEBUG);
+		}
+	}
+
+
 }
 
 #######################################################################################################
diff --git a/server/mods-available/vm_module.inc.php b/server/mods-available/vm_module.inc.php
new file mode 100644
index 0000000000000000000000000000000000000000..9a7fc371d1209858a67ef4dadcb71ab26beed664
--- /dev/null
+++ b/server/mods-available/vm_module.inc.php
@@ -0,0 +1,118 @@
+<?php
+
+/*
+Copyright (c) 2009, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    * Neither the name of ISPConfig nor the names of its contributors
+      may be used to endorse or promote products derived from this software without
+      specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+class vm_module {
+	
+	var $module_name = 'vm_module';
+	var $class_name = 'vm_module';
+	var $actions_available = array(	'openvz_vm_insert',
+									'openvz_vm_update',
+									'openvz_vm_delete',
+									'openvz_ip_insert',
+									'openvz_ip_update',
+									'openvz_ip_delete',
+									'openvz_ostemplate_insert',
+									'openvz_ostemplate_update',
+									'openvz_ostemplate_delete');
+	
+	//* This function is called during ispconfig installation to determine
+	//  if a symlink shall be created for this plugin.
+	function onInstall() {
+		global $conf;
+		
+		if($conf['services']['vserver'] == true) {
+			return true;
+		} else {
+			return false;
+		}
+		
+	}
+	
+	/*
+	 	This function is called when the module is loaded
+	*/
+	
+	function onLoad() {
+		global $app;
+		
+		/*
+		Annonce the actions that where provided by this module, so plugins 
+		can register on them.
+		*/
+		
+		$app->plugins->announceEvents($this->module_name,$this->actions_available);
+		
+		/*
+		As we want to get notified of any changes on several database tables,
+		we register for them.
+		
+		The following function registers the function "functionname"
+ 		to be executed when a record for the table "dbtable" is 
+ 		processed in the sys_datalog. "classname" is the name of the
+ 		class that contains the function functionname.
+		*/
+		
+		$app->modules->registerTableHook('openvz_vm',$this->module_name,'process');
+		$app->modules->registerTableHook('openvz_ip',$this->module_name,'process');
+		$app->modules->registerTableHook('openvz_ostemplate',$this->module_name,'process');
+		
+	}
+	
+	/*
+	 This function is called when a change in one of the registered tables is detected.
+	 The function then raises the events for the plugins.
+	*/
+
+	function process($tablename,$action,$data) {
+		global $app;
+		
+		switch ($tablename) {
+			case 'openvz_vm':
+				if($action == 'i') $app->plugins->raiseEvent('openvz_vm_insert',$data);
+				if($action == 'u') $app->plugins->raiseEvent('openvz_vm_update',$data);
+				if($action == 'd') $app->plugins->raiseEvent('openvz_vm_delete',$data);
+			break;
+			case 'openvz_ip':
+				if($action == 'i') $app->plugins->raiseEvent('openvz_ip_insert',$data);
+				if($action == 'u') $app->plugins->raiseEvent('openvz_ip_update',$data);
+				if($action == 'd') $app->plugins->raiseEvent('openvz_ip_delete',$data);
+			break;
+			case 'openvz_ostemplate':
+				if($action == 'i') $app->plugins->raiseEvent('openvz_ostemplate_insert',$data);
+				if($action == 'u') $app->plugins->raiseEvent('openvz_ostemplate_update',$data);
+				if($action == 'd') $app->plugins->raiseEvent('openvz_ostemplate_delete',$data);
+			break;
+		} // end switch
+	} // end function
+	
+
+} // end class
+
+?>
diff --git a/server/plugins-available/openvz_plugin.inc.php b/server/plugins-available/openvz_plugin.inc.php
new file mode 100644
index 0000000000000000000000000000000000000000..a9c630e5a5fb9dba749c500e1bb48838ca2cf660
--- /dev/null
+++ b/server/plugins-available/openvz_plugin.inc.php
@@ -0,0 +1,154 @@
+<?php
+
+/*
+Copyright (c) 2009, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    * Neither the name of ISPConfig nor the names of its contributors
+      may be used to endorse or promote products derived from this software without
+      specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+class openvz_plugin {
+	
+	var $plugin_name = 'openvz_plugin';
+	var $class_name  = 'openvz_plugin';
+	
+	//* This function is called during ispconfig installation to determine
+	//  if a symlink shall be created for this plugin.
+	function onInstall() {
+		global $conf;
+		
+		//* this is only true on openvz host servers, not in openvz guests
+		if(@file_exists('/proc/vz/version')) {
+			return true;
+		} else {
+			return false;
+		}
+		
+	}
+	
+		
+	/*
+	 	This function is called when the plugin is loaded
+	*/
+	
+	function onLoad() {
+		global $app;
+		
+		/*
+		Register for the events
+		*/
+		
+		//* Virtual machine
+		$app->plugins->registerEvent('openvz_vm_insert',$this->plugin_name,'vm_insert');
+		$app->plugins->registerEvent('openvz_vm_update',$this->plugin_name,'vm_update');
+		$app->plugins->registerEvent('openvz_vm_delete',$this->plugin_name,'vm_delete');
+		
+	}
+	
+	
+	function vm_insert($event_name,$data) {
+		global $app, $conf;
+		
+		$veid = intval($data['new']['veid']);
+		
+		if($veid == 0) {
+			$app->log("VEID = 0, we stop here.",LOGLEVEL_WARN);
+			return;
+		}
+		
+		$tmp = $app->db->queryOneRecord("SELECT template_file FROM openvz_ostemplate WHERE ostemplate_id = ".$vm['ostemplate_id']);
+		$ostemplate = escapeshellcmd($tmp['template_file']);
+		unset($tmp);
+		
+		//* Create the virtual machine
+		exec("vzctl create $veid --ostemplate $ostemplate");
+		$app->log("Create OpenVZ VM: vzctl create $veid --ostemplate $ostemplate",LOGLEVEL_DEBUG);
+		
+		//* Write the configuration of the VM
+		file_put_contents('/etc/vz/conf/'.$veid.'.conf',$data['new']['config']);
+		
+		//* Start the VM
+		if($data['new']['active'] == 'y') {
+			exec("vzctl start $veid");
+			$app->log("Starting OpenVZ VM: vzctl start $veid",LOGLEVEL_DEBUG);
+		}
+		
+		//* Set the root password in the virtual machine
+		exec("vzctl set $veid --userpasswd root:".escapeshellcmd($data['new']['vm_password']));
+		
+	}
+	
+	function vm_update($event_name,$data) {
+		global $app, $conf;
+		
+		$veid = intval($data['new']['veid']);
+		
+		if($veid == 0) {
+			$app->log("VEID = 0, we stop here.",LOGLEVEL_WARN);
+			return;
+		}
+		
+		//* Write the configuration of the VM
+		file_put_contents('/etc/vz/conf/'.$veid.'.conf',$data['new']['config']);
+		$app->log("Writing new configuration for $veid",LOGLEVEL_DEBUG);
+		
+		//* Apply config changes to the VM
+		if($data['new']['active'] == 'y' && $data['old']['active'] == 'y') {
+			exec("vzctl restart $veid");
+			$app->log("Restarting OpenVZ VM: vzctl restart $veid",LOGLEVEL_DEBUG);
+		} elseif ($data['new']['active'] == 'y' && $data['old']['active'] == 'n') {
+			exec("vzctl start $veid");
+			$app->log("Starting OpenVZ VM: vzctl start $veid",LOGLEVEL_DEBUG);
+		} elseif ($data['new']['active'] == 'n' && $data['old']['active'] == 'y') {
+			exec("vzctl stop $veid");
+			$app->log("Stopping OpenVZ VM: vzctl stop $veid",LOGLEVEL_DEBUG);
+		}
+		
+		//* Set the root password in the virtual machine
+		if($data['new']['vm_password'] != $data['old']['vm_password']) {
+			exec("vzctl set $veid --userpasswd root:".escapeshellcmd($data['new']['vm_password']));
+		}
+		
+		
+	}
+	
+	function vm_delete($event_name,$data) {
+		global $app, $conf;
+		
+		$veid = intval($data['old']['veid']);
+		
+		if($veid == 0) {
+			$app->log("VEID = 0, we stop here.",LOGLEVEL_WARN);
+			return;
+		}
+		
+		exec("vzctl destroy $veid");
+		$app->log("Destroying OpenVZ VM: vzctl destroy $veid",LOGLEVEL_DEBUG);
+			
+	}
+	
+
+} // end class
+
+?>