var IDTVPOP48f266dd3b = { width : 600, height: 500,
	frameSrc: 'http://www.idesktop.tv/embed/48f266dd3b/index.html',
	plpl: 'center', plw: 600, plh: 500,
	init: function () {
		if (this.frame) return;
		this.element = document.getElementById('IDTVP_48f266dd3b');
		if (!this.element && document.getElementsByClassName)
			try {
				this.element = document.getElementsByClassName ('idtv_48f266dd3b')[0];
			} catch(e) {}
		if (!this.element) { alert ('The iDesktop.tv player is not embedded properly!'); return false; }
		this.element.innerHTML = '';
		this.element.style.position = 'relative';
		this.element.style.display = 'inline';
		this.btn = document.createElement ('a');
		this.btn.href = '#48f266dd3b';
		this.btn.name = '48f266dd3b';
				this.btn_in = document.createElement('img');
		this.btn_in.src = 'http://www.idesktop.tv/embed/images/117083/sex health guru2.jpg';
		this.btn_in.style.border = 'none';
		this.btn.appendChild (this.btn_in);
						this.btn.title = 'Click to open the player';
		//this.btn.style.cursor='pointer';
		this.btn.style.border = 'none';
		this.btn.onclick = function () {IDTVPOP48f266dd3b.openPlayer.apply(IDTVPOP48f266dd3b); return false;};
		this.element.appendChild(this.btn);
		this.div = document.createElement('div');
		this.div.style.width = this.width + "px";
		this.div.style.height = this.height + "px";
		this.div.style.display = 'none';
		this.div.style.position = 'absolute';
		this.div.style.top = this.div.style.left = '10px';
		this.div.style.borderWidth = '1px';
		this.div.style.borderColor = '#000000';
		this.div.style.borderStyle = 'solid';
		this.frame = document.createElement('iframe');
		this.frame.src = 'http://www.idesktop.tv/embed/48f266dd3b/index.html';
		this.frame.style.padding = "0px";
		this.frame.style.borderWidth = "0px";
		this.frame.style.width = this.frame.style.height = "100%";
		this.frame.frameBorder = "0";
		this.div.style.overflow = this.frame.style.overflow = "hidden";
		//this.div.appendChild(this.frame);
		this.btnClose = document.createElement('img');
		this.btnClose.style.position = 'absolute';
				this.btnClose.style.top = '11px';
		this.btnClose.style.right = '8px';
				this.btnClose.style.cursor = 'pointer';
		this.btnClose.src = 'http://www.idesktop.tv/images/player_icons/close.gif';
		this.btnClose.onclick = function () {IDTVPOP48f266dd3b.closePlayer.apply(IDTVPOP48f266dd3b)};
		this.div.appendChild(this.btnClose);
		try {
			document.body.appendChild(this.div);
			this.ba = true;
		} catch (e) {
			this.element.appendChild(this.div);
			this.ba = false;
		}
		var f = document.createElement('iframe');
		f.src = "http://www.idesktop.tv/embed/48f266dd3b/utr.html?r=" + document.location;
		f.style.cssText = 'width:0;height:0;border:none;overflow:hidden;position:absolute;top:-100px;left:-100px';
		f.frameborder = f.frameBorder = f.border = "0";
		this.element.appendChild(f);
	},
	openPlayer: function () {
		if (this.plpl == "newwin") {
			var loaded = false;
			if (this.frw) {
				try {
					this.frw.Player.playlist.selectItem(i);
					this.frw.Player.playlist.playSelected();
					loaded = true;
				} catch(e) {
					loaded = false;
				}
			}
			if (!loaded)
				this.frw = window.open ('http://www.idesktop.tv/embed/48f266dd3b/index.html?dat=' + new Date(), 'idtvwin', 'width=' + this.plw + ',height=' + this.plh + 'toolbar=no,status=no,scrollbars=no,resizeable=yes');
			return;
		}
		if (this.frame.parentNode != this.div) {
			if (/MSIE/.test(navigator.userAgent))
				this.frame.src = 'http://www.idesktop.tv/embed/48f266dd3b/index.html?dat=' + new Date();
		}
		this.startW = this.btn.offsetWidth;
		this.startH = this.btn.offsetHeight;
		this.div.style.width = this.btn.offsetWidth + "px";
		this.div.style.height = this.btn.offsetHeight + "px";

		var element = (this.ba?this.element:this.div);
		this.startX = this.startY = 0;
		var elFixedX = elFixedY = 0;
	    do {
		      elFixedY += element.offsetTop  || 0; elFixedX += element.offsetLeft || 0; element = element.offsetParent || element.parentNode;
	    } while (element);
	    this.startX = elFixedX; this.startY = elFixedY;
	    var scrlX = (window.pageXOffset || document.body.scrollLeft || document.documentElement.scrollLeft);
	    var scrlY = (window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop);
	    var viewportW = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth ;
		var viewportH = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
	    var nx = 0, ny =0;
		switch (this.plpl) {
			case "center":
				nx = scrlX + ((viewportW - this.plw) / 2) - elFixedX;
				ny = scrlY + ((viewportH - this.plh) / 2) - elFixedY;
				break;
			case "left":
				nx = -this.plw;
				ny = -this.pldelta;
				break;
			case "right":
				nx = this.btn.offsetWidth;
				ny = -this.pldelta;
				break;
			case "top":
				nx = -this.pldelta;
				ny = -this.plh;
				break;
			case "bottom":
				nx = -this.pldelta;
				ny = this.btn.offsetHeight;
				break;
			default: return;
		}
		if (this.ba) {
			nx += elFixedX; ny += elFixedY;
			if (nx < 0) nx = 0;
			if (ny < 0) ny = 0;
		} else {
			if (this.ds.plpl != "center") { // some checks if top/left it is out of the viewport
				var rx = nx + elFixedX, ry = ny + elFixedY;
				if (rx < 0) nx -= rx;
				if (ry < 0) ny -= ry;
			}
		}
		this.targetX = nx; this.targetY = ny;

	    /*var elemNewFixedX = scrlX + (viewportW - this.targetW) / 2;
	    var elemNewFixedY = scrlY + (viewportH - this.targetH) / 2;
		this.targetX = elemNewFixedX - elFixedX;
		this.targetY = elemNewFixedY - elFixedY;*/
		this.div.style.display = 'block';
		this.step = 1; this.steps = 10;
		this.onTransTimer();
	},
	onTransTimer: function () {
		this.div.style.width = this.startW + (this.plw - this.startW) * this.step / this.steps + "px";
		this.div.style.height = this.startH + (this.plh - this.startH) * this.step / this.steps + "px";
		this.div.style.left = this.startX + (this.targetX - this.startX) * this.step / this.steps + "px";
		this.div.style.top = this.startY + (this.targetY - this.startY) * this.step / this.steps + "px";
		this.step ++;
		if (this.step <= this.steps) setTimeout(function () {IDTVPOP48f266dd3b.onTransTimer.apply(IDTVPOP48f266dd3b); }, 80);
		else this.onTransOver();
	},
	onTransOver: function () {
		this.div.appendChild(this.frame);
	},
	closePlayer: function () {
		this.div.style.display = 'none';
		this.div.removeChild(this.frame);
	}
}

function IDTVPOP48f266dd3bINIT () {IDTVPOP48f266dd3b.init.apply(IDTVPOP48f266dd3b);}
if (document.getElementById('IDTVP_48f266dd3b'))
	IDTVPOP48f266dd3bINIT();
else if (window.attachEvent)
	window.attachEvent('onload', IDTVPOP48f266dd3bINIT);
else if (window.addEventListener)
	window.addEventListener('load', IDTVPOP48f266dd3bINIT, true);