/*
**********************************************
Defining variables
**********************************************
*/
var slide_width='312px' //setting image width
var slide_height='120px' //setting image height
var container_width='316px' //setting container width
var container_height='160px' //setting container height
var slide_left='0px' //setting image left
var slide_top='0px' //setting image top
//setting title details
var title_top='123px' 
var title_height='12px'
var title_align='left'
var title_font_family='verdana,arial,helvetica'
var title_font_size='10px'
var title_font_weight='bold'
var title_bg_color='#ffffff'
var title_color='#000000'
var title_margin_left='2px'
//setting description details
var desc_top='135px' //setting title top
var desc_height='36px'
var desc_align='left'
var desc_font_family='verdana,arial,helvetica'
var desc_font_size='10px'
var desc_font_weight='normal'
var desc_bg_color='#ffffff'
var desc_color='#000000'
var desc_margin_left='2px'

var pause=5000 //setting pause between slide (3000=3 seconds)

/*
**********************************************
Setting up arrays
**********************************************
*/
var title=new Array()
title[0]="Australia Peru Chamber of Commerce"
title[1]="Embassy of Peru in Australia"
title[2]="Austrade Office in Peru"
title[3]="Consulate General of Peru in Australia"
title[4]="Australian Chamber of Commerce"
title[5]="C&aacutemara de Comercio de Lima"

var desc=new Array()
desc[0]="A warm welcome from the Australia Peru Chamber of Commerce"
desc[1]="An official welcome from the Embassy of Peru in Australia"
desc[2]="An official welcome from the Austrade Office in Peru"
desc[3]="An official welcome from the Consulate General of Peru in Australia"
desc[4]="A warm welcome from the Australian Chamber of Commerce"
desc[5]="A warm welcome from the C&aacutemara de Comercio de Lima"

var fadeimage=new Array()
fadeimage[0]="images/welcome/APCCI.jpg"
fadeimage[1]="images/welcome/EMBASSY PERU.jpg"
fadeimage[2]="images/welcome/AUSTRADE.jpg"
fadeimage[3]="images/welcome/CONSUL PERU.jpg"
fadeimage[4]="images/welcome/ACC.jpg"
fadeimage[5]="images/welcome/CCL.jpg"

var linkimage=new Array()
linkimage[0]="#"
linkimage[1]="#"
linkimage[2]="#"
linkimage[3]="#"
linkimage[4]="#"
linkimage[5]="#"

/*
**********************************************
Preloading images array
**********************************************
*/
var preloadedimages=new Array()
for (p=0;p<fadeimage.length;p++){
preloadedimages[p]=new Image()
preloadedimages[p].src=fadeimage[p]
}
var ie4=document.all
var dom=document.getElementById
if (ie4||dom)
document.write('<div id="firsttime" style="position:relative;width:'+container_width+';height:'+container_height+';overflow:hidden"><div id="canvas0" style="position:absolute;width:'+slide_width+';height:'+slide_height+';top:'+slide_top+';left:'+slide_left+';filter:alpha(opacity=10);-moz-opacity:10;border:thin inset #CCFFCC;"></div><div id="canvas1" style="position:absolute;width:'+slide_width+';height:'+slide_height+';top:'+slide_top+';left:'+slide_left+';filter:alpha(opacity=10);-moz-opacity:10;border:thin inset #CCFFCC;"></div><div id="title0" style="position:absolute;top:'+title_top+';left:'+slide_left+';width:'+slide_width+';height:'+title_height+';text-align:'+title_align+';font-family:'+title_font_family+'; font-size:'+title_font_size+'; font-weight:'+title_font_weight+'; layer-background-color:'+title_bg_color+'; background-color:'+title_bg_color+'; color:'+title_color+'; margin-left:'+title_margin_left+';"></div><div id="title1" style="position:absolute;top:'+title_top+';left:'+slide_left+';width:'+slide_width+';height:'+title_height+';text-align:'+title_align+';font-family:'+title_font_family+'; font-size:'+title_font_size+'; font-weight:'+title_font_weight+'; layer-background-color:'+title_bg_color+'; background-color:'+title_bg_color+'; color:'+title_color+'; margin-left:'+title_margin_left+';"></div><div id="desc0" style="position:absolute;top:'+desc_top+';left:'+slide_left+';width:'+slide_width+';height:'+desc_height+';text-align:'+desc_align+';font-family:'+desc_font_family+'; font-size:'+desc_font_size+'; font-weight:'+desc_font_weight+'; layer-background-color:'+desc_bg_color+'; background-color:'+desc_bg_color+'; color:'+desc_color+'; margin-left:'+desc_margin_left+';"></div><div id="desc1" style="position:absolute;top:'+desc_top+';left:'+slide_left+';width:'+slide_width+';height:'+desc_height+';text-align:'+desc_align+';font-family:'+desc_font_family+'; font-size:'+desc_font_size+'; font-weight:'+desc_font_weight+'; layer-background-color:'+desc_bg_color+'; background-color:'+desc_bg_color+'; color:'+desc_color+'; margin-left:'+desc_margin_left+';"></div></div>')
else
document.write('<img border=0 src="'+fadeimage[0]+'">')
var curpos=10
var degree=10
var curcanvas="canvas0"
var curtitle="title0"
var curdesc="desc0"
var lowerbound = 0
var upperbound = fadeimage.length - 1
var curimageindex = Math.round((upperbound - lowerbound)*Math.random()+lowerbound)
//var curimageindex=0
var nextimageindex=curimageindex
if (curimageindex<upperbound)
	nextimageindex++
