
function popup(b,gr_title)
{

for (var i=0; i<document.images.length; i++)
    if (document.images[i]==b) {break;}
a=document.images[i].src;
pic=new Image();
pic.src=a;
h=pic.height;
w=pic.width;

    t=(screen.height-h)/2;
    l=(screen.width-w)/2;

if (pic.width <= 0 || pic.height <= 0){
  setTimeout("popup_for_image('" + a + "');", 500);
//setTimeout("popup("+b+","+gr_title+");", 500);
}
else
{
var fenster2 = window.open('','','width='+w+',height='+h+',top='+t+',left='  +l+',location=no, statusbar=no, directories=no, resizable=no, menubar=no, toolbar=no, scrollbars=no');fenster2.focus();
if (gr_title="") gr_title="Bild";
fenster2.document.open();
fenster2.document.write("<html><head><title>"+gr_title+"</title></head><body leftmargin=0 topmargin=0 margindwidth=0 marginheight=0>");
fenster2.document.write("<img src="+a+">");
fenster2.document.write("</body></html>");
fenster2.document.close();
fenster2.focus();
}
}


function popup_for_image(a,gr_title)
{
pic=new Image();
pic.src=a;
h=pic.height;
w=pic.width;

    t=(screen.height-h)/2;
    l=(screen.width-w)/2;

if (pic.width <= 0 || pic.height <= 0){
  setTimeout("popup_for_image('" + a + "');", 500);
}
else
{
var fenster2 = window.open('','','width='+w+',height='+h+',top='+t+',left='  +l+',location=no, statusbar=no, directories=no, resizable=no, menubar=no, toolbar=no, scrollbars=no');fenster2.focus();
if (gr_title="") gr_title="Bild";
fenster2.document.open();
fenster2.document.write("<html><head><title>"+gr_title+"</title></head><body leftmargin=0 topmargin=0 margindwidth=0 marginheight=0>");
fenster2.document.write("<img src="+a+">");
fenster2.document.write("</body></html>");
fenster2.document.close();
fenster2.focus();
}
}


$(document).ready(function(){

	$("form").submit( function() {
	  return formValidating(document.formID);
	 } );

//$('img[@src$=.png]').ifixpng(); 
//$('img[@src$=.png]').iunfixpng(); 
$(".grthaedermenu").css("visibility","visible");



o = document.getElementsByTagName("object");
for(i=0; i<o.length; i++) {
o[i].outerHTML = o[i].outerHTML;
}


$(".transp").click(function() {
prjTbName= 	$(this).attr("name");
window.parent.gr_showtiny(	$(this).attr("id"),	$(this).attr("name"), prjTbName, $(this.previousSibling).attr("name"));
});

$(".transp").mouseover( function() { 
	$(this).fadeTo("fast", 0.6);
});
$(".transp").mouseout( function() { 
	$(this).fadeTo("fast", 0.0);

});




$("input").focus(function() {

var attrius=$(this).attr("type");

if (attrius=="text" || attrius=="password" || attrius=="textarea"  ) $(this).css("background-color","#fff");
if (attrius=="checkbox" || attrius=="radio") $(this).parent().css("background-color","#fff");
});




/*
$(".grtopnav").mouseover( function() { 
	var imgname=$(this).attr( "src");
	var imgnameArray = imgname.split(".");
	$(this).attr( "src", imgnameArray[0]+"_u"+".jpg");
});
$(".grtopnav").mouseout( function() { 
	var imgname=$(this).attr( "src");
	var imgnameArray = imgname.split(".");
	var imgnameArray0 = imgname.split("_");
	$(this).attr( "src", imgnameArray0[0]+".jpg");
});
*/

//grazersoft images





$(".grtopnav").hover(function(){
imgSwap(this);
},function(){
imgSwap(this);
});




//$(".grtopnav").mouseover( function() { alert("222");PNGswap(this); } );
//$(".grtopnav").mouseout( function() { PNGswap(this); } );


/*
$(".grtopnav").hover(function(){
	alert ($(this).attr( "src"));
	var imgname=$(this).attr( "src");
	var imgnameArray = imgname.split(".");
	$(this).attr( "src", imgnameArray[0]+"_u"+"."+imgnameArray[1]);
},function(){
	var imgname=$(this).attr( "src");
	var imgnameArray = imgname.split(".");
	var imgnameArray0 = imgname.split("_");
	$(this).attr( "src", imgnameArray0[0]+"."+imgnameArray[1]);
});
*/


$("#grtheader0").css("display","block");


if ($("#homeswfextra").css("display")=="none") StartTimer();


$("homeswfextra").mousemove( function() { 
//alert("test"); 
} );

$("#homeswfextra").hover(function(){
	//$("#homeswfextra").css("display","none");
	//$(".content").css("display","block");
	StartTimer();
},function(){

});






//grazersoft end


//							$("#loading").css("display","none");


});

