/*Height Content BG*/
function heightContent(Content) {
    if (jQuery.browser.msie) {
        contHeight = jQuery('#wrapper').attr('clientHeight');
        htmlHeight = jQuery('html').attr('offsetHeight');
        if (contHeight < htmlHeight) {
            htmlHeight = jQuery('html').attr('clientHeight');
        }
        else {
            htmlHeight = jQuery('html').attr('scrollHeight');
        }
    }
    else {
        contHeight = jQuery('#wrapper').attr('clientHeight');
        htmlHeight = jQuery('html').attr('clientHeight');
        if (contHeight >= htmlHeight) {
            htmlHeight = jQuery('html').attr('scrollHeight');
        }
    }
    jQuery(Content).css({
        height: (htmlHeight)+'px'
    });
}

/*blackNight*/
function callNight() {  
    jQuery('#welcome').css('display','block');
    setTimeout(function() {
        heightContent('#welcome .blackNight');
    },1);
    jQuery(window).resize( function() {
        jQuery('#welcome .blackNight').removeAttr('style');
        heightContent('#welcome .blackNight');
    });
    jQuery('#welcome .top input').click( function() {
        jQuery('#welcome').animate({
            height: 'hide',
            opacity: 'hide'
        });
    });
}

function addField(strNewField)
{      
    // We store a count of the total number of fields
    intFields  = jQuery('#employees_count').getValue();
    prevFields = intFields; 
    // Create the new ID/Name for the form element by replacing % with the current field count 
    intFields = Number(intFields) + 1;    
    strNewField = strNewField.replace(/%/g, intFields);
    // Increment the total field count and update the count field
    jQuery('#employees_count').setValue(intFields); 
    //  Add the new field to the bottom of the table            
    jQuery('#employees').append(strNewField);    
}

    
/*Corousel*/
(function($) {                                          // Compliant with jquery.noConflict()
    $.fn.jCarouselLite = function(o) {
        o = $.extend({
            btnPrev: null,
            btnNext: null,
            btnGo: null,
            mouseWheel: false,
            auto: null,

            speed: 200,
            easing: null,

            vertical: false,
            circular: true,
            visible: 3,
            start: 0,
            scroll: 1,

            beforeStart: null,
            afterEnd: null
        }, o || {});

        return this.each(function() {                           // Returns the element collection. Chainable.

            var running = false, animCss=o.vertical?"top":"left", sizeCss=o.vertical?"height":"width";
            var div = $(this), ul = $("ul", div), tLi = $("li", ul), tl = tLi.size(), v = o.visible;

            if(o.circular) {
                ul.prepend(tLi.slice(tl-v-1+1).clone())
                  .append(tLi.slice(0,v).clone());
                //o.start -= v;
            }

            var li = $("li", ul), itemLength = li.size(), curr = o.start;
            div.css("visibility", "visible");

            li.css({overflow: "hidden", float: o.vertical ? "none" : "left"});
            ul.css({margin: "0", padding: "0", position: "relative", "list-style-type": "none", "z-index": "1"});
            div.css({overflow: "hidden", position: "relative", "z-index": "2", left: "0px"});

            var liSize = o.vertical ? height(li) : width(li);   // Full li size(incl margin)-Used for animation
            var ulSize = liSize * itemLength;                   // size of full ul(total length, not just for the visible items)
            var divSize = liSize * v;                           // size of entire div(total length for just the visible items)

            li.css({width: li.width(), height: li.height()});
            ul.css(sizeCss, ulSize+"px").css(animCss, -(curr*liSize));

            div.css(sizeCss, divSize+"px");                     // Width of the DIV. length of visible images
            
            var countList = $(this).find('li').length;
            //console.log(countList);
            if(o.btnPrev)
                if((!o.circular) || (o.visible > countList)) {
                    $(o.btnPrev).addClass("disabled");
                }
                $(o.btnPrev).click(function() {
                    return go(curr-o.scroll);
                });

            if(o.btnNext)
                if(o.visible >= countList) {
                    $(o.btnNext).addClass("disabled");
                }
                $(o.btnNext).click(function() {
                    return go(curr+o.scroll);
                });

            if(o.btnGo)
                $.each(o.btnGo, function(i, val) {
                    $(val).click(function() {
                        return go(o.circular ? o.visible+i : i);
                    });
                });

            if(o.mouseWheel && div.mousewheel)
                div.mousewheel(function(e, d) {
                    return d>0 ? go(curr-o.scroll) : go(curr+o.scroll);
                });

            if(o.auto)
                setInterval(function() {
                    go(curr+o.scroll);
                }, o.auto+o.speed);

            function vis() {
                return li.slice(curr).slice(0,v);
            };

            function go(to) {
                if(!running) {

                    if(o.beforeStart)
                        o.beforeStart.call(this, vis());

                    if(o.circular) {            // If circular we are in first or last, then goto the other end
                        if(to<=o.start-v-1) {           // If first, then goto last
                            ul.css(animCss, -((itemLength-(v*2))*liSize)+"px");
                            // If "scroll" > 1, then the "to" might not be equal to the condition; it can be lesser depending on the number of elements.
                            curr = to==o.start-v-1 ? itemLength-(v*2)-1 : itemLength-(v*2)-o.scroll;
                        } else if(to>=itemLength-v+1) { // If last, then goto first
                            ul.css(animCss, -( (v) * liSize ) + "px" );
                            // If "scroll" > 1, then the "to" might not be equal to the condition; it can be greater depending on the number of elements.
                            curr = to==itemLength-v+1 ? v+1 : v+o.scroll;
                        } else curr = to;
                    } else {                    // If non-circular and to points to first or last, we just return.
                        if(to<0 || to>itemLength-v) return;
                        else curr = to;
                    }                           // If neither overrides it, the curr will still be "to" and we can proceed.

                    running = true;

                    ul.animate(
                        animCss == "left" ? { left: -(curr*liSize) } : { top: -(curr*liSize) } , o.speed, o.easing,
                        function() {
                            if(o.afterEnd)
                                o.afterEnd.call(this, vis());
                            running = false;
                        }
                    );
                    // Disable buttons when the carousel reaches the last/first, and enable when not
                    if(!o.circular) {
                        $(o.btnPrev + "," + o.btnNext).removeClass("disabled");
                        $( (curr-o.scroll<0 && o.btnPrev)
                            ||
                           (curr+o.scroll > itemLength-v && o.btnNext)
                            ||
                           []
                         ).addClass("disabled");
                    }

                }
                return false;
            };
        });
    };

    function css(el, prop) {
        return parseInt($.css(el[0], prop)) || 0;
    };
    function width(el) {
      try{
        return  el[0].offsetWidth + css(el, 'marginLeft') + css(el, 'marginRight');
      }catch(e){
      }
    };
    
    function height(el) {
      try{
        return el[0].offsetHeight + css(el, 'marginTop') + css(el, 'marginBottom');
      }catch(e){
      }
    };

})(jQuery);

    
/*Reflect-images*/
    /*
    reflection.js for jQuery v1.02
    (c) 2006-2008 Christophe Beyls <http://www.digitalia.be>
    MIT-style license.
*/
(function(a){a.fn.extend({reflect:function(b){b=a.extend({height:0.46,opacity:0.5},b);return this.unreflect().each(function(){var c=this;if(/^img$/i.test(c.tagName)){function d(){var j,g=Math.floor(c.height*b.height),k,f,i;if(a.browser.msie){j=a("<img />").attr("src",c.src).css({width:c.width,height:c.height,marginBottom:-c.height+g,filter:"flipv progid:DXImageTransform.Microsoft.Alpha(opacity="+(b.opacity*100)+", style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy="+(b.height*100)+")"})[0]}else{j=a("<canvas />")[0];if(!j.getContext){return}f=j.getContext("2d");try{a(j).attr({width:c.width,height:g});f.save();f.translate(0,c.height-1);f.scale(1,-1);f.drawImage(c,0,0,c.width,c.height);f.restore();f.globalCompositeOperation="destination-out";i=f.createLinearGradient(0,0,0,g);i.addColorStop(0,"rgba(255, 255, 255, "+(1-b.opacity)+")");i.addColorStop(1,"rgba(255, 255, 255, 1.0)");f.fillStyle=i;f.rect(0,0,c.width,g);f.fill()}catch(h){return}}a(j).css({display:"block",border:0});k=a(/^a$/i.test(c.parentNode.tagName)?"<span />":"<div />").insertAfter(c).append([c,j])[0];k.className=c.className;a.data(c,"reflected",k.style.cssText=c.style.cssText);a(k).css({width:c.width,height:c.height+g,overflow:"hidden"});c.style.cssText="display: block; border: 0px";c.className="reflected"}if(c.complete){d()}else{a(c).load(d)}}})},unreflect:function(){return this.unbind("load").each(function(){var c=this,b=a.data(this,"reflected"),d;if(b!==undefined){d=c.parentNode;c.className=d.className;c.style.cssText=b;a.removeData(c,"reflected");d.parentNode.replaceChild(c,d)}})}})})(jQuery);

