var FloatingPane = {

	xOffset: null,
	yOffset: null,
	panePosition: "absolute",
	paneWidth: null,
	paneHeight: null,
	paneWindowID: null,
	panezIndex: 1,
	loadingImageLocation:null,
	buildpanes:true,
	titleBarText:true,

	OpenPane: function(properties){

		this.xOffset = properties.xOffset;
		this.yOffset = properties.yOffset;
		this.paneWidth = properties.paneWidth;
		this.paneHeight = properties.paneHeight;
		this.paneWindowID = properties.paneWindowID;
		this.titleBarText = properties.titleBarText;
		this.loadingImageLocation = properties.loadingImageLocation;

		this.BuildContainerWindow();

		if(this.buildpanes){
		   this.BuildFloatingPane();
		   this.buildpanes = false;
		}

		//this.BuildShadows();

		new Draggable("popUpWidget", {starteffect:function(){return;},endeffect:function(){return;}});


		//var cleanUp = new Array(shadowL, shadowR, shadowB, shadowBL, shadowBR);
		var closeAction = $("closeAction");

		Event.observe(closeAction, "click",
				   function(e){
					 FloatingPane.ClosePane("popUpWidget");
				   }, false);




	},

	BuildContainerWindow: function(){

		Ajaxnode = document.createElement("DIV");
		Ajaxnode.setAttribute("id", this.paneWindowID);
		Ajaxnode.style.position = this.panePosition;
		Ajaxnode.style.width = this.paneWidth + "px";
		Ajaxnode.style.height = this.paneHeight + "px";
		Ajaxnode.style.left = this.xOffset + "px";
		Ajaxnode.style.top = this.yOffset + "px";
		Ajaxnode.style.zIndex = this.panezIndex;
		document.body.appendChild(Ajaxnode);



	},

	BuildFloatingPane: function() {




	    if(!($("ajaxLoaingImage"))) {
			var loadingImage = document.createElement("IMG");
			loadingImage.setAttribute("src", "/images/Ajax/loading.gif");
			loadingImage.setAttribute("id", "ajaxLoaingImage");
			loadingImage.style.padding = "0 0 0 5px";
			$(this.loadingImageLocation).appendChild(loadingImage);
	    }

	    $("titleBarText").innerHTML = this.titleBarText.innerHTML;
	    $("containerNode").style.height = (this.paneHeight - 38) + "px";
        $("containerNode").appendChild($("ajaxContent"));




	},

	BuildShadows: function(){

        shadowL = document.createElement('IMG');
        shadowL.setAttribute("id", "shadowL");
		shadowL.setAttribute("src", "/images/Ajax/floatingPane/shadowL.png");
		shadowL.style.position = "absolute";
		shadowL.style.width = "8px";
		shadowL.style.height = (this.paneHeight - 8) + "px";
		shadowL.style.left = "-8px";
		shadowL.style.top = "6px";
		$('popUpWidget').appendChild(shadowL);

        shadowR = document.createElement('IMG');
        shadowR.setAttribute("id", "shadowR");
		shadowR.setAttribute("src", "/images/Ajax/floatingPane/shadowR.png");
		shadowR.style.position = "absolute";
		shadowR.style.width = "8px";
		shadowR.style.height = (this.paneHeight - 8) +"px";
		shadowR.style.left = (this.paneWidth) + "px";
		shadowR.style.top = "6px";
		$('popUpWidget').appendChild(shadowR);


        shadowB = document.createElement('IMG');
        shadowB.setAttribute("id", "shadowB");
		shadowB.setAttribute("src", "/images/Ajax/floatingPane/shadowB.png");
		shadowB.style.position = "absolute";
		shadowB.style.width = (this.paneWidth) + "px";
		shadowB.style.height = "8px";
		shadowB.style.left = "0px";
		shadowB.style.top = (this.paneHeight - 2) + "px";
		$('popUpWidget').appendChild(shadowB);


        shadowBL = document.createElement('IMG');
        shadowBL.setAttribute("id", "shadowBL");
		shadowBL.setAttribute("src", "/images/Ajax/floatingPane/shadowBL.png");
		shadowBL.style.position = "absolute";
		shadowBL.style.width = "8px";
		shadowBL.style.height = "8px";
		shadowBL.style.left = "-8px";
		shadowBL.style.top = (this.paneHeight - 2) + "px";
		$('popUpWidget').appendChild(shadowBL);


        shadowBR = document.createElement('IMG');
        shadowBR.setAttribute("id", "shadowBR");
		shadowBR.setAttribute("src", "/images/Ajax/floatingPane/shadowBR.png");
		shadowBR.style.position = "absolute";
		shadowBR.style.width = "8px";
		shadowBR.style.height = "8px";
		shadowBR.style.left = (this.paneWidth) + "px";
		shadowBR.style.top = (this.paneHeight - 2) + "px";
		$('popUpWidget').appendChild(shadowBR);
	},


	ClosePane: function(MainContent){
	     $("sellersRatingPopUpContainer").appendChild($(MainContent));
             try {  /// TODO: added as its throwing some strange DOM error after three removes, investigate cause
               document.body.removeChild(Ajaxnode);
	     } catch(err) {}
	}
}

/*




*/