var detailWindow=null;

function popup(url, w, h){
	
	var myname = 'Bild';
	var pos = 'center';
	var infocus = 'front';
	
	
	if(pos=='random'){
		LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
		TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=='center'){
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;}
	else if((pos!='center' && pos!='random') || pos==null){LeftPosition=100;TopPosition=100;}settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';

	detailWindow=window.open(url,myname,settings);

	if(infocus=='front'){detailWindow.focus();detailWindow.location=url;}
}


function popup2(url, w, h, params){
	
	var myname = 'Bild';
	var pos = 'center';
	var infocus = 'front';
	
	
	if(pos=='random'){
		LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
		TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=='center'){
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;}
	else if((pos!='center' && pos!='random') || pos==null){LeftPosition=100;TopPosition=100;}
  settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',location=no,directories=no,menubar=no,toolbar=no,status=no,resizable=no,dependent=no'+ params;

	detailWindow=window.open(url,myname,settings);

	if(infocus=='front'){detailWindow.focus();detailWindow.location=url;}
}


function getElementsByClass(searchClass,node,tag) {
  var classElements = new Array();
  if (node == null)
    node = document;
  if (tag == null)
    tag = '*';
  var els = node.getElementsByTagName(tag);
  var elsLen = els.length;
  var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
  for (i = 0, j = 0; i < elsLen; i++) {
    if (pattern.test(els[i].className) ) {
      classElements[j] = els[i];
      j++;
    }
  }
  return classElements;
}



function drucken() {
  var toprint = new Array();
  var el = getElementsByClass('priceselect', document, 'input');
      
  for (i = 0, j = 0; i < el.length; i++) {
    if (el[i].checked == true) {
      toprint[toprint.length] = el[i];
    }   
  }
  if (toprint.length > 0) {
    for (i = 0, j = 0; i < el.length; i++) {
       document.getElementById('price'+el[i].value).className = 'noprint';
    }
    for (i = 0, j = 0; i < toprint.length; i++) {
      document.getElementById('price'+toprint[i].value).className = 'print';
    }
  } else {
    for (i = 0, j = 0; i < el.length; i++) {
      document.getElementById('price'+el[i].value).className = 'print';
    }
  } 
  
  self.print();
    
}