/*Pager Plugin*/
(function($) {   
    $.fn.pager = function(clas, options) {
        
        var settings = {        
            navId: 'nav',
            navClass: 'nav',
            navAttach: 'append',
            highlightClass: 'highlight',
            prevText: '&nbsp;',
            nextText: '&nbsp;',
            linkText: null,
            linkWrap: null,
            height: null
        }
        if(options) $.extend(settings, options);
        
            
        return this.each( function () {
            
            var me = $(this);
            var size;
            var i = 0;      
            var navid = '#'+settings.navId;
            
            function init () {
                size = $(clas, me).not(navid).size();
                if(settings.height == null) {           
                    settings.height = getHighest();
                }
                if(size > 1) {
                    makeNav();
                    show();
                    highlight();
                }           
                sizePanel();
                if(settings.linkWrap != null) {
                    linkWrap();
                }
            }
            function makeNav () {       
                var str = '<div id="'+settings.navId+'" class="'+settings.navClass+'">';
                str += '<a href="#" rel="prev" class="prevLink">'+settings.prevText+'</a>';
                for(var i = 0; i < size; i++) {
                    var j = i+1;
                    str += '<a href="#" rel="'+j+'">';
                    str += (settings.linkText == null) ? j : settings.linkText[j-1];                
                    str += '</a>';
                }
                str += '<a href="#" rel="next" class="nextLink">'+settings.nextText+'</a>';
                str += '</div>';
                switch (settings.navAttach) {       
                    case 'before':
                        $(me).before(str);
                        break;
                    case 'after':       
                        $(me).after(str);
                        break;
                    case 'prepend':
                        $(me).prepend(str);
                        break;
                    default:
                        $(me).append(str);
                        break;
                }
            }
            function show () {
                $(me).find(clas).not(navid).hide();
                var show = $(me).find(clas).not(navid).get(i);
                $(show).show();
            }       
            function highlight () {
                $(me).find(navid).find('a').removeClass(settings.highlightClass);
                var show = $(me).find(navid).find('a').get(i+1);            
                $(show).addClass(settings.highlightClass);
            }
    
            function sizePanel () {
                if($.browser.msie) {
                    $(me).find(clas).not(navid).css( {
                        height: settings.height
                    }); 
                } else {
                    $(me).find(clas).not(navid).css( {
                        minHeight: settings.height
                    });
                }
            }
            function getHighest () {
                var highest = 0;
                $(me).find(clas).not(navid).each(function () {
                    
                    if(this.offsetHeight > highest) {
                        highest = this.offsetHeight;
                    }
                });
                highest = highest + "px";
                return highest;
            }
            function getNavHeight () {
                var nav = $(navid).get(0);
                return nav.offsetHeight;
            }
            function linkWrap () {
                $(me).find(navid).find("a").wrap(settings.linkWrap);
            }
            init();
            $(this).find(navid).find("a").click(function () {
    
                if($(this).attr('rel') == 'next') {
                    if(i + 1 < size) {
                        i = i+1;
                    }
                } else if($(this).attr('rel') == 'prev') { 
                    if(i > 0) { 
                        i = i-1;
                    }
                } else {        
                    var j = $(this).attr('rel');    
                    i = j-1;        
                }
                show();
                highlight();
                return false;
            });
        }); 
    }
})(jQuery);

