// JavaScript Document


var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
@end @*/

if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
}

function getMyHTML(serverPage, objID) {
	var obj = document.getElementById(objID);
	xmlhttp.open("GET", serverPage);
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			obj.innerHTML = xmlhttp.responseText;
		}
	}
	xmlhttp.send(null);
}

function getResolutionWH() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return [ myWidth, myHeight ];
}

function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}


function maxDiv() {
	
	winRes=getResolutionWH();
	winScroll=getScrollXY();

	thedivOne=document.getElementById('flashPopupBg');
	thedivOne.style.left=winScroll[0]; thedivOne.style.top=winScroll[1];
	thedivOne.style.width=winRes[0]; thedivOne.style.height=winRes[1];
	thedivOne.style.visibility="visible";
	
	thedivTwo=document.getElementById('flashPopupImg');
	thedivTwo.style.left=winScroll[0]; thedivTwo.style.top=winScroll[1];
	thedivTwo.style.width=winRes[0]; thedivTwo.style.height=winRes[1];
	thedivTwo.style.visibility="visible";
}
function minDiv() {
	
	winRes=getResolutionWH();
	winScroll=getScrollXY();

	thedivOne=document.getElementById('flashPopupBg');
	thedivOne.style.left=0; thedivOne.style.top=0;
	thedivOne.style.width=0; thedivOne.style.height=0;
	thedivOne.style.visibility="hidden";
	
	thedivTwo=document.getElementById('flashPopupImg');
	thedivTwo.style.left=0; thedivTwo.style.top=0;
	thedivTwo.style.width=0; thedivTwo.style.height=0;
	thedivTwo.style.visibility="hidden";
}
function moveDiv() {
	thedivOne=document.getElementById('flashPopupBg');
	thedivTwo=document.getElementById('flashPopupImg');
	
	if(thedivTwo.style.visibility=='visible') {
		winRes=getResolutionWH();
		winScroll=getScrollXY();
	
		thedivOne.style.left=winScroll[0]; thedivOne.style.top=winScroll[1];
		thedivOne.style.width=winRes[0]; thedivOne.style.height=winRes[1];
	
		thedivTwo.style.width=winRes[0]; thedivTwo.style.height=winRes[1];
		thedivTwo.style.left=winScroll[0]; thedivTwo.style.top=winScroll[1];
	}
}

function maxImage(isrc,itxt,trans) {
	
	thePartners=document.getElementById('thepartners');
	thePartners.style.visibility="hidden";
	
	theimage=document.getElementById('popupImage');
	theimage.src=isrc;

	thetag=document.getElementById('imgtag');
	imgtag.value=itxt;

	winRes=getResolutionWH();
	winScroll=getScrollXY();
	
	thebg=document.getElementById('photoPopupHolder');
	if(trans==1) thebg.style.background='none';
	else thebg.style.backgroundColor='#ffffff';

/*
	theholder=document.getElementById('popupHolder');
	theholder.style.width=winRes[0]; theholder.style.height=winRes[1];
*/
	thedivOne=document.getElementById('photoPopupBg');
	thedivOne.style.left=winScroll[0]; thedivOne.style.top=winScroll[1];
	thedivOne.style.width=winRes[0]; thedivOne.style.height=winRes[1];
	thedivOne.style.visibility="visible";
	
	thedivTwo=document.getElementById('photoPopupImg');
	thedivTwo.style.left=winScroll[0]; thedivTwo.style.top=winScroll[1];
	thedivTwo.style.width=winRes[0]; thedivTwo.style.height=winRes[1];
	thedivTwo.style.visibility="visible";
}

function minImage() {
	
	thePartners=document.getElementById('thepartners');
	thePartners.style.visibility="visible";
	
	theimage=document.getElementById('popupImage');
	theimage.src='img/stage/loading.jpg';
/*	
	theholder=document.getElementById('popupHolder');
	theholder.style.width=0; theholder.style.height=0;
*/
	thedivOne=document.getElementById('photoPopupBg');
	thedivOne.style.left=0; thedivOne.style.top=0;
	thedivOne.style.width=0; thedivOne.style.top=0;
	
	thedivOne.style.visibility="hidden";

	thedivTwo=document.getElementById('photoPopupImg');
	thedivTwo.style.left=0; thedivTwo.style.top=0;
	thedivTwo.style.width=0; thedivTwo.style.top=0;
	
	thedivTwo.style.visibility="hidden";

}

