var dom = document.getElementById?1:0;
var ns4 = document.layers?1:0;

function init()
{

 posx = (( screen.availWidth / 2 ) + 200);

 if (dom) 
 {
 //document.getElementById("news").style.visibility = "visible";
 document.getElementById("news").style.left = posx;
 }
 else if(ns4) {
 //document['news'].visibility = "visible";
 document['news'].left = posx;
 }
}


function newWin(file, name, w, h, center, posx, posy, menu, tool, location, scroll, status, resize)
{

	h = h + 15;

	if ( h > 600 )
	{
		h = 600;
		w  = w + 19;
		scroll = '1';
		resize = '1';
	}
		
	if ( w > 800 )
	{ 
		w = 800;
		h = h + 19;
		scroll = '1';
		resize = '1';
	}

	infoWin = open('', '', ',width=' + w + ',height=' + h  + ',menubar=' + menu + ',toolbar=' + tool + ',location=' + location
						 		   + ',scrollbars=' + scroll + ',status=' + status + ',resizable=' + resize + "'");

	infoWin.document.writeln('<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">');
	infoWin.document.writeln('');
	infoWin.document.writeln('<html>');
	infoWin.document.writeln('<head>');
	infoWin.document.writeln('	<title>Zoom</title>');
	infoWin.document.writeln('<link rel=\"stylesheet\" type=\"text/css\" href=\"css/styles.css\">');	
	infoWin.document.writeln('</head>');
	infoWin.document.writeln('');
	infoWin.document.writeln('<body leftmargin=\"0\" topmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\" marginwidth=\"0\" marginheight=\"0\">');
	infoWin.document.writeln('');
	infoWin.document.writeln('');
	infoWin.document.writeln('<img src=\"'+ file+'\" border=\"0\">');
	infoWin.document.writeln('');		
	infoWin.document.writeln('<center><a class=\"nav\" href=\"javascript:self.close()\">Fenster schliessen!</a></center>');	
	infoWin.document.writeln('');		
	infoWin.document.writeln('</body>');
	infoWin.document.writeln('</html>');
	
	if (center == true)
		{
				posx = ( screen.availWidth - w ) / 2;
				posy = ( screen.availHeight - h ) / 2;
		}

		
	infoWin.moveTo(posx,posy);
	infoWin.focus();
}



function zoomWin(file, name, w, h, center, posx, posy, menu, tool, location, scroll, status, resize)
{

	prefix = '../';
	
	y = h + 80;
	x = w + 30;
	
	galWin = open(file, 'zoom', ',width=' + x + ',height=' + y  + ',menubar=' + menu + ',toolbar=' + tool + ',location=' + location
						 		   + ',scrollbars=0'  + ',status=' + status + ',resizable=' + resize + "'");
								   
	if (center == true)
		{
				posx = ( screen.availWidth - x ) / 2;
				posy = ( screen.availHeight - y ) / 2;
		}

		
	galWin.moveTo(posx,posy);
	galWin.focus();
}

function timer(pic)
{
	bild = pic;
	window.setTimeout("fade(bild)",2000);	
}


function fade(bild)
{

  document.all.DynBild.filters.blendTrans.Apply();
  document.all.DynBild.src = bild;
  document.all.DynBild.filters.blendTrans.Play();
 
 }
 
 
function isAble(formName, value)
{
	if (value != 0)
	{
		formName.disabled = false;
	}
	else
	{
		formName.disabled = true;	
	}
}

function isAnrede(formName, value)
{
	if (value == 0)
	{
		formName.firma.className = "inputfix";
		//formName.name.className = "input";
	}
	else
	{
		formName.firma.className = "input";
		//formName.name.className = "inputfix";
	}
}


function checkForm(f)
{
	var i; 
	var ret = true;
	
	for(i = 0; i < f.elements.length; i++)
	{
		if ((f.elements[i].type == 'text') && (f.elements[i].className == 'inputfix'))
		{
			if (f.elements[i].value == "") 
			{
				ret = false;
			}
		}
	}
	return ret;
}


function check(formElement, value, checkType)
{
//var exprTxt = ;
var exprStr = /\w{5,}\.?\s+\d+/;
var exprTel = /^[\d\(\)\/]{4,13}$/;
var exprPlz = /^\d{5}$/;
var exprMail = /^[a-zA-Z0-9_\.-]{2,}@[a-z0-9-]{3,}\.[a-z]{2,4}|museum$/;
var exprDom = /^[a-z0-9-]{3,}\.[a-z]{2,4}|museum$/;


	switch(checkType)
	{
	case "txt":
		if (value == "")
		{
			formElement.className = "inputwrong";
		}
		else
		{
			formElement.className = "inputfix";
			
		}
		break;

	case "str":
		result = exprStr.test(value); 

		if (result == true) 
		{ 
			formElement.className = "inputfix";
		} 
		else 
		{ 
			formElement.className = "inputwrong";
		}

		break;
				
	case "tel":
		result = exprTel.test(value); 

		if (result == true) 
		{ 
			formElement.className = "inputfix";
		} 
		else 
		{ 
			formElement.className = "inputwrong";
		}
		break;
		
	case "plz":
		result = exprPlz.test(value); 

		if (result == true) 
		{ 
			formElement.className = "inputfix";
		} 
		else 
		{ 
			formElement.className = "inputwrong";
		}
		break;
		
	case "mail":
		result = exprMail.test(value); 

		if (result == true) 
		{ 
			formElement.className = "inputfix";
		} 
		else 
		{ 
			formElement.className = "inputwrong";
		}
		break;

	case "dom":
		result = exprDom.test(value); 

		if (result == true) 
		{ 
			formElement.className = "inputfix";
		} 
		else 
		{ 
			formElement.className = "inputwrong";
		}
		break;			
	default:
		formElement.className = "inputfix";			
	}
	
}
 
