function getWindowHTML(curUrl, curTitle,bottom){
  curUrl = escape(curUrl);
  curTitle = escape(curTitle);
  bottom = (typeof bottom =='undefined')?'':bottom;
  var windowContent = '<div id="mss-social-holder'+bottom+'"><div id="mss-close-container"><a href="javascript:void(0);" onclick="closeWindow(\''+bottom+'\')" id="bmClose">close <img src="http://mystore-solutions.com/mss/social/images/close.gif" border="0"></a></div>\
  <div id="mss-social-container">\
      <div class="mss-social-link yahoo"><a href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u='+curUrl+'&t='+curTitle+'" class="openWindow" rel="size 400 800 iframe">yahoo</a></div>\
      <div class="mss-social-link google"><a href="http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk='+curUrl+'&title='+curTitle+'" class="openWindow" rel="size 400 800 iframe">google</a></div>\
      <div class="mss-social-link twitter"><a href="http://twitter.com/home?status='+curUrl+'" target="_blank">twitter</a></div>\
      <div class="mss-social-link facebook"><a href="http://www.facebook.com/sharer.php?u='+curUrl+'&t='+curTitle+'" class="openWindow" rel="size 400 800 iframe">facebook</a></div>\
      <div class="mss-social-link blogger"><a href="http://www.blogger.com/blog_this.pyra?t=' + curTitle + '&u='+curUrl+'&n='+escape(document.title)+'" class="openWindow" rel="size 400 800 iframe">blogger</a></div>\
      <div class="mss-social-link myspace"><a href="http://www.myspace.com/Modules/PostTo/Pages/?u='+curUrl+'&t='+curTitle+'" class="openWindow" rel="size 400 800 iframe">myspace</a></div>\
      <div class="mss-social-link squidoo"><a href="http://www.squidoo.com/lensmaster/bookmark?'+curUrl+'" class="openWindow" rel="size 400 800 iframe">squidoo</a></div>\
      <div class="mss-social-link delicous"><a href="http://del.icio.us/post?url='+curUrl+'&title='+curTitle+'" class="openWindow" rel="size 400 800 iframe">del.ico.us</a></div>\
	    <div class="mss-social-link thisnext"><a href="http://www.thisnext.com/pick/new/submit/url/?url='+curUrl+'&wish_or_recommend=&from_theme=" class="openWindow" rel="size 400 800 iframe">thisnext</a></div>\
      <div class="mss-social-link stumpleupon"><a href="http://www.stumbleupon.com/refer.php?url='+curUrl+'&title='+curTitle+'" class="openWindow" rel="size 400 800 iframe">stumpleupon</a></div>\
      <div class="mss-social-link digg"><a href="http://digg.com/submit?phase=2&url='+curUrl+'&title='+curTitle+'" class="openWindow" rel="size 400 800 iframe">digg</a></div>\
      <div class="mss-social-link blinklist"><a href="http://blinklist.com/index.php?Action=Blink/addblink.php&Name='+curTitle+'&Url='+curUrl+'" class="openWindow" rel="size 400 800 iframe">blinklist</a></div>\
      <div class="mss-social-link reddit"><a href="http://reddit.com/submit?url='+curUrl+'&title='+curTitle+'" class="openWindow" rel="size 400 800 iframe">reddit</a></div>\
      <div class="mss-social-link netvouz"><a href="http://netvouz.com/action/submitBookmark?url='+curUrl+'&title='+curTitle+'&popup=no" class="openWindow" rel="size 400 800 iframe">netvouz</a></div>\
      <div class="mss-social-link newsvine"><a href="http://www.newsvine.com/_wine/save?u='+curUrl+'&h='+curTitle+'" class="openWindow" rel="size 400 800 iframe">newsvine</a></div>\
      <div class="mss-social-link magnolia"><a href="http://ma.gnolia.com/bookmarklet/add?url='+curUrl+'&title='+curTitle+'" class="openWindow" rel="size 400 800 iframe">ma.gnolia</a></div>\
      <div class="mss-social-link spurl"><a href="http://www.spurl.net/spurl.php?url='+curUrl+'&title='+curTitle+'" class="openWindow" rel="size 400 800 iframe">spurl</a></div>\
      <div class="mss-social-link bloglines"><a href="http://www.bloglines.com/sub/'+curUrl+'" class="openWindow" rel="size 400 800 iframe">bloglines</a></div>\
      <div class="mss-social-link comments"><a href="http://co.mments.com/track?url='+curUrl+'&title='+curTitle+'" class="openWindow" rel="size 400 800 iframe">co.mments</a></div>\
      <div class="mss-social-link orkut"><a href="http://www.orkut.com" class="openWindow" rel="size 400 800 iframe">Orkut</a></div>\
      </div></div>' ; 
  return windowContent;
}

