var werd;
function openopen(linkk,name,w_,h_){
	linkk='/popwin.php?link='+linkk+'&dir='+name;
	var up_=100;
	var left_=100;
	param = 'top='+up_+',left='+left_+',width='+w_+',height='+h_;
	if (werd==null||werd.closed){
		werd=window.open(linkk,name, param+',status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes');
	}
	else{
		werd.close();
		werd=window.open(linkk,name, param+',status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes');
	}
	werd.focus();
}
function open_win(links,name){
	//if (un_window==null||un_window.closed){
		//un_window=window.open('http://'+links,name);
	//}
	//else{
	un_window=window.open('http://'+links,name);
	//}
	un_window.focus();
}
var nam;
function dok0(url,h,w){
	if (nam!=null && !nam.closed)nam.close();
	tops(h,w);
	nam=window.open(url,null,"height="+h+",width="+w+",status=no,toolbar=no,menubar=no,location=no,top="+top_+",left="+left_+",scrollbars=no,resizable=yes");
	nam.focus();
}
function tops(h,w){
	if (navigator.appName == "Netscape") {
		top_=window.innerHeight/2-h/2;
		left_=window.innerWidth/2-w/2;
	}
	else {
		top_=document.body.clientHeight/2-h/2;
		left_=document.body.clientWidth/2-w/2;
	}
}
function get_cur_date(b){
	a=new Date();
	year=a.getYear();
	if(year<2000)year+=1900;
	if((a.getMonth()+1+b)>12)return "01/01/"+(year+1);
	return "01/"+(a.getMonth()+1+b)+"/"+year;
}
function get_cur_date_year(b){
	a=new Date();
	year=a.getYear();
	if(year<2000)year+=1900;
	return (year-b)+"-01-01";
}


var pf = 0;
var menu_over=new Array();
function pre() {
	if (document.images) {
		menu_over[0] = ni("/img/site/top_menu_tariff.gif");
		menu_over[1] = ni("/img/site/top_menu_descript.gif");
		menu_over[2] = ni("/img/site/top_menu_contact.gif");
		menu_over[3] = ni("/img/site/top_menu_payment.gif");
		pf = 1;
	}
}
function ni(arg) {
if (document.images) {
rslt = new Image();
rslt.src = arg;
return rslt;
}
}
function ci() {
if (document.images && (pf == 1)) {
for (var i=0; i<ci.arguments.length; i+=2) {
document[ci.arguments[i]].src = ci.arguments[i+1];
}
}
}
function cin(nams1,nams2) {
 if (document.images && (pf == 1)) {
	document[nams1].src = nams2.src;
 }
}

