// JavaScript Functions

var DockPosition, DockNaviPosition;
var ShowNavi;
var nopopup;
var lvLink2;
nopopup = true;
ShowNavi = false;


function PopupPublikation(lvLink){
	if (nopopup == true){
		window.open(lvLink);
		return false;
	}else{
		nopopup = true;
	}
}



function HideSearch(){
	$("#search_input").fadeOut(400);

	$(".live-search-results").slideUp(300);

	$("#search_input input").attr("value","");
	if (($("body").hasClass("IE7") == true) || ($("body").hasClass("IE6") == true)){
		//$("#container_right").css("position","relative");
	}
}

function ShowDockMenue(){
		DockPosition =  988 - $("body").width() - $(window).scrollLeft();
		$("#container_right").stop();
		if (DockPosition > 0) {
			$("#container_right").animate({right: DockPosition + "px"}, 600);
		}
}

function ShowDockNavi(){
			DockPosition =  $("body").width() + $(window).scrollLeft();
			if (DockPosition < 780){
				$("#sidenavi_show").css("display","block");
			}else{
				//Navigation nicht anzeigen
				$("#sidenavi_show").css("display","none");		
			}
}

//Anpassung Nyromodal
function showBackground2(elts, settings, callback) {
		elts.bg.css({opacity:0}).fadeTo(500, 0.15, callback);
}



//Secure Mail
function JSrot13(text) {var text = text.replace(/%/, "@");var rot13text_rotated = ""; /* the function will return this string */;for (i = 1 ; i < (text.length + 1); i++) {k = text.charCodeAt(i-1);if (k >= 97 && k <= 109) {k = k + 13;} else if (k >= 110 && k <= 122) {k = k - 13;} else if (k >= 65 && k <= 77) {k = k + 13;} else if (k >= 78 && k <= 90) {k = k - 13;}rot13text_rotated = rot13text_rotated + String.fromCharCode(k);}return rot13text_rotated;}function Securemail(maillink){var maillink_output;maillink_output = JSrot13(maillink);location.href= 'mailto:' + maillink_output;}function displaymailaddress(linktext){var linktext_output;linktext_output = JSrot13(linktext);linktext_output = linktext_output.replace(/@/, "<span style='display:none'> *secure E-Mailaddress* <\/span>@");document.write(linktext_output);}


// zoomi - A zoom for images ~ Sean Catchpole - Version 0.9
(function($){

$.fn.zoomi = function() {
  $(this).filter("img").each(function(){
    if(!this.z) {
      $(this).zoom1().mouseover(function(){$(this).zoom2().fadeIn(400);});
      $(this).mouseout(function(){$(this.z).fadeOut(400);}); }
  });
 return this;
}

$.fn.zoom1 = function() {
  $(this).each(function(){
    var e = this;
    $(e).css({'position':'relative','z-index':'8'}).after('<img class="'+e.className+'">');
    e.z = e.nextSibling;
    $(e.z).removeClass("zoomi").addClass("zoom2").attr("src",$(e).attr('longdesc') || e.src)
    .css({'position':'absolute','z-index':'10'});
    $(e.z).hide();
  });
  return this;
}

$.fn.zoom2 = function() {
  var s = [];
  this.each(function(){
    var e = this;
    if(!e.z) e = $(e).zoom1()[0]; s.push(e.z);
    if(!e.z.complete) return;
    if(!e.z.width) { $(e.z).show(); e.z.width=e.z.width; $(e.z).hide();}
    $(e.z).css({left:-144 +'px',
    top:0 +'px'});
  });
  return this.pushStack(s);
}

$.fn.offsetLeft = function() {
  var e = this[0];
  if(!e.offsetParent) return e.offsetLeft;
  return e.offsetLeft + $(e.offsetParent).offsetLeft(); }

$.fn.offsetTop = function() {
  var e = this[0];
  if(!e.offsetParent) return e.offsetTop;
  return e.offsetTop + $(e.offsetParent).offsetTop(); }

$(function(){ $('img.zoomi').zoomi();});

})(jQuery);

//default value Plugin;

jQuery.fn.DefaultValue = function(text){
    return this.each(function(){
		//Make sure we're dealing with text-based form fields
		if(this.type != 'text' && this.type != 'password' && this.type != 'textarea')
			return;
		
		//Store field reference
		var fld_current=this;
		
		//Set value initially if none are specified
        if(this.value=='') {
			this.value=text;
		} else {
			//Other value exists - ignore
			return;
		}
		
		//Remove values on focus
		$(this).focus(function() {
			if(this.value==text || this.value=='')
				this.value='';
		});
		
		//Place values back on blur
		$(this).blur(function() {
			if(this.value==text || this.value=='')
				this.value=text;
		});
		
		//Capture parent form submission
		//Remove field values that are still default
		$(this).parents("form").each(function() {
			//Bind parent form submit
			$(this).submit(function() {
				if(fld_current.value==text) {
					fld_current.value='';
				}
			});
		});
    });
};
















