var setw=0;
function wielkosc() {   
if(setw==0) {
setLongest();
}
}
function getLongest_1() {
 	colLength = new Array(2);
 	colLength[0] =  document.getElementById("poleea").offsetHeight;
 	colLength[1] = 	document.getElementById("poleb").offsetHeight;
 	colLength[2] = 	document.getElementById("polec").offsetHeight;
	
	colLength[0] = colLength[0]+85;
	
	
	
	//if(colLength[0]>colLength[1] & colLength[0]>colLength[2]) {  return colLength[0]-44; }
	//else if(colLength[1]>colLength[0] & colLength[1]>colLength[2]) { return colLength[1]; }
	//else if(colLength[2]>colLength[0] & colLength[2]>colLength[1]) { return colLength[2]; }
	if(colLength[1]>colLength[2]) { return colLength[1]; }
	else if(colLength[2]>colLength[1]) { return colLength[2]; }
}
 function setLongest() {
	
	divLen = getLongest_1();
 	
 	
	//document.getElementById("poleea").style.height = divLen+107+"px";
 	document.getElementById("poleb").style.height = divLen+"px";
 	document.getElementById("polec").style.height = divLen+"px";
	setw=1;
}


//var xmlHttp = createXmlHttpRequestObject();

function createXmlHttpRequestObject()
   {
		var xmlHttp;
			 try
			 {
			      xmlHttp = new XMLHttpRequest();
		     }
			 catch (e)
			 {
			 			var XmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0",
														"MSXML2.XMLHTTP.5.0",
														"MSXML2.XMLHTTP.4.0",
														"MSXML2.XMLHTTP.3.0",
														"MSXML2.XMLHTTP",
														"Microsoft.XMLHTTP");
						for (var i=0; i<XmlHttpVersions.length && !xmlHttp; i++)
						{
							try
							{
								xmlHttp = new ActiveXObject(XmlHttpVersions[i]);
							}
							catch (e) {}
						}
			
			 
			 }
		if(!xmlHttp)
		alert("Blad podczas tworzenia obiektu");
		else
		return xmlHttp;
	}

// wysylanie asynch zadania
function process()
    {
	// gdy obiekt nie jest zajety
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
	       {
		   // pobieranie imienia z form
		   var pole1 = encodeURIComponent(document.getElementById("mails").value);
		   var pole2 = encodeURIComponent(document.getElementById("tresc").value);
		  
		   // wykonuje enter.php
		   //xmlHttp.open("GET","enter.php?polea=" + pole1 +"&poleb=" + pole2 , true);
		   xmlHttp.open("POST","save.php", true);
		   // metoda obslugi odpowiedzi serwera
		   //xmlHttp.onreadystatechange = handleServerResponse;
		   // wysylanie zadanie do serwera
		   //xmlHttp.send(null);
		   xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;');
		   xmlHttp.send("polea="+pole1+"&poleb="+pole2);
		   }
		   else
		   // jesli zajete to proba po sek
		   setTimeout('process()', 1000);
    }



function prezent(oEvent,id) {
var oDive = document.getElementById(id);
//alert("asd");
  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;
  }
oDive.style.top = oEvent.clientY + scrOfY + 17 + "px";
oDive.style.left = oEvent.clientX + scrOfX - 230 +"px";
//if (oDive.style.visibility == 'hidden') {
//oDive.style.visibility = 'visible'; } else {

//oDive.style.visibility = 'hidden'; }
oDive.style.visibility = 'visible'; 
//alert(scrOfY);
//alert(oEvent.clientY);

}
// prezent_full
function prezent_full(oEvent,id) {
var oDive = document.getElementById(id);
//alert("asd");
  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;
  }
oDive.style.top = 0 + "%";
oDive.style.left = 0 +"%";
//if (oDive.style.visibility == 'hidden') {
//oDive.style.visibility = 'visible'; } else {