else
	nextimageindex=0

function fadepic(){
if (curpos<100){
curpos+=1
if (tempobj.filters)
tempobj.filters.alpha.opacity=curpos
else if (tempobj.style.MozOpacity)
tempobj.style.MozOpacity=curpos/100
}
else{
clearInterval(dropslide)
nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
tempobj.innerHTML='<a target="Profile" href="'+linkimage[nextimageindex]+'"><img border=0 src="'+fadeimage[nextimageindex]+'"></a>'

nexttitle=(curtitle=="title0")? "title0" : "title1"
titleobj = ie4? eval("document.all."+nexttitle) : document.getElementById(nexttitle)
titleobj.innerHTML=title[nextimageindex]

nextdesc=(curdesc=="desc0")? "desc0" : "desc1"
descobj = ie4? eval("document.all."+nextdesc) : document.getElementById(nextdesc)
descobj.innerHTML=desc[nextimageindex]

nextimageindex=(nextimageindex<fadeimage.length-1)? nextimageindex+1 : 0
//nextimageindex = Math.round((upperbound - lowerbound)*Math.random()+lowerbound)
setTimeout("rotateimage()",pause)
}
}

function rotateimage(){
if (ie4||dom){
resetit(curcanvas)
var crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.style.zIndex++

var crosstitle=titleobj=ie4? eval("document.all."+curtitle) : document.getElementById(curtitle)
crosstitle.style.zIndex++

var crossdesc=descobj=ie4? eval("document.all."+curdesc) : document.getElementById(curdesc)
crossdesc.style.zIndex++

var temp='setInterval("fadepic()",50)'
dropslide=eval(temp)
curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
curtitle=(curtitle=="title0")? "title1" : "title0"
curdesc=(curdesc=="desc0")? "desc1" : "desc0"
}
else
document.images.defaultslide.src=fadeimage[curimageindex]
curimageindex=(curimageindex<fadeimage.length-1)? curimageindex+1 : 0
//curimageindex = Math.round((upperbound - lowerbound)*Math.random()+lowerbound)
}

function resetit(what){
curpos=10
var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
if (crossobj.filters)
crossobj.filters.alpha.opacity=curpos
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=curpos/100
}

function startit(){
var crossobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.innerHTML='<a target="Welcome" href="'+linkimage[curimageindex]+'"><img border=0 src="'+fadeimage[curimageindex]+'"></a>'
var titleobj=ie4? eval("document.all."+curtitle) : document.getElementById(curtitle)
titleobj.innerHTML=title[curimageindex]
var descobj=ie4? eval("document.all."+curdesc) : document.getElementById(curdesc)
descobj.innerHTML=desc[curimageindex]
rotateimage()
}

if (ie4||dom)
startit()
else
setInterval("rotateimage()",pause)

