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 = "
| Advanced |
| Skin | "; html += "
