function SelectAll(id) { document.getElementById(id).focus(); document.getElementById(id).select(); copy(document.getElementById(id)); } function copy(inElement) { if (inElement.createTextRange) { var range = inElement.value.createTextRange(); if (range && BodyLoaded==1) range.execCommand('Copy'); } else { var flashcopier = 'flashcopier'; if(!document.getElementById(flashcopier)) { var divholder = document.createElement('div'); divholder.id = flashcopier; document.body.appendChild(divholder); } document.getElementById(flashcopier).innerHTML = ''; var divinfo = ''; document.getElementById(flashcopier).innerHTML = divinfo; } } function getyScroll() { yScroll = 0; if (window.innerHeight && window.scrollMaxY || window.innerWidth && window.scrollMaxX) { yScroll = window.innerHeight + window.scrollMaxY; xScroll = window.innerWidth + window.scrollMaxX; var deff = document.documentElement; var wff = (deff&&deff.clientWidth) || document.body.clientWidth || window.innerWidth || self.innerWidth; var hff = (deff&&deff.clientHeight) || document.body.clientHeight || window.innerHeight || self.innerHeight; xScroll -= (window.innerWidth - wff); yScroll -= (window.innerHeight - hff); } else if (document.body.scrollHeight > document.body.offsetHeight || document.body.scrollWidth > document.body.offsetWidth) { // all but Explorer Mac yScroll = document.body.scrollHeight; xScroll = document.body.scrollWidth; } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari yScroll = document.body.offsetHeight; xScroll = document.body.offsetWidth; } return yScroll; } interval = null; function ajaxFunction() { var xmlHttp; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } return xmlHttp; } function image_save() { document.getElementById('screen').style.display = "none"; document.getElementById('screen').style.display = "block"; document.getElementById('screen').style.width = "100%"; document.getElementById('screen').style.height = getyScroll() + 'px'; } function openProgressBar(id) { if(document.getElementById(id)) document.getElementById('screen').style.display = "none"; document.getElementById('screen').style.display = "block"; document.getElementById('screen').style.width = "100%"; document.getElementById('screen').style.height = getyScroll() + 'px'; document.getElementById('progress').style.visibility = "visible"; document.getElementById('progress_show').style.display = "block"; /* generate random progress-id */ uuid = ""; for (i = 0; i < 32; i++) { uuid += Math.floor(Math.random() * 16).toString(16); } /* patch the form-action tag to include the progress-id */ document.getElementById(id).action="http://www.onlinedisk.ru/?action=upload&X-Progress-ID=" + uuid; /* call the progress-updater every 1000ms */ interval = window.setInterval( function () { fetch(uuid); }, 1000 ); } //function fetch(uuid) { // req = ajaxFunction(); // req.open("GET", "/progress", 1); // req.setRequestHeader("X-Progress-ID", uuid); // req.onreadystatechange = function () { // if (req.readyState == 4) { // if (req.status == 200) { // /* poor-man JSON parser */ // var upload = eval(req.responseText); // // document.getElementById('progress_status').innerHTML = upload.state; // // /* change the width if the inner progress-bar */ // if (upload.state == 'done' || upload.state == 'uploading') { // bar = document.getElementById('progress_show'); // w = 338 * upload.received / upload.size; // bar.style.width = w + 'px'; // } // /* we are done, stop the interval */ // if (upload.state == 'done') { // window.clearTimeout(interval); // } // } // } // } // req.send(null); //} function fetch(uuid) { req = ajaxFunction(); req.open("GET", "/progress", false); req.setRequestHeader("X-Progress-ID", uuid); req.send(null); if (req.status == 200) { /* poor-man JSON parser */ var upload = eval(req.responseText); document.getElementById('progress_status').innerHTML = upload.state; /* change the width if the inner progress-bar */ if (upload.state == 'done' || upload.state == 'uploading') { bar = document.getElementById('progress_show'); w = 338 * upload.received / upload.size; bar.style.width = w + 'px'; } /* we are done, stop the interval */ if (upload.state == 'done') { window.clearTimeout(interval); } } } function change(id,value) { document.getElementById(id).value = value; switch(id) { case "file_text" : document.getElementById("file_upload_button").disabled = false;break; case "image_text" : document.getElementById("image_upload_button").disabled = false;break; } } //Описание списков var selectedList; var backSelect; function changeBack(id,old) { if(backSelect!=null) { backSelect.style.background = "#fff"; backSelect.style.color = "#9a9a9a"; } id.style.background = "#f46401"; id.style.color ="#fff"; backSelect = id; } function showList(id) { if(selectedList!=id && selectedList!=null) { document.getElementById(selectedList).style.display = "none"; } obj = document.getElementById(id); if(obj.style.display == "none" || obj.style.display == "") { obj.style.display = "block"; selectedList = id; } else { obj.style.display = "none"; selectedList = null; } } function setValue(id,real,hide,value) { if(value == "width") value_text = "в ширину"; else value_text = "в высоту"; document.getElementById(id).value = value_text; document.getElementById(real).value = value; hideList(hide); } function check(self,name) { var a = document.getElementsByTagName('input'); var checkValue = self.checked; for (i=1; i max_width) { if(!scaled) { saveWidth = width; saveHeight = height; var ratio = (height / width ); var new_width = max_width; var new_height = (new_width * ratio); $('#' + what).height(new_height).width(new_width); scaled = true; } } } function loadImage(id) { $('#'+id).show(); $('#load').hide(); scaleImg(id); }