<?php 
	global $header_file, $left_file, $middle_file, $right_file, $footer_file,$main_interface;
	$filename = basename($_SERVER['SCRIPT_NAME']);
	
	switch($filename){
		
		// admin special files
		case 'admin-login.php': case 'resetPassword.php':
				$middle_file	=	DIR_ADMIN_TEMP_MIDDLE."/".$filename;
				$main_interface	=	DIR_ADMIN_TEMP_INTERFACE."/login_inteface.php";
		break;	
		
		case 'vieworder.php':
				$middle_file	=	DIR_ADMIN_TEMP_MIDDLE."/".$filename;
				$main_interface	=	DIR_ADMIN_TEMP_INTERFACE."/popup_interface.php";
		break;	
		case 'print_profile.php': case 'print_profile_list.php':
				$middle_file	=	DIR_TEMP_MIDDLE."/".$filename;
				$main_interface	=	DIR_TEMP_INTERFACE."/print_interface.php";
		break;	
		default: 
		
			if(strpos($_SERVER['SCRIPT_NAME'],ADMIN_DIR)){
				$header_file	=	DIR_ADMIN_TEMP_HEADER."/header.php";
				$left_file		=	DIR_ADMIN_TEMP_LEFT."/left.php";
				$middle_file	=	DIR_ADMIN_TEMP_MIDDLE."/".$filename;
				$right_file   	= 	DIR_ADMIN_TEMP_LEFT."/right.php";
				$footer_file	=	DIR_ADMIN_TEMP_FOOTER."/footer.php";
				$main_interface	=	DIR_ADMIN_TEMP_INTERFACE."/interface.php";
			break;
					
			}
			else 
			{
				$header_file	=	DIR_TEMP_HEADER."/header.php";
				$banner_file	=	DIR_TEMP_HEADER."/banner.php";
				$left_file		=	DIR_TEMP_LEFT."/left.php";
				$middle_file	=	DIR_TEMP_MIDDLE."/".$filename;
				$right_file   	= 	DIR_TEMP_RIGHT."/right.php";
				$footer_file	=	DIR_TEMP_FOOTER."/footer.php";
				$main_interface	=	DIR_TEMP_INTERFACE."/interface.php";
			}
		break;			
	}
	
	if(isset($main_interface)) {
		require_once($main_interface);	//$main_interface Load the templates for Currently Running File
	};
?>