/*@cc_on 
	@if (@_win32)
		try {document.execCommand('BackgroundImageCache', false, true);}catch(e){}
	@end
	@if (@_jscript_version >= 5.5 && @_jscript_version <= 5.7)
		(function pngFix (gif, arr) {
		       var k = arr.length, el, es;
		       while (k--) {
		           if (el=document.getElementById(arr[k])) {
		               es=el.style;es.height=el.height;es.width=el.width;es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', src='"+el.src+"',sizingMethod='image')";el.src=gif;
		           }
		       }
		   })("/assets/images/blank.gif",['logo']);
	@end
@*/
/*
 * jquery.geekga.js - jQuery plugin for Google Analytics
 * 
 * Version 1.1
 * 
 * This plugin extends jQuery with two new functions:
 * 
 *   - $.geekGaTrackPage(account_id)
 *       Track a pageview.
 * 
 *   - $.geekGaTrackEvent(category, action, label, value)
 *       Track an event with a category, action, label and value.
 * 
 * 
 * This code is in the public domain.
 * 
 * Willem van Zyl
 * willem@geekology.co.za
 * http://www.geekology.co.za/blog/
 */

(function($){var pageTracker;$.geekGaTrackPage=function(account_id){var host=(("https:"==document.location.protocol)?"https://ssl.":"http://www.");var src=host+'google-analytics.com/ga.js';$.ajax({type:'GET',url:src,success:function(){pageTracker=_gat._getTracker(account_id);pageTracker._trackPageview();},error:function(){throw"Unable to load ga.js; _gat has not been defined.";},dataType:'script',cache:true});};
$.geekGaTrackEvent=function(category,action,label,value){if(typeof pageTracker!=undefined){pageTracker._trackEvent(category,action,label,value);}else{throw"Unable to track event; pageTracker has not been defined";}};})(jQuery);
//
	var EX = {
		scaleImage : function(){
			$.fn.scaleSize = function(maxW, maxH, currW, currH){
			    var ratio = currH / currW;
				  if(currW >= maxW){
			            currW = maxW;
			            currH = currW * ratio;
			      } else if(currH >= maxH){
			            currH = maxH;
			            currW = currH / ratio;
			      }
				var oSrc = $(this).attr('src'),
				nPath = oSrc.split('/workspace/')[1],
				newSrc = '/image/1/'+currW+'/'+currH+'/0/'+nPath;
				$(this).attr('src', newSrc);
			}
			$('img', '.article').each(function(index, el) {				
				var img = $(el),
				initW = img.width(),
				initH = img.height();
				(initW > 400) ? img.scaleSize(400, 400, initW, initH) : null;
			});
		}
	}
	$(function() {
		if ($('.article img').length) {
			EX.scaleImage();
		};
	});

