/*	Copyright (c) 2001-2002, Dirk Fahland
	licensed to Turberg - http://www.turberg.de
*/

// simple var to check from other html-files where to locate this script-file
// in the window-hierarchy

var basic = true;

var pagehome = "http://www.turberg.de/";
//var pagehome = "file:///f:/webpages/turberg.de/website/";
//var pagehome = "file:///d:/eigene dateien/turberg.de/2002-03-12/";

// --------------------------- browser functions check -------------------
var nv_dom1 = false;
var nv_layers = false;
var nv_all = false;
var nv_img = false;

var nv_ver = 0;
var nv_ie = false;
var nv_nc = false;

function check_nv_functions ()
{
	if (document.all)
		nv_all = true;

	if (document.layers)
		nv_layers = true;

	if (document.images)
		nv_img = true;

	if (document.getElementById && document.createElement) // key DOM1 functions
		nv_dom1 = true;

	nv_ver = navigator.appVersion.substring(0,1);

	if (navigator.appName.substring(0,8) == "Netscape")
		nv_nc = true;
	else if (navigator.appName.substring(0,9) == "Microsoft")
		nv_ie = true;

//	alert ("The current browser allows\ndocument.all:"+nv_all+"\ndocument.layers:"+nv_layers+"\ndocument.images:"+nv_img+"\nDOM 1:"+nv_dom1+" .\nIE:"+nv_ie+"\nNetscape:"+nv_nc+"\nver:"+nv_ver);
}

/**
 * returns true if the browser is Netscape 4.X
 */
function NV_NC4x () {
	return (nv_nc && (nv_ver < 5))
}

// -------------------- index-frame-writer------------------------

function create_frames () {

	var width = 180;
	var height = 20;

	// Netscape 4.x is displaying frames very strange, re-arrange width
	if (NV_NC4x()) {
		width += 05;
		height += 05;
	}

	document.writeln('<frameset rows="100,*,'+height+'" border=0 frameborder=0 framespacing=0>');
	document.writeln('	<frame src="html'+self.lang+'/toptitle.html" 		name="titel" scrolling=no 	marginwidth=0 marginheight=0 noresize border=0 frameborder=0 framespacing=0>');
	document.writeln('	<frameset cols="'+width+',*" border=0 frameborder=0 framespacing=0>');
	document.writeln('		<frame src="html'+self.lang+'/navleft.html" 	name="links" marginwidth=0 marginheight=0 noresize border=0 frameborder=0 framespacing=0>');
	document.writeln('		<frame src="html'+self.lang+'/main.html" 		name="content" scrolling=yes 	marginwidth=0 marginheight=0 noresize border=0 frameborder=0 framespacing=0>');
	document.writeln('	</frameset>');
	document.writeln('	<frame src="html'+self.lang+'/counter.html" name="counter"  scrolling=no marginwidth=0 marginheight=0 noresize border=0 frameborder=0 framespacing=0>');
	document.writeln('</frameset>');
}

// -------------------- multi-language handling ------------------

var lang = "";

function setLanguageEnglish ()
{
	lang = "en";
}

function setLanguageDeutsch ()
{
	lang = "";
}

/* change_language

	changes the language of the page, reloads the whole frameset
*/
function change_language ( this_lang )
{
	if (this_lang == "en")
	{
		self.location.href = pagehome+"indexen.html";
	}
	else if (this_lang == "de")
	{
		self.location.href = pagehome+"index.html";
	}
}

// ------------------------ shop-interface ---------------------

var shoploaded = false;

/**
 * load_shop
 * loads the shop-pages for the navigation-bar and the content-frame
*/
function load_shop ()
{
	if (!shoploaded)	// only load the navigation-page, if it's not already loaded
	{					// to avoid cookie-deleting
		window.links.location.replace (pagehome+"/shop/nav.htm");
		shoploaded = true;
	}
	
	window.content.location.replace (pagehome+"/shop/main.htm");	
}

/**
 * load_shop_target
 * loads the shop-pages for the navigation-bar and the content-frame
 * specifies a special page to be loaded with the shop
*/
function load_shop_target (target)
{
	if (!shoploaded)	// only load the navigation-page, if it's not already loaded
	{					// to avoid cookie-deleting
		window.links.location.replace (pagehome+"/shop/nav.htm");
		shoploaded = true;
	}
	
	window.content.location.replace (pagehome+"/shop/"+target+".htm");	
}

/**
 * unload_shop
 * loads the normal pages for the navigation-bar and the content-frame
*/
function unload_shop ()
{
	if ( (window.links.menu.document.cookie.indexOf("TheBasket") != -1)
		&& (window.links.menu.document.cookie.indexOf("[") != -1)
		&& !confirm(SW_return_text(this.lang, "shopleave")) )
	{
		return;
	}

	window.links.location.replace (pagehome+"/html"+lang+"/navleft.html");
	window.content.location.replace (pagehome+"/html"+lang+"/main.html");
	shoploaded = false;
}

