var js = {
	version: '1.1.7_als',
	rootUrl: '/lib/',
	context: this,
	versioninig: false
}
js.loadedModules = {}

js.include = function(path) {
  if (js.loadedModules[path]) return;
  
  var transport = js.getXHTTPTransport();
  transport.open('GET', js.rootUrl + path.replace(/\./g, '\\') + '.js', false);
  transport.send(null);
  
  var code = transport.responseText;
  eval(code);
}

js.getXHTTPTransport = function() {
	var result = false;
	var actions = [
      function() {return new XMLHttpRequest()},
      function() {return new ActiveXObject('Msxml2.XMLHTTP')},
      function() {return new ActiveXObject('Microsoft.XMLHTTP')}
    ];
    for(var i = 0; i < actions.length; i++) {
    	try{
    		result = actions[i]();
    		break;
    	} catch (e) {}	
    }
    return result;
 }

js.include('iepngfix');
js.include('defaultvalue');

$(document).ready(function(){
    pageParams = getPageSize();
    document.getElementById('main_div').style.height = pageParams[1]-5+'px';
    $("#query").defaultValue('Поиск');
});

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		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;
	if (self.innerHeight) {	// all except Explorer
		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;
	}

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


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