//oDive.style.visibility = 'hidden'; }
oDive.style.visibility = 'visible'; 
//alert(scrOfY);
//alert(oEvent.clientY);

}
//redir
function redir(way) {
var docs = document.getElementById('prx98');
docs.src = 'ganew.php?fol=gal2/photos/'+way;
var docs = document.getElementById('w_re3').style.visibility = 'visible';
	
}


// wywalenie okna
function prezentoff(id) {
var oDive = document.getElementById(id);
oDive.style.visibility = 'hidden';
}

// zmiana koloru overmouse
function overcol(id) 
{
var oDivZm = document.getElementById(id);
//oDivZm.style.backgroundColor = '#696969';
oDivZm.style.opacity = '0.6';
oDivZm.style.filter = "alpha(opacity='60')";

}
// powrot tla po overmouse
function tlocol(id)
{
var oDivZm = document.getElementById(id);
var oDivbbox = document.getElementById('bbox');
//oDivZm.style.backgroundColor = oDivbbox.style.backgroundColor;
oDivZm.style.opacity = '1';
oDivZm.style.filter = "alpha(opacity='100')";
}
// cc
function cc(id)
{
var oTd = document.getElementById(id);
var oDivbbox = document.getElementById('bbox');
oDivbbox.style.backgroundColor = oTd.style.backgroundColor;
	
}
// ss form
function sSubs() {
if (isValidEmail(document.getElementById("mails").value)) {
process();
document.getElementById("mails").value = "";
document.getElementById("tresc").value = "";
prezentoff('w_mail');
okno("Wiadomość została wysłana, odpowiem jak najszybciej będzie to możliwe...");


} else { okno("To nie jest poprawny adres e-mail, wpisz swój adres e-mail i spróbuj ponownie...");  
//document.getElementById("mails").style.backgroundColor='#FFFFCC'; 
document.getElementById("mails").focus(); document.getElementById("mails").select(); }
}
// valid mail
function isValidEmail(sText) {
var reEmail = /^(?:\w+\.?)*\w+@(?:\w+\.)+\w+$/;
return reEmail.test(sText);
}
function okno_div_off(ido) {
var el = document.getElementById(ido);	
document.body.removeChild(el);
}
function okno_div(ref,ido,oEvent,oi) {
var oknoDiv = document.createElement("div");


var tek = document.getElementById(oi).getAttribute('opis');
var dane = "<img src='"+ref+"' border='0' /><br><span>"+tek+"</span>";
oknoDiv.innerHTML = dane;
//alert(oi);
//var oknoText = document.createTextNode(tek);
//oknoDiv.appendChild(oknoText);
oknoDiv.className= "tip";
oknoDiv.setAttribute('id',ido);


  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;
  }
oknoDiv.style.top = oEvent.clientY + scrOfY + 17 + "px";
oknoDiv.style.left = oEvent.clientX + scrOfX - 230 +"px";





document.body.appendChild(oknoDiv);

//setTimeout(function() {document.body.removeChild(oknoDiv); },4000);

}
//
// okno
function okno(vale) {
var oknoDiv = document.createElement("div");
var oknoText = document.createTextNode(vale);
oknoDiv.appendChild(oknoText);
oknoDiv.className= "tip";
document.body.appendChild(oknoDiv);

setTimeout(function() {document.body.removeChild(oknoDiv); },4000);

}
// sizer
function size(id) {
	
    mint.fx.Size(id, 800, 600, 20, 500);
} 
// news tresc wielkosc czcionki
function ntresc(xval) {
//var tval = ;
//tval.setAttribute('class',xval);
//alert(tval.getAttribute('class'));

document.getElementById("newstresc1").style.fontSize = xval; 
document.getElementById("newstresc2").style.fontSize = xval; 
document.getElementById("newstresc3").style.fontSize = xval; 
document.getElementById("newstresc4").style.fontSize = xval; 
document.getElementById("newstresc5").style.fontSize = xval; 
	
}
// news tresc wielkosc czcionki
function ntresc_sz(xval) {
//var tval = ;
//tval.setAttribute('class',xval);
//alert(tval.getAttribute('class'));

document.getElementById("newstresc1").style.fontSize = xval; 

	
}