function flevInitPersistentLayer() {
	if (arguments.length < 8) {return;}
	var mail = arguments[0]; if (mail == "") {return;}
	var	oD = eval("MM_findObj('" + mail + "')"); if (!oD) {return;}
	var iCSS = parseInt(arguments[1]);
	var sXL = arguments[2], sXC = arguments[3], sXR = arguments[4], sYT = arguments[5], sYC = arguments[6], sYB = arguments[7];
	var iS = (arguments.length > 8) ? parseInt(arguments[8]) : 0, iPx = (arguments.length > 9) ? parseInt(arguments[9]) : 0;
	if (iCSS != 0) { if (!document.layers) {oD = oD.style;} sXL = parseInt(oD.left), sYT = parseInt(oD.top);}
	var sF = "flevPersistentLayer('" + mail + "','" + sXL + "','" + sXC + "','" + sXR + "','" + sYT + "','" + sYC + "','" + sYB + "'," + iS + "," + iPx + ")";
	eval(sF);
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function flevPersistentLayer() { 
	var mail = arguments[0], oD = eval("MM_findObj('" + mail + "')"), iWW, iWH, iSX, iSY, iT = 10, sS = "";
	if (!document.layers) {oD = oD.style;}
	if (oD.tmpTimeout != null) {clearTimeout(oD.tmpTimeout);}
	var sXL = arguments[1], sXC = arguments[2], sXR = arguments[3], sYT = arguments[4], sYC = arguments[5], sYB = arguments[6];
	var iS = (arguments.length > 7) ? parseInt(arguments[7]) : 0, iPx = (arguments.length > 8) ? parseInt(arguments[8]) : 0;
	if (window.innerWidth) { 
		var oW = window; iWW = oW.innerWidth; iWH = oW.innerHeight; iSX = oW.pageXOffset; iSY = oW.pageYOffset; }
	else if (document.documentElement && document.documentElement.clientWidth) { 
		var oDE = document.documentElement; iWW = oDE.clientWidth; iWH = oDE.clientHeight; iSX = oDE.scrollLeft; iSY = oDE.scrollTop; }
	else if (document.body) { 
		var oDB = document.body; iWW = oDB.clientWidth; iWH = oDB.clientHeight; iSX = oDB.scrollLeft; iSY = oDB.scrollTop; }
	else {return;}
	var iCX = iNX = flevDivPositionValue(mail, 'left'), iCY = iNY = flevDivPositionValue(mail, 'top');
	if (sXL != "") {iNX = iSX + parseInt(sXL);} 
	else if (sXC != "") {iNX = Math.round(iSX + (iWW/2) - (flevDivPositionValue(mail, 'width')/2));}
	else if (sXR != "") {iNX = iSX + iWW - (flevDivPositionValue(mail, 'width') + parseInt(sXR));}
	if (sYT != "") {iNY = iSY + parseInt(sYT);}
	else if (sYC != "") {iNY = Math.round(iSY + (iWH/2) - (flevDivPositionValue(mail, 'height')/2));}
	else if (sYB != "") {iNY = iSY + (iWH - flevDivPositionValue(mail, 'height') - parseInt(sYB));}
	if ((iCX != iNX) || (iCY != iNY)) {
		if (iS > 0) {
			if (iPx > 0) { iT = iS;
				var iPxX = iPx, iPxY = iPx, iMX = Math.abs(iCX - iNX), iMY = Math.abs(iCY - iNY);
				// take care of diagonal movement
				if (iMX < iMY) {iPxY = (iMX != 0) ? ((iMY/iMX)*iPx) : iPx;}
				else {iPxX = (iMY != 0) ? ((iMX/iMY)*iPx) : iPx;}
				if (iPxX >= iMX) {iPxX = Math.min(Math.ceil(iPxX), iPx);}
				if (iPxY >= iMY) {iPxY = Math.min(Math.ceil(iPxY), iPx);}
				// temporary X/Y coordinates
				if ((iCX < iNX) && (iCX + iPxX < iNX)) {iNX = iCX + iPxX;}
				if ((iCX > iNX) && (iCX - iPxX > iNX)) {iNX = iCX - iPxX;}
				if ((iCY < iNY) && (iCY + iPxY < iNY)) {iNY = iCY + iPxY;}
				if ((iCY > iNY) && (iCY - iPxY > iNY)) {iNY = iCY - iPxY;} }
			else { 
				var iMX = ((iNX - iCX) / iS), iMY = ((iNY - iCY) / iS); 
				iMX = (iMX > 0) ? Math.ceil(iMX) : Math.floor(iMX); iNX = iCX + iMX; 
				iMY = (iMY > 0) ? Math.ceil(iMY) : Math.floor(iMY); iNY = iCY + iMY; } }
		if ((parseInt(navigator.appVersion)>4 || navigator.userAgent.indexOf("MSIE")>-1) && (!window.opera)) {sS="px";}
		if (iMX != 0) {eval("oD.left = '" + iNX + sS + "'");}
		if (iMY != 0) {eval("oD.top = '" + iNY + sS + "'");} }
	var sF = "flevPersistentLayer('" + mail + "','" + sXL + "','" + sXC + "','" + sXR + "','" + sYT + "','" + sYC + "','" + sYB + "'," + iS + "," + iPx + ")";
	oD.tmpTimeout = setTimeout(sF,10);
}
function flevDivPositionValue(mailiv, sProperty) { 
	this.opera = (window.opera); 
	this.ns4 = (document.layers); 
	this.ns6 = (document.getElementById && !document.all && !this.opera); 
	this.ie = (document.all); 
    var sValue = ""; docObj = eval("MM_findObj('" + mailiv + "')"); if (docObj == null) {return 0;}
	if ((sProperty == "left") || (sProperty == "top")) {
		if (!this.ns4) {docObj = docObj.style;} 
		sValue = eval("docObj." + sProperty);
		if ((this.ie) && (sValue == "")) { 
			if (sProperty == "top") { sValue = eval(mailiv + ".offsetTop"); } 
			else { sValue = eval(mailiv + ".offsetLeft"); } 
		};
	}
	else {
		if (this.opera) {
			docObj = docObj.style;
			if (sProperty == "height") { sValue = docObj.pixelHeight; } 
			else if (sProperty == "width") { sValue = docObj.pixelWidth; } 
		}
		else if (this.ns4) {sValue = eval("docObj.clip." + sProperty);} 
		else if (this.ns6) {sValue = document.defaultView.getComputedStyle(docObj, "").getPropertyValue(sProperty); } 
	    else if (this.ie) { 
			if (sProperty == "width") { sValue = eval(mailiv + ".offsetWidth"); } 
			else if (sProperty == "height") { sValue = eval(mailiv + ".offsetHeight"); } 
		}
   	}
	sValue = (sValue == "") ? 0 : sValue; 
	if (isNaN(sValue)) { if (sValue.indexOf('px') > 0) { sValue = sValue.substring(0,sValue.indexOf('px')); } } 
	return parseInt(sValue); 
}