/*carousel*/
function carouselMediaVideo(containerid) {
    jQuery(containerid+" .thumbs").jCarouselLite({
        btnNext: "#"+containerid+" .nextMV",
        btnPrev: "#"+containerid+" .prevMV",
        visible: 7,
        scroll: 1,
        circular: false,
        speed: 200
    });

}
/*pagers*/
function pagerListSearch(containerid) {
    jQuery(containerid+' > #search-list').pager('.listCont ul.divisor');
}
function pagerListMedia(containerid) {
    jQuery(containerid+' > .mediaBody').pager('.media-list ul.divisor');
}
function pagerListChannel(containerid) {
    jQuery(containerid+' .channels').pager('.channelBody ul.divisor');
}
function pagerListComm(containerid) {
    jQuery(containerid+' .content.list').pager('.contListCom ul.divisor');
}
function pagerListComm2(containerid) {
    jQuery(containerid+' .gBook').pager('.contListCom ul.divisor');
}

function filterVideoReload() {
    jQuery('.filterMediaVideo').each ( function() {
        jQuery(this).find('.filterMainVideo').click ( function() {
            if (jQuery(this).hasClass('selOpen')) {
                //jQuery(this).removeClass('selOpen');
            }
            else {
                jQuery(this).find('ul#media-filter').animate({
                    height: 'show'
                },300);
                jQuery(this).find('ul#media-filter a').animate({
                    height: 'show'
                },600);
                jQuery(this).addClass('selOpen');
            }
        });
    });
}

