﻿// Initialize jQuery
 $(document).ready(function()
 {
	// Loop through all boxes in the website
	$('div.contentBox').each(function()
	{		
	
		// default corners are angular (a shift of -18px in the sprite image)
		var tl = '-18';
		var tr = '-18';
		var br = '-18';
		var bl = '-18';
		
		// Check the class definition of the current box for rounded edges
		// top left
		if($(this).attr("class").toLowerCase().indexOf(" tl") != -1)
		{
			tl = '0';
		}
		// top right
		if($(this).attr("class").toLowerCase().indexOf(" tr") != -1)
		{
			tr = '0';
		}
		// bottom right
		if($(this).attr("class").toLowerCase().indexOf(" br") != -1)
		{
			br = '0';
		}
		// bottom left
		if($(this).attr("class").toLowerCase().indexOf(" bl") != -1)
		{
			bl = '0';
		}
		
		// Add the divs containing the corner images (angular or rounded, depending on the check above)
		// Top left corner
		$(this).prepend('<div style="height: 18px; width: 18px; position: absolute; top: -4px; left: -4px; background: url(files/style/img/sprite.png) no-repeat ' + tl + 'px 0px;"></div>');
		// Top right corner
		$(this).prepend('<div style="height: 18px; width: 18px; position: absolute; top: -4px; right: -8px; background: url(files/style/img/sprite.png) no-repeat ' + tr + 'px -36px;"></div>');
		// Bottom left corner
		$(this).prepend('<div style="height: 18px; width: 18px; position: absolute; bottom: -8px; left: -4px; background: url(files/style/img/sprite.png) no-repeat ' + bl + 'px -18px;"></div>');
		// Bottom right corner
		$(this).prepend('<div style="height: 18px; width: 18px; position: absolute; bottom: -8px; right: -8px; background: url(files/style/img/sprite.png) no-repeat ' + br + 'px -54px;"></div> ');
		
	});
	
	// Add the border images to the boxes (the 'contentWrapper' divs are wrapped into divs which contain the border images)
	$('.contentWrapper').wrap('<div style="background: url(files/style/img/borderTop.png) repeat-x top; margin-left: 14px; margin-right: 10px; position: relative; top: -4px;"><div style="background: url(files/style/img/borderBottom.png) repeat-x bottom; padding-top: 6px; padding-bottom: 18px; position: relative; bottom: -12px;"><div style="background: url(files/style/img/borderLeft.png) repeat-y left; margin-left: -18px; position: relative;"><div style="background: url(files/style/img/borderRight.png) repeat-y right; margin-right: -8px; position: relative; right: -10px;"></div></div></div></div>');

	
  
	$('#accordion').accordion({ autoHeight: false });
	
	$('#su2Min').tabs({ fx: { opacity: 'toggle' } });
	
	
	
	$("area").mouseover( function()
	{
		var state = $(this).attr('alt');
		var stateW = 0;
		var stateH = 0;
		
		switch(state)
		{
			case 'Burgenland':
				stateW = -54;
				stateH = 0;
				break;
			case 'Kärnten':
				stateW = -79;
				stateH = 0;
				break;
			case 'Niederösterreich':
				stateW = -104;
				stateH = 0;
				break;
			case 'Oberösterreich':
				stateW = -54;
				stateH = -25;
				break;
			case 'Salzburg':
				stateW = -79;
				stateH = -25;
				break;
			case 'Steiermark':
				stateW = -104;
				stateH = -25;
				break;
			case 'Tirol':
				stateW = -54;
				stateH = -50;
				break;
			case 'Vorarlberg':
				stateW = -79;
				stateH = -50;
				break;
			case 'Wien':
				stateW = -104;
				stateH = -50;
				break;
			
		}

		$("div#mapState").html(state + '<br /><div style="width: 25px; height: 25px; background: url(files/style/img/sprite.png) ' + stateW + 'px ' + stateH + 'px no-repeat;"></div>');
	})
	.mouseout( function() 
	{ 
		$("div#mapState").empty();
	}); 
	
	
	//$.pir.options.php="files/style/fonts/pir.php";
	//$("h1").pir({font: "myriad_pro_regular.ttf", wrap: true});
	//$("h2").pir({font: "myriad_pro_regular.ttf", wrap: true});
	//$(".rex-navi1 li a").pir({font: "myriad_pro_regular.ttf", wrap: true});
	
/*
	$("p.formlabel-vorname input").input_replacement({ text: 'Vorname', class: 'inputDescription' });
	$("p.formlabel-nachname input").input_replacement({ text: 'Nachname', class: 'inputDescription' });
	$("p.formlabel-ort input").input_replacement({ text: 'Ort', class: 'inputDescription' });
	$("p.formlabel-plz input").input_replacement({ text: 'Postleitzahl', class: 'inputDescription' });
	$("p.formlabel-strasse input").input_replacement({ text: 'Straße & Hausnummer', class: 'inputDescription' });
	$("p.formlabel-handy input").input_replacement({ text: 'Handy-Nr.', class: 'inputDescription' });
	$("p.formlabel-email input").input_replacement({ text: 'E-Mail-Adresse', class: 'inputDescription' });
	$("p.formlabel-gebdat input").input_replacement({ text: 'Geburtsdatum', class: 'inputDescription' });
	$("p.formlabel-schule input").input_replacement({ text: '(ehemalige) Schule', class: 'inputDescription' });
	
	
	$('input.iNachname').input_replacement({ text: 'Nachname', class: 'inputDescription' });
	$('input.iEmail').input_replacement({ text: 'Email', class: 'inputDescription' });
	
	$('#newsletterForm').validate();*/
	
 });
 
 