diff --git a/config/config-template.php b/config/config-template.php
index 3cade08469d75a8bce1c283a08874b7af3ddac6e..3d1aff1445e91766da4e89bbc2ae8dd93464d2c9 100644
--- a/config/config-template.php
+++ b/config/config-template.php
@@ -83,6 +83,21 @@ $config = array (
 	'default-saml20-idp'	=> 'max.feide.no',
 	'default-shib13-idp'	=> 'urn:mace:switch.ch:aaitest:dukono.switch.ch',
 	
+	/*
+	 * IdP Discovery service look configuration. 
+	 * Wether to display a list of idp or to display a dropdown box. For many IdP' a dropdown box  
+	 * gives the best use experience.
+	 * 
+	 * When using dropdown box a cookie is used to highlight the previously chosen IdP in the dropdown.  
+	 * This makes it easier for the user to choose the IdP
+	 * 
+	 * Options: [links,dropdown]
+	 * 
+	 */
+	#'idpdisco.layout' => 'dropdown',
+	'idpdisco.layout' => 'links',
+
+
 	/*
 	 * Meta data handler.
 	 *
diff --git a/templates/default/en/selectidp-dropdown.php b/templates/default/en/selectidp-dropdown.php
new file mode 100644
index 0000000000000000000000000000000000000000..9aba6e2b70756aa7d094c0fe5b29a5cf92a67b9e
--- /dev/null
+++ b/templates/default/en/selectidp-dropdown.php
@@ -0,0 +1,34 @@
+<?php $this->includeAtTemplateBase('includes/header.php'); ?>
+
+	<div id="header">
+		<h1>SAML 2.0 IdP Discovery Service</h1>
+		<div id="poweredby"><img src="/<?php echo $data['baseurlpath']; ?>resources/icons/bino.png" alt="Bino" /></div>
+	</div>
+	
+	<div id="content">
+
+		<h2><?php if (isset($data['header'])) { echo $data['header']; } else { echo "Select your IdP"; } ?></h2>
+		
+		<p>Please select the identity provider where you want to authenticate:</p>
+		
+		<form method="get" action="<?php echo $data['urlpattern']; ?>">
+		<input type="hidden" name="entityID" value="<?php echo $data['entityID']; ?>" />
+		<input type="hidden" name="return" value="<?php echo $data['return']; ?>" />
+		<input type="hidden" name="returnIDParam" value="<?php echo $data['returnIDParam']; ?>" />
+		<select name="idpentityid">
+		<?php
+		
+		foreach ($data['idplist'] AS $idpentry) {
+
+			echo '<option value="'.$idpentry['entityid'].'"';
+			if ($idpentry['entityid'] == $data['preferedidp']) echo ' selected="selected"';
+			echo '>'.$idpentry['name'].'</option>';
+		
+		}
+		?>
+		</select>
+		<input type="submit" value="Select"/>
+		</form>
+
+		
+<?php $this->includeAtTemplateBase('includes/footer.php'); ?>
diff --git a/templates/default/en/selectidp.php b/templates/default/en/selectidp-links.php
similarity index 99%
rename from templates/default/en/selectidp.php
rename to templates/default/en/selectidp-links.php
index c9ab2518e3ebe916eb07cee38cc2c5b2a4ef7e37..e75bf6664cbd09c89ed6fedc7cfc67e775531782 100644
--- a/templates/default/en/selectidp.php
+++ b/templates/default/en/selectidp-links.php
@@ -15,14 +15,13 @@
 		<?php
 		
 		foreach ($data['idplist'] AS $idpentry) {
-		
+			
 			echo '<h3>' . $idpentry['name'] . '</h3>';
 			echo '<p>' . $idpentry['description'] . '<br />';
 			echo '[ <a href="' . $data['urlpattern'] . $idpentry['entityid'] . '">Select this IdP</a>]</p>';
 		
 		}
 		
-		
 		?>
 
 		
diff --git a/www/saml2/sp/idpdisco.php b/www/saml2/sp/idpdisco.php
index 81e108c9a8ae6186d5ef9aee319091f8f30c5cba..f941e0262bd9d9bf936096348902a4ff14f3a5af 100644
--- a/www/saml2/sp/idpdisco.php
+++ b/www/saml2/sp/idpdisco.php
@@ -41,21 +41,36 @@ try {
 if (isset($_GET['idpentityid'])) {
 
 	$idpentityid = $_GET['idpentityid'];
-
+	setcookie('preferedidp',$idpentityid,time()+60*60*24*90); // set cookie valid 90 days
+	
 	$returnurl = SimpleSAML_Utilities::addURLparameter($return, $returnidparam . '=' . $idpentityid);
 	SimpleSAML_Utilities::redirect($returnurl);
+
 }
 
 
 $idplist = $metadata->getList('saml20-idp-remote');
 
 
-$t = new SimpleSAML_XHTML_Template($config, 'selectidp.php');
-$t->data['header'] = 'Select your identity provider';
-$t->data['idplist'] = $idplist;
-$t->data['urlpattern'] = htmlentities(SimpleSAML_Utilities::selfURL() . '&idpentityid=');
-$t->show();
-
+if ($config->getValue('idpdisco.layout') == 'dropdown') {
+	$t = new SimpleSAML_XHTML_Template($config, 'selectidp-dropdown.php');
+	$t->data['header'] = 'Select your identity provider';
+	$t->data['idplist'] = $idplist;
+	$t->data['return']= $return;
+	$t->data['returnIDParam'] = $returnidparam;
+	$t->data['entityID'] = $spentityid;
+	$t->data['preferedidp'] = (!empty($_COOKIE['preferedidp'])) ? $_COOKIE['preferedidp'] : null;
+	$t->data['urlpattern'] = htmlentities(SimpleSAML_Utilities::selfURLNoQuery());
+	$t->show();
+}
+else
+{
+	$t = new SimpleSAML_XHTML_Template($config, 'selectidp-links.php');
+	$t->data['header'] = 'Select your identity provider';
+	$t->data['idplist'] = $idplist;
+	$t->data['urlpattern'] = htmlentities(SimpleSAML_Utilities::selfURL() . '&idpentityid=');
+	$t->show();
+}
 
 
 ?>
\ No newline at end of file
diff --git a/www/shib13/sp/idpdisco.php b/www/shib13/sp/idpdisco.php
index 6c150594e5faa9ee4e07a906f762e4962f4aa30b..3687264285992604ad5180739fdfde63d1842873 100644
--- a/www/shib13/sp/idpdisco.php
+++ b/www/shib13/sp/idpdisco.php
@@ -37,21 +37,34 @@ try {
 if (isset($_GET['idpentityid'])) {
 
 	$idpentityid = $_GET['idpentityid'];
-
+	setcookie('preferedidp',$idpentityid,time()+60*60*24*90); // set cookie valid 90 days
+	
 	$returnurl = SimpleSAML_Utilities::addURLparameter($return, $returnidparam . '=' . $idpentityid);
 	SimpleSAML_Utilities::redirect($returnurl);
+
 }
 
 
 $idplist = $metadata->getList('shib13-idp-remote');
 
-
-$t = new SimpleSAML_XHTML_Template($config, 'selectidp.php');
-$t->data['header'] = 'Select your identity provider';
-$t->data['idplist'] = $idplist;
-$t->data['urlpattern'] = htmlentities(SimpleSAML_Utilities::selfURL() . '&idpentityid=');
-$t->show();
-
+if ($config->getValue('disco.layout') == 'dropdown') {
+	$t = new SimpleSAML_XHTML_Template($config, 'selectidp-dropdown.php');
+	$t->data['header'] = 'Select your identity provider';
+	$t->data['idplist'] = $idplist;
+	$t->data['return']= $return;
+	$t->data['returnIDParam'] = $returnidparam;
+	$t->data['entityID'] = $spentityid;
+	$t->data['preferedidp'] = (!empty($_COOKIE['preferedidp'])) ? $_COOKIE['preferedidp'] : null;
+	$t->data['urlpattern'] = htmlentities(SimpleSAML_Utilities::selfURLNoQuery());
+}
+else
+{
+	$t = new SimpleSAML_XHTML_Template($config, 'selectidp-links.php');
+	$t->data['header'] = 'Select your identity provider';
+	$t->data['idplist'] = $idplist;
+	$t->data['urlpattern'] = htmlentities(SimpleSAML_Utilities::selfURL() . '&idpentityid=');
+	$t->show();
+}
 
 
 ?>
\ No newline at end of file