function guessDocID(){
	tellerA=1
	arrFoundIds = new Array()
	localPaths=false // don't strip URL's but local file-paths

	// use the document's URL to determine the ID
		// first attempt: finding the  fragment-URL in the content_ini-URLs
			if(localPaths){
				strippedURL = Pathstrip(-1)
			}else{
				strippedURL = URLstrip(-1)
			}

			arrFoundIds = SearchContent(3,strippedURL,0)
			if(arrFoundIds.length>0)foundID = arrFoundIds[0]

		// second attempt: finding the shortened fragment-URL in the content_ini-URLs
			if(arrFoundIds.length==0){
				ripPoint=strippedURL.indexOf('&')
				if(ripPoint>-1){
					rippedURL = strippedURL.substring(0,ripPoint)
					arrFoundIds = SearchContent(3,strippedURL,0)
				}
			}

		// third attempt: finding the shortest fragment-URL in the content_ini-URLs
			if(arrFoundIds.length==0){
				chopPoint=strippedURL.indexOf('?')
				if(chopPoint>-1){
					choppedURL = strippedURL.substring(0,chopPoint)
					arrFoundIds = SearchContent(3,choppedURL,0)
				}
			}

	// use the referring page's URL to determine the ID
		// fourth attempt: finding the refering page's fragment-URL in the content_ini-URLs
			if(arrFoundIds.length==0){
				if(localPaths){
					strippedURL = Pathstrip(document.referrer)
				}else{
					strippedURL = URLstrip(document.referrer)
				}

				arrFoundIds = SearchContent(3,strippedURL,0)
				if(arrFoundIds.length>0)foundID = arrFoundIds[0]
			}

		// fifth attempt: finding the shortened fragment-URL in the content_ini-URLs
			if(arrFoundIds.length==0){
				ripPoint=strippedURL.indexOf('&')
				if(ripPoint>-1){
					rippedURL = strippedURL.substring(0,ripPoint)
					arrFoundIds = SearchContent(3,strippedURL,0)
				}
			}

		// sixth attempt: finding the shortest fragment-URL in the content_ini-URLs
			if(arrFoundIds.length==0){
				chopPoint=strippedURL.indexOf('?')
				if(chopPoint>-1){
					choppedURL = strippedURL.substring(0,chopPoint)
					arrFoundIds = SearchContent(3,choppedURL,0)
				}
			}

	// default solution for unfound URL
		if(arrFoundIds.length==0){
			arrFoundIds[0] = parent.getID // should be last know good Id
		}
		
return arrFoundIds[0]
}

// checks if the page is in it's proper frameset
if (parent.fcode == 'harabibi'){
	DBarray = parent.DBarray
	if(docID==-1){docID=guessDocID()} 	// guess the docID if none is given
	docID=URLparam('docID',docID) 		// fetch the ID from the URL to override
	parent.syncFrames(docID); 			// request the frameset to adjust it's frames to the docID
}else{ 
	// makes a new frameset if the wrong one is detected
	docURL = URLstrip(-1)
	if (docURL.substr(0, 11) == '/content/en') {
		window.location.href='/index_en.php?strUrl='+URLencode(docURL);
	} else {
		if (docURL.substr(0, 11) == '/content/du') {
			window.location.href='/index_du.php?strUrl='+URLencode(docURL);
		} else {
			window.location.href='/index.php?strUrl='+URLencode(docURL);
		}
	}
}