/*reflect*/
function mirrorImageMedia(containerid) {
    jQuery(containerid+' .thumbs img').reflect();
}
/*Hover show Bubble*/
function activateBubble(thumbConteiner) {
        var ContID = '#'+jQuery(thumbConteiner).attr('id');
        jQuery(ContID).find('.thumbs li a img').mouseover( function(myEvent) {
            if (jQuery(this).hasClass('toRemove')) {

            }
            else {
                var textContent = jQuery(this).parent('span').parent('a').parent('li').find('.hiddenContent').html();
                PosX = findPos(this)[0];
                var ULMov = jQuery(this).parents('ul').css('left').replace('px', '').replace('-', '');
                PosX = PosX - ULMov;
                console.log(PosX);
                if ((thumbConteiner == '.favorites') || (thumbConteiner == '.current')) {
                    jQuery(this).parents(ContID).find('.InfoBox').css('marginLeft',PosX-85);
                }
                else {
                    jQuery(this).parents(ContID).find('.InfoBox').css('marginLeft',PosX-50);
                }
                jQuery(this).parents(ContID).find('.InfoBox').html(textContent);
                jQuery(this).parents(ContID).find('.InfoBox').css('display','block');
            }
        });
        jQuery(ContID).find('.thumbs li a img').mouseout( function(myEvent) {
            jQuery(this).parents(ContID).find('.InfoBox').css('display','none');
        });
}
function findPos(obj) {
    var curleft = curtop = 0;
    curleft = jQuery(obj).parent('span').parent('a').parent('li').attr('offsetLeft');
    curtop = jQuery(obj).parent('span').parent('a').parent('li').attr('offsetTop');
    return [curleft,curtop];
}

