var MH = 210; var MW = 300; var DIFFMOVIEBOTTOM = 40; var SRW = 0; var SRH = 0; var OW = 0; var OH = 0; var SSHOW = 0; var NOGAL = 0; $(document).ready(function(){ if(window.location.hash.substr(1)!= ""){ siteID = window.location.hash.substr(1); } if(siteID=="") siteID = "home"; $("#menu_noscript").remove(); $("#content_noscript").remove(); get_main(); function get_main(){ $.get("index.php?cmd=init&siteID="+siteID, function(data) { $("#main").html(data); get_menuID(); get_menu(); $("#"+siteID).addClass("active"); $("#s"+siteID).addClass("smb_active"); $("#sb"+menuID).addClass("shm_active"); set_pos_active(); $("#menu").switchClass("me_ce", "me_"+menuID, "slow"); $("#container_main").addClass("cm_"+menuID); mainw = $("#main").width() - 20; mainh = $("#main").height() - 20; build_content(); build_gallery(); build_slogan(); build_showreel(); if(siteID=="home"){ $("#content").hide(); $("#gallery").hide(); } $("#topmenu .tmenu").click(function(e) { e.preventDefault(); clearTimeout(timeOUT); clear_ticker(); SSHOW = 0; $(".hm").unbind("click"); $(".mb"+menuID).unbind("click"); set_pos_inactive(); $("#s"+siteID).removeClass("smb_active"); $("#sb"+menuID).removeClass("shm_active"); switch_corner($(this).attr("name")); }); }); } function get_menuID(){ menuID = ""; for(i=0;i<m.length;i++){ if(SRW==0 && SRH==0){ $("#b"+m[i][6]).attr({ style: "top:"+m[i][4]+"px; left:"+m[i][5]+"px" }); $("#bm"+m[i][6]).attr({ style: "top:"+m[i][11]+"px; left:"+m[i][12]+"px" }); } if(m[i][2]==siteID) { menuID = m[i][6]; } for(ii=0;ii<m[i][13].length;ii++){ if(SRW==0 && SRH==0){ $("#"+m[i][13][ii][2]).attr({ style: "top:"+m[i][13][ii][4]+"px; left:"+m[i][13][ii][5]+"px" }); $("#s"+m[i][13][ii][2]).attr({ style: "top:"+m[i][13][ii][7]+"px; left:"+m[i][13][ii][8]+"px" }); } if(m[i][13][ii][2]==siteID) { menuID = m[i][13][ii][6]; } } } if(SRW==0 && SRH==0){ SRW = $("#showreel").width(); SRH = $("#showreel").height(); } if(menuID=="") menuID = "ho"; } function set_pos_active(){ for(i=0;i<m.length;i++){ for(ii=0;ii<m[i][13].length;ii++){ if(m[i][13][ii][2]==siteID) { $("#"+m[i][13][ii][2]).css({ "top" : m[i][13][ii][9], "left" : m[i][13][ii][10] }); $("#s"+m[i][13][ii][2]).css({ "top" : m[i][13][ii][11], "left" : m[i][13][ii][12] }); } } } } function set_pos_status(){ for(i=0;i<m.length;i++){ if(m[i][6]==menuID){ $("#sb"+m[i][6]).css({ "top" : m[i][9], "left" : m[i][10] }); } else{ $("#sb"+m[i][6]).css({ "top" : m[i][7], "left" : m[i][8] }); } } } function set_pos_inactive(){ for(i=0;i<m.length;i++){ for(ii=0;ii<m[i][13].length;ii++){ if(m[i][13][ii][2]==siteID) { $("#"+m[i][13][ii][2]).css({ "top" : m[i][13][ii][4], "left" : m[i][13][ii][5] }); $("#s"+m[i][13][ii][2]).css({ "top" : m[i][13][ii][7], "left" : m[i][13][ii][8] }); } } } } function get_site(){ build_content(); build_gallery(); build_slogan(); build_showreel(); get_menu(); $("#"+siteID).addClass("active"); $("#s"+siteID).addClass("smb_active"); $("#sb"+menuID).addClass("shm_active"); set_pos_active(); } function build_showreel(){ $("#showreel").removeClass("sr_ho sr_se sr_sw sr_ne sr_nw sr_init"); $("#showreel").addClass("sr_"+menuID); if(menuID == "ho") ha = "nw"; else ha = menuID; $("#showreel").resizable({ minHeight: MH, minWidth: MW, maxHeight: mainh - MH, maxWidth:mainw - MW, resize: function(event, ui) { fix_movie(); image_resize(); }, handles: ha }); $(".ui-resizable-handle").dblclick(function() { fix_pos(); }); $("div").removeClass("ui-icon ui-icon-gripsmall-diagonal-se"); $.get("index.php?cmd=movie&siteID="+siteID, function(data) { $("#movie").html(data); $("#movie").tabs(); $("#showreel").show(); if(siteID=="home"){ $(".ui-resizable-handle").hide(); $("#showreel").width(700); $("#showreel").height(470); } fix_movie(); }); } function build_content(){ $("#content").removeClass("ct_ho ct_se ct_sw ct_ne ct_nw"); $("#content").addClass("ct_"+menuID); $.get("index.php?cmd=content&siteID="+siteID, function(data) { $("#content").html(data); $("#content").ready(function() { $("#accordion").accordion({ fillSpace: true, change: function(event, ui) { if(siteID=="fernsehen"){ twidth = $("#ticker").width(); $("#ticker").css("left", ($("#content").width()-50)); ticker(); } } }); if(siteID!="home") $("#content").show("slow"); twidth = 0; if(siteID=="regionen" || siteID=="referenzen" || siteID=="neue_medien"){ twidth = $("#ticker").width(); $("#ticker").css("left", ($("#content").width()-50)); $("#ticker").hover(function(){ $("#ticker").stop(); }, function(){ ticker(); }); ticker(); } if(siteID=="kontakt"){ $("#kontaktformular").click(function(e) { e.preventDefault(); $('<div id="dialog_kontakt" title="Kontakt Maritim Film"></div>').appendTo("#content"); $.get("index.php?cmd=kontaktformular", function(data){ $("#dialog_kontakt").html(data.substring(1)); $("#dialog_kontakt").dialog({ autoOpen: true, resizable: false, height: 320, width: 450, modal: true, buttons: { 'Absenden': function() { $.ajax({ type: "POST", url: "?cmd=kontaktformular", data: $("#frm_contact").serialize(), success: function(msg){ $("#dialog_kontakt").html(msg.substring(1)); if(msg.substring(0,1)==1){ $('.ui-dialog-buttonpane').find('Button:eq(0)').hide(); $('.ui-dialog-buttonpane').find('Button:eq(1)').text("Schliessen"); } } }); }, 'Abbrechen': function() { $(this).dialog('close'); } } }); }); }); } fix_movie(); }); }); } function ticker(){ $("#ticker").animate({left: -twidth}, twidth*23, "linear", function(){ $("#ticker").css("left", ($("#content").width()-50)); ticker(); }); } function clear_ticker(){ if(siteID=="regionen" || siteID=="referenzen" || siteID=="fernsehen" || siteID=="neue_medien") $("#ticker").stop(); } function dummy(){ } function build_gallery(){ timeOUT = setTimeout(function(){ dummy(); },500); $("#gallery").removeClass("gl_ho gl_se gl_sw gl_ne gl_nw"); $("#gallery").addClass("gl_"+menuID); $.get("index.php?cmd=gallery&siteID="+siteID, function(data) { $("#images").html(data); $("#images").tabs({ select: function(event, ui) { clearTimeout(timeOUT); SSHOW=0; tid = ui.index + 1; thumbID = 0; SSHOW = 1; slideshow(); } }); $(".thumb").click(function() { clearTimeout(timeOUT); SSHOW=0; img = $(this).attr("src").replace("/th", "/mid"); thumbID = $(this).index() + 1; load_image(); }); if(siteID!="home") $("#gallery").show(); clearTimeout(timeOUT); tid = 1; thumbID = 0; if($(".dimid a").length > 0){ $("#gallery ul").hide(); NOGAL = 40; img = $(".dimid > a:eq(0)").attr("href"); load_image(); } else{ NOGAL = 0; SSHOW = 1; slideshow(); } fix_movie(); }); } function slideshow(){ if(SSHOW==1){ img = $("#tabs2-"+tid+" .ithumbs > img:eq("+thumbID+")").attr("src").replace("/th", "/mid"); load_image(); thumbID++; if(thumbID==$("#tabs2-"+tid+" .ithumbs > img").length){ thumbID = 0; } } } function switch_image(){ img = $("#tabs2-"+tid+" .ithumbs > img:eq("+thumbID+")").attr("src").replace("/th", ""); $("#bimg").html('<img src="'+img+'">'); } function load_image(){ $("#tabs2-"+tid+" .dimid").html('<img class="imid" src="'+img+'">'); $("#tabs2-"+tid+" .imid").load(function() { $(".imid").click(function() { clearTimeout(timeOUT); SSHOW=0; if(NOGAL==0) thumbID--; $("#menu").css("z-index", "0"); $(".ui-resizable-handle").css("z-index", "0"); $('<div id="biggallery" class="ui-widget-overlay"></div>').appendTo("body"); $('<div id="biggallery_image" style="position:absolute; width:1000px; height:680px; top:50px; left:50%; margin-left:-500px; background-color:#FFFFFF;"><p style="text-align:right"><a name="close">schliessen</a></p><p style="text-align:center" id="bimg"></p><p id="iswitch" style="text-align:center"><a name="left">&lt;&lt;</a> <a name="right">&gt;&gt;</a></p></div>').appendTo("body"); if(NOGAL > 0){ $("#iswitch").remove(); } $("#biggallery_image a").click(function() { switch($(this).attr("name")){ case 'left': thumbID--; if(thumbID==-1) thumbID = $("#tabs2-"+tid+" .ithumbs > img").length - 1; switch_image(); break; case 'right': thumbID++; if(thumbID==$("#tabs2-"+tid+" .ithumbs > img").length) thumbID = 0; switch_image(); break; case 'close': $("#menu").css("z-index", "2"); $(".ui-resizable-handle").css("z-index", "1000"); $("#biggallery").remove(); $("#biggallery_image").remove(); break; } }); switch_image(); }); OH = $("#tabs2-"+tid+" .imid").height(); OW = $("#tabs2-"+tid+" .imid").width(); image_resize(); $("#tabs2-"+tid+" .imid").fadeIn(1000); if(SSHOW==1) timeOUT = setTimeout(slideshow,6000); }); } function image_resize(){ var ph = $("#tabs2-"+tid+" .pimid").height(); var nw = $("#tabs2-"+tid+" .pimid").width(); var d = OW / nw; var nh = OH / d; if(nh > ph){ d = nh / ph; nw = nw / d; nh = ph; } nh = Math.round(nh); nw = Math.round(nw); $("#tabs2-"+tid+" .dimid").height(nh); $("#tabs2-"+tid+" .dimid").width(nw); $("#tabs2-"+tid+" .imid").height(nh); $("#tabs2-"+tid+" .imid").width(nw); } function build_slogan(){ $("#slogan").removeClass("sl_ho sl_se sl_sw sl_ne sl_nw"); $("#slogan").addClass("sl_"+menuID); $.get("index.php?cmd=slogan&siteID="+siteID, function(data) { $("#slogan").html(data); $("#slogan img").addClass("slb_"+menuID); $("#slogan").show(); }); } function get_menu(){ $("#menu img:visible").hide(); $(".hm").show(); $("#bm"+menuID).show(); $("#b"+menuID).hide(); $(".mb"+menuID).show(); $(".smb"+menuID).show(); set_pos_status(); $("#menu").show(); $(".shm").show(); $(".mb"+menuID+", .smb"+menuID).click(function() { clearTimeout(timeOUT); SSHOW = 0; clear_ticker(); $("#"+siteID).removeClass("active"); $("#s"+siteID).removeClass("smb_active"); set_pos_inactive(); siteID = $(this).attr("name"); window.location.hash = siteID; $("#"+siteID).addClass("active"); $("#s"+siteID).addClass("smb_active"); set_pos_active(); build_content(); $("#images").tabs("destroy"); $("#images").empty(); build_gallery(); $("#movie").tabs("destroy"); $("#movie").empty(); build_showreel(); $("#slogan").hide(); $("#slogan").empty(); build_slogan(); }); $(".hm, .shm").click(function() { clearTimeout(timeOUT); clear_ticker(); SSHOW = 0; set_pos_inactive(); $("#"+siteID).removeClass("active"); $("#sb"+menuID).removeClass("shm_active"); $(".hm").unbind("click"); $(".mb"+menuID).unbind("click"); switch_corner($(this).attr("name")); }); } function switch_corner(id){ $("#showreel").resizable("destroy"); if(SRW!=0){ fix_pos(); } $("#showreel").hide(); $("#movie").tabs("destroy"); $("#movie").empty(); $("#content").hide(); $("#gallery").hide(); $("#images").tabs("destroy"); $("#images").empty(); $("#slogan").hide(); $("#slogan").empty(); siteID = id; window.location.hash = siteID; $(".mb"+menuID).hide(); $(".smb"+menuID).hide(); $(".shm").hide(); $("#bm"+menuID).hide(); $("#b"+menuID).show(); omenuID = menuID; get_menuID(); if("cm_"+omenuID != "cm_"+menuID){ $("#container_main").switchClass("cm_"+omenuID, "cm_"+menuID); var speed = 3000; if(omenuID=="ho" && menuID=="nw") speed = 0; $("#menu").switchClass("me_"+omenuID, "me_"+menuID, speed, function() { get_site(); }); } else{ get_site(); } } function fix_pos(){ $("#showreel").width(SRW); $("#showreel").height(SRH); $("#showreel").removeAttr("style"); $("#showreel").removeClass("sr_ho sr_se sr_sw sr_ne sr_nw sr_init"); $("#showreel").addClass("sr_"+menuID); fix_movie(); image_resize(); } function fix_movie(){ difftab = $("#showreel .ui-tabs-nav").height() - 25; difftab2 = $("#gallery .ui-tabs-nav").height() - 25; $(".tab").width($("#showreel").width()); $(".tab").height($("#showreel").height()-DIFFMOVIEBOTTOM-difftab); $("#content").width(mainw-$("#showreel").width()); $("#content").height($("#showreel").height()); $("#gallery").width($("#showreel").width()); $("#gallery").height(mainh-$("#showreel").height()); $(".tab2").height($("#gallery").height()-DIFFMOVIEBOTTOM-difftab2+NOGAL); $("#slogan").width($("#content").width()); $("#slogan").height($("#gallery").height()); $("#accordion").accordion("resize"); tid = $("#images").tabs("option", "selected") + 1; } });
