// Here you can define your own interaction effects using the JQuery syntax.

$(document).ready(function(){
			
		$("#contact-us > ul").tabs({ selected: 2, fx: { opacity: 'toggle' } });

			
		$(".accordion h3:first").addClass("active");
		$(".accordion div:not(:first)").hide();


		$(".accordion h3").click(function(){
			$(this).next("div").slideToggle("slow")
			.siblings("div:visible").slideUp("slow");
			$(this).toggleClass("active");
			$(this).siblings("h3").removeClass("active");
		});
			
			
		$("#nav-buttons a").hover(function() {
			$(this).next("strong").animate({opacity: "show", top: "-77"}, "slow");
		}, function() {
			$(this).next("strong").animate({opacity: "hide", top: "-85"}, "fast");
		});
		
		
		$("select#jump-menu").change(function() {
			location = $(this).val();
		});
		
		$("input.form-hint").hint();		
			
		$(".styleswitch").click(function() {
			switchStylestyle(this.getAttribute("rel"));
			return false;
		});
		var c = readCookie("style");
		if (c) switchStylestyle(c);
			
});




/**
* Styleswitch stylesheet switcher built on jQuery
* Under an Attribution, Share Alike License
* By Kelvin Luck ( http://www.kelvinluck.com/ )
**/

function switchStylestyle(styleName)
{
	$('link[@rel*=style][@title]').each(function(i) 
	{
		this.disabled = true;
		if (this.getAttribute('title') == styleName) this.disabled = false;
	});
	createCookie('style', styleName, 365);
}

// cookie functions http://www.quirksmode.org/js/cookies.html
function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function eraseCookie(name)
{
	createCookie(name,"",-1);
}
// /cookie functions




/**
* Text box hints by Remy Sharp
* see http://remysharp.com/2007/01/25/jquery-tutorial-text-box-hints/
**/

jQuery.fn.hint = function () {
  return this.each(function (){
    var t = jQuery(this); 
    var title = t.attr('title'); 
    if (title) { 
      t.blur(function (){
        if (t.val() == '') {
          t.val(title);
          t.addClass('blur');
        }
      });
      t.focus(function (){
        if (t.val() == title) {
          t.val('');
          t.removeClass('blur');
        }
      });

      t.parents('form:first()').submit(function(){
          if (t.val() == title) {
              t.val('');
              t.removeClass('blur');
          }
      });

      t.blur();
      
      if ($.browser.mozilla && !t.attr('autocomplete')) {
                setTimeout(function () {
                    if (t.val() == title) t.val('');
                    t.blur();
                }, 10);
       }
      
      
    }
  });
}


/* externer Link*/

$("a.popup-link").click( function() {
window.open( $(this).attr('href') );
return false;
});
