function resetFields(whichform) {

	var url = window.location.href;

	if(url.indexOf("do=send")<0) {

		for (var i=0; i<whichform.elements.length; i++) {
			var element = whichform.elements[i];

			if(element.type == "submit") continue;
			if(element.type == "radio") continue;
			if(element.type == "checkbox") continue;
			if(!element.defaultValue) continue;

			element.onfocus = function() {
				if(this.value == this.defaultValue) this.value = "";
			}
			element.onblur = function() {
				if(this.value == "") this.value = this.defaultValue;
			}
		}
	}
}
function prepareForms() {
	for(var i=0; i<document.forms.length; i++) {
		resetFields(document.forms[i])
	}
}

function defeatFocusRects() {
	a = document.getElementsByTagName("a");
	al = a.length;
	while(al--) {
		a[al].onfocus = function() {
			this.blur();
		}
	}
}
$(document).ready(function() {
	
	$("a[@href^=http]").each(
	   function(){
		  if(this.href.indexOf(location.hostname) == -1) { 
	      $(this).attr('target', '_blank');
	    }
	});
	
	$('dl dt').css("cursor", "pointer");
	$('dl dt strong').css("cursor", "pointer");
	$('dl dt span').css("cursor", "pointer");
	$('#imageContainer').innerfade({
		speed: 1000,
		timeout: 5000,
		type: 'random_start',
		containerheight: '225px'
	});
	$('#kat_order a').lightBox({fixedNavigation:true});
	$('#anfahrt a').lightBox({fixedNavigation:true});
	$('#content .box a').lightBox({fixedNavigation:true});
	$('#sidebar a').lightBox({fixedNavigation:true});
	
	$('#lb_comp_1 a').lightBox({fixedNavigation:true});
	$('#lb_comp_2 a').lightBox({fixedNavigation:true});
	$('#lb_comp_3 a').lightBox({fixedNavigation:true});
	$('#lb_comp_4 a').lightBox({fixedNavigation:true});
	
	$('#lb_team_1 a').lightBox({fixedNavigation:true});
	$('#lb_team_2 a').lightBox({fixedNavigation:true});
	$('#lb_team_3 a').lightBox({fixedNavigation:true});
	$('#lb_team_4 a').lightBox({fixedNavigation:true});
	$('#lb_team_5 a').lightBox({fixedNavigation:true});
	$('#lb_team_6 a').lightBox({fixedNavigation:true});
	$('#lb_team_7 a').lightBox({fixedNavigation:true});	
	$('#lb_team_8 a').lightBox({fixedNavigation:true});	
	
	$('#lb_3col_1 a').lightBox({fixedNavigation:true});	
	$('#lb_3col_2 a').lightBox({fixedNavigation:true});	
	$('#lb_3col_3 a').lightBox({fixedNavigation:true});	
	
	$('#markenartikel a').lightBox({fixedNavigation:true});	
	
	$("tr td:first").css("width", "90px");
	
	prepareForms();
	defeatFocusRects();
});
