//-------------------------------------
// get browser size objects class
//use browser.js
//-------------------------------------

function browserSizeClass(){
//---------------
//propaties
//---------------
	this.doc = document;
	this.win = window;
//---------------
//user function
//---------------
	this.setWinObj = function( obj ){
		this.win = obj;
	};
	this.setDocObj = function( obj ){
		this.doc = obj;
	};
	this.getMousePos = function(evnt){
		var body = this.doc.body;
		if(isMSIE){
			var pos_y = event.clientY + (body.scrollTop || this.doc.documentElement.scrollTop);
			var pos_x = event.clientX + (body.scrollLeft || this.doc.documentElement.scrollLeft);
		}else{
			if(evnt) {
				var pos_y = evnt.pageY;
				var pos_x = evnt.pageX;
			}else {
				var pos_y = event.y + body.scrollTop;
				var pos_x = event.x + body.scrollLeft;
			}
		}
		return [ pos_y, pos_x];
	};
	this.getObjPos = function(obj){
		var temp_top = 0;
		var temp_left = 0;
		var body = "BODY";
		while(!! obj && obj.tagName !=body){
			temp_top += obj.offsetTop;
			temp_left += obj.offsetLeft;
			obj = obj.offsetParent;
		}
		if(!! obj){
			temp_top += obj.offsetTop;
			temp_left += obj.offsetLeft;
		}
		return [ temp_top , temp_left ];
	};
	this.getMonterHeight = function(){
		if( isWebkit && !document.evaluate ){
			return self.innerHeight;
		}else{
//			return ( isOpera ) ? this.doc.body.clientHeight : this.doc.documentElement.clientHeight;//2009.4.16 miura
			return ( isOpera ) ? this.win.innerHeight : this.doc.documentElement.clientHeight;
		}
	/*//old
		if(this.doc.all){
			return this.doc.body.clientHeight; 
		}else if(this.doc.layers || this.doc.getElementById){ 
			return this.win.innerHeight; 
		}
	*/
	};
	this.getMonterWidth = function(){
		if(this.doc.all){
			return this.doc.body.clientWidth; 
		}else if(this.doc.layers || this.doc.getElementById){ 
			return this.win.innerWidth; 
		}
	};
	this.getTopOffset = function(){
		return this.win.pageYOffset || this.doc.documentElement.scrollTop || this.doc.body.scrollTop;
	};
	this.getPageSize = function(){
		var xScroll, yScroll;
		var bd = this.doc.body;
		var win = this.win;
		var doc = this.doc.documentElement;
	
		if (win.innerHeight && win.scrollMaxY) {
			xScroll = win.innerWidth + win.scrollMaxX;
			yScroll = win.innerHeight + win.scrollMaxY;
		} else if (bd.scrollHeight > bd.offsetHeight){ // all but Explorer Mac
			xScroll = bd.scrollWidth;
			yScroll = bd.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = bd.offsetWidth;
			yScroll = bd.offsetHeight;
		}
		var windowWidth, windowHeight;
		if (self.innerHeight) {	// all except Explorer
			if(doc.clientWidth){
				windowWidth = doc.clientWidth; 
			} else {
				windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
		} else if (doc && doc.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = doc.clientWidth;
			windowHeight = doc.clientHeight;
		} else if (bd) { // other Explorers
			windowWidth = bd.clientWidth;
			windowHeight = bd.clientHeight;
		}	
	
		// for small pages with total height less then height of the viewport
		var pageHeight = ( yScroll < windowHeight ) ? windowHeight : yScroll;
		// for small pages with total width less then width of the viewport
		var pageWidth = ( xScroll < windowWidth ) ? xScroll : windowWidth;
		
		return [pageWidth,pageHeight];
	};
}
