function getRadioValue(rObj)
{
	for(var i=0; i<rObj.length; i++)
		if(rObj[i].checked) return rObj[i].value;
   
  return false;	
}

function getSelectValue(sObj)
{
	with(sObj) return options[options.selectedIndex].value;
}

function popup(seite,w,h)
{
	if(!w) w=500;
	if(!h) h=300;
		
	var padding=0;
	var screenw = screen.availWidth;
	var screenh = screen.availHeight;
	var winw = (w + 15 + padding);
	var winh = (h + 15 + padding);
	var posx = (screenw / 2) - (winw / 2);
	var posy = (screenh / 2) - (winh / 2);

	fenster=window.open(seite,'_blank','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width='+winw+',height='+winh+', top='+posy+', left='+posx+'');
	fenster.focus();
}

function checkobj(obj)
{
	var form=document.send;
	var result=false;
	for(var i=0; i<form.elements[obj].length; i++)
		if(form.elements[obj][i].checked)
			result=true;
    
	return result;
}
	
function checkinput(object,beschr,empty,art)
{
	value=object.value;
	mustconform  = /^([ßäüöÄÜÖâêôóáéúûàòèùa-zA-Z0-9- \.]+)$/;
	if (art=='zahl'){mustconform  = /^([0-9]+)$/;}
	if (art=='tel'){mustconform  = /^([+0-9])*([0-9 \/-]+)$/;}
	if (art=='mail'){mustconform  = /^([a-zA-Z0-9-_]+)(\.[a-zA-Z0-9-_]+)*@([a-zA-Z0-9-][a-zA-Z0-9-]+\.)+([a-zA-Z]{2,4})$/;}
   if (art!='mail')
   {
		value=value.replace(/ö/,'o');
		value=value.replace(/Ö/,'O');
		value=value.replace(/ä/,'a');
		value=value.replace(/Ä/,'A');
		value=value.replace(/ü/,'u');
		value=value.replace(/Ü/,'U');
		value=value.replace(/ß/,'s');
	}
   if ((value!='')||(!empty))
   if (mustconform!='')
   if (!mustconform.test(value))
   {
    alert(beschr);
    object.focus();
    object.select();
    return false;
   }
   return true;
}

function checkdatum (tt,mm,jjjj)
{
 var my_datum=new Date(jjjj,mm-1,tt);
 if (my_datum.getDate()==tt && my_datum.getMonth()==mm-1 && my_datum.getFullYear()==jjjj) return true; else return false
}

function check_radio(formobj,text)
{
	num=0;
	my_check=-1;
	while(check_radio_obj=formobj[num++])
		if (check_radio_obj.checked) my_check=num-1;

	return my_check;
}

function checkinput_klein(object,beschr,empty,art)
{
	fvalue=object.value;
   if (fvalue=='')
   {
    alert(beschr);
    object.focus();
    object.select();
    return false;
   }
   return true;
}

// Zugaben
function zugabe_change(obj,session)
{
	obj.checked=true;
	ajaxRequest('index.php?inhalt=angebot_info&angebot_id='+document.getElementById('angebot_id').value+'&zugabe_id='+obj.value+'&session='+session,'angebot_info',0,'','');
}	

// Angebote
var angebot_on=null;
function angebot_over(obj)
{
	if (obj)
		if (obj.className!='angebot_on') 
			obj.className='angebot_over';
}

function angebot_out(obj)
{
	if (obj)
		if (obj.className!='angebot_on') 
			obj.className='angebot';
}

function angebot_click(obj,session)
{
	if (obj)
	{
		if (angebot_on) angebot_on.className='angebot';
		obj.className='angebot_on';
		formobj=document.send.zugabe;
		
		num=check_radio(formobj);			
		angebot_id=obj.id.replace(/angebot_/,'');
		
		if (num==-1) num=formobj[0].value;
		else num=formobj[num].value;			
		
		ajaxRequest('index.php?inhalt=angebot_info&angebot_id='+angebot_id+'&zugabe_id='+num+'&session='+session,'angebot_info',0,'','');
		angebot_on=obj;			
	}
}

function footer_change(obj,session)
{
	ajaxRequest('index.php?inhalt=footer&footerid='+obj.value+'&session='+session,'footer',0,'','');
}
