function mainLinks() {
	txt+= '<a href="' + linkaddr["home"]	 + '">' + linktext["home"]	+ '</a> &bull; '
	txt+= '<a href="' + linkaddr["temp"]	 + '">' + linktext["temp"]	+ '</a> &bull; '
	txt+= '<a href="' + linkaddr["links"]	 + '">' + linktext["links"]	+ '</a> &bull; '
	txt+= '<a href="' + linkaddr["contact"]  + '">' + linktext["contact"]	+ '</a>'
}

function header() {
	// generate submenu
	submenu = "&nbsp;"
	searchStart = location.href.indexOf("?")
	anchorStart = location.href.indexOf("#")
	if(anchorStart < 0) anchorStart = location.href.length
	// add language icon
	if(lang == "de") {
		langLink = location.href.substring(0,searchStart) + "?lang=en"
		langText = "this page in English"
		langFlag = "flag2_en.gif"
	} else {
		langLink = location.href.substring(0,searchStart) + "?lang=de"
		langText = "Diese Seite auf Deutsch"
		langFlag = "flag2_de.gif"
		langLink = "javascript:alert('...coming soon...')"
	}
	//submenu+= '<a href="' + langLink + '" title="' + langText + '" class="nolink">'
	//submenu+= '<img src="../images/' + langFlag + '" width=25 height=15></a>&nbsp;'
	// add print icon and change URL
	if(printme != 1) {
		if(location.search == "")
			printLink = location.href.substring(0,searchStart) + "?print=1"
		else	printLink = location.href.substring(0,anchorStart) + "&print=1"
		submenu+= '<a href="' + printLink + '" title="print this page" class="nolink">'
		submenu+= '<img src="../images/print.gif" width=18 height=16></a>'
	}
	
	txt = ''
	txt+= '<TABLE width="100%" cellpadding=0 cellspacing=0><tr>'
	txt+= '  <td width="245" class="top1_l"><a class="nolink" href="http://www.eos4you.com"><img src="' + logo +'"></a></td>'
	txt+= '  <td class="top1_r">'
	mainLinks()
	txt+= '  </td>'
	txt+= '</tr></table>'
	txt+= '<TABLE width="100%" cellpadding=0 cellspacing=0><tr>'
	txt+= '  <td class="top2_l" width="' + logotextw + '"><a class="nolink" href="http://www.eos4you.com"><img src="' + logotext + '"></a></td>'
	txt+= '  <td class="top2_l">&nbsp;</td>'
	txt+= '  <td class="top2_r" width="245">' + submenu + '</td>'
	txt+= '</tr></table>'
	txt+= '<a name="top0"> </a>'
	
	if(printme != 1 && template == "eos") txt+= show_contextMenu()
	document.write(txt)
}

