	var i = 1;
		var total = 2;
	var k=0;
	var bann = Array("url(/images/spbo2008/spb/spb-hist-1.jpg)", "url(/images/spbo2008/spb/spb-hist-2.jpg)",
					 "url(/images/spbo2008/spb/spb-hist-3.jpg)", "url(/images/spbo2008/spb/spb1.jpg)",
					 "url(/images/spbo2008/spb/spb4.jpg)", "url(/images/spbo2008/spb/turpro3.jpg)");

//window.onresize=set;

	function set() {

		var w = document.documentElement.clientWidth;
		var top = document.getElementById('top');
				var content = document.getElementById('content');
		
			if(w < 1000)
			{
				//top.style.width = "1008px";
				content.style.width = "1008px";
				top.style.width = content.offsetWidth + "px";
			}else{
				//top.style.width = w + "px";
				content.style.width = w + "px";
				top.style.width = content.offsetWidth + "px";
			}
	}

	function auto_ch()
	{
		if(k<=4){
		document.getElementById("peter_bann").style.backgroundImage = bann[k];
		}
		else{
		document.getElementById("peter_bann").style.backgroundImage = bann[5];
		k=0;
		}
		setTimeout("auto_ch()",3200);
		k++;
	}
	
	
	
	
	function auto_change()
	{	
		
		if (i <= total){
			id = i;		
					
			document.getElementById(id).style.display = 'block';
			if (i != 1){
				id = i - 1;
				
				document.getElementById(id).style.display = 'none';
			}
		}		
		else {			
			i = 1;
			id = total;
			document.getElementById("1").style.display = 'block';			
			document.getElementById(id).style.display = 'none';			
		}
			
		setTimeout("auto_change()",2200);		
			
			i++;	
			
	}
	
	function setWidth() {
		auto_change();
		set();
	}
	
	function showDate(){
	
		//document.getElementById('daysA').style.display='block';
		var date_tour = new Date(2008,10,18);
		var date= new Date();
			count_day = date_tour.getDate()-date.getDate(); 
			if (count_day >=0){
				count_month = date_tour.getMonth()-date.getMonth()-1;
				}
			else {
				count_month = date_tour.getMonth()-date.getMonth()-2;
				count_month == 5 || count_month == 3 || count_month == 0 ? count_day = 30 + count_day : count_day = 31 + count_day;
				}
			var days = new Array("дней", "дня", "день", "day to go", "days to go");
			var month = new Array("месяцев", "месяца", "месяц", "month", "months");
			
			
			if (location.pathname.indexOf("/en") == -1){
			if ((count_day==1) || (count_day==21)||(count_day==31)){
			c_day = days[2];
			}
			else if (((count_day>=2) && (count_day<=4)) || ((count_day>=22) && (count_day<=24))){
			c_day = days[1];
			}
			else{
			c_day = days[0];
			}
			
			if ((count_month==1)){
			c_month = month[2];
			}
			else if ((count_month>=2)&& (count_month<=4)){
			c_month = month[1];
			}
			else{
			c_month = month[0];
			}
			}
			else{
			if (count_day==1){
			c_day=days[3];
			}
			else{
			c_day=days[4];
			}
			if (count_month==1){
			c_month = month[3];
			}
			else{
			c_month = month[4];
			}
			}
//			var a = new Array("","-й", "-й", "-й", "-й", "-й", "-й", "-й", "-й");
//			day = '<p>&nbsp;</p>';
		count_day == 0 ? day= '<span>'+count_month+'</span>'+"&nbsp;"+c_month : 
		count_month==0 ? day= '<span>'+count_day+'</span>'+"&nbsp;"+c_day : day= '<span>'+count_month+'</span>'+"&nbsp;"+c_month+"&nbsp;"+'<span>'+count_day+'</span>'+"&nbsp;"+c_day;
		return (day);
}
	
	
	
	

	function change_image(num)
	{
		if (num > total){
			num = 1;
			document.getElementById(num).style.display = 'block';						
			document.getElementById(total+1).style.display = 'none';
			id_next = total + 1;
			id_next = "t" + id_next;
			num = "t" + num;			
			document.getElementById(num).style.display = 'block';
			document.getElementById(id_next).style.display = 'none';	
							
		}
		else {			
			document.getElementById(num + 1).style.display = 'block';
			document.getElementById(num).style.display = 'none';
			num_2 =  num + 1;
			num = "t" + num;
			num_2 = "t" + num_2;												
			document.getElementById(num_2).style.display = 'block';
			document.getElementById(num).style.display = 'none';	
		}	
	}

	
function ticketBy(id) {

	document.getElementById('weekAb').style.display = "none";
	document.getElementById('weekEnd').style.display = "none";
	document.getElementById('weekEndVip').style.display = "none";
	document.getElementById('vip3day').style.display = "none";
	document.getElementById('vipTicket').style.display = "none";
	document.getElementById('ticket').style.display = "none";
	
	if(id)document.getElementById(id).style.display = "block";
	
	

}

function lang(uri)
{
	document.getElementById('langA').style.display = "none";
	var string = uri;

	document.write('<a href="/eng' + string + '" title="English version">English</a>');
}


// Open a window of the desired size in the centre of the screen.
function openLSWindowTandR(year, wkno, lang, tabno, eventid, ref_file, width, height, hasScrollBars) {
	// ADD NAME FIELD and make sure it get's focus!!!
	var theWidth = width;
	var theHeight = height;
	var scrollBars = "scrollbars";
	if (hasScrollBars == false) scrollBars = "scrollbars=0";
	if ((theWidth == "")||(theWidth == null)) theWidth =500;
	if ((theHeight == "")||(theHeight == null)) theHeight =668;
	var theLeft = (screen.availWidth - theWidth)/2;
	var theTop = (screen.availHeight - theHeight)/2;
	var strCheckRef = escape(ref_file);

	var lsURL = "http://www.protennislive.com/frameset.asp?year="+year+"&wkno="+wkno+"&lang="+lang+"&tabno="+tabno+"&eventid="+eventid+"&ref="+strCheckRef;
	var popupWin = window.open(lsURL, '_' + Math.round(Math.random() * 1000000),'top='+theTop+',left='+theLeft+',menubar=0,toolbar=0,location=0,directories=0,status=0,'+scrollBars+',width='+theWidth+', height='+theHeight);
}

var OpenWindow='';

function wOpen()
{
	//www=""+url_img;
	var wid = 400;
	var heid = 400;
	if(OpenWindow)OpenWindow.close();
	OpenWindow=window.open('/online.html', 'xxx', 'width='+wid+',height='+heid+'resizable=yes,top=50,left=50');

	OpenWindow.document.close();
}
