//(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&/6.0/.test(navigator.userAgent)){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};})(jQuery);

;(function($) {

/**
 * Adds (single/multiple) options to a select box (or series of select boxes)
 *
 * @name     addOption
 * @author   Sam Collett (http://www.texotela.co.uk)
 * @type     jQuery
 * @example  $("#myselect").addOption("Value", "Text"); // add single value (will be selected)
 * @example  $("#myselect").addOption("Value 2", "Text 2", false); // add single value (won't be selected)
 * @example  $("#myselect").addOption({"foo":"bar","bar":"baz"}, false); // add multiple values, but don't select
 *
 */
$.fn.addOption = function()
{
	var add = function(el, v, t, sO)
	{
		var option = document.createElement("option");
		option.value = v, option.text = t;
		// get options
		var o = el.options;
		// get number of options
		var oL = o.length;
		if(!el.cache)
		{
			el.cache = {};
			// loop through existing options, adding to cache
			for(var i = 0; i < oL; i++)
			{
				el.cache[o[i].value] = i;
			}
		}
		// add to cache if it isn't already
		if(typeof el.cache[v] == "undefined") el.cache[v] = oL;
		el.options[el.cache[v]] = option;
		if(sO)
		{
			option.selected = true;
		}
	};

	var a = arguments;
	if(a.length == 0) return this;
	// select option when added? default is true
	var sO = true;
	// multiple items
	var m = false;
	// other variables
	var items, v, t;
	if(typeof(a[0]) == "object")
	{
		m = true;
		items = a[0];
	}
	if(a.length >= 2)
	{
		if(typeof(a[1]) == "boolean") sO = a[1];
		else if(typeof(a[2]) == "boolean") sO = a[2];
		if(!m)
		{
			v = a[0];
			t = a[1];
		}
	}
	this.each(
		function()
		{
			if(this.nodeName.toLowerCase() != "select") return;
			if(m)
			{
				for(var item in items)
				{
					add(this, item, items[item], sO);
				}
			}
			else
			{
				add(this, v, t, sO);
			}
		}
	);
	return this;
};
})(jQuery);


(function($){$.dimensions={version:'1.2'};$.each(['Height','Width'],function(i,name){$.fn['inner'+name]=function(){if(!this[0])return;var torl=name=='Height'?'Top':'Left',borr=name=='Height'?'Bottom':'Right';return this.is(':visible')?this[0]['client'+name]:num(this,name.toLowerCase())+num(this,'padding'+torl)+num(this,'padding'+borr);};$.fn['outer'+name]=function(options){if(!this[0])return;var torl=name=='Height'?'Top':'Left',borr=name=='Height'?'Bottom':'Right';options=$.extend({margin:false},options||{});var val=this.is(':visible')?this[0]['offset'+name]:num(this,name.toLowerCase())+num(this,'border'+torl+'Width')+num(this,'border'+borr+'Width')+num(this,'padding'+torl)+num(this,'padding'+borr);return val+(options.margin?(num(this,'margin'+torl)+num(this,'margin'+borr)):0);};});$.each(['Left','Top'],function(i,name){$.fn['scroll'+name]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(name=='Left'?val:$(window)['scrollLeft'](),name=='Top'?val:$(window)['scrollTop']()):this['scroll'+name]=val;}):this[0]==window||this[0]==document?self[(name=='Left'?'pageXOffset':'pageYOffset')]||$.boxModel&&document.documentElement['scroll'+name]||document.body['scroll'+name]:this[0]['scroll'+name];};});$.fn.extend({position:function(){var left=0,top=0,elem=this[0],offset,parentOffset,offsetParent,results;if(elem){offsetParent=this.offsetParent();offset=this.offset();parentOffset=offsetParent.offset();offset.top-=num(elem,'marginTop');offset.left-=num(elem,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&$.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return $(offsetParent);}});function num(el,prop){return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0;};})(jQuery);

jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        var path = options.path ? '; path=' + options.path : '';
        var domain = options.domain ? '; domain=' + options.domain : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

jQuery.fn.vertToggle = function(pix,speed, easing, callback) {

  return this.animate({width: pix}, speed, easing, callback);
};

jQuery.fn.horToggle = function(pix,speed, easing, callback) {

  return this.animate({height: pix}, speed, easing, callback);
};

/////////////////////////////////////////////////////////////////////////////////

