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

Display = function(url, index, width, height){
	
	this.iframeW = width; 	
	this.iframeH = height;
	
	this.element = document.createElement("DIV");
	this.glass = document.createElement("DIV");
	
	this.iframe = null;
	this.nogood = null;
	this.index = index;
	this.validate = false;
	
	//BUILD FUNCTION
	this.build = function(){	
		
		this.element.setAttribute("class","display"); 
		this.element.setAttribute("id","display");
		this.element.style.width = this.iframeW - 40 + "px"
		//IFRAME
		this.iframe = document.createElement('IFRAME');      
        this.iframe.setAttribute('id', 'iframe'+this.index);      
        this.iframe.style.border = "0px"	
		this.iframe.style.position = "relative"
		this.iframe.style.height = this.iframeH - 71 + "px"
		this.iframe.style.width = this.iframeW - 40 + "px"
		this.iframe.style.top = "0px";
		//this.iframe.style.border = "1px solid #aaaaaa"
		if(browser != "Explorer") {

			onload_frame = false;
			//this.iframe.contentWindow.document.addEventListener('load', function(e) {onload_frame = false;}, true);
			this.iframe.observe('load', function(e) {onload_frame = false;});
			/*alert($('#iframe0"'))
			$('#iframe0"')
				.load(function() {
					alert("miao");
				});*/

		}		
		
		this.element.appendChild(this.iframe)	
	
	}
	
    this.turnOn = function(){
		//onload_frame = true;
		var ifr = document.getElementById('iframe'+this.index);
		ifr.setAttribute("src", unescape(url));
		//setTimeout('onload_frame = false',7000);  
    }
	
}
	
	
