jQuery.noConflict();

jQuery(document).ready(function(){  

  	jQuery("#felogin #tab1").add('#felogin #tab2').css({
		'margin-top' : '-93px'
	});
	
	jQuery("#felogin .login a").click(function(){
		jQuery(this).
			parents().find('#tab2').hide().
			parents().find('#tab1').show().
			parents().find(".tabs").animate({ 
				marginTop: "-12px"
			}, 500 );
		return false;
	});
	
	jQuery("#felogin .reset a").click(function(){
		jQuery(this).
			parents().find('#tab1').hide().
			parents().find('#tab2').show().
			parents().find(".tabs").animate({ 
				marginTop: "-12px"
			}, 500 );
		return false;
	});

	jQuery("#content.start .news-latest-item:nth-child(2)").addClass("odd");

	jQuery(".start #right .news-latest-item").hide();	
		
	var a = jQuery("<a>Newsmenü auf- und zuklappen</a>").
	attr('href','#').
	attr('title','Fahre das Menü auf und zu').
	addClass("btn-slide btn-slide-close");
	
	jQuery('.start #right p.rss').before(a);

	jQuery(".btn-slide").click(function(){

		jQuery(this).toggleClass("btn-slide-open").toggleClass('btn-slide-close');
		jQuery(".start #right .news-latest-item").toggle('normal');
		return false;
	});
	
  /* Changing Focus */
  jQuery('input[type=text]').
  add('input[type=password]').
  add('#skpagecommentform textarea').focus(function() {
  
	 if (this.value == this.defaultValue){  this.value = ''; }  
	 if(this.value != this.defaultValue){  this.select(); } 
	 
		/* Get back on blur with old value */
        jQuery('input[type=text]').
		add('input[type=password]').
		add('#skpagecommentform textarea').blur(function() {
		
          if (jQuery.trim(this.value) == ''){ this.value = (this.defaultValue ? this.defaultValue : '');	}
      });
	  
  });
  
});

/** validate email
 * @param String type
 */ 
jQuery.fn.validate = function(type){  
  switch (type) {
    case 'email':
        var regEx=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
        var valid = regEx.test(this.val());
                
        var form = jQuery(this).parent();
        while(form.attr('nodeName')!='FORM' ) form=form.parent();
        
        /* reset style & function */
        jQuery(form).unbind('submit');
        this.attr('style', '');
        
        /* not valid */
        if (!valid){ 
          jQuery(form).submit(function() {return false;});
          this.attr('style', 'color:red');
        }
        
        
    break;
  }
}

// RSS auto href
// @description sets rss-feed url on p.rss classes 

jQuery(document).ready(function(){  
  jQuery('p.rss a').attr('href', 'http://www.azubis-schmidtgruppe.de/rss-feed/rss.html?no_cache=1');
});

function click (e) {
  if (!e)
    e = window.event;
  if ((e.type && e.type == "contextmenu") || (e.button && e.button == 2) || (e.which && e.which == 3)) {
    if (window.opera)
      window.alert("Sorry: Diese Funktion ist deaktiviert.");
    return false;
  }
}
if (document.layers)
  document.captureEvents(Event.MOUSEDOWN);
document.onmousedown = click;
document.oncontextmenu = click;


/* 
function right(e)
{
if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3))
{
alert("Rechte Maustaste deaktiviert");
return false;
}
return true;
}

document.onmousedown=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
window.onmousedown=right; */

