	function showpicture(src)
	{
		document.getElementById('bigpic').src=src;
	}
	
	function account(src)
	{
		document.getElementById('acc').src=src;
	}
	
	function SMessage(text,header,class2){
		if (class2) class2=' '+class2; else class2='';
		if (header) text="<div class='header"+class2+"'>"+header+"</div>"+text;
		showWinHtml('message',text+"<p align='right'>&raquo; <a class='close' href=\"javascript:hideWin('message')\">schließen</a></p>");
	}
	
	function SMessage_conf(text,header,class2){
		if (class2) class2=' '+class2; else class2='';
		if (header) text="<div class='header"+class2+"'>"+header+"</div>"+text;
		showWinHtml('message',text+"<p align='right'>&raquo; <a class='close' href=\"javascript:hideWin('message');location.reload(true) \">schließen</a></p>");
	}
	
	function SMessage_contact(text,header,class2){
		if (class2) class2=' '+class2; else class2='';
		if (header) text="<div class='header"+class2+"'>"+header+"</div>"+text;
		showWinHtml('message',text+"<p align='right'>&raquo; <a class='close' href=\"javascript:hideWin('message');location.href='contact.php' \">schließen</a></p>");
	}	
	
	function not_login(){
		SMessage('Sie müssen sich erst angemeldet haben und eingeloggt sein bevor Sie bieten können.','Achtung');
	}
	
	function getListItemChange(){
		location.href="list.php?type="+document.getElementById('select_typ').value+"&cid="+document.getElementById('select_cat').value;
	}
	function save_point(){		
		document.getElementById('point'+count).style.display='inline';
		count++;
	}
	function delete_point(){
		count--;		
		document.getElementById('point'+count).style.display='none';
		document.getElementById('point_input'+count).value='';
		document.getElementById('message_input'+count).value='';		
	}
	
	function confirmprod (id){
		$.getJSON("confirm_product_ajax.php?id="+id, confirmcomplite);
	}
	function confirmcomplite(json){
		SMessage_conf(json.msg);		
	}
	function SendWinnerId(id){
		$.getJSON("winner_ajax.php?id="+id, showList);		
	}

	
	function showList(json){
				document.getElementById('winners').innerHTML='';
				
				myLI=document.createElement('li');
				myLI.appendChild(document.createTextNode('Gewinner login: '+json.user_login));
				document.getElementById('winners').appendChild(myLI);
				
				myLI=document.createElement('li');
				myLI.appendChild(document.createTextNode('Gewinner id: '+json.id_winner));
				document.getElementById('winners').appendChild(myLI);
				
				myLI=document.createElement('li');
				myLI.appendChild(document.createTextNode('Registration date: '+json.date_reg));
				document.getElementById('winners').appendChild(myLI);
				
				myLI=document.createElement('li');
				myLI.appendChild(document.createTextNode('Confirmation date: '+json.date_confirm));
				document.getElementById('winners').appendChild(myLI);
				
				if (json.user_anrede=='2') var k='Frau '; else var k ='Herr ';
				myLI=document.createElement('li');
				myLI.appendChild(document.createTextNode(json.user_title+' '+ k +' '+json.user_vorname+ ' '+json.user_nachname));
				document.getElementById('winners').appendChild(myLI);
				
				myLI=document.createElement('li');
				myLI.appendChild(document.createTextNode('Gewinner strasse: '+json.user_strasse));
				document.getElementById('winners').appendChild(myLI);
				
				myLI=document.createElement('li');
				myLI.appendChild(document.createTextNode('Gewinner PLZ: '+json.user_plz));
				document.getElementById('winners').appendChild(myLI);
				
				myLI=document.createElement('li');
				myLI.appendChild(document.createTextNode('Gewinner Ort: '+json.user_ort));
				document.getElementById('winners').appendChild(myLI);
				
				myLI=document.createElement('li');
				myLI.appendChild(document.createTextNode('Gewinner country: '+json.country_name));
				document.getElementById('winners').appendChild(myLI);
				
				myLI=document.createElement('li');
				myLI.appendChild(document.createTextNode('Gewinner email: '+json.user_email));
				document.getElementById('winners').appendChild(myLI);
				
				myLI=document.createElement('li');
				myLI.appendChild(document.createTextNode('Gewinner phone: '+json.user_phone));
				document.getElementById('winners').appendChild(myLI);
			
	
	}
	
	function get_online_users(day){
		$.getJSON("online_ajax.php?day="+day, onlinecomplite);	
	}
	function onlinecomplite(json){
		document.getElementById('hour').innerHTML=json.hour;
		document.getElementById('day').innerHTML=json.day;
		document.getElementById('week').innerHTML=json.week;
		document.getElementById('month').innerHTML=json.month;
		document.getElementById('year').innerHTML=json.year;
	}
	
	function get_bought_bites(day){
		$.getJSON("bought_bites_ajax.php?day="+day, bitescomplite);	
	}
	function bitescomplite(json){
		for (key1 in array_1){
			for (key2 in array_2){				
				document.getElementById(array_1[key1]+array_2[key2]).innerHTML=eval('json.'+array_1[key1]+array_2[key2]);
			}
		}
		for (key2 in array_2){				
			document.getElementById('money'+array_2[key2]).innerHTML=parseInt(eval('json.'+'Jahr'+array_2[key2]))*array_2[key2]*0.05;
		}		
	}
	
	function get_new_users(day){
		$.getJSON("new_reg_ajax.php?day="+day, newcomplite);	
	}
	function newcomplite(json){
		document.getElementById('count').innerHTML=json.count;	
		document.getElementById('ap').innerHTML=json.AP;
	}
	

	
	function setPayed(product_id){
		if (confirm('Vollenden'))
		$.getJSON("product_payed_ajax.php?id="+product_id, payedComplite);	
	}
	function payedComplite(json){
		SMessage_conf(json.res);
	}
	
	function setPayedBids(product_id){
		$.getJSON("bids_payed_ajax.php?id="+product_id, payedComplite);	
	}
	function payedBidsComplite(json){
		SMessage_conf(json.res);
	}
	
		function setDeleteBids(id) {
     $.getJSON("bids_pay_delete_ajax.php?id="+id, 
	 	
	 	function (data) {
					
				 	if (data.status=="ok") {
						$('#id'+data.id).hide();
					
		         	}
					 if(data.status=="no"){
					 	alert(data.msg);
						 }			
       
						 }
	 		  );
    }
	
	function setDelete(id) {
     $.getJSON("product_pay_delete_ajax.php?id="+id, 
	 	
	 	function (data) {
					
				 	if (data.status=="ok") {
						$('#id'+data.id).hide();
					
		         	}
					 if(data.status=="no"){
					 	alert(data.msg);
						 }			
       
						 }
	 		  );
    }
	
	function setPayedBids(id){
		$.getJSON("bids_payed_ajax.php?id="+id, payedCompliteBids);	
	}
	function payedCompliteBids(json){
		SMessage_conf(json.res);
	}
	
	
	function deleteBietButler(id){
		$.getJSON('set_bietbutler.php?action=delete&p_id='+id,
			function (data){
				if (data.res=='1'){
					$('#info_auto_bitter_text').hide();
					$('#info_auto_bitter').show();
					$('#acc').html(data.bid);
				}
			}
		);	
	}
	
	function getTextBietButler(data){
		var html="<br><div id='ab_from'><span style='font-weight:bold;'>from:&nbsp;</span>"+data.from+"</div><br>"+
			"<div id='ab_to'><span style='font-weight:bold;'>to:&nbsp;</span>"+data.to+"</div><br>"+
			"<div id='ab_bid'><span style='font-weight:bold; padding-bottom: 30px;'>bid:&nbsp;</span>"+data.bid+"</div><br>"+
			"<div id='ab_delete'><a href='#' onclick=\"deleteBietButler("+data.id+");\" style='color:#000000;'>L&ouml;schen</a></div><div class='clear'></div>";
			$('#info_auto_bitter').hide();
			$('#info_auto_bitter_text').html(html);	
			$('#info_auto_bitter_text').show();	
	}
	
	function showFormAutoButler(){
		$('#info_auto_bitter_text').hide();
		$('#info_auto_bitter').show();
	}

	function startBietButler(p_id){
		var from=$('#auto_from').val();
		var to=$('#auto_to').val();
		var bid=$('#auto_bid').val();
		
		$.getJSON('set_bietbutler.php?p_id='+p_id+'&from='+from+'&to='+to+'&bid='+bid,
			function(data){	
				$('#info_auto_bitter_text').show();													
				if (data.error=='1'){ 
					$('#info_auto_bitter_text').html(data.text);
				}	
				else{
					getTextBietButler(data);
					$('#acc').html(data.user_bid);
					$('#auto_from').val('');
					$('#auto_to').val('');
					$('#auto_bid').val('');							
									
				}
				
			}							
		);
	}
	function insertOrder(arrayId){
		var txt_link_id='';
		var txt_link_order='';
		var txt_link='';
	for (i=0; i<=arrayId.length-1; i++){
		idval=eval('form'+arrayId[i]+'.'+'sort_order_'+arrayId[i]+'.value');
		txt_link_id=txt_link_id + arrayId[i] + ',';
		txt_link_order=txt_link_order + idval + ',';
		
		}
		var lengthStr=txt_link_id.length;
		txt_link_id=txt_link_id.substr(0,lengthStr-1);
		var lengthStr=txt_link_order.length;
		txt_link_order=txt_link_order.substr(0,lengthStr-1);
		
	$.getJSON('save_order.php?id=' + txt_link_id + '&order=' + txt_link_order,  savedComplete);
	
	}
	function savedComplete(data){
		SMessage_conf(data.res)
	}
	function editCategory(name_cat, id_cat){
		
		$('#form_edit_cat').show();
		my_edit_form.name.value=name_cat;
		my_edit_form.id.value=id_cat;
	}
	function save_edit_cat(){
		
		var name_cat=eval('my_edit_form.name.value');
		var id_cat=eval('my_edit_form.id.value');
		name_cat=escape(name_cat);
		$.getJSON('save_edit_cat_ajax.php?name='+name_cat+'&id='+id_cat, saveEditComplete);
		
	}
	function saveEditComplete(data){
		SMessage_conf(data.res);
	}
	
	