function add_recomendations(id) {
if (document.all)
	var xMax = screen.width, yMax = screen.height;
else
	if (document.layers)
		var xMax = window.outerWidth, yMax = window.outerHeight;
	else
		var xMax = 540, yMax=480;

var xOffset = (xMax - 250)/2, yOffset = (yMax - 100)/2;

window.open('/photo_favs.php?action=add&id='+id,'recomendations','width=250,height=200,screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+',copyhistory=no,directories=no,menubar=no,location=no,scrollbars=yes,resizable=no') ;
} 



function send_email(id) {
if (document.all)
	var xMax = screen.width, yMax = screen.height;
else
	if (document.layers)
		var xMax = window.outerWidth, yMax = window.outerHeight;
	else
		var xMax = 540, yMax=480;

var xOffset = (xMax - 250)/2, yOffset = (yMax - 100)/2;

window.open('/send_email.php?action=add&id='+id,'recomendations','width=250,height=300,screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+',copyhistory=no,directories=no,menubar=no,location=no,scrollbars=yes,resizable=no') ;
} 



      function hasClass(ele,cls) {
      return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
      }
       
      function addClass(ele,cls) {
      if (!this.hasClass(ele,cls)) ele.className += " "+cls;
      }

      function removeClass(ele,cls) {
      if (hasClass(ele,cls)) {
      var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
      ele.className=ele.className.replace(reg,' ');
      }
      }

   

   //   removeClass(document.getElementById("test"), "test")

    //  if(hasClass(document.getElementById("test"), "test")){//do something};

function voting(star) {
	//alert (star);
	var elem = document.getElementById("vote_str");  
	elem.value = star; 
	removeClass(document.getElementById("vote_str_1"), "vote_str_active");
	removeClass(document.getElementById("vote_str_2"), "vote_str_active");
	removeClass(document.getElementById("vote_str_3"), "vote_str_active");
	for (i=1;i<=star;i++)
	{
		addClass(document.getElementById("vote_str_"+i), "vote_str_active");
	}
}

function voting2(star) {
	//alert (star);
	removeClass(document.getElementById("vote_str_1"), "vote_str_over");
	removeClass(document.getElementById("vote_str_2"), "vote_str_over");
	removeClass(document.getElementById("vote_str_3"), "vote_str_over");
	for (i=1;i<=star;i++)
	{
		addClass(document.getElementById("vote_str_"+i), "vote_str_over");
	}	

}
function showDiv(div) {
	document.getElementById(div).style.display='block';
}

function hideDiv(div) {
	document.getElementById(div).style.display='none';
}

  function showHideDiv(d) 
	{
		if(d.length < 1) { return; }
		if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
		else { document.getElementById(d).style.display = "none"; }
	} 

function checkLogin(login, div, alert_txt) {
//walidacja czy nie ma zlych znak�w
var alphaExp = /^[0-9a-zA-Z\.\-\_\+]+$/;
if(login.match(alphaExp) && login.length > 2){
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById(div).innerHTML=xmlhttp.responseText;
  }
  }
xmlhttp.open("GET","verification.php?login="+login,true);
xmlhttp.send();	
}
else
	document.getElementById(div).innerHTML=alert_txt;
document.getElementById(div).style.display='block';
	//alert('login '+login);
}



function addStatButtons(photo, user, button) {

if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById(div).innerHTML=xmlhttp.responseText;
  }
  }
xmlhttp.open("GET","stat_photo_buttons.php?id_photo="+photo+"&id_author="+user+"&button="+button,true);
xmlhttp.send();	
}

function addStatBanners(id_baner, lang) {

if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById(div).innerHTML=xmlhttp.responseText;
  }
  }
xmlhttp.open("GET","stat_banners.php?id_baner="+id_baner+"&lang="+lang,true);
xmlhttp.send();	
}

