function alertPosition() {
	var scrollInterval;
	var topX;
	var topY;
	var winX;
	var winY;
	var MS;
	var openWindow;
	var selectWindow;
	var winName;
	var resizeLeft;

	this.resizeLeft = 100;
	this.openWindow = false;
	document.all?this.MS=true:this.MS=false;
}

alertPosition.prototype.getBrowserCoordinate = function() {
	this.topX = document.documentElement.scrollLeft;
	this.topY = document.documentElement.scrollTop;
	
	if(this.MS) {
		this.winX = document.documentElement.clientWidth;
		this.winY = document.documentElement.clientHeight;	
	} else {
   		this.winX = window.innerWidth - 16;
   		this.winY = window.innerHeight ;		
	}

}

alertPosition.prototype.scrollResize = function() {
	if(this.openWindow) {
		this.setNewTransparentCoordinate();
	}
}

alertPosition.prototype.getFlashCoordinate = function(elm) {

	var x, y = 0;

	x = elm.offsetLeft;
	y = elm.offsetTop;

	elm = elm.offsetParent;
	while(elm != null) {
        x = parseInt(x) + parseInt(elm.offsetLeft);
        y = parseInt(y) + parseInt(elm.offsetTop);
        elm = elm.offsetParent;
     }
    return {Top:y, Left: x};
}

alertPosition.prototype.setNewTransparentCoordinate = function() {
	this.getBrowserCoordinate();
	document.getElementById("upload").style.top = this.topY + "px";
	document.getElementById("upload").style.width = this.winX  + "px"; 
	document.getElementById("upload").style.height = this.winY  + "px";
}

alertPosition.prototype.windowResize = function() {
	if(this.openWindow) {
		this.setNewTransparentCoordinate();
		this.setNewWindowCoordinates();
	}
}

alertPosition.prototype.setNewWindowCoordinates = function() {
	if(this.selectWindow == 1) {
		this.setAlerWindowCoordinate();
	} else {
		this.setShareCoordinate();
	}
}

alertPosition.prototype.setAlerWindowCoordinate = function() {
	document.getElementById("flashPlayer").style.visibility = "hidden";
	var flashPlayerXY = this.getFlashCoordinate(document.getElementById("flashPlayer"));
	document.getElementById("loginRequired").style.top = (flashPlayerXY.Top + 250) + "px";
	document.getElementById("loginRequired").style.left = ((this.winX/2) - 190) + "px";
	//document.getElementById("loginRequired").style.left = flashPlayerXY.Left + "px";
}

alertPosition.prototype.setShareCoordinate = function() {
	document.getElementById("flashPlayer").style.visibility = "hidden";
	var flashPlayerXY = this.getFlashCoordinate(document.getElementById("flashPlayer"));
	document.getElementById("share").style.top = (flashPlayerXY.Top + 150) + "px";
	document.getElementById("share").style.left = ((this.winX/2) - 190) + "px";
	//document.getElementById("share").style.left = flashPlayerXY.Left + "px";
}

alertPosition.prototype.setOtherWindowPosition = function() {
	if(this.openWindow) {
		this.setNewTransparentCoordinate();
		document.getElementById(this.winName).style.top = (this.winY/2-50) + "px";
		document.getElementById(this.winName).style.left = (this.winX/2 - this.resizeLeft) + "px";
	}
}
