/*jQuery.fn.resize = function (MAXwidth, MAXheight) {
	var item = $(this);
	var maxWidth = MAXwidth; // Max width for the image
	var maxHeight = MAXheight;    // Max height for the image
	var ratio = 0; // Used for aspect ratio
	var width = item.width();    // Current image width
	var height = item.height();  // Current image height
	
	if(item.attr('src') != undefined && item.attr('src') !== '' && width == 0) {
		// If image and width is 0 probably hidden, so find out real dimensions
		var realIMG = new Image();
		realIMG.src = item.attr('src');
		width = realIMG.width;
		height = realIMG.height;
		delete realIMG;
	}
	
	//alert(tip.innerWidth());
	if(width > 0) {
		// Check if the current width is larger than the max
		if(width > maxWidth){
			ratio = maxWidth/width;
			item.css("width", maxWidth); // Set new width
			item.css("height", height * ratio);  // Scale height based on ratio
			height = height * ratio;    // Reset height to match scaled image
			width = width * ratio;    // Reset width to match scaled image
		}
		
		// Check if current height is larger than max
		if(height > maxHeight){
			ratio = maxHeight/height;
			item.css("height", maxHeight);   // Set new height
			item.css("width", width * ratio);    // Scale width based on ratio
			width = width * ratio;    // Reset width to match scaled image
		}
		return {width: width, height: height};
	}
	return false;
}*/

jQuery.fn.textToggle = function (str1, str2) {
	var element = $(this);
	var currentText = element.text();
	if(currentText == str1) element.text(str2);
	else if(currentText == str2) element.text(str1);
	else element.text(str1);
	return element;
}
