$(document).ready(function() { var photo = 0; var max = 1; var move = 400; var pos = 0; var pixel = 10; var m_2006_june = 53; var m_2006_december = 310; var m_2007_march_1 = 450; var m_2007_march_2 = 542; var m_2007_june = 683; var m_2007_september = 796; var t_2006_june = 0; var t_2006_december = -400; var t_2007_march_1 = -2490; var t_2007_march_2 = -13525; var t_2007_june = -23470; // old 21630 var t_2007_september = -24080; // old 22240 function markerMove() { if (pos >= 0) { $("#marker").animate({ left: m_2006_june },500); $("#nav_left").hide(); } else if (pos <= t_2006_december && pos >= t_2007_march_1) $("#marker").animate({ left: m_2006_december },500); else if (pos <= t_2007_march_1 && pos > t_2007_march_2) $("#marker").animate({ left: m_2007_march_1 },500); else if (pos <= t_2007_march_2 && pos >= t_2007_june) $("#marker").animate({ left: m_2007_march_2 },500); } function videoStop() { $("#face2face_video").remove(); $("img.nav_photo").fadeTo(300,0.2); $("#p_main").fadeTo(300,1); $("#play").show(); } function videoStart() { if (arguments.length) delay = arguments[0]; else delay = 0; if (pos != 0) { pos = 0; photo = 0; $("#nav_content").animate({ left: pos },700); } $("#nav_left").hide(); setTimeout(function() { $("#p_main").hide(); $("#face2face_video").remove(); $("#play").after('
'); $("#play").hide(); $("#nav_right").show(); },delay); markerMove(); } function navReset() { pos = 0; photo = 0; $("#nav_content").animate({ left: pos },500); $("#nav_left").hide(); videoStop(); markerMove(); return true; } function navLeft() { img_cur = $("img.nav_photo").get(photo); img_new = $("img.nav_photo").get(photo-1); move = parseInt($(img_cur).attr("width")); // pos = -(photo * move - move); pos += move+pixel; pos2 = pos; photo--; $("#nav_content").animate({ left: pos2 },500); $("img.nav_photo").fadeTo(300,0.2); $(img_new).fadeTo(300,1); if (pos == 0) { $("#nav_left").hide(); $("#play").show(); } $("#nav_right").show(); markerMove(); } function navRight() { img_new = $("img.nav_photo").get(photo+1); img_next = $("img.nav_photo").get(photo+2); move = parseInt($(img_new).attr("width")); pos -= move+pixel; // pos = -(photo * move + move); photo++; $("#nav_content").animate({ left: pos },500); $("img.nav_photo").fadeTo(300,0.2); $(img_new).fadeTo(300,1); if (!$(img_next).attr("id")) $("#nav_right").hide(); $("#nav_left").show(); // Timeline cleanup $("#face2face_video").remove(); $("#p_main").show(); markerMove(); } // Loading stuffs // $("#nav_intro").load("feeds/intro.xml?lang="); $("#i_contact").attr("href","mailto:face2faceproject@gmail.com"); // $.get("feeds/images.xml",function(data) { $("#empty").before(data); }); $("#photos_load").load("feeds/images.xml"); img = $("img.nav_photo").get(photo+1); $(img).fadeTo(300,0.3); setTimeout(function() { $("#intro").fadeOut(300); $("#supercontainer").fadeIn(800); },2000); // If start the video $("#play").click(function() { $("#p_main").hide(); $("#play").after(''); $(this).hide(); }); $("#i_video").click(function() { if (pos != 0) delay = 1000; else delay = 0; videoStart(delay); return false; }); $("#i_purchase").click(function() { $("#m_2007_june").click(); return false;}); // Logo click $("#logo > a").click(function() { navReset(); return false; }); // Menu click $("#info > a.thickbox").click(function() { videoStop(); }); // Play button $("#play").hover( function() { if ($.browser.msie) $(this).css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/play_on.png')"); else $(this).css("background-image","url('../images/play_on.png')"); }, function() { if ($.browser.msie) $(this).css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/play.png')"); else $(this).css("background-image","url('../images/play.png')"); } ); // Timeline image rollover $("img.event").hover( function() { $(this).attr("src",$(this).attr("src").replace(".gif","")+"_on.gif"); }, function() { $(this).attr("src",$(this).attr("src").replace("_on.gif","")+".gif"); } ); // Timeline date browsing $("#m_2006_june").click(function() { navReset(); return false; }); $("#m_2006_december").click(function() { pos = t_2006_december; photo = 1; $("#marker").animate({ left: m_2006_december },500); $("#nav_content").animate({ left: pos },500); videoStop(); $("#p_main").fadeTo(300,0.2); img = $("img.nav_photo").get(photo); $(img).fadeTo(300,1); $("#nav_right").show() }); $("#m_2007_march_1").click(function() { pos = t_2007_march_1; photo = 6; $("#marker").animate({ left: m_2007_march_1 },500); $("#nav_content").animate({ left: pos },500); videoStop(); img = $("img.nav_photo").get(photo); $(img).fadeTo(300,1); $("#nav_right").show(); }); $("#m_2007_march_2").click(function() { pos = t_2007_march_2; photo = 30; $("#marker").animate({ left: m_2007_march_2 },500); $("#nav_content").animate({ left: pos },500); videoStop(); img = $("img.nav_photo").get(photo); $(img).fadeTo(300,1); $("#nav_right").show(); $("#nav_left").show(); }); $("#m_2007_june").click(function() { videoStop(); pos = t_2007_june; $("#marker").animate({ left: m_2007_june },500); $("#nav_content").animate({ left: pos },500); $("#nav_right").hide(); $("#nav_left").hide(); }); $("#m_2007_september").click(function() { videoStop(); pos = t_2007_september; $("#marker").animate({ left: m_2007_september },500); $("#nav_content").animate({ left: pos },500); $("#nav_right").hide(); $("#nav_left").hide(); }); // Disabled click for none middle photo $("img.nav_photo").click(function() { img_cur = $("img.nav_photo").get(photo); if ($(this).attr("id") != $(img_cur).attr("id")) return false; }); // Language setup $("#language").click(function() { $.get("feeds/language.xml?lang="+$(this).attr("rel"),function(xml) { if ($("result",xml).text() == 1) { document.location = $("location",xml).text(); } else alert($("message",xml).text()); }); return false; }); // Browse stuffs $("#nav_left").click(function() { navLeft(); }); $("#nav_right").click(function() { navRight(); }); });