function closeWindow(bottom) {
  bottom = (typeof bottom =='undefined')?'':bottom;
  jQuery('#mss-social-holder'+bottom).hide('slow').data('status', 'closed');
}

function openWindow(bottom) {
  bottom = (typeof bottom =='undefined')?'':bottom;
  jQuery('#mss-social-holder'+bottom).show('slow').data('status', 'open');
}

jQuery(document).ready(function($) {
  
  if($('#mss-bookmark')){
    $('#mss-bookmark').click(function() {
      if ($('#mss-social-holder').data('status') == 'open') {
        closeWindow();
      } else {
        openWindow();
      }
    });
  }
  if($('#mss-bookmark-bottom')){
    $('#mss-bookmark-bottom').click(function() {
      if ($('#mss-social-holder-bottom').data('status') == 'open') {
        closeWindow('-bottom');
      } else {
        openWindow('-bottom');
      }
    });
  
  }
    
  $.fn.colorbox.init();
  $('.openWindow').click(function(ev){
    ev.preventDefault();
    var $self = $(this);

    $.fn.colorbox({
      opacity:0.35,
      href: $self.attr('href'),
      iframe: true,
      height: '85%',
      width: '900px',
      open: true
    });
  });
});

var loadedImgs = new Array();
function preloadImages() {
    
    var imgArray =
    ['http://mystore-solutions.com/mss/social/images/close.gif',
    'http://mystore-solutions.com/mss/social/images/SB-delicious.png',    
    'http://mystore-solutions.com/mss/social/images/SB-digg.png',    
    'http://mystore-solutions.com/mss/social/images/SB-blogmarks.png',
    'http://mystore-solutions.com/mss/social/images/SB-blogger.png',       
    'http://mystore-solutions.com/mss/social/images/SB-furl.png',    
    'http://mystore-solutions.com/mss/social/images/SB-blinklist.png',    
    'http://mystore-solutions.com/mss/social/images/SB-reddit.png',    
    'http://mystore-solutions.com/mss/social/images/SB-feedmelinks.png',    
    'http://mystore-solutions.com/mss/social/images/SB-technorati.png',    
    'http://mystore-solutions.com/mss/social/images/SB-yahoo.png',    
    'http://mystore-solutions.com/mss/social/images/SB-rawsugar.png',    
    'http://mystore-solutions.com/mss/social/images/SB-netvouz.png',    
    'http://mystore-solutions.com/mss/social/images/SB-rojo.png',    
    'http://mystore-solutions.com/mss/social/images/SB-shadows.png',    
    'http://mystore-solutions.com/mss/social/images/SB-newsvine.png',    
    'http://mystore-solutions.com/mss/social/images/SB-magnolia.png',    
    'http://mystore-solutions.com/mss/social/images/SB-stumbleupon.png',    
    'http://mystore-solutions.com/mss/social/images/SB-google.png',    
    'http://mystore-solutions.com/mss/social/images/SB-squidoo.png',    
    'http://mystore-solutions.com/mss/social/images/SB-spurl.png',    
    'http://mystore-solutions.com/mss/social/images/SB-blinkbits.png',    
    'http://mystore-solutions.com/mss/social/images/SB-blogmarks.png',                      
    'http://mystore-solutions.com/mss/social/images/SB-bloglines.png',    
    'http://mystore-solutions.com/mss/social/images/SB-comments.png',    
    'http://mystore-solutions.com/mss/social/images/SB-scuttle.png',    
    'http://mystore-solutions.com/mss/social/images/SB-ask.png',    
    'http://mystore-solutions.com/mss/social/images/SB-thisnext.png',    
    'http://mystore-solutions.com/mss/social/images/SB-kaboodle.png',        
    'http://mystore-solutions.com/mss/social/images/SB-twitter.png',
    'http://mystore-solutions.com/mss/social/images/SB-myspace.png',
    'http://mystore-solutions.com/mss/social/images/SB-orkut.png',
    'http://mystore-solutions.com/mss/social/images/SB-facebook.png'];
    
    for (key in imgArray) {
      loadedImgs[key] = new Image();
      loadedImgs[key].src = imgArray[key];
    }
      		    
}

preloadImages();
