// kwyshell. java script
// check frameset and redirect to correct frame page
function trackHistoryInfo (varHref, prefername, printpage)
{
	var myroot = SearchMyRoot(parent.location.href);
	var page = varHref;
	var pos = page.indexOf(myroot);
	var printer = '<img src="' + myroot + 'images/print.gif" width="14" height="12" align="absbottom">';

	// do nothing for print friendly mode
	if (location.search == '?PrintFriendly')
	{
		document.title = 'Kwyshell\'s ' + prefername + ' [PrintFreindly]';
		return;
	}

	// analyszie the href. If the href is one of our page. we will show the hostory
	if (pos != -1)
	{
		var subpage = page.substring(pos + myroot.length, page.length);
		var ss =  subpage.split('/');
		
		var strout = '';
		var strlink = '';
			
		// check if get any return data
		if (ss.length > 0)
		{
			if (ss[0] == 'Documents')
				strlink = '<a href="' + myroot + 'Articles.htm"' + ' class="CssHisLink">Articles</a>';
			else if (ss[0] == 'Download')
				strlink = '<a href="' + myroot + 'Download.htm"' + ' class="CssHisLink">Download</a>';
			else if (ss[0] == 'Product')
				strlink = '<a href="' + myroot + 'Product.htm"' + ' class="CssHisLink">Product</a>';
			else if (ss[0] == 'Project')
				strlink = '<a href="' + myroot + 'Project.htm"' + ' class="CssHisLink">Project</a>';
			else if (ss[0] == 'Personal')
				strlink = '<a href="' + myroot + 'Kwyshell.htm"' + ' class="CssHisLink">Personal</a>';
		}
			
		if (strlink.length > 0)
		{
			strout += strlink;
			strout += '<span class="CssHisLinkTag"> &gt; </span>';
			strlink = '';
		}

		// Append the final tags
		strout += '<span class="CssHisLink"><B>' + prefername + '</B></span>';
		
		// Write down the strout
		document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
		document.write('<tr>');
		document.write('<td width="75%" height="15"><div align="left">');
		document.write(strout);
		document.write('</div></td>');
		document.write('<td width="25%" height="15"><div align="right">');
		
		// If support printable page
		if (printpage)
		{
			document.write('<a href="' + self.location.href + '?PrintFriendly" target="_blank" class="CssHisLink">Print Friendly</a> ');
			document.write(printer);
		}
		
		document.write('</div></td>');
		document.write('</tr></table>');
		document.write('<hr style="color: #C0C0C0"size="1">');
	}	

}