diff --git a/apps/calendar/templates/part.eventform.php b/apps/calendar/templates/part.eventform.php
index 8588b9168f7bb03bee5e60c1cda4e831b4661662..dfa5fb8c78a9fded48a37e8a0065346925c3d5da 100644
--- a/apps/calendar/templates/part.eventform.php
+++ b/apps/calendar/templates/part.eventform.php
@@ -13,9 +13,7 @@
 			<select id="category" name="categories[]" multiple="multiple" title="<?php echo $l->t("Select category") ?>">
 				<?php
 				if (!isset($_['categories'])) {$_['categories'] = array();}
-				foreach($_['category_options'] as $category){
-					echo '<option value="' . $category . '"' . (in_array($category, $_['categories']) ? ' selected="selected"' : '') . '>' . $category . '</option>';
-				}
+				echo html_select_options($_['category_options'], $_['categories'], array('combine'=>true));
 				?>
 			</select></td>
 			<th width="75px">&nbsp;&nbsp;&nbsp;<?php echo $l->t("Calendar");?>:</th>
@@ -23,9 +21,7 @@
 			<select style="width:140px;" name="calendar">
 				<?php
 				if (!isset($_['calendar'])) {$_['calendar'] = false;}
-				foreach($_['calendar_options'] as $calendar){
-					echo '<option value="' . $calendar['id'] . '"' . ($_['calendar'] == $calendar['id'] ? ' selected="selected"' : '') . '>' . $calendar['displayname'] . '</option>';
-				}
+				echo html_select_options($_['calendar_options'], $_['calendar'], array('value'=>'id', 'label'=>'displayname'));
 				?>
 			</select></td>
 		</tr>
@@ -66,9 +62,7 @@
 			<select name="repeat" style="width:350px;">
 				<?php
 				if (isset($_['repeat_options'])) {
-					foreach($_['repeat_options'] as $id => $label){
-						echo '<option value="' . $id . '"' . ($_['repeat'] == $id ? ' selected="selected"' : '') . '>' . $label . '</option>';
-					}
+					echo html_select_options($_['repeat_options'], $_['repeat']);
 				}
 				?>
 			</select></td>
diff --git a/apps/contacts/ajax/getdetails.php b/apps/contacts/ajax/getdetails.php
index 0e76de61afb0b23ac1a673be23047fff250c2cda..260fb53a6862b5562640fd0040862e9fd90a1fcb 100644
--- a/apps/contacts/ajax/getdetails.php
+++ b/apps/contacts/ajax/getdetails.php
@@ -51,10 +51,22 @@ if(is_null($vcard)){
 	exit();
 }
 
+$property_types = array(
+	'ADR'   => $l10n->t('Address'),
+	'TEL'   => $l10n->t('Telephone'),
+	'EMAIL' => $l10n->t('Email'),
+	'ORG'   => $l10n->t('Organization'),
+);
+$adr_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'ADR');
+$phone_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'TEL');
+
 $details = OC_Contacts_VCard::structureContact($vcard);
 $tmpl = new OC_Template('contacts','part.details');
 $tmpl->assign('details',$details);
 $tmpl->assign('id',$id);
+$tmpl->assign('property_types',$property_types);
+$tmpl->assign('adr_types',$adr_types);
+$tmpl->assign('phone_types',$phone_types);
 $page = $tmpl->fetchPage();
 
 OC_JSON::success(array('data' => array( 'id' => $id, 'page' => $page )));
diff --git a/apps/contacts/ajax/showaddcard.php b/apps/contacts/ajax/showaddcard.php
index 2f534f0fe2d0bc772a8ae81a17317b6c67b4d8fa..98367758fd4dbae358130b02a18b2783daa23e06 100644
--- a/apps/contacts/ajax/showaddcard.php
+++ b/apps/contacts/ajax/showaddcard.php
@@ -29,9 +29,14 @@ $l10n = new OC_L10N('contacts');
 OC_JSON::checkLoggedIn();
 OC_JSON::checkAppEnabled('contacts');
 
+$adr_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'ADR');
+$phone_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'TEL');
+
 $addressbooks = OC_Contacts_Addressbook::all(OC_USER::getUser());
 $tmpl = new OC_Template('contacts','part.addcardform');
 $tmpl->assign('addressbooks',$addressbooks);
+$tmpl->assign('adr_types',$adr_types);
+$tmpl->assign('phone_types',$phone_types);
 $page = $tmpl->fetchPage();
 
 OC_JSON::success(array('data' => array( 'page' => $page )));
