<?php 
	$domain_name = "";
	$uri = $_SERVER["REQUEST_URI"]; 
	$exploded_uri = explode("/", $uri); 
	$domain_name = $exploded_uri[1];
	//echo '<br>Domain Name: '.$domain_name.'<br>';
	if ($domain_name == "tei") { 
		$domain_name .= "/";
	} else {$domain_name = "";}
	
	$thisPage = substr($_SERVER["SERVER_NAME"],strrpos($_SERVER["SERVER_NAME"],"/")+0);
	$protocol = isset($_SERVER["HTTPS"]) ? 'https' : 'http';
	$thisPage = $protocol."://".$thisPage."/".$domain_name;
	$thisUrl  = $_SERVER['DOCUMENT_ROOT'].'/'.$domain_name;
	
	$curPage  = $protocol."://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
	if ($curPage != $thisPage)
		$curPage = str_replace($thisPage, "", $curPage);
	$curPage = str_replace("index.php", "", $curPage);

	
	//echo "<br>thisPage: ".$thisPage;
	//echo "<br>thisUrl: ".$thisUrl;
	?>