





var widthSetting = {
    'mine.com.sg':{'default':210, 'top':1000, 'right_button': 240, 'right':240},
    'designrete.com':{'default':210, 'top':1000, 'right_button': 240, 'right':240},
    'thenetworkhub.com':{'default':220, 'top':1000, 'right_button': 240, 'right':240},
    'nwhholdings.com':{'default':220, 'top':1000, 'right_button': 240, 'right':240},
    'thefirstcad.com':{'default':220, 'top':1000, 'right_button': 240, 'right':240}

};

function getBannerWidth(_site, _location){
    _settings = widthSetting[_site];
    if(!_settings) return null;

    _width = _settings[_location];

    if(!_width) {
        _width = _settings['default'];
    }

    return _width;
}







function createBanner(banner){


    var image_0 = "<img src='_src' border='0' width='_width'/>";
    var image_1 = "<a href='_href'><img src='_src' width='_width' border='0'/></a>";
    var flash = '<object width="_width" height="_height"> \
    <param name="movie" value="_src"></param>\
    <param name="allowFullScreen" value="true"></param>\
    <embed src="_src" type="application/x-shockwave-flash" allowfullscreen="true" width="_width" height="_height"></embed></object>';

    var result = null;

    if(banner.type == 'image'){
        if(banner.href){
            result = image_1;
        }else {
            result = image_0;
        }
    }else {
        result = flash;
    }

    width = getBannerWidth(banner.site, banner.location);

    result = result.replace(/_src/g, banner.src);
    result = result.replace(/_height/g, banner.height);
    result = result.replace(/_href/g, banner.href);
    result = result.replace(/_width/g, width);


    return result;
}
/*
function startBannerRotate(id_placeHolder, banner_list, index_banner){
    document.getElementById(id_placeHolder).innerHTML = createBanner(banner_list[index_banner]);
    var next_banner_index = (index_banner + 1) % banner_list.length;

    setTimeout(function(){startBannerRotate(id_placeHolder, banner_list, next_banner_index)},5000 );
}
*/

function startBannerRotate(id_placeHolder, banner_list, index_banner){
  var next_banner_index = (index_banner + 1) % banner_list.length;
	var el = document.getElementById(id_placeHolder);
  el = $(el);
  var	firstChild = $(el.childNodes[0]);
	var span = document.createElement("span")
	span = $(span);
	span.innerHTML = createBanner(banner_list[next_banner_index])
	if(firstChild) {
		firstChild.fade({ duration: 0.8 });
		span.hide();
		setTimeout(function(){span.appear(); el.removeChild(el.childNodes[0])}, 700);
	}
	el.appendChild(span);
	setTimeout(function(){startBannerRotate(id_placeHolder, banner_list, next_banner_index)},5000);
}


// EOF
var banner_list1284003245997 = [{'href':'http://www.mine.com.sg/mall/productlist/19817', 'src':'http://www.mine.com.sg/upload/1257145727247_FlipBanner.jpg', 'height': '', type:'image', site:'mine.com.sg', location:'top'},{'href':'http://www.mine.com.sgwww.mine.com.sg', 'src':'http://www.mine.com.sg/upload/1280144093695_CS5-TopBanner-WP(B)].jpg', 'height': '', type:'image', site:'mine.com.sg', location:'top'},{'href':'http://www.mine.com.sgwww.mine.com.sg', 'src':'http://www.mine.com.sg/upload/1280144093696_CS5-TopBanner-DP(B).jpg', 'height': '', type:'image', site:'mine.com.sg', location:'top'},{'href':'http://www.mine.com.sgwww.mine.com.sg', 'src':'http://www.mine.com.sg/upload/1280144093697_apro9-minebanner-copy.jpg', 'height': '', type:'image', site:'mine.com.sg', location:'top'}];
var banner_place_holder_1284003245997 = 'banner_place_holder_1284003245997';
var banner_random_1284003245997 = 0;
document.write("<div id='banner_place_holder_1284003245997' style='height:194px; width: 1000px'></div> ");
startBannerRotate(banner_place_holder_1284003245997, banner_list1284003245997, banner_random_1284003245997);
