/**
 * Slide Box : a jQuery Plug-in
 * Samuel Garneau <samgarneau@gmail.com>
 * http://samuelgarneau.com
 * 
 * Released under no license, just use it where you want and when you want.
 */

(function($){
	
	$.fn.slideBox = function(params){
	
		var content = $(this).html();
		var defaults = {
			width: "100%",
			height: "200px",
			position: "bottom"			// Possible values : "top", "bottom"
		}
		
		// extending the fuction
		if(params) $.extend(defaults, params);
		
		var divPanel = $("<div class='slide-panel'>");
		var divContent = $("<div class='content'>");
	
		$(divContent).html(content);
		$(divPanel).addClass(defaults.position);
		$(divPanel).css("width", defaults.width);
		
		// centering the slide panel
		$(divPanel).css("left", (100 - parseInt(defaults.width))/2 + "%");
	
		// if position is top we're adding 
		if(defaults.position == "top")
			$(divPanel).append($(divContent));
		
		// adding buttons
		$(divPanel).append("<div class='slide-button'>See all services</div>");
		$(divPanel).append("<div style='display: none' id='close-button' class='slide-button'>Close</div>");
		
		if(defaults.position == "bottom")
			$(divPanel).append($(divContent));
		
		$(this).replaceWith($(divPanel));
		
		// Buttons action
		$(".slide-button").click(function(){
			if($(this).attr("id") == "close-button")
				$(divContent).animate({height: "0px"}, 1000);
			else
				$(divContent).animate({height: defaults.height}, 1000);
			
			$(".slide-button").toggle();
		});
	};
	
})(jQuery);


// *** Fügt eine E-Mail-Adresse ein ***
function InsertMails(mailnam,mailsvr,maildom,subject,text)
{
  if(text=="")
    document.write('<a href="mailto:'+mailnam+'@'+mailsvr+'.'+maildom+'?subject='+subject+'">'+mailnam+'@'+mailsvr+'.'+maildom+'</a>');
  else
    document.write('<a href="mailto:'+mailnam+'@'+mailsvr+'.'+maildom+'?subject='+subject+'">'+text+'</a>');
}


// *** Fügt eine E-Mail-Adresse ein ***
function InsertMail(mailnam,mailsvr,maildom,text)
{
  if(text=="")
    document.write('<a href="mailto:'+mailnam+'@'+mailsvr+'.'+maildom+'">'+mailnam+'@'+mailsvr+'.'+maildom+'</a>');
  else
    document.write('<a href="mailto:'+mailnam+'@'+mailsvr+'.'+maildom+'">'+text+'</a>');
}



/* Funktion für das Dropdown Menue */
function P7_JumpMenu(selObj,restore){ 
	var theFullString = selObj.options[selObj.selectedIndex].value;
	if (restore) selObj.selectedIndex=0;
	var theLength = theFullString.length;
	var endPos = theFullString.lastIndexOf("~");
	var theUrl, theTarget, theParent;
	if (endPos > 0) {theUrl = theFullString.substring(0,endPos);}
	else {theUrl = theFullString;}
	endPos++
	if (endPos < theLength) {theTarget = theFullString.substring(endPos,theLength)}
	else {theTarget = "window:Main";}
	if (theTarget == "window:New") {window.open(theUrl);}
	else if (theTarget == "window:Main") {eval("parent.location='"+theUrl+"'");}
	else {eval("parent.frames[\'"+theTarget+"\'].location='"+theUrl+"'");}
}