diff --git a/apps/contacts/ajax/showsetproperty.php b/apps/contacts/ajax/showsetproperty.php
index 6188f4773c3771b745184719cf75a7197fc5d0f0..4ec3dd7d8e1d2991dc7ff9e5e4a556c515c17c26 100644
--- a/apps/contacts/ajax/showsetproperty.php
+++ b/apps/contacts/ajax/showsetproperty.php
@@ -61,11 +61,13 @@ if(is_null($line)){
 	exit();
 }
 
+$adr_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'ADR');
 
 $tmpl = new OC_Template('contacts','part.setpropertyform');
 $tmpl->assign('id',$id);
 $tmpl->assign('checksum',$checksum);
 $tmpl->assign('property',OC_Contacts_VCard::structureProperty($vcard->children[$line]));
+$tmpl->assign('adr_types',$adr_types);
 $page = $tmpl->fetchPage();
 
 OC_JSON::success(array('data' => array( 'page' => $page )));
diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php
index a6795c7935b7e716072d574c650a20cd1fefc90b..56602f25c0a2aa8c243f5435dc15ed1994082fe1 100644
--- a/apps/contacts/lib/vcard.php
+++ b/apps/contacts/lib/vcard.php
@@ -372,4 +372,24 @@ class OC_Contacts_VCard{
 			return null;
 		}
 	}
+	public static function getTypesOfProperty($l, $prop){
+		switch($prop){
+		case 'ADR':
+			return array(
+				'WORK' => $l->t('Work'),
+				'HOME' => $l->t('Home'),
+			);
+		case 'TEL':
+			return array(
+				'HOME'  =>  $l->t('Home'),
+				'CELL'  =>  $l->t('Mobile'),
+				'WORK'  =>  $l->t('Work'),
+				'TEXT'  =>  $l->t('Text'),
+				'VOICE' =>  $l->t('Voice'),
+				'FAX'   =>  $l->t('Fax'),
+				'VIDEO' =>  $l->t('Video'),
+				'PAGER' =>  $l->t('Pager'),
+			);
+		}
+	}
 }
diff --git a/apps/contacts/templates/part.addcardform.php b/apps/contacts/templates/part.addcardform.php
index a596ad8163a6c094ef87057f032c890cb89ce5cd..037e3629bb9d23a00ec26a59b2a652e0975d51e6 100644
--- a/apps/contacts/templates/part.addcardform.php
+++ b/apps/contacts/templates/part.addcardform.php
@@ -7,9 +7,7 @@
 				<li class="input stringish">
 					<label class="label" for="id"><?php echo $l->t('Group'); ?></label>
 					<select name="id" size="1">
-						<?php foreach($_['addressbooks'] as $addressbook): ?>
-							<option value="<?php echo $addressbook['id']; ?>"><?php echo $addressbook['displayname']; ?></option>
-						<?php endforeach; ?>
+						<?php echo html_select_options($_['addressbooks'], null, array('value'=>'id', 'label'=>'displayname')); ?>
 					</select>
 				</li>
 			</ol>
@@ -46,14 +44,7 @@
 						<li class="fragment">
 							<label for="tel_type"><?php echo $l->t('Type'); ?></label>
 							<select id="TEL" name="parameters[TEL][TYPE]" size="1">
-								<option value="home"><?php echo $l->t('Home'); ?></option>
-								<option value="cell" selected="selected"><?php echo $l->t('Mobile'); ?></option>
-								<option value="work"><?php echo $l->t('Work'); ?></option>
-								<option value="text"><?php echo $l->t('Text'); ?></option>
-								<option value="voice"><?php echo $l->t('Voice'); ?></option>
-								<option value="fax"><?php echo $l->t('Fax'); ?></option>
-								<option value="video"><?php echo $l->t('Video'); ?></option>
-								<option value="pager"><?php echo $l->t('Pager'); ?></option>
+								<?php echo html_select_options($_['phone_types'], 'CELL') ?>
 							</select>
 						</li>
 					</ol>
@@ -67,8 +58,7 @@
 			<li class="input">
 				<label class="label" for="adr_type"><?php echo $l->t('Type'); ?></label>
 				<select id="adr_type" name="parameters[ADR][TYPE]" size="1">
-					<option value="work"><?php echo $l->t('Work'); ?></option>
-					<option value="home" selected="selected"><?php echo $l->t('Home'); ?></option>
+					<?php echo html_select_options($_['adr_types'], 'HOME') ?>
 				</select>
 			</li>
 			<li class="input stringish">
diff --git a/apps/contacts/templates/part.details.php b/apps/contacts/templates/part.details.php
index 212be283d8053d7de6730fc5eb295cd7e83ed0d9..f5bd75809b1e55b797858af7f7625e0feefdce7d 100644
--- a/apps/contacts/templates/part.details.php
+++ b/apps/contacts/templates/part.details.php
@@ -27,10 +27,7 @@
 				<input type="hidden" name="id" value="<?php echo $_['id']; ?>">
 				<p class="contacts_property_name">
 					<select name="name" size="1">
