/*
 * Url preview script v 1.0.0
 * Powered by jQuery (http://www.jquery.com)
 * 
 * Written by Alex (http://www.thumbshots.ru)
 * For more info visit http://www.thumbshots.ru/api
 *
 */
function ThumbshotPopups(tclass, target) {
	if (!target) {
		target = jQuery("a[href^=\'http:\']").not("[href*=\'" + window.location.host + "\']");
	}
	if (target.length < 1) return;
	var host = 'http://get.thumbshots.ru/';
	var params = new Array();
	params['size'] = 'L';
	jQuery('<style type="text/css"> .' + tclass + ' {position:absolute;left:-20000px;display:none;z-index:10;border:1px solid #ccc; background:#333; padding:2px;color:#fff} .' + tclass + ' img {margin:0;padding:0;border:none} </style>').appendTo('head');
	var query = [];
	for (var v in params) {
		if (typeof params[v] != 'function') {
			query.push(encodeURIComponent(v) + '=' + encodeURIComponent(params[v]))
		}
	}
	jQuery(target).each(function (i) {
		jQuery(this).hover(function () {
			jQuery("body").append("<div class='" + tclass + "' id='" + tclass + i + "'><img src='" + host + "?" + query.join('&') + "&url=" + jQuery(this).attr('href') + "' alt='Loading preview' /></div>");
			jQuery("#" + tclass + i).css({
				opacity: 1,
				display: "none"
			}).fadeIn(50)
		}, function () {
			jQuery("#" + tclass + i).fadeOut(50)
		}).mousemove(function (kmouse) {
			jQuery("#" + tclass + i).css({
				left: kmouse.pageX + 25,
				top: kmouse.pageY - 55
			})
		})
	})
}

var jQueryScriptOutputted = false;

function initjQuery() {
	if (typeof(jQuery) == 'undefined') {
		if (!jQueryScriptOutputted) {
			jQueryScriptOutputted = true;
			document.write("<scr" + "ipt type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js\"></scr" + "ipt>")
		}
		setTimeout("initjQuery()", 50)
	}
	else {
		jQuery(document).ready(function () {
			// เจเสแ?ศเอแ?ฮแ??เอเภ เยเอเลแ?อเศแ?แ???หเสเภแ?แ?rel="external"
		  ThumbshotPopups( 'ThumbshotPopups', jQuery("a[rel~=external]") );
			// ThumbshotPopups('ThumbshotPopups');
		})
	}
}

initjQuery();