var b_timer = null;
var b_on = true;
var blnkrs = null;
var mainColour="#FFFFFF";
var highLightColour="#FBF371";
var activeButtonColour="#99CCFF";
var activeButtonText="#FFFFFF";
var buttonColours=new Array()
buttonColours[0]=highLightColour
buttonColours[1]=highLightColour
buttonColours[2]=highLightColour
buttonColours[3]=highLightColour
buttonColours[4]=highLightColour
buttonColours[5]=highLightColour
buttonColours[6]=highLightColour
buttonColours[7]=highLightColour
var fadeimages=new Array()
fadeimages[0]=["http:\/\/www.crt.net.au\/Images\/SectionHeader\/Main_770x120_welcome.jpg", "Software/Software.html", ""] 
fadeimages[1]=["http:\/\/www.crt.net.au\/Images\/SectionHeader\/Main_770x120_software.jpg", "Hardware/Hardware.html", ""] 
fadeimages[2]=["http:\/\/www.crt.net.au\/Images\/SectionHeader\/Main_770x120_hardware.jpg", "Networking/Networking.html", ""] 
fadeimages[3]=["http:\/\/www.crt.net.au\/Images\/SectionHeader\/Main_770x120_internet.jpg", "Internet/Internet.html", ""]
fadeimages[4]=["http:\/\/www.crt.net.au\/Images\/SectionHeader\/Main_770x120_networking.jpg", "Support/Support.html", ""]
fadeimages[5]=["http:\/\/www.crt.net.au\/Images\/SectionHeader\/Main_770x120_support.jpg", "About/About.html", ""]
fadeimages[6]=["http:\/\/www.crt.net.au\/Images\/SectionHeader\/Main_770x120_about.jpg", "About/ETopics/ETopics.html", ""]
fadeimages[7]=["http:\/\/www.crt.net.au\/Images\/SectionHeader\/Main_770x120_etopics.jpg", "About/ETopics/ETopics.html", ""]

var fadeimages2=new Array() 
fadeimages2[0]=["http:\/\/www.crt.net.au\/Images\/Promotions\/Broadband_promo.jpg", "http://www.crt.net.au/Internet/Broadband/Broadband.html", ""]
fadeimages2[1]=["http:\/\/www.crt.net.au\/Images\/Promotions\/Promo1.jpg", "http://www.netcomm.com.au/SpecSheets/NP285_Turbo_HomePlug_Twin_Pack.pdf ", "_new"]
fadeimages2[2]=["http:\/\/www.crt.net.au\/Images\/Promotions\/Promo2.jpg", "http://panasonic.com.au/content/library/flash/120206_workio/index.html", "_new"]
fadeimages2[3]=["http:\/\/www.crt.net.au\/Images\/Promotions\/Promo3.jpg", "http://www.panasonic.com.au/whats_new/offers/offer.cfm?detailsID=106", "_new"]
fadeimages2[4]=["http:\/\/www.crt.net.au\/Images\/Promotions\/Promo4.jpg", "http://www.eid.toshiba.com.au/rerite/rerite.htm", "_new"]
var fadebgcolor="..\/Images\/SectionHeader\/Loading.gif"
var fadearray=new Array()
var fadeclear=new Array()
var dom=(document.getElementById)
var iebrowser=document.all
 
function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, menuswitch, displayorder)
{
this.pausecheck=pause;this.mouseovercheck=0;this.delay=delay;this.degree=10;this.curimageindex=0;this.nextimageindex=1;fadearray[fadearray.length]=this;this.slideshowid=fadearray.length-1;
this.canvasbase="canvas"+this.slideshowid;this.curcanvas=this.canvasbase+"_0";
if (typeof displayorder!="undefined") theimages.sort(function() {return 0.5 - Math.random();});
this.theimages=theimages;this.menuswitch=menuswitch;this.imageborder=parseInt(borderwidth);this.postimages=new Array();
for (p=0;p<theimages.length;p++){this.postimages[p]=new Image();this.postimages[p].src=theimages[p][0];}
 
var fadewidth=fadewidth+this.imageborder*2;
var fadeheight=fadeheight+this.imageborder*2;
 
if (iebrowser&&dom||dom)
document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);-moz-opacity:10;-khtml-opacity:10;background-image:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);-moz-opacity:10;background-image:'+fadebgcolor+'"></div></div>')
else
document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>')
 
