/*
'	$Id: global.js 1519 2007-10-23 08:40:21Z bernd $
'	$Date: 2007-10-23 10:40:21 +0200 (Di, 23 Okt 2007) $
'	$HeadURL: svn://server01/Fiat/trunk/include/global.js $
'	$Revision: 1519 $
'
'	Name:		
'	Funktion:	
'
'	Aufruf:		-
'				
'	Projekt:	Fiat: wartung 2007
'				
'	Änderungen:	23.10.2007, BOH:	tagged
*/
/*############################################################################
'##
'##	global.js
'##
'##############################################################################
'##
'##	Projekt:	Fiat: CC-Relaunch 2004
'##
'##	Beschreibung:
'##
'##		versch. Routinen und Funktionen fuer allgemeinen Gebrauch
'##
'##	Autor:		Arc Interactive, Hamburg
'##
'##
'##############################################################################
'##
'##
'##
'##
'############################################################################*/

//
//	ErrorHandler
//
function ErrorHandler( msg, url, line ) {

	// @Live: alle Fehlermeldungen aus !
 	// alert ( 'Zeile:' + line + '\n' + msg + '\n' + url + '\n');

	return true;
}

// nur im INTRA: Fehlermeldung via Browser, KEIN eigener Fehler-Handler (!)
window.onerror = ErrorHandler;
// nur im INTRA: Fehlermeldung via Browser, KEIN eigener Fehler-Handler (!)

//
//	OpenWindow
//
function OpenWindow( theURL, theTitle, theParams, theHeight, theWidth, isCenter )
{

	//
	// alert( theURL+ '|' +theTitle+ '|' +theParams+ '|' +theHeight+ '|' +theWidth+ '|' +isCenter );
	//alert( theHeight+ '|' +theWidth );
		
	//
	var theNewWindow   = null;
	var theFinalParams = "";

	//
	if( theHeight && theHeight != "" ) theFinalParams  = 'height=' + theHeight + ',';
	if( theWidth  && theWidth  != "" ) theFinalParams += 'width='  + theWidth  + ',';
	theFinalParams += theParams;

	//
	theNewWindow = window.open( theURL, theTitle, theFinalParams );
	
	if( theNewWindow.focus() ) theNewWindow.focus();

	//
	if( isCenter && (theHeight && theHeight != "") && (theWidth && theWidth != "") )
	{
		theNewWindow.moveTo( (screen.width-theWidth)/2 , (screen.height-theHeight)/2 );
	}

}

//
//	Open in same Window
//
function OpenSameWindow(theURL) {

    window.location = theURL;

    if (theNewWindow.focus()) theNewWindow.focus();

    //
    if (isCenter && (theHeight && theHeight != "") && (theWidth && theWidth != "")) {
        theNewWindow.moveTo((screen.width - theWidth) / 2, (screen.height - theHeight) / 2);
    }

}


//
//	CenterWindow
//
function CenterWindow( win, width, height )
{
	var winl = Math.floor((screen.width-width)/2);
	var wint = Math.floor((screen.height-height)/2);

	if (winl < 0) winl = 0;
	if (wint < 0) wint = 0;

	win.moveTo(winl, wint);
}

//
//	AntiZ	(JavaScript-Version)
//
//	ersetzt im String 'theCarCode' die zweite Stelle durch eine '0'
//
//	Hintergrund:
//	Nach Einbau der "MotorMatrix" können CarCodes auftreten, deren Markenschlüssel geändert wurde:
//	Fiat: 0Z (statt 00) / Lancia: 7Z (statt 70) / Alfa: 8Z (statt 80)
//	Um diese "Automatik-CarCodes" wieder in den Originalzustand zu versetzen, gibt es "AntiZ".
//
function AntiZ( theCarCode )
{
	return( theCarCode.substring( 0, 1 ) + '0' + theCarCode.substring( 2, theCarCode.length ) );
}

//
//
//
/*
function GetElementInDocument( theDocument, theID )
{
	if( theDocument.getElementById )
	{
		if( theDocument.getElementById( theID ) )	return( theDocument.getElementById( theID ) );
	}	
	else
	if( theDocument.all )
	{
		if( theDocument.all[ theID ] )				return( theDocument.all[ theID ] );
	}
	else
	if( theDocument.layers )
	{
		if( theDocument.layers[ theID ] )			return( theDocument.layers[ theID ] );
	}
	else
	{
												return( null );
	}
}
*/
/*	       END $Id: global.js 1519 2007-10-23 08:40:21Z bernd $ END   '*/

