var adaptSize=false;
var v_coef=100;
var okmenu=true;
var pagehistory=0;
var pageold=0;

window.onresize=adaptContentTO;

function _(o) {
	if (!o) return false;
	if (!document.getElementById) return false;
	if (!document.getElementById(o)) return false;
	return document.getElementById(o);
}

function init() {
	adaptContent();
	//Safari
	/*
	browserV= navigator.appVersion;
	if (browserV.match(/Safari.*?/)) {
		_('imagtransmenu').style.width='263px';
	}
	*/
}

function adaptContent() {
	myWidth=getWidth();
	myBckgndLeft=(myWidth-1828)/2;
	_('page').style.backgroundPosition=myBckgndLeft+'px 0px';
	myHeight=getHeight();
	if (myHeight<570) {
		myHeightPage='570px';
	} else {
		myHeight-=11;
		myHeightPage=myHeight+'px';
	}
	_('page').style.height=myHeightPage;
	/* setLeft('content', 974); */
	adaptSize=false;
}

function adaptContentTO() {
	if (!adaptSize) {
		adaptSize=true;
		setTimeout("adaptContent()", 500);
	}
}

function xhrRequest(type) {
	var xhrSend;
	if (!type) {
		type = 'text';
	}
	if (window.ActiveXObject) {
		try {
			xhrSend = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xhrSend = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	} else if (window.XMLHttpRequest) {
		xhrSend = new XMLHttpRequest();
		if (xhrSend.overrideMimeType) {
			xhrSend.overrideMimeType('text/' + type);
		}
	}
	return (xhrSend);
}

function getWidth() {
  myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
	myWidth = window.innerWidth;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	myWidth = document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	myWidth = document.body.clientWidth;
  }
  return myWidth;
}	

function getHeight() {
  myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
	myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	myHeight = document.body.clientHeight;
  }
  return myHeight;
}