if (iebrowser&&dom||dom)
this.startit()
else{this.curimageindex++;setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay);}
}

function fadepic(obj){
if (obj.degree<100){obj.degree+=10;
if (obj.tempobj.filters&&obj.tempobj.filters[0]){
if (typeof obj.tempobj.filters[0].opacity=="number")
obj.tempobj.filters[0].opacity=obj.degree
else
obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
}
else if (obj.tempobj.style.MozOpacity) 
obj.tempobj.style.MozOpacity=obj.degree/101;
else if (obj.tempobj.style.KhtmlOpacity)
obj.tempobj.style.KhtmlOpacity=obj.degree/100;
}
else{
clearInterval(fadeclear[obj.slideshowid])
obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
obj.populateslide(obj.tempobj, obj.nextimageindex)
obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
}
}
 
fadeshow.prototype.populateslide=function(picobj, picindex){
var slideHTML=""
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'
slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML+='</a>'
picobj.innerHTML=slideHTML
}
 
 
fadeshow.prototype.rotateimage=function(){
if (this.pausecheck==1) //if pause onMouseover enabled, cache object
var cacheobj=this
if (this.mouseovercheck==1)
setTimeout(function(){cacheobj.rotateimage()}, 100)
else if (iebrowser&&dom||dom){
this.resetit()
var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
crossobj.style.zIndex++
fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50)
this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
}
else{
var ns4imgobj=document.images['defaultslide'+this.slideshowid]
ns4imgobj.src=this.postimages[this.curimageindex].src
}

/*
if (this.menuswitch==1)
{
    // change the button background
    var buttonindex = this.curimageindex;
    var oldbuttonindex = (buttonindex==0)? 7 : buttonindex-1
    document.getElementById("top_" + oldbuttonindex).style.color=mainColour;
    document.getElementById("top_" + buttonindex).style.color=buttonColours[buttonindex];
}
*/
this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0


}
 
fadeshow.prototype.resetit=function(){
this.degree=10
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
if (crossobj.filters&&crossobj.filters[0]){
if (typeof crossobj.filters[0].opacity=="number") //if IE6+
crossobj.filters(0).opacity=this.degree
else //else if IE5.5-
crossobj.style.filter="alpha(opacity="+this.degree+")"
}
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=this.degree/101
else if (crossobj.style.KhtmlOpacity)
crossobj.style.KhtmlOpacity=obj.degree/100
}
 
 
fadeshow.prototype.startit=function(){
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
this.populateslide(crossobj, this.curimageindex)
if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
var cacheobj=this
var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid)
crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}
crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}
}
this.rotateimage()
}

function MouseOverColour(num)
{
    if (document.getElementById("navbutton_" + num).style.backgroundColor != "#99ccff")
    { 
        document.getElementById("navbutton_" + num).style.backgroundColor=buttonColours[num]
    }
}

function MouseOutColour(num)
{
    if (document.getElementById("navbutton_" + num).style.backgroundColor != "#99ccff")
    { 
        document.getElementById("navbutton_" + num).style.backgroundColor=mainColour
    }
} 

function ButtonInit(num)
   {
        document.getElementById("navbutton_" + num).style.backgroundColor="#99ccff"
        document.getElementById("navlink_" + num).style.color="#FFFFFF"
   }
   
   function ShowMap()   {        window.open("..\/..\/Images\/Location_map.gif","_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=540, height=335, titlebar=no");      }
   
