$(document).bind('ready', function() {  var imgContainer = $('#homepageImage'),      image = $('#homepageImage img'),      title = $('#imageTitle'),      link = $('#homepageImage a'),      newImg = new Image();    imgContainer.css('display', 'block');   if (rfs2.rotatorImages.data[0].imageType === 1) {    rfs2.rotatorImages.data[0].URL = 'resources/' + rfs2.rotatorImages.data[0].URL;  } else {    rfs2.rotatorImages.data[0].URL = 'uploads/' + rfs2.rotatorImages.data[0].URL + '.jpg';  }  image.attr('src', rfs2.rotatorImages.data[0].URL);  if (rfs2.rotatorImages.data[0].imageTitle.length > 0) {    title.text(rfs2.rotatorImages.data[0].imageTitle);  }  if (rfs2.rotatorImages.data[0].productURL !== null) {    link.attr('href', rfs2.rotatorImages.data[0].productURL);  }    newImg.onload = function () {    var      // jQuery selected dom elements.      userContent = $('#userContent'),      parentContainer = imgContainer.parent(),      userInnerContent = $('#userInnerContents'),      // Values used for logic and calculation      imgWidth = this.width,      imgHeight = this.height,      floatedHeight = 0,      separationWidth = imgContainer.css('margin-right'), // Store for later use.      // Function calculates the minimum width before allowing content to       // re-float next to selection image.      snapWidth = function () {        var width = parseInt(imgContainer.css('min-width')) +                    parseInt(separationWidth) +                    parseInt(userContent.css('min-width')) +                    (imgContainer.outerWidth() - imgContainer.width()) +                    (userContent.outerWidth() - userContent.width());                  return width;      },            // Function monitors window width and determines when to apply styling      // that allows for fluid floating/unfloating of the content.      sizing = function() {        if (userInnerContent.width() > userContent.width()) {          userContent.css('min-width', userInnerContent.width());        }                if (userContent.offset().top > imgContainer.offset().top) {          if (snapWidth() < parentContainer.width()) {            imgContainer.css('float', 'left').css('width', imgContainer.css('min-width')).css('margin-right', separationWidth);            userContent.css('height', floatedHeight);          } else {            imgContainer.css('float', 'none').css('width', 'auto').css('margin-right', 0);            userContent.css('height', 'auto');          }        }      };    if (imgWidth > 302) {      imgContainer.css('width', imgContainer.width() - 302 + imgWidth);    }    if (imgWidth > 302) {      imgContainer.css('height', imgContainer.height() - 302 + imgHeight);    }    imgContainer.css('min-width', imgContainer.width());    if (userContent.length > 0) {      userContent.css('height', floatedHeight);      floatedHeight = imgHeight - (userContent.outerHeight() - userContent.height()) - 50;      $(window).bind('resize', sizing);      sizing();      setInterval(sizing, 10000);    }  };    newImg.src = rfs2.rotatorImages.data[0].URL;});// $(document).bind('ready', function() {	// var image = $('#homepageImage img'), title = $('#homepageImage span'), link = $('#homepageImage a'),      // newImg = new Image(); 	// if (rfs2.rotatorImages.data[0].imageType === 1) {		// rfs2.rotatorImages.data[0].URL = 'resources/' + rfs2.rotatorImages.data[0].URL;	// } else {		// rfs2.rotatorImages.data[0].URL = 'uploads/' + rfs2.rotatorImages.data[0].URL + '.jpg';	// }    // newImg.onload = function () {    // var width = this.width,        // height = this.height,        // isUp = 0,        // container = $('#homepageImage'),        // imageTitle = $('#imageTitle'),        // popContentDown = function () {                  // }        // popContentUp = function () {                  // };            // if (width < 302)  { width = 302;  }    // if (height < 302) { height = 302; }        // container      // .css('display','block')      // .css('width', width)      // .css('height', height);    // imageTitle.css('width',width - 8);        // // $('#homepageImage')      // // .css('height', this.height)      // // .css('width', this.width)      // // .css('display', 'block');    // // $('#selectedImage')      // // .css('display', 'block');        // // if (newImg.width > 500) {      // // $('#homepageImage')        // // .css('float', 'none')        // // .css('margin', '0px auto');      // // $('#userContent')        // // .css('clear', 'left')        // // .css('width', this.width)        // // .css('margin', '10px auto');      // // $('#followUs')        // // .css('text-align', 'center');    // // } else {      // // $('#userContent')        // // .css('margin-left', this.width + 10)        // // .css('min-height', this.height - 40);    // // }              // };    // newImg.src = rfs2.rotatorImages.data[0].URL;	// image.attr('src', rfs2.rotatorImages.data[0].URL);  	// if (rfs2.rotatorImages.data[0].imageTitle.length > 0) {		// title.text(rfs2.rotatorImages.data[0].imageTitle);	// }	// if (rfs2.rotatorImages.data[0].productURL !== null) {		// link.attr('href', rfs2.rotatorImages.data[0].productURL);	// }// });
