// declare a function to change the preexisting dropdown to include all of the addresses set in the cookie -->
// also declare a function to set the selected status -->

	var default_address_id = 0;
	
	function printAddressList( formname, objname, default_address_id, show_default, country) {
		if (addressList) {
			var listString = addressList;

			if (!country) country = "GB"; 
			var list = listString.split(";");
			var index = 0;
			for(var i = 0; i<list.length; i++) {
				var keyvalpair = list[i].split(":");
				var options = document.getElementById(objname).options;
				if (!keyvalpair[5] || (keyvalpair[5] == country)) {
					index++;
					if (default_address_id && default_address_id == keyvalpair[0]) {
						// Hack for ie - for some reason, it doesn't set the selectedIndex properly
						if(!is_ie6up) {
							options[index] = new Option( keyvalpair[1], keyvalpair[0], false, true );			
						} else {
							options[index] = new Option( keyvalpair[1], keyvalpair[0], false, true );			
							options.selectedIndex = index;
						}
					}
					else {
						if (keyvalpair[0] && keyvalpair[1]) {
							options[index] = new Option( keyvalpair[1], keyvalpair[0], false, false );			
						}
					}
				}
			}
		}
	}

// check whether the site is only accessible from a link of an intranet page
	// if it is, check whether the user is from the intranet
	// if the site only accessible from an intranet link and the user is not from
	// the intranet link, then redirect to access_deny.html


	// get the cookie
	var referring_url_required = getcookie("referring_url_required");

	// if the site only accessible from an intranet link
	var current_page_name = document.URL.match(/access_deny\.html/);
	if ((referring_url_required != "") && (current_page_name != "access_deny.html") ) {
		var referring_url_ok = getcookie("referring_url_ok");
		// first time, set cookie
		if ((referring_url_ok == "") || (referring_url_ok == 0)) {
			referring_url_ok = getReferrer().indexOf(referring_url_required);
			if (referring_url_ok == -1) {
				referring_url_ok = 0;
			}
			else {
				referring_url_ok = 1;	
			}
			setcookie("referring_url_ok", referring_url_ok, "");
		}

		// redirect to access_deny.html
		if (referring_url_ok == 0) {
			document.location.href = "/access_deny.html";	
		}
	}

	//set the entry page cookie
	var entry_page = getcookie("entry_page");
	if(entry_page == ''){
		ref = String(document.location);
		host = getHost();
		setcookie('entry_page',ref,host);
	}

	// cookie used to show the current users name
	// replace + with ' ' 
	// get rid of website id from the returned cookie value 
	var user = getcookie('vr_user_fname').replace(/\+/g,' ');

	//function to remove SI tab
	function hideSI() {
		changeClass('tab_top-left-simply', 'blank');
		changeClass('tab_top-right-simply', 'blank');
		changeClass('tab_name-simply', 'blank');
		changeClass('tab_top_spacer-simply', 'blank');
		changeClass('tab_spacer-simply', 'blank');
		changeClass('parentcat_2124383', 'blank');
		}

