/* extends Jquery auf exists */
jQuery.fn.exists = function(){return jQuery(this).length>0;}

$(document).ready(function() {
	setTimeout(function() {
		/* INPUT VALUES  - START */
		$('input.del').focus(function(){
			
			var name = $(this).attr('name');
			var typ  = $(this).attr('type')
			var val  = this.value;
			var sval = $(this).data(name);
			
			if(val==sval && typ=='text' && typ!='radio' && typ!='submit' ){
				this.value='';
			}
			
		});
		
		$('input.del').blur(function(){
			
			var name = $(this).attr('name');
			
			if(this.value=='' && $(this).data(name)!=null){
				
				this.value = $(this).data(name);
			}
		});
		
		$('input.del').each(function() {
			
			if (this.value!='') {
				var name = $(this).attr('name');
				$(this).data(name, this.value);
			}
		});
		
		$('input._autoselect').focus();
		
		$('div.rahmen1 h1').css({'height':'45px'});
		$('div.rahmen1 div.bilder').css({'float':'none'});
		$('div.rahmen1 p').hide().css({'margin-left':'170px'});
		
		$('div.rahmen1').css({'width':'170px', 'height':'270px', 'overflow':'hidden', 'position':'absolute', 'margin':'5px', 'margin-right':'15px', 'background-color':'#fff'});
		
		$('div.rahmen1').each(function(key){
			var left = parseInt($(this).css('left'));
			left = 190*(key);
			$(this).css({'left':left+'px'}).attr('id',key);
		});
		
		$('div.rahmen1').hover(function(){
			var left = $(this).css('left');
			$(this).css({'z-index':'10','box-shadow':'0px 0px 4px #000', 'border-radius':'10px', 'border':'1px solid #cecece'});
			$(this).children().children('div.bilder').css({'float':'left'});
			
			$(this).animate({
				width: '100%',
				left: '0px',
				padding: '10px'
			}, 400, function(){
				$(this).children('div.rahmen1 p').fadeIn(300);
			});
		}, function (){
			var left = parseInt($(this).attr('id'));
			left = 190*(left);
			$(this).children('div.rahmen1 p').hide();
			$(this).stop(true, true).animate({
				width: '170px',
				left: left+'px',
				padding: '0px'
			}, 400, function(){
				$(this).css({'z-index':'1','box-shadow':'0px 0px 0px #000', 'border-radius':'0px', 'border':'none'});
			});
			
		});
	},800);
});

function stopError() {
  return true;
}

window.onerror = stopError;


/* Scroll Stopper - STOP
 *
 *
 * JS - Cookies | lesen und schreiben - START */

function cookie_schreiben(wert,inhalt) {
    
   document.cookie = wert + "=" + inhalt;
   var check = document.cookie

   if (check && check.indexOf(wert) > -1) return true;
   else return false;
}

function cookie_lesen(wert) {
    
   var inhalt = document.cookie;
   var posName = inhalt.indexOf("; " + wert + "=");
   if (posName == -1) {
      if (inhalt.indexOf(wert + "=") == 0) posName = 0;
      else return null;
   }

   var wertAnfang = inhalt.indexOf("=", posName)+1;
   var wertEnde = inhalt.indexOf(";", posName+1);
   if (wertEnde == -1) wertEnde = inhalt.length;

   var wert = inhalt.substring(wertAnfang, wertEnde);
   return unescape(wert);
}
/* JS - Cookies | lesen und schreiben - STOP */
