/*
	Version 1.00
	(c) 2002 insign gmbh
	written by mk
	last change 30.07.2002 [mk]
	
	history:
	1.00	30.07.2002	initial Version
	1.01	22.08.2003  Changed from Marcel Tschopp: variable autoPos => if set to true, the layer will move to the right position when resizing the window
	1.02	19.09.2003	Changed from Marcel Tschopp: lArr['help']['centeredDesign'] => if set to true, the layer will be positioned at the middle position of the window plus xDist
*/
scriptPath='jscripts/';
usedScripts=new Array();
usedScripts['forms.js']=true;
usedScripts['validationFunctions.js']=true;
usedScripts['formsLayer.js']=false;
usedScripts['slideLayer.js']=false;
usedScripts['formImages.js']=false;
usedScripts['fixLayer.js']=false;
usedScripts['fadeElements.js']=false;
usedScripts['fadeLayer.js']=false;
usedScripts['shopFunctions.js']=false;
usedScripts['formFunctions.js']=true;

doNotInit=new Array();
doNotInit['Search']=true; //enter the names of the forms without formcheck
doNotInit['loginForm']=true;

//-----------------forms layer-----------------
layerSource="<table border=0 cellpadding=borderSize cellspacing=0 width=layerWidth><tr><td class=borderStyle><table border=0 cellpadding=tableCellpadding cellspacing=0 width=100%><tr><td width=100% class=bgStyle><span class=fontStyle>textToReplace</span></td></tr></table></td></tr></table>";
eTypes=new Array('help','complete','text','optional');//handled events of the script (can be deleted)
showLyrFor=new Array('text','textarea','password','select-one');//element-types, for which the help-layer should be shown

//don't change
showIt=new Array();
for(i=0;i<showLyrFor.length;i++)
	showIt[showLyrFor[i]]=true;
lArr=new Array();
for(i=0;i<eTypes.length;i++)
	lArr[eTypes[i]]=new Array();

lArgs=new Array('layerWidth','borderSize','tableCellpadding','borderStyle','bgStyle','fontStyle','xDist','yDist','onTop','alignRight');
//end don't change

lArr['help']['centeredDesign']=true;					// if set to true, the layer will be positioned at the middle position of the window plus xDist
lArr['help']['layerWidth']=200;							// width of layer 
lArr['help']['borderSize']=1;							// border size of layer
lArr['help']['tableCellpadding']=3;						// cellpadding in the layer
lArr['help']['borderStyle']='tdhelpborder';				// name of the border style
lArr['help']['bgStyle']='tdhelp';						// name of the background style
lArr['help']['fontStyle']='freq';						// name of the font style
lArr['help']['xDist']=document.layers?50:50;			// distance (x-direction) between image and layer (Netscape) respectively the form element and the layer
														// if lArr['help']['centeredDesign'] is true, the layer will be positioned at the middle position of the window plus xDist
lArr['help']['yDist']=document.layers?-12:0;			// distance (y-direction) between image and layer (Netscape) respectively the form element and the layer
lArr['help']['onTop']=false;							// if true the layer is placed on top of the form element
lArr['help']['alignRight']=document.layers?680:680;		// for values != 0 the help layer will be fixed in x-direction at the given position

lArr['complete']['fontStyle']='fcomplete';				// propertys may be overwritten
lArr['optional']['fontStyle']='ftext';
lArr['text']['fontStyle']='ftext';


//-----------------slide layers-----------------
maxStep=20;						//maximal step size
slideTo=20;						//timeout between steps
relSpeed=5;					//the bigger it is the shorter the slow down distance is
xOut=document.layers?680:680;	//for values != 0 the x position of the layre is fixed to the value xOut (pixel)
yOut=-100;						//y position, where the layer is sliding to
autoPos=true;      //if autoPos is set to true, the layer will move to the right position while resizing the window

//-----------------fade elements-----------------
elFadeDuration=.5;		//"fading time" (seconds)
elFadeIn=100;			//"opacity" (%)
elFadeOut=80;			//"opacity" (%)
elFadeStyle=1;			//style (1 to 5)

//-----------------fade layer-----------------
fLayerDuration=1;	//"fading time" (seconds)
fLayerStyle=3;		//style (1 to 5)
fLayerOpacity=90;	//"opacity" (%)

//-----------------fix layer-----------------
//fixes the layer relativ to the position of an image (name='layerPos')
xDist=1;		//distance between layer and image (horizontal)
yDist=1;		//distance between layer and image (vertical)

//-----------------form images-----------------
//needs 3 images ('form.gif','form_ok.gif' and 'form_not_ok.gif')
imgPath='../images/icons/'; //path to the images
imgSrcs=new Array(imgPath+'form.gif',imgPath+'form_ok.gif',imgPath+'form_not_ok.gif'); //srcs of the images
imgEvents=new Array('neutral','ok','not_ok'); 

//-----------------including scripts-----------------
scriptCode='<script language="JavaScript1.2" src="'+scriptPath+'scriptSRC"></script>';

for(i in usedScripts){
	if(!eval("window."+i.replace(/\./,'_')) && usedScripts[i])
		document.write(scriptCode.replace(/scriptSRC/,i));
}

function doResize(isOnload){
	if(usedScripts['formsLayer.js'] || usedScripts['slideLayer.js'] || usedScripts['fixLayer.js'] || usedScripts['fadeLayer.js']) {
		// reposition the layer only if it's a centered design
		if(lArr['help']['centeredDesign']) {
			// calculate the correct x-position
			newXPos=window.innerWidth?Math.floor(window.innerWidth/2)+lArr['help']['xDist']:((document.body && document.body.scrollWidth != 'undefined')?(Math.floor(document.body.scrollWidth/2)+lArr['help']['xDist']):512+lArr['help']['xDist']);
			xOut = newXPos;
			// has to be done in order of correct function...
			for(i=0;i<eTypes.length;i++)
				lArr[eTypes[i]]['alignRight']=newXPos;
			// reposition the layer
			if(getLyrObject('helpLayer') && newXPos && autoPos) {
				getLyrObject('helpLayer').left=newXPos;
			}
  			if(!isOnload && window.doOnresize)
				doOnresize();
		}
	}
}

if(window.onresize)
	doOnresize=window.onresize;
window.onresize=doResize;
