function addToBasket (id, visitor_id, src) {
	show_menu ('basket');
	var d = document.getElementById (id);
	if (d==null) {
		var imgDiv = document.createElement("div");
		imgDiv.id = id;
		var img = document.createElement("img");
		img.src = src;
		//img.width=100;
		// Löschen Link
		var del = document.createElement("a");
		del.href = "";
		// Löschen Button
		var imgDel = document.createElement("img");
		imgDel.src = "/images/delete.gif";
		imgDel.alt = "delete";
		imgDel.border = "0";
		var br = document.createElement("br");
		document.getElementById('basket').appendChild(imgDiv);
		imgDiv.appendChild(img);
		imgDiv.appendChild(br);
		imgDiv.appendChild(del);
		del.appendChild(imgDel);

		sendRequestGet ('http://www.rabbarien.de/library/ajax.php?ajax_action=basket_add&image_id='+id+'&visitor_id='+visitor_id);
	}
}

function delFromBasket(id, visitor_id) {
	var imgDiv = document.getElementById(id);
	document.getElementById('basket').removeChild(imgDiv);
	sendRequestGet ('http://www.rabbarien.de/library/ajax.php?ajax_action=basket_del&image_id='+id+'&visitor_id='+visitor_id);
}

function show_menu (obj) {
	document.getElementById('service').style.display='none';
	document.getElementById('exif').style.display='none';
	document.getElementById('search').style.display='none';
	document.getElementById('basket').style.display='none';
	document.getElementById(obj).style.display='block';
}

function mouse_over_menu (obj) {
//	document.getElementById(obj).style.display='block';
}
function mouse_out_menu (obj) {
//	document.getElementById(obj).style.display='none';
}

function vote_current(id) {
	for(i = 0; i <= id; i++) {
		document.images['vote_' + i].src = 'images/vote_on.gif';
	}
}

function vote_off(id) {
	for(i = 0; i < 10; i++) {
		document.images['vote_' + i].src = 'images/vote_off.gif';
	}
}

function vote_image (value, image_id, visitor_id, avg) {
	alert ('Danke für das Voting');

	for (i=0; i<10;i++) {
		if (i<avg) {
			document.images['vote_' + i].src = 'images/vote_on.gif';
			document.images['voted_' + i].src = 'images/vote_on.gif';
		}
		else {
			document.images['vote_' + i].src = 'images/vote_off.gif';
			document.images['voted_' + i].src = 'images/vote_off.gif';
		}
		document.images['vote_' + i].onmouseover = null; 
		document.images['vote_' + i].onmouseout  = null; 
		document.images['vote_' + i].onclick     = null; 
	}

	sendRequestGet ('http://www.rabbarien.de/library/ajax.php?ajax_action=vote&image_id='+image_id+'&count_visitor_id='+visitor_id+'&value='+value);
}

var obj1;
var id1;

function getElementsByClassName(class_name) {
	var all_obj, ret_obj=new Array(), j=0, teststr;

	if(document.all){
		all_obj=document.all;
	}
	else if(document.getElementsByTagName && !document.all) {
		all_obj=document.getElementsByTagName("*");
	}

	for(i=0;i<all_obj.length;i++) {
		if(all_obj[i].className.indexOf(class_name)!=-1) {
			teststr=","+all_obj[i].className.split(" ").join(",")+",";
			if(teststr.indexOf(","+class_name+",")!=-1) {
				ret_obj[j]=all_obj[i];
				j++;
			}
		}
	}
	return ret_obj;
}

function startdrag(id) {
	document.onmousemove = dodrag;
	document.getElementById('calendar_container').style.cursor = 'move';
	var cl = getElementsByClassName('calendar_month');
	//document.getElementById('calendar_month').style.cursor = 'move';
	id1 = id;
}

function dodrag(ereignis) {

}

function swap_drag (obj1, obj2) {
	tmpX = obj1.style.left;
	tmpY = obj1.style.top;
	obj1.style.left = obj2.style.left;
	obj1.style.top  = obj2.style.top;
	obj2.style.left = tmpX;
	obj2.style.top  = tmpY;
}


function enddrag(id2, visitor_id) {
//alert(id1+'---'+id2);
	var obj1 = document.getElementById(id1);
	var obj2 = document.getElementById(id2);
	swap_drag (obj1, obj2);
	sendRequestGet ('http://www.rabbarien.de/library/ajax.php?ajax_action=calendar_order&order1='+id1+'&order2='+id2+'&visitor_id='+visitor_id);
//alert('http://www.rabbarien.de/library/ajax.php?ajax_action=calendar_order&order1='+id1+'&order2='+id2+'&visitor_id='+visitor_id);
	document.getElementById('calendar_container').style.cursor = 'pointer';
}
