Root = '';

function PageHeader(aTitle,aLevel,aMenuName) {
	for (i=0;i<aLevel;++i) {
		Root += '../';
	}
	WithFrames = true;
	if (top == window) WithFrames = false;
	if (WithFrames) {
		Frame = top.frames['title'];
		if (Frame == null) WithFrames = false;
	}
	if (WithFrames) {
		Doc = top.frames['title'].document;
		Doc.open("text/html","replace");
		Doc.clear();
		Doc.write('</script>\n');

		Doc.write('<html>\n');
		Doc.write('<head>\n');
		Doc.write('<LINK REL="stylesheet" TYPE="text/css" HREF="'+Root+'style.css">\n');
		Doc.write('</head>\n');
		Doc.write('<body class=title background='+Root+'pic/title_bg.jpg>\n');
		Doc.write('<h1><!--<p class=title>-->\n');
		Doc.write(''+aTitle+'\n');
		Doc.write('<br><br><br></p></h1>\n');
		Doc.write('</body>\n');
		Doc.write('</html>\n');

		Doc.close();
		Frame = top.frames['menu'];
		if (Frame != null) {
			Frame.SetSelectedItem(aMenuName);
//			Frame.SetSelectedItem2(location.href);
		}
	} else {
		Doc = document;

		Doc.write('<table width="100%"><tr><td class=title background='+Root+'pic/title_bg.jpg>\n');
		Doc.write('<h1 class=title><!--<p class=title>-->\n');
		Doc.write(''+aTitle+'\n');
		Doc.write('</h1>\n');
		Doc.write('</td></tr></table>\n');
		Doc.write('<table class="main_menu" background='+Root+'pic/menu_line_bg.jpg border=0 cellpadding="0" cellspacing="0"><tr>\n');
		Doc.write('<td><a name="home" href="'+Root+'start_page.htm"><img border=0 src="'+Root+'pic/menu_line_home.jpg"></a></td>\n');
		Doc.write('<td><a name="cpu_cards" href="'+Root+'cpu_cards.htm"><img border=0 src="'+Root+'pic/menu_line_cpu_cards.jpg"></a></td>\n');
		Doc.write('<td><a name="peripherials" href="'+Root+'peripherials.htm"><img border=0 src="'+Root+'pic/menu_line_peripherials.jpg"></a></td>\n');
		Doc.write('<td><a name="motherboards" href="'+Root+'motherboards.htm"><img border=0 src="'+Root+'pic/menu_line_motherboards.jpg"></a></td>\n');
		Doc.write('<td><a name="devel_tools" href="'+Root+'devel_tools.htm"><img border=0 src="'+Root+'pic/menu_line_dev_tools.jpg"></a></td>\n');
		Doc.write('<td><a name="value_add" href="'+Root+'value_add.htm"><img border=0 src="'+Root+'pic/menu_line_value_add.jpg"></a></td>\n');
		Doc.write('<td width=100%><img src="'+Root+'pic/menu_line_end.jpg"></td>\n');
		Doc.write('</tr></table>\n');

	}
}

function PageFooter() {
	WithFrames = true;
	if (top == window) WithFrames = false;
	if (WithFrames) {
		Frame = top.frames['title'];
		if (Frame == null) WithFrames = false;
	}
	if (!WithFrames) {
//		document.write('<p><a href="javascript:history.back();">Back</a></p>\n');
		FooterMenu();
	}
}

function PicPageFooter() {
	document.write('<p><a href="javascript:history.back();">Back</a></p>\n');
	PageFooter();
}

