/* Control.js
 * 
 * Copyright @ 2008 - Fabrizio Morroia
 * 
 *          sbroWs.com 
 */

Control = function(navigator, screenH){
		
	this.element = document.createElement("DIV");
	this.leftButton = document.createElement("A");
	this.rightButton = document.createElement("A");
	
	this.build = function(){
		
		this.element.setAttribute("id","control");
		this.leftButton.setAttribute("id","leftControlButton");
		this.rightButton.setAttribute("id","rightControlButton");
	
		//var top = - (screenH/2) - 240 + "px";
		//var top = - (screenH/2) - (2 *  footerheight) - 50 + "px";
		var top = 50 + (stripe.height/2) - 40;
		this.element.style.top = top +"px";
		
		this.clientW = document.documentElement.clientWidth;
		
		//this.width = 5.73 * ( this.clientW / 8 ) + 150;
		this.width = this.clientW - 11;
		this.element.style.width = this.width + "px";		
		this.element.style.left = ((this.clientW - this.width)/2)+"px";
		
		if(browser == "Explorer"){
			this.leftButton.style.setAttribute('cssText',"float:left");
			this.rightButton.style.setAttribute('cssText',"float:right");
		}else{
        	this.leftButton.setAttribute("style","float:left");
			this.rightButton.setAttribute("style","float:right");			
		}
		
  		//LeftButton
  		this.leftButton.onclick = function(){ navigator.next(1);}
		this.leftButton.onmouseover = function(){ document.images["back"].src = "images/back_on_sh.png"; return true };
  		this.leftButton.onmouseout = function(){ document.images["back"].src = "images/back_off_sh.png"; return true };
  		this.leftButton.innerHTML = "<img name=\"back\" title=\"back\" src=\"images/back_off_sh.png\">";
  		
		this.element.appendChild(this.leftButton);
				
		//RightButton
		this.rightButton.onclick = function(){ navigator.prev(1);}
		
		this.rightButton.onmouseover = function(){ document.images["next"].src = "images/next_on_sh.png"; return true };
  		this.rightButton.onmouseout = function(){ document.images["next"].src = "images/next_off_sh.png"; return true };
		this.rightButton.innerHTML = "<img name=\"next\" title=\"next\" src=\"images/next_off_sh.png\">"; 
		
		this.element.appendChild(this.rightButton);
		
	}

}