function moveImage() {
	thedivOne=document.getElementById('photoPopupBg');
	thedivTwo=document.getElementById('photoPopupImg');
	
	if(thedivTwo.style.visibility=='visible') {
		winRes=getResolutionWH();
		winScroll=getScrollXY();
	
		thedivOne.style.left=winScroll[0]; thedivOne.style.top=winScroll[1];
		thedivOne.style.width=winRes[0]; thedivOne.style.height=winRes[1];
	
		thedivTwo.style.width=winRes[0]; thedivTwo.style.height=winRes[1];
		//thedivTwo.style.left=winScroll[0]; thedivTwo.style.top=winScroll[1];
	}
}

function mainmenuButOn(num,obj) {
	obj.src='/images/stage/but_0'+num+'_on.gif';
}
function mainmenuButOff(num,obj) {
	obj.src='/images/stage/but_0'+num+'_off.gif';
}

function colorTables() {
	mycontent = document.getElementById('pageContentHolder');
	
	mytables    = mycontent.getElementsByTagName("table");
	for(i=0; i <= mytables.length-1; i++) {

		if(mytables[i].id!='noformat' && mytables[i].id!='colorTablesPlayers') {
		
				mytables[i].style.border = 'none';
				mytables[i].style.width = '100%';
				
					myrows = mytables[i].getElementsByTagName("tr");
					for(a=0; a <= myrows.length-1; a++) {
						if(myrows[a].id!='noformat') {
							if(a%2==0) { thecolor="tr0"; theTDcolor="td0"; }
							else { thecolor="tr1"; theTDcolor="td1"; }
							if(a==0) { thecolor="trHead"; theTDcolor="tdHead"; }
							myrows[a].className = thecolor;
							
							// TDji
								mytdsx    = myrows[a].getElementsByTagName("td");
								for(bx=0; bx <= mytdsx.length-1; bx++) {
									mytdsx[bx].className= theTDcolor;
								}
							
						}
					}
				
					mytds    = mytables[i].getElementsByTagName("td");
					for(b=0; b <= mytds.length-1; b++) {
						mytds[b].style.width= 'auto';
						mytds[b].style.textAlign= 'left';
						mytds[b].style.verticalAlign= 'middle';				
						mytds[b].style.height= 'auto';
						mytds[b].style.padding= '6px';
						mytds[b].style.paddingLeft= '6px';				
					}
				
				
		} else if(mytables[i].id=='colorTablesPlayers') {
				mytables[i].style.border = 'none';
				mytables[i].style.width = '100%';
				
					myrows = mytables[i].getElementsByTagName("tr");
					for(a=0; a <= myrows.length-1; a++) {
						if(myrows[a].id!='noformat') {
							if(a%2==0) { thecolor="tr0"; theTDcolor="td0"; }
							else { thecolor="tr1"; theTDcolor="td1"; }
//							if(a==0) { thecolor="trHead"; theTDcolor="tdHead"; }
							myrows[a].className = thecolor;
							
							// TDji
								mytdsx    = myrows[a].getElementsByTagName("td");
								for(bx=0; bx <= mytdsx.length-1; bx++) {
									mytdsx[bx].className= theTDcolor;
								}
							
						}
					}
				
					mytds    = mytables[i].getElementsByTagName("td");
					for(b=0; b <= mytds.length-1; b++) {
						mytds[b].style.width= 'auto';
						mytds[b].style.textAlign= 'left';
						mytds[b].style.verticalAlign= 'top';				
						mytds[b].style.height= 'auto';
						mytds[b].style.padding= '6px';
						mytds[b].style.paddingLeft= '6px';				
					}
					
		}
	}

}


function hideSponsors() {
	thePartners=document.getElementById('thepartners');
	thePartners.style.visibility="hidden";
}
function showSponsors() {
	thePartners=document.getElementById('thepartners');
	thePartners.style.visibility="visible";
}