var block_arr = new Array();
var minimum_top = 20;
var minimum_left = 20;
var zIndexValue = 200;

function getAbsoluteOffsetTopConfirmation(obj){
	    var top = obj.offsetTop;
	    var parent = obj.offsetParent;
	    while (parent != document.body)
			{
		        top += parent.offsetTop;
		        parent = parent.offsetParent;
		    }
	    return top;
	}

function getAbsoluteOffsetLeftConfirmation(obj){
	    var left = obj.offsetLeft;
	    var parent = obj.offsetParent;
	    while (parent != document.body)
			{
		        left += parent.offsetLeft;
		        parent = parent.offsetParent;
		    }
	    return left;
	}

function getPageSizeWithScroll(){
		if (window.innerHeight && window.scrollMaxY) {// Firefox
			yWithScroll = window.innerHeight + window.scrollMaxY;
			xWithScroll = window.innerWidth + window.scrollMaxX;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			yWithScroll = document.body.scrollHeight;
			xWithScroll = document.body.scrollWidth;
		} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
			yWithScroll = document.body.offsetHeight;
			xWithScroll = document.body.offsetWidth;
	  	}
		arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
		//alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
		return arrayPageSizeWithScroll;
	}

//Hide all confirmation blocks
function hideAllBlocks(){
		var obj;
		var enable_frm = '';
		if(arguments.length == 1)
			var enable_frm = arguments[0];
		if(obj = $('selAlertbox'))
			obj.style.display = 'none';
		for(var i=0;i<block_arr.length;i++){
				if(obj = $(block_arr[i]))
					{	obj.style.display = 'none';
						disableAll('1', enable_frm);
					}
			}
		if(obj = $('hideScreen'))
			obj.style.display='none';

		if(obj = $('selAjaxWindow'))
			obj.style.display='none';

		if(obj = $('selAjaxWindowInnerDiv'))
			obj.innerHTML='';

		if ((catObj = $('category')) || (sub_catObj = $('sub_category'))){
			br=getBrowser();
			if (br[0] == 'msie' && getMajorVersion(br[1]) == '6'){
				if (catObj = $('category'))
					catObj.style.display = '';

				if (sub_catObj = $('sub_category'))
					sub_catObj.style.display = '';
			}
		}

		return false;
	}

function changePosition(fromObj, toObj, add_top_position, add_left_position){
		fromObj.style.zIndex = zIndexValue;
		var top = getAbsoluteOffsetTopConfirmation(toObj)+ add_top_position;
		var left = getAbsoluteOffsetLeftConfirmation(toObj)+ add_left_position;
		if(top<minimum_top)
			top = minimum_top;
		if(left<minimum_left)
			left = minimum_left;
		fromObj.style.top = top + 'px';
		fromObj.style.left = left + 'px';
		fromObj.style.display = 'block';
		if(obj = $('hideScreen')){
			var ss = getPageSizeWithScroll();
			obj.style.width=ss[0]+"px";
			obj.style.height=ss[1]+"px";
			obj.style.display='block';
		}
	}

var alert_manual = function(){
		var obj;
		var alert_value = arguments[0];
		var place = arguments[1];
		var add_left_position = 0
		var add_top_position = 0;
		if(arguments.length>=3)
			add_top_position = arguments[2];
		if(arguments.length>=4)
			add_left_position = arguments[3];
		if(obj = $('selAlertMessage'))
			obj.innerHTML = alert_value;
		if(fromObj = $('selAlertbox'))
			changePosition(fromObj, $(place), add_top_position, add_left_position);
		if(obj = $('selAlertOkButton'))
			obj.focus();
		return false;
	}
