/* ********* OBRAZKY, PRIDAT/ODEBRAT INPUT ********* */ function MWCATALOG_add_file_input(bt_title){ var container = document.getElementById('filebox'); if(container.childNodes.length>0 && container.lastChild && container.lastChild.firstChild.value.length>0){ container.appendChild(_create_sub_container(bt_title)); }else if(container.childNodes.length == 0){ container.appendChild(_create_sub_container(bt_title)); } } function _create_file_input(){ var node = document.createElement('input'); node.setAttribute('type', 'file'); node.setAttribute('name', 'pimage[]'); node.setAttribute('readonly', 'readonly'); node.setAttribute('size', '30'); node.setAttribute('value', ''); node.setAttribute('class', 'in img_obj'); node.setAttribute('onblur', 'MWCATALOG_add_file_input(\'normal\')'); node.setAttribute('onchange', 'MWCATALOG_add_file_input(\'normal\')'); node.onpropertychange = function(){ MWCATALOG_add_file_input(); } /* IE7 FIX */ return node; } function _create_button_input(bt_title){ var node = document.createElement('input'); node.setAttribute('type', 'button'); node.setAttribute('title', bt_title); node.setAttribute('value', 'x'); node.setAttribute('class', 'mwcatalog_bt remove_obj'); node.style.width = '32px'; node.setAttribute('onclick', 'MWCATALOG_remove_sub_container(this)'); return node; } function _create_sub_container(bt_title){ var node = document.createElement('div'); node.appendChild(_create_file_input()); node.appendChild(_create_button_input(bt_title)); return node; } function MWCATALOG_remove_sub_container(param){ var container = document.getElementById('filebox'); container.removeChild(param.parentNode); } function __mwcatalog_jrun_post(xcatch,source,target){ var s = document.getElementById(source); var t = document.getElementById(target); $.post( xcatch, $(s).serialize(), function(data){ if(target!='none'){ $(t).before(data).remove(); } } ); } jQuery.fn.delay = function(time,func){ this.each(function(){ setTimeout(func,time); }); return this; }; function __mwcatalog_jrun_call(xcatch, title){ $(this).delay(200,function(){ $.get(xcatch, function(data){ $.jGrowl(data, { life: 5000 }); }); }); } /* NEVIIIIIIIIIM */ function MWCATALOG_refresh_form(formid){ var xfrm = document.getElementById(formid); if(xfrm){ xfrm.action = '?refreshorder=1'; xfrm.submit(); } } function MWCATALOG_send_form(){ var xfrm = document.getElementById('payform'); if(xfrm){ xfrm.submit(); } }