// rf.js update:04April1999rev1.0 owner=jw pgmr: ric

/* This function gets the device name from the summary page HTML name.
   It then appends it to the hash character (#).
   It returns the device name in UPPER CASE */
function sumPageName() {
	var devName = location.pathname;
	var temp = devName.substring(devName.lastIndexOf("/")+1,devName.length);
	devName = temp.substring(0,temp.indexOf("_"));
	temp = devName;
	devName = "#" + temp.toUpperCase();
	return devName;
}
//
/* 	This function gets the referrer URL to the summary page.  It checks to
	see if a hash character is present.  If it is, it removes the hash
	character and all the text after it.
	Next, the referrer URL is checked to see which subdirectory it resides
	in. IF it came from the LDMOS Selector Guide, the RF and IF
	Selector Guide or the System Solutions sub directories, a return
	anchor is created, otherwise nothing is done.
	Also, three conditions are set:
		1 = Selector Guide-LDMOS
		2 = Selector Guide
		3 = System Solutions
	This function calls the sumPageName() function.
	It returns the href anchor of the referrer page or nothing.*/
//	
function setReturnAnchor() {
	var URL = document.referrer;
	var yoHash = "";
	var sourcePATH = "";
	var devName = "";
	if (URL.indexOf("#") != -1) {
		yoHash = URL.substring(0,URL.indexOf("#"));
		URL = yoHash;}
		
	if (URL.indexOf("/sg/sgldmos/") != -1) {
   	  hotImage = "<img src=\"../../images/returnsgldmos.gif\" width=210 height=28 border=0 alt=\"Return\">";
	  sourcePATH = "../.." + URL.substring(URL.indexOf("/sg/sgldmos/"),URL.length);
      URL = "1<a href=\"" + sourcePATH + sumPageName() + "\">" + hotImage + "</a>";}
  	else {
      if (URL.indexOf("/sg/sghtml/") != -1) {
   	  	hotImage = "<img src=\"../../images/returnsg.gif\" width=145 height=28 border=0 alt=\"Return\">";
	  	sourcePATH = "../.." + URL.substring(URL.indexOf("/sg/sghtml/"),URL.length);
      	URL = "2<a href=\"" + sourcePATH + sumPageName() + "\">" + hotImage + "</a>";}
	  else {
      	if (URL.indexOf("/systemsolutions/") != -1) {
   	  	  hotImage = "<img src=\"../../images/returnsyssol.gif\" width=160 height=28 border=0 alt=\"Return\">"
	  	  sourcePATH = "../.." + URL.substring(URL.indexOf("/systemsolutions/"),URL.length);
      	  URL = "3<a href=\"" + sourcePATH + sumPageName() + "\">" + hotImage + "</a>";}
		else {
		  URL = "4&nbsp;";}}
	}
		
	return URL;
}
//
/*	This function writes a message to the screen, telling the user to
	use the browser Back button for all returns from collateral links
	back to the Summary Page if the user desires to return to the source
	Selector Guide or System Solutions page.
*/
function backMessage(num) {
	var subdir;
	if (num == 1) {
		subdir = "LDMOS Selector Guide"; }
	else {
	  if (num == 2) {
	     subdir = "Selector Guide"; }
	  else {
	     if (num == 3) {
		 subdir = "System Solutions"; }
	  }
	}
	if (num != 4) {
		document.write('<font size="-2" face="Arial, Helvetica" color="#FF0000">&#151; If you want to return to the ' + subdir + ' page from this location, you must<br>use the browser <strong><u>Back</u></strong> button from any collateral links listed below to return to this page. &#151;</font><br>');}
}
//
/*	This function is called from the Summary Page. It calls the 
	backMessage() function and writes the href anchor code to return 
	to the refferer page if from the Selector Guide-LDMOS, the Selector
	Guide or System Solutions.
*/
function sumPage() {
	var hrefAnchor = setReturnAnchor();
	var subdir = hrefAnchor.charAt(0);
	backMessage(subdir);
	document.write(hrefAnchor.substring(1,hrefAnchor.length));
}

