var mySIZE = {1:'150',2:'320',3:'640',4:'800',5:'1024'}
function loadThumb() {	
	$.ajax({
		type: "GET",
		url: "img.php",
		data: 	"site=" + document.getElementById("url").value + "&type=" + $("input[@name='type']:checked").val(),
		cache: false,
		success: function(html){			
			$("#imageHolder").html("<img src='images/spinner.gif'><br /> جاري أخذ لقطة عن الموقع المطلوب ، يرجى الإنتظار");
			check_loaded(html);			
		}
	});
}

function check_loaded (id) {
	$.ajax ( {
		type: "GET",
		url: "img.php",
		data: "id=" + id,
		cache: false,
		success: function(txt) {
			if ( txt == 0 )	{
				setTimeout('check_loaded('+ id + ')',10000);
			}else if (txt == -1 ) {
				$("#imageHolder").html("عذراً <br> الموقع المطلوب محجوب من قبل فلتر لقطة");
			}else{
				var output = '<strong>لقياسات اخرى:</strong> <br />';
				var c = 0;
				output += 'دون مؤثرات: ';
				for (var size in mySIZE )	{
					c++;
					if (c > 1 ) output += ' - ';
					output += '<a href="GetIMG.php?size=' + size + '&id=' + id + '" target="_blank">' + mySIZE[size] + '</a>';					
				}
				c = 0;
				output += '<br />مـع مؤثرات: ';
				for (var size in mySIZE )	{
					c++;
					if (c > 1 ) output += ' - ';
					output += '<a href="GetIMG.php?effect=1&size=' + size + '&id=' + id + '" target="_blank">' + mySIZE[size] + '</a>';
				}
				output += "<br /><br /><img width='380' src='GetIMG.php?size=2&effect=1&id=" + id + "' />";
				$("#imageHolder").html(output);
			}
		}
	});
}

