/* Fix for ie5 getElementsByTagName - Thanks atany*/ if(document.all && !(document.getElementsByTagName('*').length)) Element.extend({ getElementsByTagName: function(str){ return(str=='*')?this.all:this.tags(str); } }); function reset_make_model() { $('sel_make').selectedIndex = 0; } function showLoading(divid) { $(divid).set('html', '
'); var load = new Element('h5', {html: 'Loading...'}); $(divid).adopt(load); } function genModels( makeID, list ) { if ( !parseInt(makeID) ) { return; } $(list).length = 0; $(list)[0] = new Option('Loading...'); var url = base_url+'/catalogue/get-models'; var reqModels = new Request.JSON({ url: url, onComplete: function(models) { $(list).length = 0; $(list)[0] = new Option('-- Please Select --', ''); models.each(function(model) { try { $(list).add(new Option(model.name, model.id), null); } catch(err) { $(list).add(new Option(model.name, model.id)); } }); } }); reqModels.get({'make': makeID}); } function getKitInfo( id ) { var divid = "result_"+id; if ($(divid).get('html') == '') { var url = base_url+'/catalogue/item'; $(divid).set('html', 'Loading...'); new Request( { url: url, data: 'id='+id, onComplete: function(resp) { $(divid).set('html', resp); } }).send(); } showhide( divid ); } function toggleBG( element, colourA, colourB ) { if ($(element).getStyle('background-color') == colourA ) { $(element).setStyle('background-color', colourB); } else { $(element).setStyle('background-color', colourA); } } function showhide( divid ) { if ($(divid).getStyle('display') == 'none') { $(divid).setStyle('display', 'block'); } else { $(divid).setStyle('display', 'none'); } } function load_content( content, oncomplete ) { var url = base_url+'/'+content; showLoading('main_content'); new Request.HTML({ url: url, update: $('main_content'), method: 'get', onComplete: function( result ) { if( oncomplete ) { oncomplete(); } } }).send(); } function load_content_page( page_name ) { content = 'content/show/page/'+page_name; load_content( content ); } function sendForm(form, updatediv, oncomplete) { new Request.HTML({ url: form.action, update: updatediv }).post(form); } function toggleVisibility(el) { var theclass = el.get('class'); if( theclass == 'hidden' ) { el.set('class', 'visible'); } else { el.set('class', 'hidden'); } }/* Fix for ie5 getElementsByTagName - Thanks atany*/ if(document.all && !(document.getElementsByTagName('*').length)) Element.extend({ getElementsByTagName: function(str){ return(str=='*')?this.all:this.tags(str); } }); function reset_make_modelrotor() { $('sel_rotormake').selectedIndex = 0; } function showLoadingrotor(divid) { $(divid).set('html', '
'); var load = new Element('h5', {html: 'Loading...'}); $(divid).adopt(load); } function genrotorModels( makeID, list ) { if ( !parseInt(makeID) ) { return; } $(list).length = 0; $(list)[0] = new Option('Loading...'); var url = base_url+'/cataloguerotor/get-models'; var reqModels = new Request.JSON({ url: url, onComplete: function(models) { $(list).length = 0; $(list)[0] = new Option('-- Please Select --', ''); models.each(function(model) { try { $(list).add(new Option(model.name, model.id), null); } catch(err) { $(list).add(new Option(model.name, model.id)); } }); } }); reqModels.post({'make': makeID}); } function getrotorKitInfo( id ) { var divid = "result_"+id; if ($(divid).get('html') == '') { var url = base_url+'/cataloguerotor/item'; $(divid).set('html', 'Loading...'); new Request( { url: url, data: 'id='+id, onComplete: function(resp) { $(divid).set('html', resp); } }).send(); } showhide( divid ); } function toggleBGrotor( element, colourA, colourB ) { if ($(element).getStyle('background-color') == colourA ) { $(element).setStyle('background-color', colourB); } else { $(element).setStyle('background-color', colourA); } } function showhiderotor( divid ) { if ($(divid).getStyle('display') == 'none') { $(divid).setStyle('display', 'block'); } else { $(divid).setStyle('display', 'none'); } } function load_contentrotor( content, oncomplete ) { var url = base_url+'/'+content; showLoading('main_content'); new Request.HTML({ url: url, update: $('main_content'), method: 'get', onComplete: function( result ) { if( oncomplete ) { oncomplete(); } } }).send(); } function load_content_pagerotor( page_name ) { content = 'content/show/page/'+page_name; load_content( content ); } function sendFormrotor(form, updatediv, oncomplete) { new Request.HTML({ url: form.action, update: updatediv }).post(form); } function toggleVisibilityrotor(el) { var theclass = el.get('class'); if( theclass == 'hidden' ) { el.set('class', 'visible'); } else { el.set('class', 'hidden'); } }