function IIDControl() { this.nav_mode = 'right'; this.nav_width = 280; this.nav_moving = false; this.move_complete_url = ''; this.min_height = 700; } IIDControl.prototype.resize_screen = function(callback) { if(this.nav_mode === 'left') { this.move_screen_left(); } if(this.nav_mode === 'right') { this.move_screen_right(); } var height = $(window).height(); var width = $(window).width(); var content_width = width - this.nav_width; var content_height = height; if(content_height < this.min_height) content_height = this.min_height; $("#nav_footer").css( { "top": (height-165) + "px" } ); $("#slideshow").height(content_height); $("#slideshow").width(content_width); $("#nav_column").height(content_height); $("#nav_column").css( { "left":content_width}); if(this.nav_mode === 'left') { $("#base").css({ "left":0-content_width}); } var content_width = width - this.nav_width; $("#nav_footer").css( { "top": (content_height-165) + "px" } ); $("#slideshow").height(content_height); $("#slideshow").width(content_width); $("#nav_column").height(content_height); $("#nav_column").css( { "left":content_width}); $("#content_frame").css( { "left": width + "px" } ); $(".loading").css( { "left":content_width/2+content_width+100}); //$("#content_frame").hide() $("#content_frame").width(content_width); //$("#content_frame").height(height); }; IIDControl.prototype.move_complete = function(callback) { //if(!this.nav_moving) // return; this.nav_moving = false; if(this.move_complete_url != '') { this.load_content(this.move_complete_url); } if(this.nav_mode === 'right') { $('#content_frame').hide(); } this.move_complete_url = ''; $("body").css("cursor", "auto"); } IIDControl.prototype.move_screen_right = function(callback) { if(this.nav_moving || this.nav_mode === 'right') { this.move_complete(); return; } var width = $(window).width(); var content_width = width - this.nav_width; var obj = this; $("#base").animate({ left:0 }, 1000, "swing", function(){iid_control.move_complete(); } ); this.nav_moving = true; this.nav_mode = 'right'; }; IIDControl.prototype.move_screen_left = function(callback) { if(this.nav_moving || this.nav_mode === 'left') { this.move_complete(); return; } var width = $(window).width(); var content_width = width - this.nav_width; var obj = this; $("#base").animate({ left:0-content_width }, 1000, "swing", function(){iid_control.move_complete(); } ); this.nav_moving = true; this.nav_mode = 'left'; }; IIDControl.prototype.init = function(callback) { //this.move_screen_right(); this.resize_screen(); }; IIDControl.prototype.content_loading = function(url) { //$("body").css("cursor", "progress"); //url = '/content/loading.html' //$('#content_frame').attr('src', url); $('#content_frame').hide(); $('.loading').show(); } IIDControl.prototype.load_content = function(url) { //this.move_screen_right(); //alert('url ['+url+']'); $('#content_frame').attr('src', url); $('#content_frame').hide(); var content_width = $(window).width() - this.nav_width; var height = $(window).height(); if(height < this.min_height) height = this.min_height; $("#content_frame").height(height); //alert(navigator.userAgent); if((navigator.userAgent.match(/MSIE 7/i)) ||(navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) { $("#content_frame").width(5000); } else { $("#content_frame").width(content_width); } }; IIDControl.prototype.move_project_to_top = function(selected_item_id) { var item; var height; var item_name; // if selected item then offset negativly up to top position // if item is less then selected position then, shift down by one // if item is above selected item then leave in default pos for(item = 1; item <= 10; item+=1) { height=0; if(item == selected_item_id) height = (item-1)*-23; if(item > selected_item_id) height = 0; if(item < selected_item_id) height = 23; item_name = '#nav_proj_'+item; $( item_name).animate({ 'top':height },100, "swing"); } }; var iid_control = new IIDControl(); $(window).load(function() { iid_control.init(); $(window).resize(function(){ iid_control.resize_screen(); }); $("#nav_item_about").click(function(){ $("#nav_menu_about").animate({ height:142 }, 700, "swing"); $("#nav_menu_projects").animate({ height:0 }, 700, "swing"); $("#nav_menu_contact").animate({ height:0 }, 700, "swing"); }); $("#nav_item_projects").click(function(){ $("#nav_menu_about").animate({ height:0 }, 700, "swing"); $("#nav_menu_projects").animate({ height:230 }, 700, "swing"); $("#nav_menu_contact").animate({ height:0 }, 700, "swing"); }); $("#nav_item_news").click(function(){ $("#nav_menu_about").animate({ height:0 }, 700, "swing"); $("#nav_menu_projects").animate({ height:0 }, 700, "swing"); $("#nav_menu_contact").animate({ height:0 }, 700, "swing"); iid_control.content_loading(); iid_control.move_complete_url = 'content/project.php?id=113'; iid_control.move_complete(); iid_control.move_screen_left(); }); $("#nav_item_contact").click(function(){ $("#nav_menu_about").animate({ height:0 }, 700, "swing"); $("#nav_menu_projects").animate({ height:0 }, 700, "swing"); $("#nav_menu_contact").animate({ height:100 }, 700, "swing"); }); $(".nav_proj").click(function(){ var project_id = $(this).attr('project_id'); var menu_pos = $(this).attr('menu_pos'); //alert(menu_pos+','+project_id); iid_control.content_loading(); iid_control.move_project_to_top(menu_pos); iid_control.move_complete_url = 'content/project.php?id='+project_id; iid_control.move_screen_left(); }); $("#nav_menu_about li").click(function(){iid_control.move_screen_left(); }); $("#nav_item_approach").click(function(){ iid_control.content_loading(); iid_control.move_complete_url = 'content/approach.html'; iid_control.move_screen_left(); }); $("#nav_item_team").click(function(){ iid_control.content_loading(); iid_control.move_complete_url = 'content/team.php'; iid_control.move_screen_left(); }); $("#nav_item_timeline").click(function(){ iid_control.content_loading(); iid_control.move_complete_url = 'content/timeline.html'; iid_control.move_screen_left(); }); $("#nav_item_profile").click(function(){ iid_control.content_loading(); iid_control.move_complete_url = 'content/profile.html'; iid_control.move_screen_left(); }); $("#nav_item_sustainability").click(function(){ iid_control.content_loading(); iid_control.move_complete_url = 'content/sustainability.html'; iid_control.move_screen_left(); }); $("#nav_item_breeam").click(function(){ iid_control.content_loading(); iid_control.move_complete_url = 'content/breeam.html'; iid_control.move_screen_left(); }); $("#nav_item_zerocarbon").click(function(){ iid_control.content_loading(); iid_control.move_complete_url = 'content/zerocarbon.html'; iid_control.move_screen_left(); }); $("#nav_item_directions").click(function(){ iid_control.content_loading(); iid_control.move_complete_url = 'content/contact_directions.html'; iid_control.move_screen_left(); }); $("#nav_item_jobs").click(function(){ iid_control.content_loading(); iid_control.move_complete_url = 'content/contact_jobs.html'; iid_control.move_screen_left(); }); $("#iid_logo").click(function(){iid_control.move_screen_right(); }); iid_control.resize_screen(); /*function onBefore(curr, next, opts, fwd) { // on Before arguments: // curr == DOM element for the slide that is currently being displayed // next == DOM element for the slide that is about to be displayed // opts == slideshow options // fwd == true if cycling forward, false if cycling backward // on the first pass, addSlide is undefined (plugin hasn't yet created the fn yet) if (!opts.addSlide) return; // add our next slide opts.addSlide(''); }; */ $('#content_frame').load(function() { $('.loading').hide(); $('#content_frame').show(); }); $('.loading').hide(); $('#slideshow').load('/feeds/homeImages2.php', function(){ $('#slideshow').cycle({ timeout: 8000, speed: 2000, //before: onBefore }); $("#slideshow").backgroundScale({ imageSelector: ".slideshow_image", centerAlign: true, containerPadding: 0 }); }); });