-						<option value="ADR"><?php echo $l->t('Address'); ?></option>
-						<option value="TEL"><?php echo $l->t('Telephone'); ?></option>
-						<option value="EMAIL" selected="selected"><?php echo $l->t('Email'); ?></option>
-						<option value="ORG"><?php echo $l->t('Organization'); ?></option>
+						<?php echo html_select_options($_['property_types'], 'EMAIL') ?>
 					</select>
 				</p>
 				<p class="contacts_property_data" id="contacts_generic">
@@ -44,8 +41,7 @@
 					<li>
 						<label for="adr_type"><?php echo $l->t('Type'); ?></label>
 						<select id="adr_type" name="parameters[TYPE]" size="1">
-							<option value="work"><?php echo $l->t('Work'); ?></option>
-							<option value="home" selected="selected"><?php echo $l->t('Home'); ?></option>
+							<?php echo html_select_options($_['adr_types'], 'HOME') ?>
 						</select>
 					</li>
 					<li>
@@ -80,14 +76,7 @@
 				<p class="contacts_property_data" id="contacts_phonepart">
 					<input type="text" name="value" value="">
 					<select name="parameters[TYPE]" size="1">
-						<option value="home"><?php echo $l->t('Home'); ?></option>
-						<option value="cell" selected="selected"><?php echo $l->t('Mobile'); ?></option>
-						<option value="work"><?php echo $l->t('Work'); ?></option>
-						<option value="text"><?php echo $l->t('Text'); ?></option>
-						<option value="voice"><?php echo $l->t('Voice'); ?></option>
-						<option value="fax"><?php echo $l->t('Fax'); ?></option>
-						<option value="video"><?php echo $l->t('Video'); ?></option>
-						<option value="pager"><?php echo $l->t('Pager'); ?></option>
+						<?php echo html_select_options($_['phone_types'], 'CELL') ?>
 					</select>
 				</p>
 				<p class="contacts_property_data" id="contacts_generic">
diff --git a/apps/contacts/templates/part.setpropertyform.php b/apps/contacts/templates/part.setpropertyform.php
index eb8a67a8aa5fb7902ce9754afaa78c3c0770ba69..811b9626ce496e436480b7e3193205a5ea2cef7b 100644
--- a/apps/contacts/templates/part.setpropertyform.php
+++ b/apps/contacts/templates/part.setpropertyform.php
@@ -5,6 +5,12 @@
 		<?php if($_['property']['name']=='ADR'): ?>
 			<p class="contacts_property_name"><label for="adr_pobox"><?php echo $l->t('Address'); ?></label></p>
 			<ol class="contacts_property_data" id="contacts_addresspart">
+				<li class="input">
+					<label class="label" for="adr_type"><?php echo $l->t('Type'); ?></label>
+					<select id="adr_type" name="parameters[TYPE]" size="1">
+						<?php echo html_select_options($_['adr_types'], strtoupper($_['property']['parameters']['TYPE'])) ?>
+					</select>
+				</li>
 				<li>
 					<label for="adr_pobox"><?php echo $l->t('PO Box'); ?></label>
 					<input id="adr_pobox" type="text" name="value[0]" value="<?php echo $_['property']['value'][0] ?>">
diff --git a/lib/template.php b/lib/template.php
index 440b62003e77dc6343a9ccac57de462c06e6f427..d1439199e1ee23fb2807d08940bf40eed7eca00f 100644
--- a/lib/template.php
+++ b/lib/template.php
@@ -98,6 +98,33 @@ function relative_modified_date($timestamp) {
 	else { return $l->t('years ago'); }
 }
 
+function html_select_options($options, $selected, $params=array()) {
+	if (!is_array($selected)){
+		$selected=array($selected);
+	}
+	if (isset($params['combine']) && $params['combine']){
+		$options = array_combine($options, $options);
+	}
+	$value_name = $label_name = false;
+	if (isset($params['value'])){
+		$value_name = $params['value'];
+	}
+	if (isset($params['label'])){
+		$label_name = $params['label'];
+	}
+	$html = '';
+	foreach($options as $value => $label){
+		if ($value_name && is_array($label)){
+			$value = $label[$value_name];
+		}
+		if ($label_name && is_array($label)){
+			$label = $label[$label_name];
+		}
+		$select = in_array($value, $selected) ? ' selected="selected"' : '';
+		$html .= '<option value="' . $value . '"' . $select . '>' . $label . '</option>';
+	}
+	return $html;
+}
 
 /**
  * This class provides the templates for owncloud.