function show_contextMenu() {
	var txt = ""
	var sel = ""
	var i   = 0
	var eosLevel1_nam = new Array()
	var eosLevel1_url = new Array()
	var ext = ".html"
	
	eosLevel1_nam[i] = "Introduction"
	eosLevel1_url[i] = "index"
	i++
	eosLevel1_nam[i] = "Features"
	eosLevel1_url[i] = "features"
	i++
	eosLevel1_nam[i] = "How it works"
	eosLevel1_url[i] = "workflow"
	i++
	eosLevel1_nam[i] = "Buy the template"
	eosLevel1_url[i] = "buy"
	i++
	eosLevel1_nam[i] = "Example Galleries"
	eosLevel1_url[i] = "examples"
	/*
	i++
	eosLevel1_nam[i] = "Applications"
	eosLevel1_url[i] = "applications"
	i++
	eosLevel1_nam[i] = "Getting Started"
	eosLevel1_url[i] = "start"
	*/
	i++
	eosLevel1_nam[i] = "Getting Started w/BreezeBrowser"
	eosLevel1_url[i] = "breezebrowser_v15"
	i++
	eosLevel1_nam[i] = "Getting Started w/IMatch"
	eosLevel1_url[i] = "imatch"
	i++
	eosLevel1_nam[i] = "Getting Started w/iView MPro"
	eosLevel1_url[i] = "iview_v31"
	i++
	eosLevel1_nam[i] = "Getting Started w/JAlbum"
	eosLevel1_url[i] = "jalbum_v7"
	i++
	eosLevel1_nam[i] = "Getting Started w/Photo Mechanic"
	eosLevel1_url[i] = "photomechanic"
	i++
	eosLevel1_nam[i] = "Getting Started w/PS CS"
	eosLevel1_url[i] = "pscs"
	i++
	eosLevel1_nam[i] = "EOS Project setup"
	eosLevel1_url[i] = "eosproject"
	i++
	eosLevel1_nam[i] = "Customization"
	eosLevel1_url[i] = "customization"
	i++
	eosLevel1_nam[i] = "Request Key"
	eosLevel1_url[i] = "mykey"
	i++
	
	txt+= '<TABLE class="contexttable" cellpadding=0 cellspacing=0><tr><td>Jump to: '
	txt+= '<select class="contextopt" name="contextmenu" '
	txt+= ' onChange="document.location = this.options[this.selectedIndex].value">'
	for(i=0; i<eosLevel1_nam.length; i++) {
		if(location.pathname.indexOf(eosLevel1_url[i]) > 0) sel = " selected"
		txt+= '<option value="' + eosLevel1_url[i] + ext + '"' + sel + '>' + eosLevel1_nam[i]
		sel = ""
	}
	txt+= '</select>'
	txt+= '</td></tr></table>'
	return txt
}

function footer() {
	// StatCounter code
	sc_includeScript = "http://www.statcounter.com/counter/counter.js"
	document.writeln('<scr' + 'ipt type="text/javascript" language="JavaScript"' + ' src=' + sc_includeScript + '></scr' + 'ipt>')
	
	// menu links
	txt = ''
	txt+= '<TABLE width="100%" cellpadding=0 cellspacing=0><tr>'
	txt+= '<td class="footer" height="26">'
	mainLinks()
	txt+= '</td></tr></table>'
	document.write(txt)
	
	// moves the focus away from the drop down list
	window.focus()
	
	if(typeof(_userv) != "undefined") {
		_uacct = "UA-1221288-2"
		urchinTracker()
	}
}

function AdSense() {
	google_ad_client = "pub-5359759624664683"
	google_alternate_color = "cccccc"
	google_ad_width = 468
	google_ad_height = 15
	google_ad_format = "468x15_0ads_al"
	//2007-08-25: eostemplate.com/eos, eos4you.com/eos
	google_ad_channel = "6107975997+1192008562"
	google_color_border = "cccccc"
	google_color_bg = "CCCCCC"
	google_color_link = "993333"
	google_color_text = "333333"
	google_color_url = "666666"
	
	as_includeScript = "http://pagead2.googlesyndication.com/pagead/show_ads.js"
	document.writeln('<scr' + 'ipt type="text/javascript" src=' + as_includeScript + '></scr' + 'ipt>')
}

function printPage() {
	document.write('<style>')
	document.write('body {')
	document.write('	background: #fff;')
	document.write('	color: #000;')
	document.write('}')
	document.write('.outertable {')
	document.write('	margin: 0px;')
	document.write('	border: none;')
	document.write('	width: 100%;')
	document.write('}')
	document.write('.outertable td {')
	document.write('	padding: 0px;')
	document.write('	background: #fff;')
	document.write('	background-image: none;')
	document.write('}')
	document.write('.innertable {')
	document.write('	margin: 0px;')
	document.write('	border: none;')
	document.write('	width: 100%;')
	document.write('}')
	document.write('.innertable td {')
	document.write('	text-align: justify;')
	document.write('	padding: 0px;')
	document.write('	background: #fff;')
	document.write('}')
	document.write('div#Header {')
	document.write('	background: #fff;')
	document.write('}')
	document.write('div#Header p {')
	document.write('	background: #fff;')
	document.write('}')
	document.write('</style>')

	self.print()
}


