var dimension = 0; var STATE_IDLE = 0; var STATE_SAVING = 1; var STATE_SAVING_AS = 2; var STATE_VIEWER = 3; var state = STATE_IDLE; var product_data = ""; var screenshot_name = ""; var save_data = ""; var load_name = ""; var load_data = ''; var load_data_pos = 0; var load_read_only = false; var isReady = false; var sessionID = "09c0eeotnkqvbv38fragci7pv171hqro"; var logo_uuid = "4921d6cfcafae9.51174424"; var floor_width = 0; var floor_depth = 0; var floor_meters = 'false'; var loadingScreen = true; function redirect(mx) { this.location = "http://" + mx + ".3d-standards.com/application/index.php?login=true"; } function getSetup() { document.threedstandards.send('setupData', 'http://abex.3d-standards.com#0#/tools/getproductxml.php?uuid=|/tools/getimage.php?uuid=|/files/w3fs/#48231835284052.47401109#09c0eeotnkqvbv38fragci7pv171hqro#49c00648181357.66653957#Unknown'); } function init() { document.getElementById("content-main").className = ""; setCompanyLogo('4921d6cfcafae9.51174424', 'Abex Exhibit Systems'); setLinks(); } function showMessage() { var e = document.getElementById("message"); if(e != null) { e.style.display = ""; e = document.getElementById("content-header"); if(e != null) { e.style.height = "200px"; } e = document.getElementById("content-top"); if(e != null) { e.style.height = "220px"; } e = document.getElementById("content-main"); if(e != null) { e.style.top = "220px"; } e = document.getElementById("content-border"); if(e != null) { e.style.top = "206px"; } contentPositionTop = 220; } } function hideMessage() { var e = document.getElementById("message"); if(e != null) { e.style.display = "none"; e = document.getElementById("content-header"); if(e != null) { e.style.height = "80px"; } e = document.getElementById("content-top"); if(e != null) { e.style.height = "100px"; } e = document.getElementById("content-main"); if(e != null) { e.style.top = "100px"; } e = document.getElementById("content-border"); if(e != null) { e.style.top = "86px"; } contentPositionTop = 100; } } var active_step; var animate_lock = false; function animateStep(event){ if(event == null){ return; } var element = $(Event.element(event)); //event.currentTarget; if(element == null){ return; } if(element.hasClassName('step_arrow') || element.hasClassName('sstitle') || element.hasClassName('step_number')){ element = $(element).up(); //element.parentElement; } animateStepAction(element); } function animateStepAction(element){ if(animate_lock){ return false; } var next_step = $(element).next('div'); var forwards = false; if(next_step.id != active_step.id){ if(next_step.id.charAt(next_step.id.length-1) > active_step.id.charAt(active_step.id.length-1)){ forwards = true; } animate_lock = true; Element.setStyle(next_step, { height: 0 }); next_step.show(); //alert("cur: "+active_step.height() + " nex:" + next_step.height()); //before, not onComplete //active_step.height(active_step.height()-next_step.has()); active_step.removeClassName('activeo'); next_step.addClassName('activeo'); if(active_step.id == 'step4'){ var confirmation = document.getElementById("pdf_status"); if(confirmation != null){ confirmation.innerHTML = ""; } } var transformHeight = 526 - (116); var effects = new Array(); var options = { sync: true, scaleFrom: 0, scaleContent: false, transition: Effect.Transitions.linear, scaleMode: { originalHeight: transformHeight, originalWidth: 231 }, scaleX: false, scaleY: true }; effects.push(new Effect.Scale(next_step, 100, options)); options = { sync: true, scaleContent: false, transition: Effect.Transitions.linear, scaleX: false, scaleY: true }; effects.push(new Effect.Scale(active_step, 0, options)); var myDuration = 0.75; new Effect.Parallel(effects, { duration: myDuration, fps: 35, queue: { position: 'end', scope: 'accordion' }, beforeStart: function() { $$('.step_title').each(function(element) { element.removeClassName('next-step'); element.removeClassName('completed-step'); }); next_step.previousSiblings().grep(new Selector('h3')).each(function(element){$(element).addClassName('completed-step');}); var tmp = next_step.next('h3'); if(tmp != null){ tmp.addClassName('next-step'); } if(!forwards){ var previousStep = next_step.previous('h3'); if(previousStep != null){ previousStep.removeClassName('closed').addClassName('open'); // fail here null pointer IE ?? } active_step.previous('h3').removeClassName('open').addClassName('closed'); } }.bind(this), afterFinish: function() { //next_step.style.height = transformHeight+"px"; active_step.hide(); if(forwards){ next_step.previous('h3').removeClassName('closed').addClassName('open'); var previousStep = active_step.previous('h3'); if(previousStep != null){ previousStep.removeClassName('open').addClassName('closed'); } } active_step = next_step; animate_lock = false; }.bind(this) }); } else{ // Clicking on same step reloads the previous one, unless it's step 1 if(next_step.id != 'step1'){ } else{ } var simulate_next = $(element).previous('h3'); // { currentTarget: $(element).previous('h3') }; animateStepAction(simulate_next); } } function sidepanelSelectable(){ var sidepanel = document.getElementById('side-panel'); if(sidepanel != null){ sidepanel.onselectstart=document.onselectstart; } } function sidepanelUnselectable(){ var sidepanel = document.getElementById('side-panel'); if(sidepanel != null){ sidepanel.onselectstart=noselect; } } function noselect(e){return false;} function ready() { active_step = $$('#step1')[0]; $$('.step_title').invoke('observe', 'click', animateStep); refreshCategories(); if(sessionID != null) { document.threedstandards.send('sessionID', sessionID); sessionID = null; } isReady = true; showProductMenus(); hideLoadingScreen(); } // AJAX search category function function searchRequests(){ // return category uuid (parent, child) } // AJAX div submitting gubbins function hideSidePanel(){ var sidepane = document.getElementById('side-panel_overlay'); if(sidepane != null){ sidepane.style.display = 'none'; } } function submitRequestForm(action,email,content){ new Ajax.Updater(document.getElementById('side-panel_overlay_content'), 'http://abex.3d-standards.com/application/content/support-category.php', { evalScripts : true, parameters: { 'action': action, 'email' : email, 'content' : content } }); } function overlayRequestForm(){ new Ajax.Updater(document.getElementById('side-panel_overlay_content'), 'http://abex.3d-standards.com/application/content/support-category.php', { evalScripts:true, onComplete: function(response){ document.getElementById('side-panel_close').style.display = 'block'; document.getElementById('side-panel_overlay').style.display = 'block'; } }); } function overlayLoginScreen(){ loadingScreen = false; document.getElementById('side-panel_overlay').style.display = 'block'; document.getElementById('side-panel_overlay_content').innerHTML = ""; document.getElementById('side-panel_close').style.display = 'none'; } function submitRegisterScreen(company_name,email,password1,password2,region_uuid,voucher,accept){ new Ajax.Updater(document.getElementById('side-panel_overlay_content'), 'http://abex.3d-standards.com/application/content/register.php', { evalScripts : true, parameters: { 'company_name' : company_name, 'email' : email, 'password1' : password1, 'password2' : password2, 'region_uuid': region_uuid, 'voucher': voucher, 'accept': accept, 'create': 'true' } }); } function overlayRegisterScreen(){ loadingScreen = false; new Ajax.Updater(document.getElementById('side-panel_overlay_content'), 'http://abex.3d-standards.com/application/content/register.php', { evalScripts:true, onComplete: function(response){ document.getElementById('side-panel_close').style.display = 'none'; document.getElementById('side-panel_overlay').style.display = 'block'; } } ); } function hideLoadingScreen(){ if(loadingScreen){ //$('#side-panel_overlay').fadeOut("slow"); overlayLoginScreen(); } } function refreshCategories() { //categories_row document.getElementById("categories").src = "./content/categories.php"; //new Ajax.Updater(document.getElementById('categories_row'), 'http://abex.3d-standards.com/application/content/categories.php', { evalScripts:true } ); } // function appLogin(id) { if(isReady) { document.threedstandards.send('sessionID', id); } else { sessionID = id; } } function help() { window.open("../../files/languages/en/help/index.php", "_blank", "width=900,height=700,directories=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no"); } function feedback() { window.open('http://abex.3d-standards.com/application/content/email-form.php?recipient=feedback&button=28', '_blank', 'width=800,height=400,directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no'); } function support() { window.open('http://abex.3d-standards.com/application/content/email-form.php?recipient=support&button=27', '_blank', 'width=800,height=400,directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no'); } function updateTextureMenuTitle(){ // Localisation things outside frames var element = document.getElementById('texture_menu_title'); if(element != null){ new Ajax.Updater(element, "http://abex.3d-standards.com/application/content/updatetexturemenutitle.php"); } //document.getElementById('fileupload').src = document.getElementById('fileupload').src; // force reload of directupload // also the user image cutting board button ? } function setDetails(uuid) { openPopup("./content/details.php?uuid="+uuid); showOverlay(); } function updateShellschemeStatus(update, status){ new Ajax.Updater(document.getElementById("shellschemes"),"http://abex.3d-standards.com/application/content/shellschemes.php", { method: 'post', parameters: {update:update,status:status,chosen:chosen_shellscheme_item, width:floor_width,depth:floor_depth,meters:floor_meters} }); } function updateProductStatus(update, status, category, manufacturer){ new Ajax.Updater(document.getElementById("menu"),"http://abex.3d-standards.com/application/content/menu.php", { evalScripts : true, method: 'post', parameters: {update:update,status:status,category:category, manufacturer:manufacturer} }); } function updateProductsQuery(query, manufacturer_uuid){ new Ajax.Updater(document.getElementById("menu"),"http://abex.3d-standards.com/application/content/menu.php", { evalScripts : true, parameters: {query:query, manufacturer:manufacturer_uuid} }); } function updateProducts(category_uuid, manufacturer_uuid) { if(menu_type == 0) { if(document.getElementById("menu") != null){ document.getElementById("menu").src = "./content/menu.php?category=" + category_uuid + "&manufacturer=" + manufacturer_uuid; } } else if(menu_type == 1) { alert("TODO - put inside other menu? type="); if(document.getElementById("menu_m") != null) { document.getElementById("menu_m").src = "./content/swatches/menu.php?category=" + category_uuid + "&uuids=" + swatch_uuids + "&manufacturer=" + manufacturer_uuid; } } } function overlayPasswordReminder(container){ new Ajax.Updater(container, 'http://abex.3d-standards.com/application/content/remind.php'); } function submitPasswordReminder(container,email){ new Ajax.Updater(container, 'http://abex.3d-standards.com/application/content/remind.php', { evalScripts : true, parameters: {reset_email: email} }); } function reloadApplication() { window.location = "../../application/index.php"; } function login() { overlayLoginScreen(); } function changeLanguage(element){ if(element != null){ var language_uuid = element.options[element.selectedIndex].value; if(language_uuid != null){ new Ajax.Request("http://abex.3d-standards.com/application/content/changelanguage.php", { method : 'post', parameters: {lang:language_uuid} }); } document.threedstandards.send('changeLanguage', ''+language_uuid); refreshCategories(); setLinks(); updateTextureMenuTitle(); } } function logout() { if(confirm("Any unsaved data may be lost, are you sure you want to log out?")) { wipeTexEdit(); new Ajax.Request("http://abex.3d-standards.com/application/content/sessionlogout.php", { onComplete: function(){ refreshCategories(); setLinks(); hidePopup(); login(); hideMessage(); resetLogo(); } }); document.threedstandards.send('cancelProcess', ''); appLogin("-1"); } } function psignup() { //openPopup("../files/languages/en/front/signup.php"); openPopup("../signupiframe.php"); } function signup() { overlayRegisterScreen(); //openPopup("./content/register.php"); } function resetLogo() { setCompanyLogo('4921d6cfcafae9.51174424', 'Abex Exhibit Systems');} function refresh_account_status() { parent.document.threedstandards.send('cancelProcess', ''); parent.appLogin("-1"); parent.refreshCategories(); parent.setLinks(); parent.login(); } function shareProject() { parent.document.threedstandards.send('takeScreenshot', ''); } function admin() { openPopup("./content/admin.php"); } function openLoad() { openPopup("./content/data.php?mode=load"); } function openPopup(url) { if(setPopupFrame("popup_frame", url)) { resetPopupSize("content-popup"); showPopup(); } } function openPopupWithLoading(url) { var load_elm = document.getElementById("popup_loading_screen"); load_elm.style.display = 'block'; // Jamie - turn this on to show texedit loading screen if(setPopupFrame("popup_frame", url)) { resetPopupSize("content-popup"); showPopup(); } } function finishedLoading(){ var load_elm = document.getElementById("popup_loading_screen"); if(load_elm != null){ load_elm.style.display = 'none'; } } function openPopupID(id, frameID, url) { if(setPopupFrame(frameID, url)) { resetPopupSize(id); showPopupID(id); } } function popupClosed(id, cancelProcess) { if( (id == "popup_frame") && cancelProcess ) { document.threedstandards.send('cancelProcess', ''); } document.getElementById(id).src = "./content/blank.html"; } function setLinks() { document.getElementById("user_links").src = "./content/links.php"; } function addProduct(uuid,cat) { document.threedstandards.send('productsToLoad', uuid); new Ajax.Request("http://abex.3d-standards.com/tools/stats/stat.php", { method : 'post', parameters: {productid:uuid, category:cat} }); } function resetFlooring() { document.threedstandards.send('resetFloorTexture', ''); document.threedstandards.send('cancelProcess', ''); setFileUpload("-1"); } function addFlooring(uuid) { parent.document.threedstandards.send('loadingMessage', 11); new Ajax.Updater('fileupload', "./content/directfileupload.php", { method : 'get', evalScripts: 'true', parameters: { product: 'grounds', material: uuid, width: floor_width, depth: floor_depth } }); } function floorWidth(width) { floor_width = parseFloat(width); } function floorDepth(depth) { floor_depth = parseFloat(depth); } function setPopupFrame(id, url) { if( (document.getElementById(id) != null) && (document.getElementById(id).src != "http://abex.3d-standards.com/application/" + url) ) { document.getElementById(id).src = url; return true; } return false; } function textureEdit(puid,template,data,tuids,width,depth,material) { openPopupWithLoading("./content/textureedit/textureedit.php?puid="+puid+"&tuid="+template+"&data="+data+"&tuids="+tuids+"&width="+width+"&depth="+depth+"&material="+material); } var textureimages = null; var texturezindexes = null; var texturebkgcolor = "FFFFFF"; function cacheImages(images,indexes,bkgcolor){ textureimages = images; texturezindexes = indexes; texturebkgcolor = bkgcolor; } function wipeTexEdit(){ textureimages = null; texturezindexes = null; texturebkgcolor = "FFFFFF"; } function getState(){ return textureimages; } function getZindexes(){ return texturezindexes; } function getBkgcolor(){ return texturebkgcolor; } var dataholder = ""; function textureUpload(){ openPopupWithLoading("./content/textureedit/textureedit.php?"+dataholder); } function $m(elm){ return document.getElementById(elm); } function remove(theVar){ if(theVar != null){ var theParent = theVar.parentNode; if(theParent != null){ theParent.removeChild(theVar); } } } function addEvent(obj, evType, fn){ if(obj.addEventListener) obj.addEventListener(evType, fn, true) if(obj.attachEvent) obj.attachEvent("on"+evType, fn) } function removeEvent(obj, type, fn){ if(obj.detachEvent){ obj.detachEvent('on'+type, fn); }else{ obj.removeEventListener(type, fn, false); } } function isWebKit(){ return RegExp(" AppleWebKit/").test(navigator.userAgent); } function startImageUpload(form,url_action){ parent.document.threedstandards.send('uploading_file', 'start'); //if(limit_images < CROPPER.options.limit){ var urlenc = url_action.split('='); var destination = urlenc[1]; // verify it's a number or something? var detectWebKit = isWebKit(); form = typeof(form)=="string"?$m(form):form; var erro=""; if(form==null || typeof(form)=="undefined"){ erro += "The form of 1st parameter does not exists.\n"; }else if(form.nodeName.toLowerCase()!="form"){ erro += "The form of 1st parameter its not a form.\n"; } if(erro.length>0){ alert("Error in call ajaxUpload: " + erro); return; } var iframe = document.createElement("iframe"); iframe.setAttribute("id","ajax-temp"); iframe.setAttribute("name","ajax-temp"); iframe.setAttribute("width","0"); iframe.setAttribute("height","0"); iframe.setAttribute("border","0"); iframe.setAttribute("style","width: 0; height: 0; border: none;"); form.parentNode.appendChild(iframe); window.frames['ajax-temp'].name="ajax-temp"; var doUpload = function(){ var response = $m('ajax-temp').innerHTML; removeEvent($m('ajax-temp'),"load", doUpload); //if(response.indexOf('FAIL') == 0){ //$m('ajax-temp').src = "javascript: window.parent.fillBlank(document.body.innerHTML,'"+destination+"');void(0);"; //$m('ajax-temp').src = "javascript: eval(document.body.innerHTML);void(0);"; if(detectWebKit){ remove($m('ajax-temp')); }else{ setTimeout(function(){ remove($m('ajax-temp'))}, 250); } } addEvent($m('ajax-temp'),"load", doUpload); form.setAttribute("target","ajax-temp"); form.setAttribute("action",url_action); form.setAttribute("method","post"); form.setAttribute("enctype","multipart/form-data"); form.setAttribute("encoding","multipart/form-data"); form.submit(); } function setFileUpload(data) { data = ""+data; dataholder = data; var e = document.getElementById("texture_available"); var f = document.getElementById("no_texture_available"); if(e != null) { if(data == "-1"){ e.style.display = 'none'; f.style.display = 'block'; } else{ if(dataholder != ""){ new Ajax.Updater('fileupload', "./content/directfileupload.php", { method : 'get', evalScripts: 'true', parameters: dataholder }); } else{ remove($m('ajax-temp')); // needs tested online - should cancel fileupload if performed in reasonable time var html = ""; html += ""; html += ""; html += ""; html += ""; html += "
Advanced
Skin
"; document.getElementById("fileupload").innerHTML = html; } e.style.display = 'block'; f.style.display = 'none'; } } if(data == "-1") { //showProductMenus(); } } function reapplyFileUpload(data) { new Ajax.Updater('fileupload', "./content/directfileupload.php", {method : 'get', evalScripts: 'true', parameters: data}); } function confirmReset() { if(confirm("You will lose any unsaved work. Are you sure you want to create a new scene?")) { document.threedstandards.send("reset", "confirmed"); resetData(); } } function confirmDelete() { if(confirm("Delete this product? You will not be able to undo any changes.")) { document.threedstandards.send("delete", "confirmed"); } } function resetData() { save_data = ""; load_name = ""; load_data = ''; load_data_pos = 0; load_read_only = false; } function setCompanyLogo(uuid, name) { if(uuid == "-1") { document.getElementById("content-header-company-logo").innerHTML = ""; } else { document.getElementById("content-header-company-logo").innerHTML = ""; } logo_uuid = uuid; } function setFloorSizeFromApplet(widdep){ var array = widdep.split("|"); if(array != null && array[0] != null && array[1] != null && array[2] != null){ document.getElementById('step1_floorwidth').value=array[0]; document.getElementById('step1_floordepth').value=array[1]; setDimension((array[2] == "f")? 1:0, false); } } // http://stackoverflow.com/questions/18082/validate-numbers-in-javascript-isnumeric/1830844#1830844 function isNumber(n) { return !isNaN(parseFloat(n)) && isFinite(n); } function setFloorSize(width,depth,meters){ //var corrected_width = Math.round(width); //var corrected_depth = Math.round(depth); //document.getElementById('step1_floorwidth').value=corrected_width; //document.getElementById('step1_floordepth').value=corrected_depth; if(isNumber(width) && isNumber(depth)){ findShellschemes(width,depth,meters); var arg = width+"|"+depth; // applet wants size in hundreds (holds state of region for conversion or do it here?) document.threedstandards.send("setfloorsize", arg); return true; } return false; } function ss(selector){ var elm = $$(selector); if(elm == null){ return false; } return elm; } function findShellschemes(width,depth,meters){ // ajax request to populate application.php 'shellschemes' div with appropriate sizes of // current manufacturers' premade stand types - categorised by dev_step1 category parent. // with possible sub categories ( 1 level only ? ) similar to step2. // categories are then only visible iff there are products owned by this manufacturer inside // and of the given size ( immovable + !scaling + scaling_startW + scaling_startD) floor_width = width; floor_depth = depth; floor_meters = meters; new Ajax.Updater(document.getElementById("shellschemes"),"http://abex.3d-standards.com/application/content/shellschemes.php", { evalScripts : true, parameters: {'width': width, 'depth': depth, 'meters': meters, 'chosen': chosen_shellscheme_item} } ); } var chosen_shellscheme_item = 0; function setChosenShellSchemeItem(id){ chosen_shellscheme_item = id; } function forceChosenShellSchemeItem(id){ chosen_shellscheme_item = id; highlightChosenShellScheme(); } function highlightChosenShellScheme(){ var shellschemes = ss('.shellscheme_item'); if(shellschemes){ shellschemes.each(function(element){ element.removeClassName('selected'); }); if(chosen_shellscheme_item != null){ var highlight = ss('#shell_'+chosen_shellscheme_item.replace(".", "\\.")); if(highlight){ highlight.each(function(element){ element.addClassName("selected"); }); } } else{ var blank_shell = ss('#shell_0'); if(blank_shell){ blank_shell.each(function(element){ element.addClassName("selected"); }); } } } } function replaceStep1Shellscheme(productID){ chosen_shellscheme_item = productID; document.threedstandards.send("replaceShellscheme", productID); // highlight menu with selected highlightChosenShellScheme(); } function show_shellscheme_menu(){ // show shellschemes if not already set .. findShellschemes(document.getElementById("step1_floorwidth").value,document.getElementById("step1_floordepth").value,document.getElementById("step1_meters").checked); } function setDimension(_dimension, update){ if(_dimension == 1){ document.getElementById('width_measurement').innerHTML="ft"; document.getElementById('depth_measurement').innerHTML="ft"; document.getElementById('step1_feet').checked = true; document.getElementById('step1_meters').checked = false; } else{ document.getElementById('width_measurement').innerHTML="m"; document.getElementById('depth_measurement').innerHTML="m"; document.getElementById('step1_feet').checked = false; document.getElementById('step1_meters').checked = true; } /*if(document.getElementById('step1_floorwidth') != null && document.getElementById('step1_floorwidth') != null){ if(dimension == 1){ var width = (document.getElementById('step1_floorwidth').value / 30.48) * 12 * 100; var depth = (document.getElementById('step1_floordepth').value / 30.48) * 12 * 100; var remainderW = Math.floor(width % 12); var remainderD = Math.floor(depth % 12); document.getElementById('step1_floorwidth').value= ""+Math.floor(width/12) + "." + remainderW; document.getElementById('step1_floordepth').value= ""+Math.floor(depth/12) + "." + remainderD; document.getElementById('width_measurement').innerHTML="'"; document.getElementById('depth_measurement').innerHTML="'"; //document.getElementById('step1_floorwidth').value=document.getElementById('step1_floorwidth').value*100/30.48; //document.getElementById('step1_floordepth').value=document.getElementById('step1_floordepth').value*100/30.48; } else{ document.getElementById('width_measurement').innerHTML="m"; document.getElementById('depth_measurement').innerHTML="m"; document.getElementById('step1_floorwidth').value=toNearestHalf(document.getElementById('step1_floorwidth').value*30.48/100); document.getElementById('step1_floordepth').value=toNearestHalf(document.getElementById('step1_floordepth').value*30.48/100); } }*/ if(update){ document.threedstandards.send("setdimensions", _dimension); } dimension = _dimension; } function toNearestHalf(num){ var half = Math.ceil(num)-0.5 + 0.25; if(num >= half){ return Math.ceil(num) } else if(num < half - 0.25){ return Math.floor(num) } else{ return half } } function setFloorByLocation(location) { if(document.getElementById('step1_meters') != null && document.getElementById('step1_feet') != null){ if(location == 1){ document.getElementById('step1_meters').checked = false; document.getElementById('step1_feet').checked = true; document.getElementById('width_measurement').innerHTML='ft'; document.getElementById('depth_measurement').innerHTML='ft'; }else{ document.getElementById('step1_meters').checked = true; document.getElementById('step1_feet').checked = false; document.getElementById('width_measurement').innerHTML='m'; document.getElementById('depth_measurement').innerHTML='m'; } } document.threedstandards.send("setfloorlocation", location); } function loadData() { if(load_data != null){ if(load_data_pos >= load_data.length) { document.threedstandards.send('load_segment', null); if(load_read_only) { resetData(); } else { load_data = ''; } } else if(load_data.length >= 100) { document.threedstandards.send('load_segment', load_data.substring(load_data_pos, load_data_pos + 100)); load_data_pos += 100; } else { document.threedstandards.send('load_segment', load_data); load_data_pos = load_data.length; } } } function saveData(data) { if(data != null) { save_data += data; document.threedstandards.send("dataReceived", ""); } else { openPopup("./content/saving/save-data.php?method=save"); } state = STATE_SAVING; } function saveAsData(data) { if(data != null) { save_data += data; document.threedstandards.send("dataReceived", ""); } else { openPopup("./content/saving/save-data.php?method=saveas"); } state = STATE_SAVING_AS; } function viewerData(data) { if(data != null) { save_data += data; document.threedstandards.send("dataReceived", ""); } else { openPopup("./content/saving/snapshot-data.php"); } state = STATE_VIEWER; } function screenshotStart() { openPopup("./content/saving/screenshot-name.php"); } function screenshotName(name) { screenshot_name = name; document.threedstandards.send("screenshotName", screenshot_name); } var step4_parameters = {}; function productData(_data) { if(_data == null) { if(!cancelled){ var user_rfq = false; if(document.getElementById("user_rfq") != null && document.getElementById("user_rfq").checked){ user_rfq = true; } var confirmation = document.getElementById("pdf_status"); if(confirmation != null){ confirmation.innerHTML = ""; } step4_parameters = {}; step4_parameters['products'] = product_data; step4_parameters['screenshot'] = screenshotData; step4_parameters['user_rfq'] = user_rfq; step4_parameters['logo'] = logo_uuid; $$('#step4_customfields input').each(function(item){ step4_parameters["step4_"+item.readAttribute('title')] = item.value; }); step4_parameters = $H(step4_parameters).toJSON(); new Ajax.Request("http://abex.3d-standards.com/application/content/saving/pdf-email.php", { method: 'post', parameters: step4_parameters, onComplete: function(response){ // turn off loading animation and any blocking? var pdf_load = document.getElementById('pdf_loading'); if(pdf_load != null){ pdf_load.style.display = 'none'; // or show completion message } var confirmation = document.getElementById("pdf_status"); if(confirmation != null){ try{ var json = (response.responseText).evalJSON(true); confirmation.innerHTML = json.res; } catch(ex){ confirmation.innerHTML = "Unknown error"; } } blockPDFs = false; createPDFAfterScreenshot = false; document.threedstandards.send('cancelProcess',''); } }); } else{ cancelled = false; } } else { product_data += _data; document.threedstandards.send('dataReceived', ''); } } function cancelPDF(){ cancelled = true; document.threedstandards.send('cancelProcess',''); blockPDFs = false; createPDFAfterScreenshot = false; product_data = ""; screenshotData = ""; } function exportItem(data) { data = ""+data; var str = data.split(","); openPopup("./content/single-item-viewer.php?data=" + data); } function setWorkerSource(url) { document.getElementById("worker").src = url; } var categories_height = 70; var step_height_offset = 29; var search_height = 28; var products_height = 439; var row_height = 20; var rows = 0; var swatch_uuids = ""; var menu_type = -1; function setRows() { var size = categories_height + search_height;// + row_height;(rows * row_height); document.getElementById("categories").style.height = size + "px"; document.getElementById("menu").height = (products_height - size) + "px"; document.getElementById("products_row").style.height = (products_height - size) + "px"; if(document.getElementById("products") != null) { document.getElementById("products").style.height = (products_height - size) + "px"; } } function showProductMenus() { //document.getElementById("categories_row").className = ""; //document.getElementById("products_row").className = ""; menu_type = 0; swatch_uuids = ""; setRows(); } var screenshotData = ""; var blockScreenshots = false; var blockPDFs = false; var createPDFAfterScreenshot = false; var cancelled = false; function sendScreenshotSegment(segment){ if(segment == null){ // complete document.threedstandards.send('screenshotDataCallback', 'completed'); blockScreenshots = false; if(!cancelled){ if(createPDFAfterScreenshot){ // pdf with screenshot document.threedstandards.send("startPDFCreate","true"); } else{ // just a screenshot -- post it server var is_IE = true; // regex client? if(is_IE){ var sesame = window.open("about:blank",'threedsimage','width=750,height=560,directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no'); sesame.document.write(""); sesame.document.write("

Creating Image please wait

"); //sesame.document.write("
"); sesame.document.write(""); sesame.document.write(""); sesame.document.write("
"); sesame.document.write(""); sesame.document.close(); } else{ window.open('data:image/png;base64,'+screenshotData, 'open_window', 'menubar, toolbar, location, directories, status, scrollbars, resizable, dependent, width=640, height=480, left=0, top=0') } } } else{ cancelled = false; } } else{ screenshotData += segment; document.threedstandards.send("screenshotDataCallback","received_ok"); } } function startScreenshot(){ if(!blockPDFs && !blockScreenshots){ cancelled = false; blockScreenshots = true; screenshotData = ""; document.threedstandards.send("createScreenshot","start"); return true; } return false; } function createPDF(){ if(startScreenshot()){ var confirmation = document.getElementById("pdf_status"); if(confirmation != null){ confirmation.innerHTML = ""; } var show_loading = document.getElementById('pdf_loading'); if(show_loading != null){ show_loading.style.display = 'block'; } product_data = ""; blockPDFs = true; createPDFAfterScreenshot = true; } }