/**
 * Cookie plugin
 */

$(document).ready(function() {
    //$.cookie('ogilvyhealthworld', 'ohwcookietest', { expires: 3 });
	//alert($.cookie('ogilvyhealthworld'));
	
	/*
	var cache = [];
  // Arguments are image paths relative to the current page.
  	$.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
      }
   }
   
   $.preLoadImages("images/work-assist-02b.jpg", "/path/to/image2.png");
   $.preLoadImages("images/work-assist-03b.jpg", "/path/to/image2.png");
   $.preLoadImages("images/work-assist-04b.jpg", "/path/to/image2.png");
   $.preLoadImages("images/work-assist-05b.jpg", "/path/to/image2.png");
   $.preLoadImages("images/work-assist-06b.jpg", "/path/to/image2.png");
   $.preLoadImages("images/work-assist-07b.jpg", "/path/to/image2.png");
   $.preLoadImages("images/work-assist-08b.jpg", "/path/to/image2.png");
	
	
	$('#img02').mouseover(function(){ $(this).attr("src", "images/work-assist-02b.jpg"); $('#a02').css({'margin-right':'21px', 'margin-top':'20px'});})
	            .mouseout(function(){ $(this).attr("src", "images/work-assist-02.jpg"); $('#a02').css( {'margin-right':'36px', 'margin-top':'35px'});});
				
	$('#img03').mouseover(function(){ $(this).attr("src", "images/work-assist-03b.jpg"); $('#a03').css({'margin-top':'42px'});})
	            .mouseout(function(){ $(this).attr("src", "images/work-assist-03.jpg"); $('#a03').css( { 'margin-top':'57px'});});
				
	$('#img04').mouseover(function(){ $(this).attr("src", "images/work-assist-04b.jpg"); $('#a04').css({'margin-top':'32px'});})
	            .mouseout(function(){ $(this).attr("src", "images/work-assist-04.jpg"); $('#a04').css( {'margin-top':'40px'});});
				
	$('#img05').mouseover(function(){ $(this).attr("src", "images/work-assist-05b.jpg"); $('#a05').css({'margin-right':'4px', 'margin-top':'45px'});})
	            .mouseout(function(){ $(this).attr("src", "images/work-assist-05.jpg"); $('#a05').css( {'margin-right':'15px', 'margin-top':'60px'});});
				
	$('#img06').mouseover(function(){ $(this).attr("src", "images/work-assist-06b.jpg");  $('#b01').css('margin-top','16px'); $('#b01').css('margin-right','18px');})
	            .mouseout(function(){ $(this).attr("src", "images/work-assist-06.jpg");  $('#b01').css('margin-top','30px'); $('#b01').css('margin-right','33px');});
				
	$('#img07').mouseover(function(){ $(this).attr("src", "images/work-assist-07b.jpg"); $('#b03').css({'margin-right':'29px', 'margin-top':'31px'});})
	            .mouseout(function(){ $(this).attr("src", "images/work-assist-07.jpg"); $('#b03').css( {'margin-right':'40px', 'margin-top':'44px'});});
				
	$('#img08').mouseover(function(){ $(this).attr("src", "images/work-assist-08b.jpg"); $('#b04').css('margin-top','6px');})
	            .mouseout(function(){ $(this).attr("src", "images/work-assist-08.jpg"); $('#b04').css('margin-top','20px');});	*/		
				
});

jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};
