var xmlHttp;

function Clicky(status){
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }    

  
var url="index.php?class=gallery&action=getPicture";
url=url+"&status=" + status;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

//selectCategory
function selectCategory(id){

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }

var url = "index.php?class=kalorikalkulaator&action=selectCategoryCalculator&category="+id;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);

}

//attributes
function attributez(id,lang,type,k,v){

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }

var url = "index.php?lang=" + lang +"&class=" + type + "&action=showAttributes&id=" + id + "&k=" + k + "&v=" + v;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);

}


function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("Hint").innerHTML=xmlHttp.responseText;
}
} 

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
else
cntfield.value = maxlimit - field.value.length;
}

//popup

function popup(item_nr,item_name,lang){
var load = window.open("components/Catalog/bookmark.php?action=view&item_nr="+item_nr+"&item_name="+item_name+"&lang="+lang,"","scrollbars=no,menubar=0,height=350,width=500,resizable=no,toolbar=no,location=0,status=0");
}

//images popup


function popimages(id){
var load = window.open("components/Catalog/images.php?id=" + id,"","scrollbars=yes,menubar=0,height=750,width=500,resizable=no,toolbar=no,location=0,status=0");
}

function print(url){
  var load = window.open("index.php?" + url,"","scrollbars=no,menubar=yes,height=0,width=0,resizable=yes,toolbar=no,location=0,status=0");
}

  
function printPage() {
if (window.print)
   window.print();
}


function setCookie(c_name,value,expiredays){
var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
