// set current domain and the list of all active domains var currentDomain = 'www.alphatrad.com'; var currentDomainAlias = 'com'; var domainsList = []; domainsList['at'] = { 'alias': 'at', 'domain': 'www.alphatrad.at', 'name': 'Alphatrad Austria', 'email': 'austria@alphatrad.at', 'phone': '+43 1 23060 8140' }; domainsList['be'] = { 'alias': 'be', 'domain': 'viaverbia.be', 'name': 'ViaVerbia Belgium', 'email': 'info@viaverbia.com', 'phone': '+352 28 48 01 38' }; domainsList['cat'] = { 'alias': 'cat', 'domain': 'www.alphatrad.cat', 'name': 'Alphatrad Spain', 'email': 'spain@alphatrad.com', 'phone': '+ 34 91 579 46 55' }; domainsList['ch'] = { 'alias': 'ch', 'domain': 'www.traducta.ch', 'name': 'Traducta Switzerland', 'email': 'info@traducta.ch', 'phone': '+41 61 312 34 13' }; domainsList['com'] = { 'alias': 'com', 'domain': 'www.alphatrad.com', 'name': 'Alphatrad', 'email': '', 'phone': '' }; domainsList['de'] = { 'alias': 'de', 'domain': 'www.alphatrad.de', 'name': 'Alphatrad Germany', 'email': 'germany@alphatrad.de', 'phone': '+49 681 996 38 25' }; domainsList['dk'] = { 'alias': 'dk', 'domain': 'optilingua-oversaettelser.dk', 'name': 'Alphatrad Denmark', 'email': 'cph@optilingua.dk', 'phone': '+45 70 20 65 70' }; domainsList['es'] = { 'alias': 'es', 'domain': 'www.alphatrad.es', 'name': 'Alphatrad Spain', 'email': 'spain@alphatrad.com', 'phone': '+ 34 91 579 46 55' }; domainsList['fr'] = { 'alias': 'fr', 'domain': 'www.alphatrad.fr', 'name': 'Alphatrad France', 'email': 'devis@alphatrad.com', 'phone': '+33 1 69 77 8800' }; domainsList['it'] = { 'alias': 'it', 'domain': 'www.traducta.it', 'name': 'Traducta Italy', 'email': 'italy@traducta.it', 'phone': '+39 02 7254 6469' }; domainsList['lu'] = { 'alias': 'lu', 'domain': 'www.alphatrad.lu', 'name': 'Alphatrad Luxembourg', 'email': 'info@alphatrad.lu', 'phone': '+352 20 20 36 06' }; domainsList['luv'] = { 'alias': 'luv', 'domain': 'viaverbia.lu', 'name': 'ViaVerbia Luxembourg', 'email': 'info@viaverbia.com', 'phone': '' }; domainsList['nl'] = { 'alias': 'nl', 'domain': 'traducta.nl', 'name': 'Traducta Netherlands', 'email': '', 'phone': '' }; domainsList['optima'] = { 'alias': 'optima', 'domain': 'optima-translation.com', 'name': 'Optima Translation', 'email': '', 'phone': '' }; domainsList['pt'] = { 'alias': 'pt', 'domain': 'www.alphatrad.pt', 'name': 'Alphatrad Portugal', 'email': 'portugal@alphatrad.com', 'phone': '+351 21 321 14 33' }; domainsList['uk'] = { 'alias': 'uk', 'domain': 'www.alphatrad.co.uk', 'name': 'Alphatrad UK', 'email': 'uk@alphatrad.co.uk', 'phone': '+44 2070 926 632' }; function get_referrer() { var referrer = jQuery.cookie('alpha_referrer_alias'); if(referrer != null && referrer != currentDomainAlias) { return referrer; } else { return ''; } } // function to change the contact data in quotation block based on referrer // quotation block international site (homme and inner page) function quotation_block_change() { var referrer = get_referrer(); // if empty referrer defaults to UK if(referrer.length == 0 || typeof domainsList[referrer] != 'object') { referrer = 'uk'; } /* jQuery('#quotation-block-int .phone a').html(domainsList[referrer].phone); jQuery('#quotation-block-int .phone a').attr('href', 'tel:' + domainsList[referrer].phone); jQuery('#quotation-block-int .phone a').removeClass(); jQuery('#quotation-block-int .phone a').addClass(domainsList[referrer].alias.replace('.','')); */ jQuery('#quotation-block-int #quotation-phone-1').html(domainsList[referrer].phone); jQuery('#quotation-block-int #quotation-phone-1').attr('href', 'tel:' + domainsList[referrer].phone); jQuery('#quotation-block-int #quotation-phone-1').removeClass(); jQuery('#quotation-block-int #quotation-phone-1').addClass(domainsList[referrer].alias.replace('.','')); jQuery('#quotation-block-int .email a').html(domainsList[referrer].email); jQuery('#quotation-block-int .email a').attr('href', 'mailto:' + domainsList[referrer].email); } // function to change the contact data in contact form based on referrer // and also change the contact data based on drop list changes function contact_dropbox_change() { var alias = jQuery('#country_selector option:selected').val(); if(alias.length > 0) { jQuery.cookie('alpha_referrer_alias', alias); } var referrer = get_referrer(); // if empty referrer defaults to UK if(referrer.length == 0 || typeof domainsList[referrer] != 'object') { referrer = 'uk'; } if(alias == 'other') { jQuery("#country_selector option[value='other']").attr("selected", "selected"); } else { jQuery("#country_selector option[value='"+referrer+"']").attr("selected", "selected"); } jQuery('#contact-page-int #contact_int_phone').html(domainsList[referrer].phone); jQuery('#contact-page-int #contact_int_email a').html(domainsList[referrer].email); jQuery('#contact-page-int #contact_int_email a').attr('href', 'mailto:' + domainsList[referrer].email + '?subject=Query or quotation request'); } // function to change the contact data in quotation form based on referrer function quotation_dropbox_change(init) { init = init || false; if(init) { var alias = get_referrer(); } else { var alias = jQuery('#destination option:selected').val(); if(alias.length > 0) { jQuery.cookie('alpha_referrer_alias', alias); } } // for empty or no valid referrer we leave unselected if(alias.length > 0 && typeof domainsList[alias] == 'object') { jQuery("#destination option[value='"+alias+"']").attr("selected", "selected"); } else { } } (function ($, Drupal, window, document, undefined) { jQuery(document).ready(function() { quotation_block_change(); /* // if we are on the contact page if($('#contact-page-int').length != 0) { // on first display of the page select drop list based on cookie contact_dropbox_change(); // attach the event to dropbox jQuery("#country_selector").change(function() { contact_dropbox_change(); quotation_block_change(); }); } */ // if we are on the quotation page if($('#devisForm').length != 0) { // on first display of the page select drop list based on cookie quotation_dropbox_change(true); // attach the event to dropbox jQuery("#destination").change(function() { quotation_dropbox_change(); quotation_block_change(); }); } }); })(jQuery, Drupal, this, this.document);