var selected;
var submitter = null;

function submitFunction() {
    submitter = 1;
}
function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}

function selectRowEffect(object, buttonSelect) {
  if (!selected) {
    if (document.getElementById) {
      selected = document.getElementById('defaultSelected');
    } else {
      selected = document.all['defaultSelected'];
    }
  }

  if (selected) selected.className = 'moduleRow';
  object.className = 'moduleRowSelected';
  selected = object;

// one button is not an array
  if (document.getElementById('payment'[0])) {
    document.getElementById('payment'[buttonSelect]).checked=true;
  } else {
    //document.getElementById('payment'[selected]).checked=true;
  }
}

function rowOverEffect(object) {
  if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}

function rowOutEffect(object) {
  if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}

function setRezept(id,preis){
	document.getElementById('id'+id).innerHTML=preis;
	var s=document.getElementsByName(id+'rw');
	for(var i=0;i<s.length;i++){if(s[i].checked)v=s[i].value;}

}

 function newPhotoWindow(winWidth,winHeight,title,text) {
   dt = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>";
pictureWindow = window.open('','picWin','toolbar=no,location=no,scrollbars=yes,status=no,menubar=no,resizable=no,width=' + winWidth + ',height=' + winHeight + '');
pictureWindow.document.write (dt+"<html><head><title>" + title + "</title> <link rel='stylesheet' type='text/css'></head> <body bgcolor='#FFFFFF' text='#000000' > <p align='center'><span > " + text + " </span></p> <table width='554' border='0' cellspacing='0' cellpadding='0' align='center'> <tr> <td bgcolor='#990000' width='25' height='100'></td> <td width='536' height='50' valign='bottom'> <table width='535' border='0' cellspacing='0' cellpadding='0'> <tr> <td valign='bottom' height='50'> <div align='center'> <table width='100%' border='0' cellspacing='0' cellpadding='0'> <tr> <td width='10'></td> <td> <div align='center'></div> </td> </tr> </table> </div> </td> </tr> <tr> <td valign='bottom' height='15'>&nbsp; </td> </tr> </table> <table width='100%' border='0' cellspacing='0' cellpadding='0' align='right'> <tr> <td width='402' height='50'></td> <td width='43' height='50'>&nbsp;</td> <td width='91' height='50'><a href='javascript:window.close()'><img src='../../Images/CloseWindow.gif' width='72' height='72' align='right' border='0'></a></td> </tr> </table> </td> </tr> </table> </body> </html>");
pictureWindow.document.close;
}

function popup(Title,Text) {
newWindow = window.open('','newWin','scrollbars=yes,width=630,height=400');
newWindow.document.write(Text);
newWindow.document.close;
}

//htr
function setPrice(price, ident){
	document.getElementById(ident).innerHTML = price;
}

function hideElement (id)
{
	document.getElementById(id).style.display = 'none';
}

function toggledisplay (id){
  if (document.getElementById) {
    var mydiv = document.getElementById(id);
    mydiv.style.display = (mydiv.style.display=='block'?'none':'block');
  }
}

function check_form_optional(form_name) {
  var form = form_name;

  var firstname = form.elements['firstname'].value;
  var lastname = form.elements['lastname'].value;
  var street_address = form.elements['street_address'].value;

  if (firstname == '' && lastname == '' && street_address == '') {
    return true;
  } else {
    return check_form(form_name);
  }
}

//Funktion zur Arraybildung
function ent(name, category, manufacturer, keyword,  bias, producturl, packagingsize, langid, proid, custid)
{
    this.name=name;
    this.category=category;
    this.manufacturer=manufacturer;
    this.keyword=keyword;
    this.bias=bias;
    this.producturl=producturl;
    this.packagingsize=packagingsize;
    this.langid=langid;
	this.proid=proid;
    this.custid=custid;
}

ent.prototype.toString = function () {
   return this.category;
};

function sortPrename (p1, p2) {
   if (p1.category > p2.category)
     return -1;
   else if (p1.category < p2.category)
     return 1;
   else if (p1.category > p2.category)
     return -1;
   else
     return 1;
}

function OpenNewDocument(address) {
	window.open(address, "_self");
}

function setup() {}

