function count(o,n) {

	if (o.value.length > n) {

		o.value = o.value.substr(0,n);
	}

	document.getElementById('counter').innerHTML='pozostało znaków: '+(250-o.value.length)+'';
}

function zoom_in() {


	var i=document.getElementById('iframe');

	h = i.clientHeight;
	w = i.clientWidth;

	h_percent = Math.round(h/100);
	w_percent = Math.round(w/100);

	new_width = Math.round(w+(w_percent*5));
	new_height = Math.round(h+(h_percent*5));

	if(w<875) {

		i.style.width = new_width+'px';
		i.style.height = new_height+'px';
	
	}
}

function zoom_out() {


	var i=document.getElementById('iframe');

	h = i.clientHeight;
	w = i.clientWidth;

	h_percent = Math.round(h/100);
	w_percent = Math.round(w/100);

	new_width = Math.round(w-(w_percent*5));
	new_height = Math.round(h-(h_percent*5));

	if(w>500) {

		i.style.width = new_width+'px';
		i.style.height = new_height+'px';
	
	}
}

function lights_on_off() {

	var s=document.getElementById('shadow');

	if(s.clientHeight>0) {

		s.style.height = "0px";
		s.style.width = "0px";

	} else {

		s.style.height = "100%";
		s.style.width = "100%";

	}
}

var ObiektXMLHttp = false;

if (window.XMLHttpRequest) {

 ObiektXMLHttp = new XMLHttpRequest();

} else if (window.ActiveXObject) { 

  ObiektXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");

} 

function Ajax (Loading, Source) { 

 var ObiektXMLHttp = false;

 if (window.XMLHttpRequest) {

  ObiektXMLHttp = new XMLHttpRequest();

 } else if (window.ActiveXObject) { 

  ObiektXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");

 } 
 
 if(ObiektXMLHttp) {

  var Loading = document.getElementById(Loading);

  ObiektXMLHttp.open("GET", Source);

  ObiektXMLHttp.onreadystatechange = function() { 

   if (ObiektXMLHttp.readyState == (1 || 0)) {

    Loading.innerHTML = '';

   }

   if (ObiektXMLHttp.readyState == 4) {

    Loading.innerHTML = ObiektXMLHttp.responseText;

   }



  } 

  ObiektXMLHttp.send(null);

 }

} 

function select_url(url) {

   var go_to_url = url.options[url.selectedIndex].value;
   window.top.location.href = go_to_url;

} 


function bookmark() {

	var url = "http://www.e-gierki.com/?source=fav";
	var title = "e-GIERKI.com - Twoje Gry Online";

	if (window.sidebar) {

		window.sidebar.addPanel(title, url,"");

	} else if( window.external ) {

		window.external.AddFavorite(url, title);

	} else if(window.opera && window.print) {

		window.external.AddFavorite(url, title);
	}


} 

function SendRequest(target) {

    var req = mint.Request();
    var response = document.getElementById(target);
    req.OnSuccess = function() {
        response.innerHTML = this.responseText;
    }
               
    req.SendForm("form");

}

function ajax_post_request(source, target) {

    var req = mint.Request();
    var response = document.getElementById(target);
    req.OnSuccess = function() {
        response.innerHTML = this.responseText;
    }
               
    req.SendForm(source);

}



function forumChangeCategory() {

    var req = mint.Request();
    var response = document.getElementById("moderation_status");
    req.OnSuccess = function() {
        response.innerHTML = this.responseText;
    }
               
    req.SendForm("forumChangeCategory");

}