var intHideSoftware, intHideHardware, intHideInternet, intHideNetworking, intHideSupport, intHideAbout;
var intShowSoftware, inShowHardware, intShowInternet, intShowNetworking, intShowSupport, intShowAbout
var i=0;var j=0;var k=0;var l=0;var m=0;var n=0;var hideSpeed=1;var showSpeed=5;
function showSoftware(){if (i>-70)	{	i=i-showSpeed;	document.all("software").style.bottom=i;	}}
function showHardware(){if (j>-154){	j=j-showSpeed;	document.all("hardware").style.bottom=j;	}}
function showInternet(){if (k>-102)	{	k=k-showSpeed;	document.all("internet").style.bottom=k;	}}
function showNetworking(){if (l>-70)	{	l=l-showSpeed;	document.all("networking").style.bottom=l;	}}
function showSupport(){if (m>-85)	{	m=m-showSpeed;	document.all("support").style.bottom=m;	}}
function showAbout(){if (n>-135)	{	n=n-showSpeed;	document.all("about").style.bottom=n;	}}
function showmenuSoftware(){clearInterval(intHideSoftware);intShowSoftware=setInterval("showSoftware()",10);}
function showmenuHardware(){clearInterval(intHideHardware);intShowHardware=setInterval("showHardware()",10);}
function showmenuInternet(){clearInterval(intHideInternet);intShowInternet=setInterval("showInternet()",10);}
function showmenuNetworking(){clearInterval(intHideNetworking);intShowNetworking=setInterval("showNetworking()",10);}
function showmenuSupport(){clearInterval(intHideSupport);intShowSupport=setInterval("showSupport()",10);}
function showmenuAbout(){clearInterval(intHideAbout);intShowAbout=setInterval("showAbout()",10);}
function hideSoftware(){if (i<0)	{	i=i+hideSpeed;	document.all("software").style.bottom=i;	}}
function hideHardware(){if (j<0)	{	j=j+hideSpeed;	document.all("hardware").style.bottom=j;	}}
function hideInternet(){if (k<0)	{	k=k+hideSpeed;	document.all("internet").style.bottom=k;	}}
function hideNetworking(){if (l<0)	{	l=l+hideSpeed;	document.all("networking").style.bottom=l;	}}
function hideSupport(){if (m<0)	{	m=m+hideSpeed;	document.all("support").style.bottom=m;	}}
function hideAbout(){if (n<0)	{	n=n+hideSpeed;	document.all("about").style.bottom=n;	}}
function hidemenuSoftware(){clearInterval(intShowSoftware);intHideSoftware=setInterval("hideSoftware()",10);}
function hidemenuHardware(){clearInterval(intShowHardware);intHideHardware=setInterval("hideHardware()",10);}
function hidemenuInternet(){clearInterval(intShowInternet);intHideInternet=setInterval("hideInternet()",10);}
function hidemenuNetworking(){clearInterval(intShowNetworking);intHideNetworking=setInterval("hideNetworking()",10);}
function hidemenuSupport(){clearInterval(intShowSupport);intHideSupport=setInterval("hideSupport()",10);}
function hidemenuAbout(){clearInterval(intShowAbout);intHideAbout=setInterval("hideAbout()",10);}



function blink() { var tmp = document.getElementsByTagName("span"); if (tmp) { blnkrs = new Array(); var b_count = 0; for (var i = 0; i < tmp.length; ++i) { if (tmp[i].className == "blink") { blnkrs[b_count] = tmp[i]; ++b_count; } } blinkTimer(1500); } } 
function blinkTimer(ival) { if (b_timer) { window.clearTimeout(b_timer); b_timer = null; } blinkIt(); b_timer = window.setTimeout('blinkTimer(' + ival + ')', ival); } 
function blinkIt() { for (var i = 0; i < blnkrs.length; ++i) { if (b_on == true) { blnkrs[i].style.visibility = "hidden"; } else { blnkrs[i].style.visibility = "visible"; } } b_on =!b_on; } 



/* Cookies!! */

function getCookie(NameOfCookie)
{ if (document.cookie.length > 0) 
{ begin = document.cookie.indexOf(NameOfCookie+"="); 
if (begin != -1) 
{ begin += NameOfCookie.length+1; 
end = document.cookie.indexOf(";", begin);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(begin, end)); } 
}
return null; 
}



function setCookie(NameOfCookie, value, expiredays) 
{ var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
document.cookie = NameOfCookie + "=" + escape(value) + 
((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}



function delCookie (NameOfCookie) 
{ if (getCookie(NameOfCookie)) {
document.cookie = NameOfCookie + "=" +
"; expires=Thu, 01-Jan-70 00:00:01 GMT";
}

}