//
// getPageScroll()
// Returns array with x,y page scroll values.
// Core code from - quirksmode.com
//
function getPageScroll(){

	var xScroll, yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
		xScroll = self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
		xScroll = document.documentElement.scrollLeft;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
		xScroll = document.body.scrollLeft;	
	}

	arrayPageScroll = new Array(xScroll,yScroll) 
	return arrayPageScroll;
}

// -----------------------------------------------------------------------------------
//setInterval
//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.com
// Edit for Firefox by pHaez
//
function getPageSize(){
	
	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;
	
//	console.log(self.innerWidth);
//	console.log(document.documentElement.clientWidth);

	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;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

//	console.log("xScroll " + xScroll)
//	console.log("windowWidth " + windowWidth)

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}
//	console.log("pageWidth " + pageWidth)

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

// -----------------------------------------------------------------------------------

function closeResSpe() {
  new Effect.Fade('overlay1', { duration: 0.5}); $('ResSpe').remove();
}
function ShowPopUs(text, type) { 
	if (type == 'warning') {
	  bgcolor = '#A22B02';	 
	}
	else if (type == 'error') {
	  bgcolor = '#EF4308';	 
	}
	else {
	  bgcolor = '#014006';	 
	}
	var objBody = document.getElementsByTagName("body").item(0);
	var objOverlay = document.createElement("div");
	objOverlay.setAttribute('id','overlay1');
	objOverlay.onclick = closeResSpe
    objBody.appendChild(objOverlay);
	$('overlay1').setStyle({position: 'absolute',top:0,left:0,zIndex:90,width:'100%',height:'100%',backgroundColor:'#000',display:'none'});
	var aPageSize = getPageSize();
	$('overlay1').setStyle({width:aPageSize[0]+'px', height:aPageSize[1]+'px'});


    new Effect.Appear('overlay1', { duration: 1.0, from: 0.0, to: 0.5 });
	var arrayPageScroll = getPageScroll();
	var aTop = arrayPageScroll[1] + (arrayPageSize[3] / 10);
	var aLeft = arrayPageScroll[0]+400;
    var datacont = document.createElement("div");
	datacont.setAttribute('id','ResSpe');
	objBody.appendChild(datacont);
	$('ResSpe').setStyle({position:'absolute',backgroundColor:'#FFFFFF',width:'450px',minHeight:'100px',maxHeight:'200px',top:aTop+'px',left:aLeft+'px',zIndex:100});
	datacont.innerHTML = '<div style="border:5px solid #4A5A7A; width:450px;"><div id="header" style="width:450px; height:22px; background-color:#4A5A7A"><div style="float:left; font-weight:bold;font-size:15px;color:#FFFFFF;">Reviews Sending Status</div><div style="float:right;"><span style="cursor:pointer; font-weight:bold;font-size:15px;color:#FFFFFF;" onclick="javascript:closeResSpe();">CLOSE (X)</span></div></div><div style="height:50px;; background-color:#FFFFFF;color:'+bgcolor+';text-align:left;padding:4px; width:442px;">'+text+'</div><div id="pFooter" style="height:20px; width:450px; background-color:#4A5A7A" align="center"><span style="cursor:pointer; font-weight:bold;font-size:15px;color:#FFFFFF;" onclick="javascript:closeResSpe();">CLOSE X</span></div></div>';
}











