/* SCM: 05/10/2007 added unobtrusive toggle functionality - removed the original one */
if((typeof Prototype=='undefined') || (typeof Element == 'undefined') || (typeof Element.Methods=='undefined')){
//prototype not present...
} else {
Event.observe(window,'load',page_loaded, true);
}
function page_loaded(evt){
$A(document.getElementsByClassName('toggle')).each(function(i, cnt){
i.removeClassName('toggle');
tmp = i.classNames();
newClassName = '';
tmp.each(function(n) {
newClassName = n + '_collapsed';
});
i.className = newClassName;
i.next().className = newClassName;
//new Insertion.Top(i.next(), ' ');
if (i.hasClassName('sales_disclaimer')) { //add three dots for sales disclaimer only
new Insertion.After(i, '...');
}
Event.observe(i,'click',toggleDisclaimer, false);
Event.observe(i,'focus',linkBlurring, false);
});
}
var newClassName = '';
var effectDurationDown = 1; //effect duration to show toggled elements
var effectDurationUp = 1; //effect duration to hide toggled elements
function toggleDisclaimer (e) {
var element = Event.findElement(e,'a'); //$(Event.element(e));
currentClassName = element.className;
if (currentClassName.endsWith('_collapsed') == true ) {
/* show the content element */
newClassName = currentClassName.substr(0, currentClassName.length - 10);
element.className = newClassName;
element.next().hide();
if (element.next().hasClassName('no_print')) { //hide '...' element
element.next(1).hide();
element.next(1).className = '';
if (window.opera) {
element.next(1).show();
} else {
new Effect.BlindDown(element.next(1), {'duration' : effectDurationDown, 'afterFinish' : function(){
/*a = element.next(1).getHeight();
element.next(1).setStyle({
height: a + 'px'
});*/
element.next(1).className = newClassName;
element.next(1).show();
}
});
}
} else {
element.next().className = '';
if (window.opera) {
element.next().show();
} else {
new Effect.BlindDown(element.next(), {'duration' : effectDurationDown, 'afterFinish' : function(){
/*a = element.next().getHeight();
element.next().setStyle({
height: a + 'px'
});*/
element.next().className = newClassName;
element.next().show();
}
});
}
}
} else {
/* hide the content element */
newClassName = currentClassName + '_collapsed';
element.className = newClassName;
/*if (element.next().hasClassName('no_print')) { //show ... element
element.next().show();
element.next(1).className = newClassName;
} else {
element.next().className = newClassName;
}*/
if (element.next().hasClassName('no_print')) { //hide '...' element
element.next(1).className = '';
new Effect.BlindUp(element.next(1), {'duration' : effectDurationUp, 'afterFinish' : function(){
element.next(1).className = newClassName;
element.next(1).show();
element.next().show();
}
});
} else {
element.next().className = '';
new Effect.BlindUp(element.next(), {'duration' : effectDurationUp, 'afterFinish' : function(){
element.next().className = newClassName;
element.next().show();
}
});
}
}
Event.stop(e);
}
function linkBlurring(e) {
var link = Event.element(e);
if(link.blur) link.blur();
Event.stop(e);
}
/* Swith panels to display for content - Used Mazdas */
function toggleVisibility(layerID) {
if (document.getElementById(layerID).style.display == 'block') {
document.getElementById(layerID).parentNode.childNodes[0].style.background = 'url(/NR/rdonlyres/D22C472A-E937-4681-B064-41A54BCD05C0/0/btn_plus_open.gif) no-repeat 0 4px';
document.getElementById(layerID).style.display = 'none';
}
else {
foo = document.getElementById("list").getElementsByTagName('div').length;
for(i=0;i0% APR');
}
return DisplayName;
}
/* Flash link handling
* called in the swf, e.g: javascript:linkCall("Mazda2nano_home_register","MUK07NM2NANOS");
*/
// add redirect urls as required:
var redirectPaths = {
'Mazda2nano_home_register': '/Showroom/ComingSoon/Register/KeepingInTouch.aspx?cname=',
'Mazda2nano_home_register_blank': '/Showroom/ComingSoon/Register/KeepingInTouch.aspx'
};
function linkCall (eventName, cname) {
// fix munged params
var pKey = 'cname=';
var linkToRedirect = redirectPaths[eventName];
if (cname.indexOf(pKey)== 0) {
cname = cname.substring(pKey.length);
}
else
{
//nothing
//cname = '';
if (eventName.indexOf('_blank') >= 0 ) {
linkToRedirect = redirectPaths[eventName];
eventName = eventName.substring(0, eventName.indexOf('_blank'));
}
}
var flashLogPath = '/Templates/Utilities/FlashLoggingMazda2.aspx?pathInfo=';
//logging requests:
sendLogging(flashLogPath + eventName);
tc_log(eventName);
// page redirect:
var url = linkToHttps(linkToRedirect, cname);
var t = setTimeout('document.location.href="' + url +'"', 100);
}
function sendLogging (url) {
return new Ajax.Request(url, {
method: 'get',
onFailure: function(transport) {
//alert("failed with: " + transport.status);
}
});
}
function linkToHttps (path, cname) {
var tmp = document.location.hostname.indexOf('uk');
var tmp2 = document.location.hostname.indexOf('it');
var url = 'https://';
url += document.location.hostname;
if ( tmp > 0){
url += '/Showroom/ComingSoon/Mazda2/Register/KeepingInTouch.aspx?cname=';
}
else if ( tmp2 > 0){
url += '/BuyingAMazda/testdrive.aspx?cname=';
} else {
url += path;
}
url += cname;
return url;
}