// _________________________________________________________________
//
// File	:   	comgate.js
// Project	:   03U6 e-Commerce Shop
// Copyright:   (c) 2000 Powersoft AG, Bern
// Author 	:   Tom Faller
// Created	:   06.12.1999
// System	:   JavaScript1.0-Capable Browser
// Description   :   Initialization and global functions.
// Modification  :   00.00.0000 / V 0.00.00 / tf /
//_________________________________________________________________

var isExplorer4plus = false;
var isNavigator5plus = false;
var isExplorer5plus = false;

//Get browser for animation:
if (navigator.userAgent.indexOf("MSIE") != -1)
{
	var index = navigator.userAgent.indexOf("MSIE")
	if (navigator.userAgent.substring(index+5,index+6) >= 4) isExplorer4plus = true;
	if (navigator.userAgent.substring(index+5,index+6) >= 5) isExplorer5plus = true;
}
else if (navigator.userAgent.indexOf("Mozilla") != -1 && navigator.appVersion.substring(0,1) >= 5) isNavigator5plus = true;

function printFileDate()
{
		modified = new Date(document.lastModified);
		year = modified.getYear(); 
		month = modified.getMonth() + 1;
		// Handle browser specific bugs:
		if (year < 100) year += 2000;
		if (year < 2000 && year >= 1900) year += 100; //Explorer 4
		if (year > 2050) year -= 70; //Navigator 4.5
		// Print out:
		document.write("Last Update " + month + "/" + modified.getDate() + "/" + year); 	
}

function redirect(url,secs)
{
	if (secs == 0)
	{
		window.location.href = url;
	}
	else
	{
		var output = "This page will transfer in ";
		output += secs + "s";
		window.status = output;
		secs=secs-1;
		var command = "redirect('"+ url + "', " + secs +")";
		window.setTimeout(command, 1000);	//run after 1000 millisecs
	}
}

function validateInput()
{
	var formComplete=true;
	var msg="Vervollstaendigen Sie bitte Ihre Angaben. Um Ihre Anfrage bearbeiten zu koennen, benoetigen wir folgende Angaben:\n";
	if (document.forms[0].kommentar.value.length == 0)
	{
		msg+="- Ihr Projektbeschrieb/Anforderungen\n";
		document['inputKommentar'].src = 'images/missing.gif';
		formComplete=false;
		document.forms[0].kommentar.focus();
	}
	else document['inputKommentar'].src = 'images/blindy.gif';
	if (document.forms[0].name.value.length == 0)
	{
		msg+="- Name\n";
		document['inputName'].src = 'images/missing.gif';
		if (formComplete) document.forms[0].name.focus();
		formComplete=false;
	}
	else document['inputName'].src = 'images/blindy.gif';
	if (document.forms[0].vorname.value.length == 0)
	{
		msg+="- Vorname\n";
		document['inputVorname'].src = 'images/missing.gif';
		if (formComplete) document.forms[0].vorname.focus();
		formComplete=false;
	}
	else document['inputVorname'].src = 'images/blindy.gif';
	if (document.forms[0].firma.value.length == 0)
	{
		msg+="- Firma\n";
		document['inputFirma'].src = 'images/missing.gif';
		if (formComplete) document.forms[0].firma.focus();
		formComplete=false;
	}
	else document['inputFirma'].src = 'images/blindy.gif';
	if (document.forms[0].tel.value.length == 0)
	{
		msg+="- Telefonnummer\n";
		document['inputTel'].src = 'images/missing.gif';
		if (formComplete) document.forms[0].tel.focus();
		formComplete=false;
	}
	else document['inputTel'].src = 'images/blindy.gif';
	if (formComplete) return true; 
	else
	{
		alert(msg);
		return false;
	}
}

function inputFocus(object, on)
{
	if (isExplorer4plus)
	{
		if (on) object.style.backgroundColor='#CECF9C';
		else object.style.backgroundColor='#DEDCCA';
	}
}
//-----------------------------------------------------------------
// Name          :	openWindow()
// Returns       :	
// Description   :	Opens a simple window displaying sourceUrl
// Created       :	20.09.1999
// Modification  :   00.00.2001 / V 1.00.00 / tf / release
//-----------------------------------------------------------------

function openWindow(name, width, height, scrollbar, url)
{
	var outStr = "height=" + height + ",width=" + width;
	outStr = outStr + ",menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=no";
	if (!scrollbar) {
		outStr = outStr + ',scrollbars=no';
	}
	else {
		outStr = outStr + ',scrollbars';
	}
	if (typeof url == "undefined") url="";
	w = window.open(url, name, outStr);
	w.focus();
}

//-----------------------------------------------------------------
// Name          :	openWindow()
// Returns       :	
// Description   :	Opens a simple window displaying sourceUrl
// Created       :	20.09.1999
// Modification  :   00.00.2001 / V 1.00.00 / tf / release
//-----------------------------------------------------------------

function addFavorite()
{
	window.external.AddFavorite(location.href, document.title);
}