// reading a variable in the parsed string
function getParm(string,parm) {
	string = string.replace(/%26/g,"&")
	var startPos= string.indexOf(parm+"=")
	if (startPos> -1) {
		startPos= startPos+parm.length+1
		var endPos= string.indexOf("&",startPos)
		if (endPos== -1) endPos= string.length
		//alert(string+ ": string.substring("+startPos+","+endPos+") = "+string.substring(startPos,endPos))
		return unescape(string.substring(startPos,endPos))
	}
	return ''
}


// _______________________________________________________________________
// -----------------------------------------------------------------------
//
//                              M  A  I  N
// _______________________________________________________________________
// -----------------------------------------------------------------------

var parsed	= window.location.search.substring(1)
var lang	= getParm(parsed,"lang")
var printme	= getParm(parsed,"print")
var from	= getParm(parsed,"from")

// StatCounter variables
var sc_project	= 615236
var sc_partition= 3
var sc_security	= "f9c8803f"
var sc_invisible= 1

var linktext = new Array()
var linkaddr = new Array()

// check if referrer is set
if(from != "") {
	// keep cookie for some years
	cookie_life = 356	// days (= 1 year)
	expirationDate = new Date()
	expirationDate.setTime(expirationDate.getTime() + 1000 * 60 * 60 * 24 * cookie_life)
	Set_Cookie("from", from, expirationDate)
}

if(lang == "de") {
	linktext["home"]	= "Start"
	linkaddr["home"]	= "../home/index.html"
	linktext["temp"]	= "Templates"
	linkaddr["temp"]	= "../home/templates.html"
	linktext["links"]	= "Links"
	linkaddr["links"]	= "../home/links.html"
	linktext["contact"]	= "Kontakt"
	linkaddr["contact"]	= "../home/contact.html"
} else {
	linktext["home"]	= "Home"
	linkaddr["home"]	= "http://www.eos4you.com/home/index.html"
	linktext["temp"]	= "Templates"
	linkaddr["temp"]	= "../home/templates.html"
	linktext["links"]	= "Links"
	linkaddr["links"]	= "../home/links.html"
	linktext["contact"]	= "Contact"
	linkaddr["contact"]	= "../home/contact.html"
}

// see http://developer.irt.org/script/976.htm
logo = "../images/eos4you_60.jpg"
logotext = "../images/eos_60.gif"
logotextw = 245
template = ""

var eosfolder = /[\/\\]eos[\/\\]/
var eosfolder2= /[\/\\]de[\/\\]/
if(eosfolder.test(location.pathname) || eosfolder2.test(location.pathname)) {
	logo = "../images/eostemplate_60.jpg"
	logotext = "../images/eos2_60.gif"
	logotextw = 269
	linktext["home"] = "EOS4you"
	template = "eos"
}


if(printme == 1) printPage()


// cookie functions
function Get_Cookie(name) {
	var start = document.cookie.indexOf(name+"=");
	var len = start+name.length+1;
	if ((!start) && (name != document.cookie.substring(0,name.length))) return "";
	if (start == -1) return "";
	var end = document.cookie.indexOf(";",len);
	if (end == -1) end = document.cookie.length;
	return unescape(document.cookie.substring(len,end));
}
function Set_Cookie(name, value, expires, path, domain, secure) {
	document.cookie = name + "=" +escape(value) +
			( (expires) ? ";expires=" + expires.toGMTString() : "") +
			( (path) ? ";path=" + path : "") + 
			( (domain) ? ";domain=" + domain : "") +
			( (secure) ? ";secure" : "");
}
function Delete_Cookie(name, path, domain) {
	if (Get_Cookie(name))
		document.cookie = name + "=" +
		( (path) ? ";path=" + path : "") +
		( (domain) ? ";domain=" + domain : "") +
		";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

