var ovEl;
var dmo = {	

setFlash: function() {
	if(!document.getElementById('dmo-flashpop')) {
		objBody = document.getElementsByTagName("body").item(0);
		fp = document.createElement('div');
		fp.setAttribute('id','dmo-flashpop');
		fp.style.position = 'relative';
		//fp.style.top = dmo_flashPosTop+'px';
		//fp.style.left = dmo_flashPosLeft+'px';
		fp.style.width = dmo_flashWidth+'px';
		fp.style.marginLeft = 'auto';
		fp.style.marginRight = 'auto';
		fp.style.paddingRight = '105px';
		fp.style.paddingTop = '150px';
		fp.style.zIndex = '1001';
		fp.innerHTML = dmo_flashNotInstalled
		fp.onclick = dmo.hideOverlay;
		ovEl.appendChild(fp);
	}
	fpEl = document.getElementById('dmo-flashpop');
	fpEl.style.display = 'block';
	var fpMovie = new SWFObject(dmo_flashMovie, "fpop", dmo_flashWidth, dmo_flashHeight, dmo_flashMinVer);
	fpMovie.addVariable("targetURL", dmo_flashTargetURL);
	fpMovie.addParam("allowScriptAccess","sameDomain");
	fpMovie.write("dmo-flashpop");

},

setHTTP: function() {
	if(!document.getElementById('dmo-flashpop')) {
		objBody = document.getElementsByTagName("body").item(0);
		fp = document.createElement('div');
		fp.setAttribute('id','dmo-flashpop');
		fp.style.position = 'relative';
		//fp.style.top = dmo_flashPosTop+'px';
		//fp.style.left = dmo_flashPosLeft+'px';
		fp.style.width = dmo_flashWidth+'px';
		fp.style.marginLeft = 'auto';
		fp.style.marginRight = 'auto';
		fp.style.paddingRight = '105px';
		fp.style.paddingTop = '150px';
		fp.style.zIndex = '1001';
		//fp.innerHTML = dmo_flashNotInstalled
		//fp.onclick = dmo.hideOverlay;
		ovEl.appendChild(fp);
	}
	fpEl = document.getElementById('dmo-flashpop');
	fpEl.style.display = 'block';
	var fpIframe = '<iframe src="'+dmo_httpUrl+'" width="500" height="350" marginwidth="0" marginheight="0" scrolling="no" frameborder="0"></iframe>';
	fpEl.innerHTML = fpIframe;
},

setOverlay: function(httpUrl) {
	dmo_flashPosLeft = document.getElementById('content').offsetLeft + 190;
	if(!document.getElementById('dmo-overlay')) {
		objBody = document.getElementsByTagName("body").item(0);
		ov = document.createElement('div');
		ov.setAttribute('id','dmo-overlay');
		ov.style.position = 'absolute';
		ov.style.top = '0';
		ov.style.left = '0';
		ov.style.zIndex = '1000';
		ov.style.position = 'absolute';
		//ov.style.background = 'url(../_images/transparent.png)';
		//ov.style.backgroundColor = '#000000';
		//ov.style.MozOpacity = '.75';
		//ov.style.opacity = '.75';
		//ov.style.filter = 'alpha(opacity=75)';
		ov.style.display = 'none';
		objBody.appendChild(ov);
	}
	ovEl = document.getElementById('dmo-overlay');
	winDim = dmo.getPageSize();
	ovEl.style.width = winDim[0] + 'px';
	ovEl.style.height = winDim[1] + 'px';
	ovEl.style.display = 'block';
	//dmo.toggleQTaste();
	if(httpUrl) dmo_httpUrl=httpUrl;
	dmo.setHTTP();
	//dmo.setFlash();
},

hideOverlay: function() {
	if(document.getElementById('dmo-overlay')) document.getElementById('dmo-overlay').style.display = 'none';
	if(document.getElementById('dmo-flashpop')) document.getElementById('dmo-flashpop').style.display = 'none';
},

getPageSize: function() {
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;

	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
},

checkOverlay: function() {
	if(document.getElementById('dmo-overlay') && document.getElementById('dmo-overlay').style.display == 'block') {
		ovEl = document.getElementById('dmo-overlay');
		winDim = dmo.getPageSize();
		ovEl.style.width = winDim[0] + 'px';
		ovEl.style.height = winDim[1] + 'px';
	}
},

addEvent: function(obj, evt, fn) {
	if(obj.addEventListener) {
		obj.addEventListener(evt, fn, false);
	} else {
		obj.attachEvent('on'+evt, fn);
	}
}

}
dmo.addEvent(window, 'resize', dmo.checkOverlay);
//dmo.addEvent(window, 'load', dmo.setOverlay);

function fl() {
	this.display = function() {};
	this.close = function() {dmo.hideOverlay()};
}
var Flashlayer = new fl;