function FooterMenu() {
	document.write('<p class=footermenu>\n');
	document.write('<table width=100%><tr><td width="20%" class=footermenu>');
	document.write('<a href="'+Root+'index.htm?page='+URLEncode(location.href)+'">View it with frames</a></td><td width=60%  class=footermenu>\n');

	document.write('<strong><a href="'+Root+'start_page.htm" >Home</a></strong> <br>\n');

	document.write('<strong><a href="'+Root+'cpu_cards.htm" >CPU Cards</a></strong> | \n');
	document.write('<a href="'+Root+'cpu_cards/dsp-218x.htm" >scADSP218x</a> | \n');
	document.write('<a href="'+Root+'cpu_cards/sharc.htm" >scSharc</a> | \n');
	document.write('<a href="'+Root+'cpu_cards/atmel.htm" >scAT91</a> | \n');
	document.write('<a href="'+Root+'cpu_cards/maverick.htm" >scMaverick</a><br>\n');

	document.write('<strong><a href="'+Root+'peripherials.htm" >Peripherial cards</a></strong> | \n');
	document.write('<a href="'+Root+'peripherials/spcs8900.htm" >spCS8900</a> | \n');
	document.write('<a href="'+Root+'peripherials/spuart.htm" >spUART</a> | \n');
	document.write('<a href="'+Root+'peripherials/spusbfn.htm" >spUSBfn</a><br>\n');

	document.write('<strong><a href="'+Root+'motherboards.htm" >Motherboards</a></strong> <br>\n');

	document.write('<strong><a href="'+Root+'devel_tools.htm" >Development tools</a></strong> | \n');
	document.write('<a href="'+Root+'documents.htm" >Documentation</a> | \n');
	document.write('<a href="'+Root+'dev_tools/dev_board.htm" >smDevBoard</a><br>\n');

	document.write('<strong><a href="'+Root+'value_add.htm" >Value added Services</a></strong> <br>\n');
	document.write('<strong><a href="'+Root+'order.htm" >Prices and Ordering</a></strong> <br>\n');

	document.write('<strong>Feedback</storng> | \n');
	document.write('<a href="mailto:simm_sys_web@rcs.hu">e-Mail</a><br> \n');
	document.write('</td><td width="20%" class=footermenu><a href="javascript:window.print();">Print</a></td></tr></table>\n');
	document.write('</p>\n');
}

function InsertPicture(aPath,aPictName,aTitle) {
	var PicPath = URLEncode(aPath+"/"+aPictName);
	var Title = URLEncode(aTitle)
	document.write('<a href="'+Root+'showpic.htm?pic='+PicPath+'&title='+Title+'"><IMG SRC="'+Root+aPath+'/thumb/'+aPictName+'"></a>');
}

/**************************************************************
 | Replaces all occurences of aWhat to aTo in aWhere.
 **************************************************************/
function ReplaceAll(
	aWhere,				// Where to search (IN)
	aWhat,				// What to search
	aTo)				// What to replace to
						// Returns: the resulted string.
{
	var Idx = 0;
	while ((Idx = aWhere.indexOf(aWhat,Idx)) != -1)
	{
		aWhere = aWhere.substr(0,Idx)+aTo+aWhere.substr(Idx+aWhat.length,aWhere.length-Idx+aWhat.length);
		Idx += aTo.length;
	} // while
	return aWhere;
} // ReplaceAll

function URLDecode(
	aURL)				// URL string
						// Returns: the resulted string.
{
	aURL = ReplaceAll(aURL,"+"," ");
	aURL = unescape(""+aURL);
	return aURL;
} //URLDecode

function URLEncode(
	aURL)				// URL string
						// Returns: the resulted string.
{
	aURL = escape(""+aURL);
	aURL = ReplaceAll(aURL," ","+");
	return aURL;
} //URLEncode

function FillParamList(
	aParams)			// List of parameters (OUTPUT)
						// Returns: the filled list
{
	var QStr = ""+document.location.search;
	var Name = "";
	var Value = "";
	var InName = true;
	var ListIdx = 0;
	for(i=1;i<=QStr.length;i++)
	{
		var CurChr = QStr.charAt(i);
		if (InName)
		{
			if (CurChr == "=")
			{
				InName = false;
				Value = "";
			} else
			{
				Name += CurChr;
			} // if
		} else
		{
			if ((CurChr == "&") || (i == QStr.length))
			{
				Name = URLDecode(Name);
				Value = URLDecode(Value);
				aParams[ListIdx] = new Array();
				aParams[ListIdx].Name = Name;
				aParams[ListIdx].Value = Value;
				++ListIdx;
				InName = true;
				Value = "";
				Name = "";
			} else
			{
				Value += CurChr;
			} // if
		} // if
	} // for
	return aParams;
} // FillParamList

function GetParam(
	aParams,			// List of parameters to append
	aName)				// Name of the parameter to search for
{
	var i;
	for(i=0;i<aParams.length;++i)
	{
		if (aParams[i].Name == aName) return aParams[i].Value;
	} // for
	return null;
} // GetParam


function DbgPrintParams(
	aParams)			// List of parameters to append
{
	var i;
	if (aParams.length > 0) {
		document.write("<table border>\n");
		document.write("<tr><td>name</td><td>value</td></tr>\n");
		for(i=0;i<aParams.length;++i)
		{
			document.write("<tr><td>"+aParams[i].Name+"</td><td>"+aParams[i].Value+"</td></tr>\n");
		} // for
		document.write("</table>\n");
	} // if
} // DbgPrintParams


var Params = new Array;

FillParamList(Params,document.location.search);

function ClosePopup() {
/*   var popupName = "TripodPopup2";

   var popup = window.open("", popupName);
   popup.location = "hello.htm";
   popup.close();*/
}

