// JavaScript Document

function highlight(state) {
	element=event.srcElement;
	
	if (element.tagName=='INPUT') {
		etype=element.type;
		
	if ((etype=='text'))
		{
		if(state==1){ 
		element.className="onIE"; 
		}
		 else {element.className="on";}
		}
	//element.focus();
	}
}

// JavaScript Document

function changeSty(classpassed){
	//element=event.srcElement;
	//document.getElementById('buttonIMG').className=classpassed;
	//element.className=classpassed;
}

// cssvault specific function
function showItems(url) {
		
	url = url + "?remote=1";   
	
	http.open('get',url,true);
	document.getElementById('indicator').style.display = "inline";
	
	http.onreadystatechange = function() {
		if(http.readyState == 4){
			document.getElementById('indicator').style.display = "none";
			document.getElementById('items').innerHTML = http.responseText;
		}
	}
	
	http.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	http.send(null);	
	
	return false;
}

function rateItem(itemid,rate) {
	
	
	var p_element = document.getElementById("rating-"+ itemid);
	
	
	p_element.innerHTML = "<div class=\"rating_stat\">r<br/>a<br/>t<br/>i<br/>n<br/>g<br/></div>";
	
	var url = "/rate.php?itemid="+itemid+"&rate="+rate;   
	
	http.open('get',url,true);
	
	http.onreadystatechange = function() {
		if(http.readyState == 4){
			
			p_element.innerHTML = http.responseText;
			
		}
	}
	
	http.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	http.send(null);	
		
}

/********************************************************
 Make this IE7 Compatible ;)
 http://ajaxian.com/archives/ajax-on-ie-7-check-native-first
*********************************************************/
createRequestObject = function() {
	var xmlhttp;
		/*@cc_on
	@if (@_jscript_version>= 5)
			try {xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
					try {xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");}
					catch (E) {xmlhttp = false;}
			}
	@else
		xmlhttp = false;
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest != "undefined") {
			try {xmlhttp = new XMLHttpRequest();} catch (e) {xmlhttp = false;}
	}
	return xmlhttp;
}

var http = createRequestObject();

function addEvent(obj, evType, fn){ 
 if (obj.addEventListener){ 
   obj.addEventListener(evType, fn, false); 
   return true; 
 } else if (obj.attachEvent){ 
   var r = obj.attachEvent("on"+evType, fn); 
   return r; 
 } else { 
   return false; 
 } 
}

/* woytek */

function more(k) {
	for(i=1; i<=k; i++) {
		document.getElementById('i'+i).src='/gfx/herb1.gif';
	}
}
function less(){
	for(i=1; i<=5; i++) {
		document.getElementById('i'+i).src='/gfx/herb2.gif';
	}
}
im = new Image().src="/gfx/herb1.gif";
im = new Image().src="/gfx/herb2.gif";



function strona(id, active, className)
{
	this.id = id;
	this.active = typeof active == 'undefined' ? 0 : active;
	this.className = typeof className == 'undefined' ? 'strona' : className;
	
	this.show = function(n)
	{
		document.getElementById('' + this.id + this.active).style.display = 'none';
		document.getElementById('' + this.id + n).style.display = 'block';
		var underscore = '_';
		while (document.getElementById('' + this.id + underscore + this.active))
		{
			document.getElementById('' + this.id + underscore + this.active).className = this.className + underscore + 'n';
			document.getElementById('' + this.id + underscore + n).className = this.className + underscore + 'a';
			underscore += '_';
		}
		this.active = n;
	}
}

function checkTerms() {
		if (document.getElementById('form1_regulamin').checked == true) {
			document.getElementById('regulaminWarning').style.display = 'none';
			document.getElementById('regbut').style.display = 'block';
			return true;
		}
		else
		{
			document.getElementById('regulaminWarning').style.display = 'block';
			document.getElementById('regbut').style.display = 'none';
			return false;
		}
}
