// 'stacks' is the Stacks global object. // All of the other Stacks related Javascript will // be attatched to it. var stacks = {}; // this call to jQuery gives us access to the globaal // jQuery object. // 'noConflict' removes the '$' variable. // 'true' removes the 'jQuery' variable. // removing these globals reduces conflicts with other // jQuery versions that might be running on this page. stacks.jQuery = jQuery.noConflict(true); // Javascript for stacks_in_5_page4 // --------------------------------------------------------------------- // Each stack has its own object with its own namespace. The name of // that object is the same as the stack's id. stacks.stacks_in_5_page4 = {}; // A closure is defined and assined to the stack's object. The object // is also passed in as 'stack' which gives you a shorthand for refering // to this object from elsewhere. stacks.stacks_in_5_page4 = (function(stack) { // When jQuery is used it will be available as $ and jQuery but only // inside the closure. var jQuery = stacks.jQuery; var $ = jQuery; // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // My Product stack // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx $(document).ready(function() { jQuery.url = function() { var segments = {}; var parsed = {}; /** * Options object. Only the URI and strictMode values can be changed via the setters below. */ var options = { url : window.location, // default URI is the page in which the script is running strictMode: false, // 'loose' parsing by default key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], // keys available to query q: { name: "queryKey", parser: /(?:^|&)([^&=]*)=?([^&]*)/g }, parser: { strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, //less intuitive, more accurate to the specs loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ // more intuitive, fails on relative paths and deviates from specs } }; /** * Deals with the parsing of the URI according to the regex above. * Written by Steven Levithan - see credits at top. */ var parseUri = function() { str = decodeURI( options.url ); var m = options.parser[ options.strictMode ? "strict" : "loose" ].exec( str ); var uri = {}; var i = 14; while ( i-- ) { uri[ options.key[i] ] = m[i] || ""; } uri[ options.q.name ] = {}; uri[ options.key[12] ].replace( options.q.parser, function ( $0, $1, $2 ) { if ($1) { uri[options.q.name][$1] = $2; } }); return uri; }; /** * Returns the value of the passed in key from the parsed URI. * * @param string key The key whose value is required */ var key = function( key ) { if ( ! parsed.length ) { setUp(); // if the URI has not been parsed yet then do this first... } if ( key == "base" ) { if ( parsed.port !== null && parsed.port !== "" ) { return parsed.protocol+"://"+parsed.host+":"+parsed.port+"/"; } else { return parsed.protocol+"://"+parsed.host+"/"; } } return ( parsed[key] === "" ) ? null : parsed[key]; }; /** * Returns the value of the required query string parameter. * * @param string item The parameter whose value is required */ var param = function( item ) { if ( ! parsed.length ) { setUp(); // if the URI has not been parsed yet then do this first... } return ( parsed.queryKey[item] === null ) ? null : parsed.queryKey[item]; }; /** * 'Constructor' (not really!) function. * Called whenever the URI changes to kick off re-parsing of the URI and splitting it up into segments. */ var setUp = function() { parsed = parseUri(); getSegments(); }; /** * Splits up the body of the URI into segments (i.e. sections delimited by '/') */ var getSegments = function() { var p = parsed.path; segments = []; // clear out segments array segments = parsed.path.length == 1 ? {} : ( p.charAt( p.length - 1 ) == "/" ? p.substring( 1, p.length - 1 ) : path = p.substring( 1 ) ).split("/"); }; return { /** * Sets the parsing mode - either strict or loose. Set to loose by default. * * @param string mode The mode to set the parser to. Anything apart from a value of 'strict' will set it to loose! */ setMode : function( mode ) { strictMode = mode == "strict" ? true : false; return this; }, /** * Sets URI to parse if you don't want to to parse the current page's URI. * Calling the function with no value for newUri resets it to the current page's URI. * * @param string newUri The URI to parse. */ setUrl : function( newUri ) { options.url = newUri === undefined ? window.location : newUri; setUp(); return this; }, /** * Returns the value of the specified URI segment. Segments are numbered from 1 to the number of segments. * For example the URI http://test.com/about/company/ segment(1) would return 'about'. * * If no integer is passed into the function it returns the number of segments in the URI. * * @param int pos The position of the segment to return. Can be empty. */ segment : function( pos ) { if ( ! parsed.length ) { setUp(); // if the URI has not been parsed yet then do this first... } if ( pos === undefined ) { return segments.length; } return ( segments[pos] === "" || segments[pos] === undefined ) ? null : segments[pos]; }, attr : key, // provides public access to private 'key' function - see above param : param // provides public access to private 'param' function - see above }; }(); var yourfolder = jQuery.url.attr("directory"); if(yourfolder == "/"){yourfolder = ""}; var dooabuttonlink; var dooabuttontarget; $("#stacks_in_5_page4 .stacks_in_5_page4buttoncontainer").each(function() { dooabuttonlink = $("a", this).attr("href"); dooabuttonrel = $("a", this).attr("rel"); dooabuttonclass = $("a", this).attr("class"); $(this).wrap(''); }); $("#stacks_in_5_page4 .stacks_in_5_page4link").hover( function () { $("a", this).css("color","#FFFFFF"); }, function () { $("a", this).css("color","#FFFF66"); } ); var itsIE = navigator.userAgent.match(/MSIE 8/i) || navigator.userAgent.match(/MSIE 7/i) != null; if(itsIE){ $("#stacks_in_5_page4 .outershadow").css({ "box-shadow": "none", "behavior":"url(" + yourfolder + "files/IPIE.htc)" }); $("#stacks_in_5_page4 .stacks_in_5_page4link:first-child .stacks_in_5_page4buttoncontainer").css({ "border-radius": "20px 0px 0px 20px", "behavior":"url(" + yourfolder + "files/IPIE.htc)" }); $("#stacks_in_5_page4 .stacks_in_5_page4link:last-child .stacks_in_5_page4buttoncontainer").css({ "border-radius": "0px 20px 20px 0px", "behavior":"url(" + yourfolder + "files/IPIE.htc)" }); } }); // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // End my producet stack // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx return stack; })(stacks.stacks_in_5_page4); // Javascript for stacks_in_12_page4 // --------------------------------------------------------------------- // Each stack has its own object with its own namespace. The name of // that object is the same as the stack's id. stacks.stacks_in_12_page4 = {}; // A closure is defined and assined to the stack's object. The object // is also passed in as 'stack' which gives you a shorthand for refering // to this object from elsewhere. stacks.stacks_in_12_page4 = (function(stack) { // When jQuery is used it will be available as $ and jQuery but only // inside the closure. var jQuery = stacks.jQuery; var $ = jQuery; // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // FADER STACK BY http://www.doobox.co.uk XXXXXXXX // V-1.0.3 LAST UPDATED 24/3/2011 XXXXXXXXXXXXXXXX // COPYRIGHT@2010 MR JG SIMPSON, TRADING AS DOOBOX // ALL RIGHTS RESERVED XXXXXXXXXXXXXXXXXXXXXXXXXXX // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx $(document).ready(function() { $("#stacks_in_12_page4 img").removeClass("imageStyle").addClass('dooFaderImage'); // get the main background image if one exists var bgimage = $('.stacks_in_12_page4background img').attr("src"); // create the image array from the images the user has dropped in to the slides var FArray = $.makeArray($('.stacks_in_12_page4faderImageContainer img')); $(FArray).hide(); // set initial global variables var doowidth = 0; var dooheight = 0; var dooi = 0; var doox = 0; var dooy = 0; var stacks_in_12_page4total = FArray.length - 1; var stacks_in_12_page4delay = 1; var doofaderborder = 0 + "px solid #FFFFFF" var dootopmargin = 0; var dooleftmargin = 0; // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // get the size of the highest image in px // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx var dooheight = 0; $.each(FArray, function(index, height) { if($(height).height() > dooheight){ dooheight = $(height).height(); } }); dooheight = dooheight +"px"; // add the px for ie // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // get the size of the widest image in px // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx var doowidth = 0; $.each(FArray, function(index, width) { if($(width).width() > doowidth){ doowidth = $(width).width(); } }); doowidth = doowidth + "px"; // add the px for ie // remove the initial image container and images from the page(not needed) $('.stacks_in_12_page4faderImageContainer img').remove(); // place the first slide right away, before the effect starts $(FArray[0]).appendTo(".stacks_in_12_page4faderbox").show(); // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // setup the initial css for the faderbox // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx if("no" == "yes"){ $(".stacks_in_12_page4faderbox").css("backgroundColor", "#F4F4F4"); } $(".stacks_in_12_page4faderbox").css({ "background-image": "url("+bgimage+")", "padding": "0px", "height": dooheight + '', "width": doowidth + '', "border": doofaderborder + '' }); // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // The Main Fader Infinite Function XXXXX // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx function rotateFader(){ $("#stacks_in_12_page4 img").removeClass("imageStyle").addClass('dooFaderImage'); // set up vars for negative centering margins (only applies if centering set in the hud to true) if("no" == "yes"){ dootopmargin = $(FArray[dooi]).height() / 2; dooleftmargin = $(FArray[dooi]).width() / 2; dootopmargin = "-" + Math.round(dootopmargin) + "px"; dooleftmargin = "-" + Math.round(dooleftmargin) + "px"; // take care of the css for each image as the images rotate (only applies if centering set in the hud to true) $(FArray[dooi]).css({ "position": "absolute", "top": "50%" , "left": "50%", "marginTop": dootopmargin, "marginLeft": dooleftmargin }); } $(FArray[dooi]).appendTo(".stacks_in_12_page4faderbox").delay(stacks_in_12_page4delay).fadeIn(3000, function() { $(FArray[dooi]).delay(3000).fadeOut(3000, function() { // do something in a future upgrade, when fade out has ended. }); if(dooi < stacks_in_12_page4total){dooi = dooi + 1;} else{dooi = 0;} stacks_in_12_page4delay = 3000; rotateFader(); }); // set up vars for negative centering margins (only applies if centering set in the hud to true) if("no" == "yes"){ dootopmargin = $(FArray[dooi]).height() / 2; dooleftmargin = $(FArray[dooi]).width() / 2; dootopmargin = "-" + Math.round(dootopmargin) + "px"; dooleftmargin = "-" + Math.round(dooleftmargin) + "px"; // take care of the css for each image as the images rotate (only applies if centering set in the hud to true) $(FArray[dooi]).css({ "position": "absolute", "top": "50%" , "left": "50%", "marginTop": dootopmargin, "marginLeft": dooleftmargin }); } } // initialize the fader function and rotate the images rotateFader(); }); // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // END DOOBOX FADER STACK XXXXXXXXXXXXXXXXXXXXX // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx return stack; })(stacks.stacks_in_12_page4);