$(document).ready(function(){
    $(".middletextimage").cu_xFader({'fadetime' : 2000,'waittime' : 6000,'prevobj':'.middletextpreview'}); 
    $(".middletextimagehpall").cu_xFader({'fadetime' : 2000,'waittime' : 6000,'pointobj':'.middletextimagehpdot','pointcl':'hpdotactive','pointxicl':'hpimagedark','pointxdcl':'hpdotdark'});
    $(".MenuBarArea LI").hover(
        function(){$(this).find('ul:first').slideDown(200)},
        function(){$(this).find('ul:first').slideUp(1)}
        );
    $("A").cu_xLinkLog({'url' : "/content/elink.php/?l=", 'url2':"&d="});
    $(".MenuBarArea UL LI UL LI:last-child A").css({paddingBottom:14});
    $(".middletextpreview IMG:last-child").css({marginRight:0,marginLeft:2});
    $(".highspagesone:last-child A").css({borderBottom:"0px solid #FFFFFF"});
    $(".homebutton, IMG[src$='buttonvergleichmedical.png'], IMG[src$='buttonvergleichrelax.png']").mouseover(function(){ $("BODY").css('cursor','pointer')}).mouseleave(function(){ $("BODY").css('cursor','auto')});
    $("IMG[src$='01\/buttonvergleichmedical.png']").mousedown(function(){loadlayover('/content/popup/medical_tech.php/1/');});
    $("IMG[src$='01\/buttonvergleichrelax.png']").mousedown(function(){loadlayover('/content/popup/relax_tech.php/1/');});
    $("IMG[src$='04\/buttonvergleichmedical.png']").mousedown(function(){loadlayover('/content/popup/medical_tech.php/4/');});
    $("IMG[src$='04\/buttonvergleichrelax.png']").mousedown(function(){loadlayover('/content/popup/relax_tech.php/4/');});
    $(".formallhigh .formtextfield").focusin(function(){kontaktfocus($(this));});
    $(".middletext IMG[src*='cat24']").addClass("middlezoomer");
    $(".middletext IMG[src*='cat24']").wrap('<div class="middlezoomerout" />');
    $(".middletext IMG[src*='cat24']").after('<img src="/content/images/lupe.png" class="middlezoomerlupe">');
    window.setTimeout(resizezoomer,200);
    $(".middletext .middlezoomer").mouseover(function(){zoomer($(this));}).mouseout(function(){dezoomer($(this));});
});
$(document).load(function(){
    resizezoomer();
});
function printfenster(url,fe,br,ho) {
	var brI;
	var HoI;
	brI = (window.screen.width/2) - ((br/2) + 10);
	HoI = (window.screen.height/2) - ((ho/2) + 20);
	var win = window.open(url,fe,"height="+ho+",width="+br+",left=" + brI + ",top=" + HoI + ",screenX=" + brI + ",screenY=" + HoI + ",resizable=yes,scrollbars=yes,toolbar=no,menubar=yes,status=no");
	win.focus();
	window.event.returnValue=false;
	return false;
}
function fenster(url,fe,br,ho) {
	return printfenster(url,fe,br,ho);
}
function CUflashtag(url,wid,hei,fva,bgc,wmo){
    if (bgc==''){ bgc='#FFFFFF';}
    if (wmo==''){ wmo='transparent';}
    AC_FL_RunContent( 'codebase','https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width',wid,'height',hei,'src',url,'flashvars',fva,'quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie',url,'bgcolor',bgc,'wmode',wmo,'AllowScriptAccess','always'); 
}
function loadlayover(url){
    if ($("#layover").length==0){
        $('.allarea').after('<div id="layover"></div>');
    }
    $("#layover").fadeOut(1);
    $("#layover").load( url ,function(){
        $("#layover").fadeIn(500);
        $(".techparthead, .closetechlayover").mouseover(function(){ $("BODY").css('cursor','pointer')}).mouseleave(function(){ $("BODY").css('cursor','auto')});
        $(".techpart:gt(1) .techpartcontent").slideUp(1);
        $(".techarea:eq(0) .techparthead").addClass('techpartheadactive');
        $(".techparthead").mouseover(function(){
            myindex=$(this).parent().parent().index()-1;
            $(".techarea:not(:eq("+myindex+")) .techpartcontent").slideUp(500);
            $(".techarea:not(:eq("+myindex+")) .techparthead").removeClass('techpartheadactive');
            $(".techarea:eq("+myindex+") .techpartcontent").slideToggle(500);
            $(".techarea:eq("+myindex+") .techparthead").toggleClass('techpartheadactive');
        });
        $(".closetechlayover").mousedown(function(){
            $("#layover").fadeOut(500,function(){$("#layover").empty();});
        });
    });
}
function zoomer($this){
    $("#middlezoomerbig").detach();
    $('.allarea').after('<div id="middlezoomerbig"><div class="middlezoomerbiginner"><img src="'+$this.attr('src')+'"></div></div>');
    $('#middlezoomerbig IMG:first').load(function() {
        $('.middlezoomerbiginner').width($(this).width());
        $('.middlezoomerbiginner').css({marginLeft: -($(this).width() / 2), marginTop: -($(this).height() / 2)});
        $(".middlezoomerbiginner").fadeIn(200);
    });
    /*$("#middlezoomerbig IMG:first").mousedown(function(){
        $("#middlezoomerbig").fadeOut(300,function(){$("#layover").empty();});
    });*/
}
function dezoomer($this){
    $("#middlezoomerbig").fadeOut(300,function(){$("#layover").empty();});
}
function resizezoomer(){
    $(".middlezoomerout").each(function(){
        $(this).height($(this).children(".middlezoomer").height());
    });
}
function pw_download(url){
    $("#pwdownload").detach();
    $('.allarea').after('<div id="pwdownload"></div>');
    $("#pwdownload").fadeOut(1);
    $pwlang=(url.indexOf('/de/')!==-1)?(1):(4);
    $pwurl='/content/popup/pw_download.php/'+$pwlang+'/?u='+url;
    $("#pwdownload").load( $pwurl ,function(){
        pw_download2($(this),$pwurl);
    });
}
function pw_download2($this,$pwurl){
    $("#pwdownload").fadeIn(100);
    $("#pwdownload INPUT[name=scloginaction]").click(function(event){
        event.preventDefault();
        pw_download3($this,$pwurl);
    });
    $(".pw_downloadclose").mousedown(function(){
            $("#pwdownload").fadeOut(500,function(){$("#pwdownload").empty();});
        });
} 
function pw_download3($this,$pwurl){
    $param={"sclogin":$this.find('INPUT[name=sclogin]').val(),"scpasswd":$this.find('INPUT[name=scpasswd]').val()};
    $("#pwdownload").load($pwurl,$param,function(){
        pw_download2($(this),$pwurl);
    });
} 
function kontaktfocus($this){
    data=$this.data('kontaktfocus');
    if (!data || !data.cleared){
        $this.data('kontaktfocus',{'cleared':true});
        $this.val('');
    }
}
