function flashslideshow(setting){
	this.wrapperid=setting.wrapperid
	this.imagearray=setting.imagearray
	this.pause=setting.pause
	this.transduration=setting.transduration/1000 //convert from miliseconds to seconds unit to pass into el.filters.play()
	this.currentimg=0
	var preloadimages=[] //temp array to preload images
	for (var i=0; i<this.imagearray.length; i++){
		preloadimages[i]=new Image()
		preloadimages[i].src=this.imagearray[i][0]
	}
	document.write('<div id="'+this.wrapperid+'" class="'+setting.wrapperclass+'"><div id="'+this.wrapperid+'_inner" style="width:100%">'+this.getSlideHTML(this.currentimg)+'</div></div>')
	var contentdiv=document.getElementById(this.wrapperid+"_inner")
	var slideshow=this
	flashslideshow.addEvent(contentdiv, function(){slideshow.isMouseover=1}, "mouseover")
	flashslideshow.addEvent(contentdiv, function(){slideshow.isMouseover=0}, "mouseout")
	setInterval(function(){slideshow.rotate()}, this.pause)
}

flashslideshow.addEvent=function(target, functionref, tasktype){
	if (target.addEventListener)
		target.addEventListener(tasktype, functionref, false);
	else if (target.attachEvent)
		target.attachEvent('on'+tasktype, function(){return functionref.call(target, window.event)});
},

flashslideshow.setopacity=function(el, degree){ //sets opacity of an element (FF and non IE browsers only)
	if (typeof el.style.opacity!="undefined")
		el.style.opacity=degree
	else
		el.style.MozOpacity=degree
	el.currentopacity=degree
},

flashslideshow.prototype.getSlideHTML=function(index){
	var slideHTML=(this.imagearray[index][1])? '<a href="'+this.imagearray[index][1]+'" target="'+this.imagearray[index][2]+'">\n' : '' //hyperlink slide?
	slideHTML+='<img src="'+this.imagearray[index][0]+'" />'
	slideHTML+=(this.imagearray[index][1])? '</a><br />' : '<br />'
	slideHTML+=(this.imagearray[index][3])? this.imagearray[index][3] : '' //text description?
	return slideHTML //return HTML for the slide at the specified index
}

flashslideshow.prototype.rotate=function(){
	var contentdiv=document.getElementById(this.wrapperid+"_inner")
	if (this.isMouseover){ //if mouse is over slideshow
		return
	}
	this.currentimg=(this.currentimg<this.imagearray.length-1)? this.currentimg+1 : 0
	flashslideshow.setopacity(contentdiv, 0.6)
	contentdiv.innerHTML=this.getSlideHTML(this.currentimg)
	contentdiv.fadetimer=setInterval(function(){
		if (contentdiv.currentopacity<1)
			flashslideshow.setopacity(contentdiv, contentdiv.currentopacity+0.1)
		else
			clearInterval(contentdiv.fadetimer)
	}, 120) //end setInterval
}

function openclose(id,state) {
    var arrow = document.getElementById(id);
	var imgstate = "opened";
	if (state==1) {
		imgstate = "opened";
	} else imgstate = "closed";
	arrow.src = arrow.src.substring(0,arrow.src.lastIndexOf('_'))+"_"+imgstate+".jpg";
}

function hideme(myelement) {
	var state = 0;
	var mailbox = document.getElementById(myelement);
	if (mailbox.offsetHeight > 0) {
		state = 0;
	} else state = 1;
	
	var myHeight = new fx.Height(myelement , {duration: 150});
	myHeight.toggle();
	
	var imgsrc = myelement + "img";
	openclose(imgsrc,state);
}

function showPress() {
	document.getElementById("press").style.display = "block";
	document.getElementById("press-link").style.display = "none";
	document.getElementById("press-link-current").style.display = "inline";
	document.getElementById("company").style.display = "none";
	document.getElementById("company-link").style.display = "inline";
	document.getElementById("company-link-current").style.display = "none";
}
function showNews() {
	document.getElementById("press").style.display = "none";
	document.getElementById("press-link").style.display = "inline";
	document.getElementById("press-link-current").style.display = "none";
	document.getElementById("company").style.display = "block";
	document.getElementById("company-link").style.display = "none";	
	document.getElementById("company-link-current").style.display = "inline";
}

function showAdvisors() {
	document.getElementById("advisors").style.display = "block";
	document.getElementById("advisors-link").style.display = "none";
	document.getElementById("advisors-link-current").style.display = "inline";
	document.getElementById("founders").style.display = "none";
	document.getElementById("founders-link").style.display = "inline";
	document.getElementById("founders-link-current").style.display = "none";
}
function showFounders() {
	document.getElementById("advisors").style.display = "none";
	document.getElementById("advisors-link").style.display = "inline";
	document.getElementById("advisors-link-current").style.display = "none";
	document.getElementById("founders").style.display = "block";
	document.getElementById("founders-link").style.display = "none";	
	document.getElementById("founders-link-current").style.display = "inline";
}

function showVEVideo() {
	document.getElementById("see-voicelock-ent-demo").style.display = "none";
	document.getElementById("hide-voicelock-ent-demo").style.display = "inline";
	document.getElementById("video-faq").style.display = "block";
}
function hideVEVideo() {
	document.getElementById("see-voicelock-ent-demo").style.display = "inline";
	document.getElementById("hide-voicelock-ent-demo").style.display = "none";
	document.getElementById("video-faq").style.display = "none";
}