// JavaScript Document

function DropDownMenu()
{
	jQuery(window).load(function(){
		
		//Current ermitteln und setzen
		bodyid = jQuery('body').attr("id");
		
		//check subnavi vorhanden?
		bodysubnavi = jQuery('body').attr('subnavi');
				
		if(typeof bodysubnavi != 'undefined')
		{
			jQuery('#navi-'+bodyid).parent().addClass('current');
			jQuery('#navi-'+bodyid).parent().find('ul').addClass('sfstatic');
		}
		
		//Init Dropdown Menu
		jQuery('ul.sf-menu').superfish({ 
			delay: 1000,                            // one second delay on mouseout 
			speed:       'fast',                          // faster animation speed
			pathClass:  'current',
			disableHI: false,
			
		});
		
		jQuery("#navigation > li > ul, #navigation > li > a").hover(function()
			{
				jQuery(this).parent().find('a').addClass('nav-mouseover');
				jQuery(this).addClass('nav-mouseover');
								
				
			}, function () {
				
				jQuery(this).parent().find('a').removeClass('nav-mouseover');
				jQuery(this).removeClass('nav-mouseover');
					
			});
	
		
		//Submenu Mouseover Effekt	
		jQuery.swapImage(".swap");
		
		//Set Mouseover im Submenu
		path = jQuery('#subnavi-'+bodysubnavi).children().attr('src');
		ext = path.slice(path.indexOf("."),path.length)
		filename = path.replace(ext,"");
		hoverfilename = filename + "_hover.gif";
		jQuery('#subnavi-'+bodysubnavi).children().attr('src',hoverfilename);
			
	});
}


//Shadowbox Img/Media Viewer
//doc: http://www.shadowbox-js.com/usage.html
function jQueryShadowbox(init)
{
	Shadowbox.init({
		handleOversize: "drag",
		modal: true
	});
}

//Easy Version of Submit Form
//http://docs.jquery.com/Plugins/Validation
function jQueryFormmailerA(id)
{
	jQuery(document).ready(function(){	
		
		//idcheckbox = "unterlagen"
		
		jQuery("#"+id).validate({
			errorPlacement: function(error, element) {}, //keine Errors anzeigen
			
			/*
			rules: {
				 Strasse: { required: { depends: function(element) { return PruefeCheckbox(idcheckbox); } } },
				 PLZ: { required: { depends: function(element) { return PruefeCheckbox(idcheckbox);  } } },
				 ORT: { required: { depends: function(element) { return PruefeCheckbox(idcheckbox);  } } },
				 Firma: { required: { depends: function(element) { return PruefeCheckbox(idcheckbox);  } } } },
			*/
			
			highlight: function(element, errorClass) {
				 jQuery(element.form).find("label[for=" + element.id + "]").addClass('labelerror'); },
			
			unhighlight: function(element, errorClass) {
				 jQuery(element.form).find("label[for=" + element.id + "]").removeClass('labelerror'); }
			
		});
		
	});
	
}