/*scrollTop Plugin*/
var scrolltotop={
	//startline: Integer. Number of pixels from top of doc scrollbar is scrolled before showing control
	//scrollto: Keyword (Integer, or "Scroll_to_Element_ID"). How far to scroll document up when control is clicked on (0=top).
	setting: {startline:100, scrollto: 0, scrollduration:1000, fadeduration:[500, 100]},
	controlHTML: '', //HTML for control, which is auto wrapped in DIV w/ ID="topcontrol"
	controlattrs: {offsetx:5, offsety:5}, //offset of control relative to right/ bottom of window corner
	anchorkeyword: '#top', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links

	state: {isvisible:false, shouldvisible:false},

	scrollup:function(){
		if (!this.cssfixedsupport) //if control is positioned using JavaScript
			this.$control.css({opacity:0}) //hide control immediately after clicking it
		var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto)
		if (typeof dest=="string" && jQuery('#'+dest).length==1) //check element set by string exists
			dest=jQuery('#'+dest).offset().top
		else
			dest=0
		this.$body.animate({scrollTop: dest}, this.setting.scrollduration);
	},

	keepfixed:function(){
		var $window=jQuery(window)
		var controlx=$window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx
		var controly=$window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety
		this.$control.css({left:controlx+'px', top:controly+'px'})
	},

	togglecontrol:function(){
		var scrolltop=jQuery(window).scrollTop()
		if (!this.cssfixedsupport)
			this.keepfixed()
		this.state.shouldvisible=(scrolltop>=this.setting.startline)? true : false
		if (this.state.shouldvisible && !this.state.isvisible){
			this.$control.stop().animate({opacity:1}, this.setting.fadeduration[0])
			this.state.isvisible=true
		}
		else if (this.state.shouldvisible==false && this.state.isvisible){
			this.$control.stop().animate({opacity:0}, this.setting.fadeduration[1])
			this.state.isvisible=false
		}
	},
	
	init:function(){
		jQuery(document).ready(function($){
			var mainobj=scrolltotop
			var iebrws=document.all
			mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode
			mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body')
			mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>')
				.css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', bottom:mainobj.controlattrs.offsety, right:mainobj.controlattrs.offsetx, opacity:0, cursor:'pointer'})
				.attr({title:'Scroll Back to Top'})
				.click(function(){mainobj.scrollup(); return false})
				.appendTo('body')
			if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!='') //loose check for IE6 and below, plus whether control contains any text
				mainobj.$control.css({width:mainobj.$control.width()}) //IE6- seems to require an explicit width on a DIV containing text
			mainobj.togglecontrol()
			$('a[href="' + mainobj.anchorkeyword +'"]').click(function(){
				mainobj.scrollup()
				return false
			})
			$(window).bind('scroll resize', function(e){
				mainobj.togglecontrol()
			})
		})
	}
}

scrolltotop.init()

