// * fix ie bug - custom script (Author: Ryan)
function tSwapImage(obj, img) {
	var doSwap = function () {
		document.getElementById(obj).setAttribute('src', img);
    }
	setTimeout(doSwap, 100);
}
//
var theImages = new Array();
//
theImages[0] = 'images/bluetooth-fact-1.jpg';
theImages[1] = 'images/bluetooth-fact-2.jpg';
theImages[2] = 'images/bluetooth-fact-3.jpg';
theImages[3] = 'images/bluetooth-fact-4.jpg';
theImages[4] = 'images/bluetooth-fact-5.jpg';
theImages[5] = 'images/bluetooth-fact-6.jpg';
theImages[6] = 'images/bluetooth-fact-7.jpg';

var j = 0;
var p = theImages.length;
var preBuffer = new Array();
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages[i]
}

function rotateFact() {
	var random = Math.round(Math.random()*(p-1));
	var doSwap = function () {
		document.getElementById('fact').setAttribute('src', theImages[random]);
    }
	setTimeout(doSwap, 1);
}

//rotateFact();



//
// swap div id = H700
function swapH700(id){
	switch(id){
	
	case "black":
		document.getElementById("H700link").innerHTML="<p class=\"buynow\"><a href=\"http://moto.brightpoint.com.au/motostore/AccDetails.aspx?CID=2&amp;Code=074250\" class=\"arrowlink\" title=\"Buy Now\">Buy Now</a></p>";
        break;
    case "blue":
        document.getElementById("H700link").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    case "cosmicblue":
        document.getElementById("H700link").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    case "silver":
        document.getElementById("H700link").innerHTML="<p class=\"buynow\"><a href=\"http://moto.brightpoint.com.au/motostore/AccDetails.aspx?CID=2&amp;Code=074235\" class=\"arrowlink\" title=\"Buy Now\">Buy Now</a></p>";
        break;
    case "plum":
        document.getElementById("H700link").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    case "red":
        document.getElementById("H700link").innerHTML="<p class=\"buynow\"><a href=\"http://moto.brightpoint.com.au/motostore/AccDetails.aspx?CID=2&amp;Code=074266\" class=\"arrowlink\" title=\"Buy Now\">Buy Now</a></p>";
        break;
    case "dg":
        document.getElementById("H700link").innerHTML="<p class=\"buynow\"><a href=\"http://moto.brightpoint.com.au/motostore/AccDetails.aspx?CID=2&amp;Code=074253\" class=\"arrowlink\" title=\"Buy Now\">Buy Now</a></p>";
        break;
    default : 
    	document.getElementById("H700link").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    }
}
//
// swap div id = H500
function swapH500(id){
	switch(id){
	
	case "black":
		document.getElementById("H500link").innerHTML="<p class=\"buynow\"><a href=\"http://moto.brightpoint.com.au/motostore/AccDetails.aspx?CID=2&amp;Code=074238\" class=\"arrowlink\" title=\"Buy Now\">Buy Now</a></p>";
        break;
    case "glossyblack":
        document.getElementById("H500link").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    case "nickel":
        document.getElementById("H500link").innerHTML="<p class=\"buynow\"><a href=\"http://moto.brightpoint.com.au/motostore/AccDetails.aspx?CID=2&amp;Code=074218\" class=\"arrowlink\" title=\"Buy Now\">Buy Now</a></p>";
        break;
    case "white":
        document.getElementById("H500link").innerHTML="<p class=\"buynow\"><a href=\"http://moto.brightpoint.com.au/motostore/AccDetails.aspx?CID=2&amp;Code=074239\" class=\"arrowlink\" title=\"Buy Now\">Buy Now</a></p>";
        break;
    case "cosmicblue":
        document.getElementById("H500link").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    case "spablue":
        document.getElementById("H500link").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    case "lightblue":
        document.getElementById("H500link").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    case "lightgreen":
        document.getElementById("H500link").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    case "orange":
        document.getElementById("H500link").innerHTML="<p class=\"buynow\"><a href=\"http://moto.brightpoint.com.au/motostore/AccDetails.aspx?CID=2&amp;Code=074267\" class=\"arrowlink\" title=\"Buy Now\">Buy Now</a></p>";
        break;
    case "firered":
        document.getElementById("H500link").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    case "cherry":
        document.getElementById("H500link").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    case "hotpink":
        document.getElementById("H500link").innerHTML="<p class=\"buynow\"><a href=\"http://moto.brightpoint.com.au/motostore/AccDetails.aspx?CID=2&amp;Code=074245\" class=\"arrowlink\" title=\"Buy Now\">Buy Now</a></p>";
        break;
    case "bubblegum":
        document.getElementById("H500link").innerHTML="<p class=\"buynow\"><a href=\"http://moto.brightpoint.com.au/motostore/AccDetails.aspx?CID=2&amp;Code=074267\" class=\"arrowlink\" title=\"Buy Now\">Buy Now</a></p>";
        break;
    case "pink":
        document.getElementById("H500link").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    default : 
    	document.getElementById("H500link").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    }
}
//
// swap div id = H350
function swapH350(id){
	switch(id){
	
	case "black":
		document.getElementById("H350link").innerHTML="<p class=\"buynow\"><a href=\"http://moto.brightpoint.com.au/motostore/AccDetails.aspx?CID=2&amp;Code=074259\" class=\"arrowlink\" title=\"Buy Now\">Buy Now</a></p>";
        break;
    case "pearl":
        document.getElementById("H350link").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    case "silverquartz":
        document.getElementById("H350link").innerHTML="<p class=\"buynow\"><a href=\"http://moto.brightpoint.com.au/motostore/AccDetails.aspx?CID=2&amp;Code=074268\" class=\"arrowlink\" title=\"Buy Now\">Buy Now</a></p>";
        break;
    case "silversail":
        document.getElementById("H350link").innerHTML="<p class=\"buynow\"><a href=\"http://moto.brightpoint.com.au/motostore/AccDetails.aspx?CID=2&amp;Code=074268\" class=\"arrowlink\" title=\"Buy Now\">Buy Now</a></p>";
        break;
    case "blue":
        document.getElementById("H350link").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    case "pink":
        document.getElementById("H350link").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    default : 
    	document.getElementById("H350link").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    }
}
//
// swap div id = H300
function swapH300(id){
	switch(id){
	

    case "black":
        document.getElementById("H300link").innerHTML="<p class=\"buynow\"><a href=\"http://moto.brightpoint.com.au/motostore/AccDetails.aspx?CID=2&amp;Code=074243\" class=\"arrowlink\" title=\"Buy Now\">Buy Now</a></p>";
        break;
    case "white":
        document.getElementById("H300link").innerHTML="<p class=\"buynow\"><a href=\"http://moto.brightpoint.com.au/motostore/AccDetails.aspx?CID=2&amp;Code=074242\" class=\"arrowlink\" title=\"Buy Now\">Buy Now</a></p>";
        break;
    case "pink":
        document.getElementById("H300link").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    default : 
    	document.getElementById("H300link").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    }
}
//
// swap div id = H3
function swapH3(id){
	switch(id){

    case "black":
        document.getElementById("H3link").innerHTML="<p class=\"buynow\"><a href=\"http://moto.brightpoint.com.au/motostore/AccDetails.aspx?CID=2&amp;Code=074240\" class=\"arrowlink\" title=\"Buy Now\">Buy Now</a></p>";
        break;
    case "platinum":
        document.getElementById("H3link").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    case "silver":
        document.getElementById("H3link").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    default : 
    	document.getElementById("H3link").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    }
}
//
// swap div id = HS815
function swapHS815(id){
	switch(id){

    case "black":
        document.getElementById("HS815link").innerHTML="<p class=\"buynow\"><a href=\"http://moto.brightpoint.com.au/motostore/AccDetails.aspx?CID=2&amp;Code=074236\" class=\"arrowlink\" title=\"Buy Now\">Buy Now</a></p>";
        break;
    case "platinum":
        document.getElementById("HS815link").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    default : 
    	document.getElementById("HS815link").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    }
}

//
// swap div id = OROKR
function swapOROKR(id){
	switch(id){

    case "white":
        document.getElementById("OROKRlink").innerHTML="<p class=\"buynow\"><a href=\"http://moto.brightpoint.com.au/motostore/AccDetails.aspx?CID=2&amp;Code=074257\" class=\"arrowlink\" title=\"Buy Now\">Buy Now</a></p>";
        break;
    case "black":
        document.getElementById("OROKRlink").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    case "rootbeer":
        document.getElementById("OROKRlink").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    default : 
    	document.getElementById("OROKRlink").innerHTML="<p class=\"notavailable\">Colour currently not available for purchase in the MOTOSTORE.</p>";
        break;
    }
}