/*
jQuery Url Plugin
 * Version 1.0
 * 2009-03-22 19:30:05
 * URL: http://ajaxcssblog.com/jquery/url-read-get-variables/
 * Description: jQuery Url Plugin gives the ability to read GET parameters from the actual URL
 * Author: Matthias Jäggli
 * IMPROVED: jQuery Url Plugin gives the ability to read GET parameters from the ALL URL's		* 
 * IMPROVED BY: Domenico Lupinetti (Ostico@gmail.com)
 * Copyright: Copyright (c) 2009 Matthias Jäggli under dual MIT/GPL license.
 */

(function($) {
	$.url = {};
	$.extend($.url, {
		_params : {},
		init : function(path) {
			var paramsRaw = "";
			try {
				paramsRaw = (path.split("?", 2)[1] || "").split("#")[0].split("&") || [];
				for ( var i = 0; i < paramsRaw.length; i++) {
					var single = paramsRaw[i].split("=");
					if (single[0])
						this._params[single[0]] = unescape(single[1]);
				}
			} catch (e) {
				// alert(e);
			}
		},
		param : function(real_image, name) {
			this.init(real_image);
			return this._params[name] || "";
		},
		paramAll : function(real_image) {
			this.init(real_image);
			return this._params;
		}
	});

})(jQuery);
// parse Params of a GET STRING

/*
 * Image preview script powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com) 
 * MODIFIED by Domenico Lupinetti (Ostico@gmail.com)
 * 
 * for more info visit
 * http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 * 
 */

$(document).ready(
		function() {

			$("img.preview").hover(
					function(e) {
						xOffset = 125;
						yOffset = 15;

						this.t = this.alt;
						var real_image = $(e.target).attr("src");
						if (real_image == undefined || real_image == null || real_image == "") {
							return;
						}
						var obj = $.url.param(real_image, "src");

						var loc = window.location.href;

						var location = get_base() + "/";
/*
						try {
							var t = loc.split("http://")[1].split("?")[0];
							var ind = t.indexOf(".php") || t.indexOf(".htm") || t.indexOf(".html");
							if( ind )
							{
								var location = get_base() + "/";
							}
						} catch (e) {
							var location = loc;
						}
*/
						var image_magnified = location
								+ "images/thumb.php?src=" + obj
								+ "&width=250&height=250&f=0&q=100";
						var c = (this.t != "") ? "<br/>" + this.t : "";
						$("body").append(
								"<p id='preview'><img class='m_image' src='"
										+ image_magnified
										+ "' alt='Image Preview' />" + c
										+ "</p>");

						$("#preview").css("top", (e.pageY - xOffset) + "px")
								.css("left", (e.pageX + yOffset) + "px")
								.fadeIn("fast");

					}, function() {
						// this.title = this.t;
					$("#preview").remove();
				});

			$("img.preview").mousemove(
					function(e) {
						$("#preview").css("top", (e.pageY - xOffset) + "px")
								.css("left", (e.pageX + yOffset) + "px");
					});

		});

