// JavaScript Document
// Errors

window.onerror=fehler;
 function fehler(){
return true;
}

function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}

addLoadEvent(function() {
if (window.location.host.search("roactemra")!=-1)
 {
	pagelinks=document.createElement("div");
	if(document.getElementById("col1"))
	document.getElementById("col1").insertBefore(pagelinks,document.getElementById("first"));
	else if(document.getElementById("sp1"))
	document.getElementById("sp1").insertBefore(pagelinks,document.getElementById("first"));

	pagelinks.setAttribute("style","float:right;width:149px;height:17px;background:url(../images/layout/bg_line_dotted.gif) bottom repeat-x;",0);
	pagelinks.innerHTML='<a  href="javascript:print();" style="float:left;padding-left:17px;height:14px;background:url(../images/layout/ico_print.gif) no-repeat;color:#878787;text-decoration:none;margin:0 5px 0 15px;">Drucken</a>';
pagelinks.setAttribute("class","pagelinks",0);
 }
})
$(document).ready(function(){
	$("#contact-form").submit(function() {
		var bAllValid = true;
		$("input.required").each(function() {
			if(this.value == "") {
				bAllValid = false;
				$(this).addClass("invalid");				
				$("label[for='" + this.id + "']").each(function() {
					$(this).addClass("invalid");
				});
			} else {
				$(this).removeClass("invalid");				
				$("label[for='" + this.id + "']").each(function() {
					$(this).removeClass("invalid");
				});
			}
		});
		
		$("select.required").each(function(sValue, oElement) {
			if(this.value == 0) {
				bAllValid = false;
				$(this).addClass("invalid");				
				$("label[for='" + this.id + "']").each(function() {
					$(this).addClass("invalid");
				});
			} else {
				$(this).removeClass("invalid");				
				$("label[for='" + this.id + "']").each(function() {
					$(this).removeClass("invalid");
				});
			}
		});
		
		if(bAllValid == false) {
			$("#form-validation-error").addClass("show");
		} else {
			$("#form-validation-error").removeClass("show");
		}
		
		return bAllValid;
	});
});

function show_pic(pic_loc){
	// if(popWin != null) if(!popWin.closed) popWin.close()      
	ref=self.location.pathname;
	theURL = "/services/show_pic.html?pic="+pic_loc+"&sid="+"&opener="+ref;
 	popWin = window.open(theURL,'picture','width=1,height=1,scrollbars=auto,toolbar=no,location=no,status=no,resizable=yes,top=0,left=0');
}