jQuery.fn.typeWatch = function(wait, fire) {
this.each(function() {
var input = this;
var timeout;

$(input).keyup(function() {
clearTimeout(timeout);
timeout = setTimeout(function() {

//alert ($(input).attr("value").length)

//if ($(input).attr("value").length>2)
  {
   fire();
  }


   }, wait)
});

});
return this;
}









////////////////////////////////////////////////////////////////////////////////
$(document).ready(

function(){


////////////////////////////////////////////////////////////////////////////////

$(".startseite").mouseover(function(){
$("#"+$(this).find('img').attr('alt')).addClass("fett");
})

$(".startseite").mouseout(function(){
$("#"+$(this).find('img').attr('alt')).removeClass("fett");
})
////////////////////////////////////////////////////////////////////////////////

//$(".startkategorie").mouseover(function(){
//$("#b_"+$(this).attr('id')+" img").addClass("fett1");
//})

//$(".startkategorie").mouseout(function(){
//$("#b_"+$(this).attr('id')+" img").removeClass("fett1");
//})
////////////////////////////////////////////////////////////////////////////////


$("#gusr").focus(function() {if ($("#gusr").attr("value")=="Benutzername"){$("#gusr").attr("value", "");}});
$("#gusr").blur(function() {if ($("#gusr").attr("value")==undefined){$("#gusr").attr("value", "Benutzername");} });

$("#stichwort").focus(function() {if ($("#stichwort").attr("value")=="Stichwort"){$("#stichwort").attr("value", "");}});
$("#stichwort").blur(function() {if ($("#stichwort").attr("value")==undefined){$("#stichwort").attr("value", "Stichwort");} });

$("#suchbegriff").focus(function() {if ($("#suchbegriff").attr("value")=="Stichwort, Firma, etc."){$("#suchbegriff").attr("value", "");}});
$("#suchbegriff").blur(function() {if ($("#suchbegriff").attr("value")==undefined){$("#suchbegriff").attr("value", "Stichwort, Firma, etc.");} });


$("#dummy").focus(function() {
// if ($("#gpwd").attr("value")=="Kennwort")
//{
  $("#dummy").hide()
  $("#gpwd").show();
  $("#gpwd").focus()


//}

});
$("#gpwd").blur(function() {if ($("#gpwd").attr("value")==undefined)
  {
  $("#dummy").show()
  $("#gpwd").hide();

  }

  });




if ($.cookie('c_links')=='1')
{
$("#draussen").css({display:"none"});
$("#links").css({width:"20px"});
$("#nach_rechts").css({display:"block"});
}

if ($.cookie('ho2inhalt')=='1')
   {
   $("#ho2inhalt").hide();
   $("#ho2 img").attr({"src":"icon_runter.gif"});
 }
if ($.cookie('ho3inhalt')=='1')
   {
   $("#ho3inhalt").hide();
   $("#ho3 img").attr({"src":"icon_runter.gif"});
 }
 
if ($.cookie('navinhalt')=='1')
   {
   $("#navinhalt").hide();
   $("#nav img").attr({"src":"icon_runter.gif"});
 }
 
if ($.cookie('katinhalt')=='1')
   {
   $("#katinhalt").hide();
   $("#kat img").attr({"src":"icon_runter.gif"});
 }




$(".hoch").click(function(){

  alert("->"+this.id);

  $("#"+this.id+"inhalt").slideToggle(600);

  if ($.cookie(this.id+"inhalt") == 1)
  {$.cookie(this.id+"inhalt",'0');$("#"+this.id+" img").attr({"src":"icon_hoch.gif"});}
  else
  {$.cookie(this.id+"inhalt",'1');$("#"+this.id+" img").attr({"src":"icon_runter.gif"});}

  return false;


  });

$(".nachlinks").click(function(){

                                  $("#draussen").slideToggle(600, function(){
                                  $("#links").vertToggle(20,600, function(){
                                  $("#nach_rechts").slideToggle(600);
                                  });
                                  });
                                  $.cookie('c_links','1');
                                  return false
                                  });
                                  
$(".nachrechts").click(function(){

                                  $("#nach_rechts").slideToggle(600, function(){
                                  $("#links").vertToggle(240,600, function(){
                                  $("#draussen").slideToggle(600);
                                  });
                                  });
                                  $.cookie('c_links','0');
                                  return false
                                  });

//use like
//$("#schnellsuche").typeWatch(200, function() { alert('You finished typing') });

///
});






