// JavaScript Document, reload in frameset if out of context
if(top.window.length == 0){
	var hostStr = window.location.hostname;
	if(!((fsHostMod != null) && (fsHostMod!=''))){
		var fsHost = 'http://' + hostStr;
		var fsHostMod = '';
	}else{
		if(hostStr.indexOf('localhost')<0){
			var fsHost = 'http://' + fsHostMod;
			fsHostMod = fsHostMod.toLowerCase();
		}else{
			var fsHost = 'http://' + hostStr;
		}
	}
	var fsPathname = window.location.pathname.toLowerCase();
	if(fsPathname.indexOf("/hd/")>=0) { 
		fsHost += "/hd";
		fsPathname = fsPathname.substring(fsPathname.firstIndexOf("/hd/")+4)
	}
	if(((fsPathname != null) && (fsPathname!=''))){
		var fsFilename = fsPathname.substring(fsPathname.lastIndexOf("/")+1);
		var fsPath = fsPathname.substring(0,fsPathname.lastIndexOf("/")+1);
	}
	if(!((fsHomePath != null) && (fsHomePath!=''))){
		var fsHomePath = '/';
	}
	
	if(!((fsHomeFile != null) && (fsHomeFile!=''))){
		if(	(fsHost.indexOf('selfaccess')>-1)||
				(fsHostMod.indexOf('selfaccess')>-1)||
				(fsPathname.indexOf("/www/sa/")>=0)){
//			var fsHomeFile = 'sa_home.php';
			var fsHomeFile = 'sa_ver2_kereru.php';
		}else if(fsHost.indexOf('instantworkbook')>-1){
//			var fsHomeFile = 'iwb_home.php';
			var fsHomeFile = 'sa_ver2.php';
		}else{
//			var fsHomeFile = 'sa_home.php';
			var fsHomeFile = 'sa_ver2.php';
		}
	}
	if((fsPathMod == null) || (fsPathMod =='')){ 
		var fsPathMod = '';
	}else{
		fsPathMod = '&fsPathMod=' + fsPathMod;
	}
	var fsSearch = window.location.search.substring(1);
	var fsHref = fsHost + fsHomePath + fsHomeFile + '?dirReload=' + fsFilename + fsPathMod + '&fsPath=' + fsPath;
	// var fsHref = fsHost + fsHomePath + fsHomeFile + '?dirReload=' + fsPathname;
	if(fsSearch !=''){
		fsHref += '&'+ fsSearch;
	}
	window.location.replace(fsHref); 
}