jQuery(document).ready( function() {
    /*Category Open Close*/
    jQuery('#category_menu').click( function() {
        if (jQuery('#category_menu div.categoryList').hasClass('openTable')) {
            if (jQuery.browser.msie) {
                jQuery('#category_menu div.categoryList').animate({
                    height: 'hide'
                }).removeClass('openTable');
            }
            else {
                jQuery('#category_menu div.categoryList').animate({
                    opacity: 'hide',
                    height: 'hide'
                }).removeClass('openTable');
            }
        }
        else {
            if (jQuery.browser.msie) {
                jQuery('#category_menu div.categoryList').animate({
                    height: 'show'
                });
            }
            else {
                jQuery('#category_menu div.categoryList').animate({
                    opacity: 'show',
                    height: 'show'
                });
            }
            setTimeout( function(){jQuery('#category_menu div.categoryList').addClass('openTable');}, 20)
        }         
    });

    jQuery('body').click( function() {
        if (jQuery('#category_menu div.categoryList').hasClass('openTable')) {
            if (jQuery.browser.msie) {
                jQuery('#category_menu div.categoryList').animate({
                    height: 'hide'
                }).removeClass('openTable');
            }
            else {
                jQuery('#category_menu div.categoryList').animate({
                    opacity: 'hide',
                    height: 'hide'
                }).removeClass('openTable');
            }
        }     
    });

    jQuery('.bodyBox .buttonData input#videoComments').click( function() {
        jQuery('.commentsBox').animate({
            opacity: 'show',
            height: 'show'
        }, 400);        
        jQuery('.commentsBoxFrm').animate({
            opacity: 'show',
            height: 'show'
        }, 400);        
        jQuery('#channel-media-box, .favorites, #media-box, .current').animate({
            opacity: 'hide',
            height: 'hide'
        }, 200);                                                  
    });

    /*BodyBG*/
    setTimeout(function() {
        heightContent('body');
    },1);
    jQuery(window).resize( function() {
        jQuery('body').removeAttr('style');
        heightContent('body');
    });

    /*Hover show Bubble*/
    jQuery('.group-init-box').each( function() {
        var groupID = $(this).attr('id');
        activateBubble('#'+groupID);
    });
    activateBubble('.current');
    activateBubble('#media-box');
    activateBubble('.favorites');
    activateBubble('#channel-media-box');
    
    /*Remove Video Logic*/
    jQuery('.linkRemoveFav a').click( function() {
        jQuery(this).parent('.linkRemoveFav').parent('li').find('h3').fadeOut(300);
        jQuery(this).parent('.linkRemoveFav').parent('li').find('.questionRemove').fadeIn(300);
        jQuery(this).parent('.linkRemoveFav').parent('li').find('a span img').addClass('toRemove');
    });
    jQuery('.questionRemove .cancelRemove').click( function() {
        jQuery(this).parents('.questionRemove').parent('li').find('h3').fadeIn(300);
        jQuery(this).parents('.questionRemove').fadeOut(300);
        jQuery(this).parents('.questionRemove').parent('li').find('a span img').removeClass('toRemove');
    });

    filterVideoReload();

    carouselMediaVideo('.mediaBody');
    carouselMediaVideo('#media-box');
    carouselMediaVideo('#channel-media-box');

    // AUTOLOAD CODE BLOCK (MAY BE CHANGED OR REMOVED)
    jQuery(function($) {
        $("img.reflect").reflect({/* Put custom options here */});
    });

    mirrorImageMedia('.myMedia');
    mirrorImageMedia('.myInstitutions');
    mirrorImageMedia('#media-box');
    mirrorImageMedia('.current');
    mirrorImageMedia('.favorites');
    mirrorImageMedia('#channel-media-box');
    jQuery('.group-init-box').each( function() {
        var groupID = $(this).attr('id');
        mirrorImageMedia('#'+groupID);
    });

    pagerListMedia('#media-box');
    pagerListSearch('#search-box');
    pagerListChannel('#channels');
    pagerListComm('.commentsCont');
    pagerListComm2('#guestbook_content');

    /*Safari Hack buttons*/
    if (jQuery.browser.safari) {
        jQuery('#media_upload #reply, #advanced_search #reply, #registerformdiv .button, #loginformdiv .button, .commentsCont .button, .bodyBox .buttonData input, ').css('paddingBottom','0px');
        jQuery('#mainmenu #searchbox input#search').css('top','2px');
    }

    /*filter*/
    jQuery('body').click( function() {
        jQuery('.filterMainVideo.selOpen').each ( function() {
            if (jQuery(this).hasClass('selOpenSeq')) {
                jQuery(this).find('ul#media-filter').animate({
                    height: 'hide'
                },100);
                jQuery(this).find('ul#media-filter a').animate({
                    height: 'hide',
                    opacity: 'hide'
                },50);
                jQuery(this).removeClass('selOpen').removeClass('selOpenSeq');
            }
            else {
                jQuery(this).addClass('selOpenSeq');
            }
        });
    });
    
    // DATEN HOLEN
    jQuery('#addfield').click(function() {
      strNewField = '<tr id=\"tr_employee_%\"><td><table width=\"400\" style=\"margin-top:10px;border-bottom:1px solid #C6C6C6;\" cellpadding=\"2\" cellspacing=\"2\" border=\"0\"><tr id=\"tr_firstname_%\"><th>';
      strNewField = strNewField + '<label for=\"empl_firstname_%\">Firstname</label>'; 
      strNewField = strNewField + '</th><td width=\"180\">';
      strNewField = strNewField + '<input type=\"text\" name=\"empl[firstname_%]\" id=\"empl_firstname_%\" />';
      strNewField = strNewField + '</td><td width=\"140\"><p><a onClick=\"jQuery(\'#tr_employee_%\').remove();\">[-] Remove this author</a></p></td></tr>';
      strNewField = strNewField + '<tr id=\"tr_middlename_%\"><th>';
      strNewField = strNewField + '<label for=\"empl_middlename_%\">Middlename</label>'; 
      strNewField = strNewField + '</th><td>';
      strNewField = strNewField + '<input type=\"text\" name=\"empl[middlename_%]\" id=\"empl_middlename_%\" />';
      strNewField = strNewField + '</td></tr>';
      strNewField = strNewField + '<tr id=\"tr_surname_%\"><th>';
      strNewField = strNewField + '<label for=\"empl_surname_%\">Surname</label>'; 
      strNewField = strNewField + '</th><td>';
      strNewField = strNewField + '<input type=\"text\" name=\"empl[surname_%]\" id=\"empl_surname_%\" />';
      strNewField = strNewField + '</td></tr><tr><td>&nbsp;</td></tr></table></tr>';
      addField(strNewField);
    });

    jQuery('#search').autocomplete(
    {
        url:'/search/custCompleteSearch',
        formatItem: function(data, i, n, value) {
            return value.split(".")[0];
        },
        formatResult: function(data, value) {
            return value.split(".")[0];
        }
    }).bind('result.autocomplete', function() {});
    
    
    /*Hover Info Box*/
    jQuery('.colInfo .headlineBox .InfoBut').mouseover( function() {
    	jQuery('.textData .infoText').css('display','block');
    });
    jQuery('.colInfo .headlineBox .InfoBut').mouseout( function() {
    	jQuery('.textData .infoText').css('display','none');
    });
    
    /*welcome Call*/
	jQuery('.welcomeLink').click( function() {
		var welcomeContent = '<div id="welcome"><div class="blackNight"></div><div class="box-w"><div class="top clearfix"><div class="headlineBox"><img src="/images/iclinics/text_image/hdWelcomeToIClinicsL.png" height="17" /></div><input class="butClose" type="image" src="/images/iclinics/butCloseLayer.png" width="25" height="23" /></div><div class="content thumbs clearfix"><p>iClinics gives you all: science, education, trade of experience, communication and community.</p><p>To view the continously growing content of this peer-reviewed scientific online journal, just start to browse whatever is of interest for you or what you need to know. iClinics is a free open-access publication, which does not require the hazzles of login procedures except for a few sensitive topics. Due to ist web-based structure, the frontiers between written manuscripts, "slide" presentations in PowerPoint or Keynote format, spreadsheeths, pictures, audio and video are becoming nonexistent. Read a new little trick-of-the-trade, educate yourself on basic office procedures or view complex surgical procedures along with the related critical comments of the international scientific community - its all there. The quality of the content is guaranteed by the peer-review requirement for each single contribution, which is filtered through the judgement of reknowed experts in urology and related specialities.</p><div class="left welcomeImg1"><img class="left" src="images/hohenfellner.jpg" /><p>Markus Hohenfellner, M.D. </p></div><div class="left welcomeImg2"><img class="left" src="images/santucci.jpg" /> <p>Richard Santucci, M.D.</p></div><p>Moreover, we cordially invity you to participate actively in iClinics as well. Rate and comment iClinic content, upload your content to iClinics, contribute to the discussion groups or the interactive blog platform. Precondition for such active participation is that you register in iClinics with the authentication of your identity by your affiliation with a recognized clinical and/or scientific institution or membership of a major national or international scientific society.</p><p>In summary, iClinics is committed to continue the tradition of classical paper journals in facilitating the discovery of the unknown and the search for the truth. Additionally it stands for education and quick and efficient communication. iClinics intends to succeed as a worldwide platform for the medical community to share its experience for the best of our patients - salus aegroti suprema lex.</p></div><div class="mediaBoxBot">  </div></div></div>';
		jQuery('body').prepend(welcomeContent);
		callNight();
	});

});