function homeintro(oImg){
$('#homeswf').css('display','none');
$('#home').css('display','block');
}
function homeintro2(oImg){
	$("#homeswfextra").css("display","none");
	$(".content").css("display","block");
	StartTimer();
}
function imgSwap(oImg)
{
   var strOver  = "_on.png"    // image to be used with mouse over
   var strOff = "_off.png"     // normal image
   var strImg = oImg.src
   if (strImg.indexOf(strOver) != -1) 
      oImg.src = strImg.replace(strOver,strOff)
   else
      oImg.src = strImg.replace(strOff,strOver)
}
/**/


function checkEmail (strng) {
var ret=true;
if (strng == "") {
   ret = false;
}
    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       ret = false;
    }
    else {
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          ret = false;
       }
    }
return ret;    
}

var strKlassenName = "novalidate";
var u1sercolor="#e51635";
var strPattern = eval("/"+strKlassenName+"/");
function formValidating(objForm){
	  var blnSend = true;
		  for(var i=0; i<objForm.elements.length; i++){

			var objElement = objForm.elements[i];
				if (objElement.type=="text" || objElement.type=="password" || objElement.type=="textarea" ){
				var gr_match1=objElement.value;
				var illegalChars1= /[\(\)\<\>\\\"\[\]]/
				if (gr_match1.match(illegalChars1))  {objElement.style.backgroundColor = u1sercolor; blnSend = false;} else objElement.style.backgroundColor = "";
				}

				if (objElement.type=="text" || objElement.type=="password" )
						if(objElement.className.search(strPattern) == -1){
								
								
								if(objElement.value.length < 1 ) {
								objElement.style.backgroundColor = u1sercolor; blnSend = false;
								} else if(objElement.value.length >= 3) {
								objElement.style.backgroundColor = "";
								}
								if (objElement.name.search("email") >=0){
								var valid=objElement.value;
								if (checkEmail(objElement.value)==true) objElement.style.backgroundColor = ""; else {objElement.style.backgroundColor = u1sercolor; blnSend = false;}
								}
		
							var gr_match=objElement.value;
							var illegalChars= /[\(\)\<\>\\\"\[\]]/
							if (gr_match.match(illegalChars))  {objElement.style.backgroundColor = u1sercolor; blnSend = false;} else if (blnSend == true) objElement.style.backgroundColor = "";
		
				}
				if (objElement.type=="checkbox" )
				if(objElement.className.search(strPattern) == -1){
				  if(objElement.checked == false) {
					objElement.parentNode.style.backgroundColor = u1sercolor; blnSend = false;
				  } else if(objElement.checked == true) {
					objElement.parentNode.style.backgroundColor = "";
				  }
				}

				if (objElement.type=="radio" )
				if(objElement.className.search(strPattern) == -1){
					var boolRadio = false; 
					for(var z=0; z<objForm.elements[objElement.name].length; z++){
						if (objForm.elements[objElement.name][z].checked) {boolRadio = true; }
					}
				  if(boolRadio == false) {
					objElement.parentNode.style.backgroundColor = u1sercolor; blnSend = false;
				  } else if(boolRadio == true) {
					objElement.parentNode.style.backgroundColor = "";
				  }
				}
		  }
	  return blnSend;
}


var dStartTime;       
var bRunning = false; 
function StartTimer()
{
  //if( bRunning )  return;
  bRunning = true;          
  dStartTime = new Date();  
  ShowTime();               
}
function StopTimer()
{
  bRunning = false;         
}
function ShowTime()
{
	if( !bRunning ) 
	return;
	var dDeltaTime = new Date();  
	dDeltaTime.setTime( new Date() - dStartTime ); 
	var sMin = dDeltaTime.getMinutes(); 
	var sSec = dDeltaTime.getSeconds(); 
	var sHours = Math.floor( dDeltaTime / 3600000 );
	sMin = ( sMin < 10 ) ? "0" + sMin : sMin;
	sSec = ( sSec < 10 ) ? "0" + sSec : sSec;
	//document.forms[0].sTime.value = sHours + ":" + sMin + ":" + sSec;
	setTimeout('ShowTime()', 1000);
	if (sMin==5 && sSec==0){
		$("#homeswfextra").html('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="1000" height="600" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="UserFiles/File/flash/fachbereich_home6ola.swf" /><embed type="application/x-shockwave-flash" width="1000" height="600" src="UserFiles/File/flash/fachbereich_home6ola.swf"></embed></object>');
		$("#homeswfextra").css("display","block");
		$(".content").css("display","none");
	}
}


