").appendTo(container);
// var imgs_container = $("
").appendTo(container);
//
// var close = $("
").appendTo(container);
// var number = $("
"+ ($(".cont").size() + 1) +"
").appendTo(sub_container);
// var text = $("
" + sankoreLang.enter + "
").appendTo(sub_container);
//
// $("").appendTo(imgs_container);
// var add_img = $("
").appendTo(imgs_container);
// container.insertBefore($(".add_block"));
//}
//add new img block
function addImgBlock(dest){
var img_block = $("").insertBefore(dest);
$("
").appendTo(img_block);
$("
").appendTo(img_block);
$("
").appendTo(img_block);
$("").appendTo(img_block);
$("").appendTo(img_block);
}
//function refreshBlockNumbers(){
// var i = 0;
// $(".cont").each(function(){
// $(this).find(".number_cont").text(++i);
// })
//}
//shuffles an array
function shuffle( arr )
{
var pos, tmp;
for( var i = 0; i < arr.length; i++ )
{
pos = Math.round( Math.random() * ( arr.length - 1 ) );
tmp = arr[pos];
arr[pos] = arr[i];
arr[i] = tmp;
}
return arr;
}
function stringToXML(text){
if (window.ActiveXObject){
var doc=new ActiveXObject('Microsoft.XMLDOM');
doc.async='false';
doc.loadXML(text);
} else {
var parser=new DOMParser();
doc=parser.parseFromString(text,'text/xml');
}
return doc;
}
function onDropTarget(obj, event) {
$(obj).find("img").remove();
if (event.dataTransfer) {
var format = "text/plain";
var textData = event.dataTransfer.getData(format);
if (!textData) {
alert(":(");
}
textData = stringToXML(textData);
var tmp = textData.getElementsByTagName("path")[0].firstChild.textContent;
var tmp_img = $("").attr("src", "../../" + tmp);
$(obj).append(tmp_img);
setTimeout(function(){
if(tmp_img.height() >= tmp_img.width())
tmp_img.attr("height", "120");
else{
tmp_img.attr("width","120");
var h = tmp_img.height();
tmp_img.attr("height",h);
tmp_img.css("margin",(120 - tmp_img.height())/2 + "px 0");
}
}, 6)
}
else {
alert ("Your browser does not support the dataTransfer object.");
}
if (event.stopPropagation) {
event.stopPropagation ();
}
else {
event.cancelBubble = true;
}
return false;
}