function showHideBlock(an,aus){
 document.getElementById(an).style.display="block";
 document.getElementById(aus).style.display="none";
}
function showImgBig(id){
	var imgSrc=document.getElementById(id).src;
	var imgSrcDet =imgSrc.replace(/thumb/g, "detail");
	document.getElementById('mainpic').style.backgroundImage = "url(" + imgSrcDet + ")";
}
function showZoomImgBig(id){
	var imgSrc=document.getElementById(id).src;
	var imgSrcDet =imgSrc.replace(/special/g, "zoom");
	zoomDaPic(imgSrcDet);
	document.getElementById('start_zoom_url').value=imgSrcDet;

	resetZoomPic();
	//document.getElementById('zoomPicBox').innerHTML="<img src='"+imgSrcDet+"' id='zP' alt='' style='left:20px;' />";

	//new Draggable('zP',{handle:'handle2', onEnd:function(){getActPos()}});

//	zoomDaPic(imgSrcDet );
}
function showBlockZack(block){
	document.getElementById(block).style.display="block";
}
function switchBloeckeDet(id){
	var bloeckeDet= new Array('descDet','dynaccDet','accDet','testDet');
	for(i=0; i<bloeckeDet.length; i++){
		if(id==bloeckeDet[i]){
			document.getElementById(id).style.display="block";
		}else{
			document.getElementById(bloeckeDet[i]).style.display="none";
		}
	}
}
function detailMenuSwitch(x1,x2,x3,x4){
	document.getElementById(x1).style.zIndex=100;
	document.getElementById(x2).style.zIndex=8;
	document.getElementById(x3).style.zIndex=7;
	document.getElementById(x4).style.zIndex=6;
}
function iprint(ptarget)
{
	ptarget.focus();
	ptarget.print();
}
 function changeSource(anker){
	agbIframe.location.href='##absolutePath##Popup.jsp##session_id##?Category=10410110#'+anker;
 }
function showDetailView(){
	document.getElementById("produktDetailBlock").style.display = "block";
}


function splitV(puffer){
	document.getElementById('slider1v').innerHTML=puffer[0];
	document.getElementById('slider2v').innerHTML=puffer[1];
}
function getRequestAttribute(form_id){
	var form = document.getElementById(form_id);
	var attribute = "";
	var select_fields = form.getElementsByTagName("select");
	//Select-Felder
	for(var i=0;i<select_fields.length;i++){
		attribute = attribute + "&" + select_fields[i].name + "="+ select_fields[i].options[select_fields[i].options.selectedIndex].value;
	}
	// Input-Felder
	var input_fields = form.getElementsByTagName("input");
	for(var i=0;i<input_fields.length;i++){
		if(input_fields[i].type=="checkbox"){
			if(input_fields[i].checked == true){
				attribute = attribute + "&" + input_fields[i].name + "="+ input_fields[i].value;
			}
		}else{
			attribute = attribute + "&" + input_fields[i].name + "="+ input_fields[i].value;
		}
	}
	// textareas
	var textarea_fields = form.getElementsByTagName("textarea");
	for(var i=0;i<textarea_fields.length;i++){
		attribute = attribute + "&" + textarea_fields[i].name + "="+ textarea_fields[i].value;
	}
	return attribute;
}



function productListSort(url,form,sort_order){
	var attribute = getRequestAttribute(form);
	document.location.href = url+attribute+"&sort_order="+sort_order;
}
function productListSortName(url,form,SortName){
	var attribute = getRequestAttribute(form);
	document.location.href = url+attribute+"&sort="+2+"&sort_order="+SortName;
}
function productListMaxRows(url,form,maxRows){
	var attribute = getRequestAttribute(form);
	document.location.href = url+attribute+"&products-per-page="+maxRows;
}
function setPriceValues(puffer){
	var formName=document.getElementById('formNameHidden').value;
	document.getElementById('priceFrom').value=puffer[0];
	document.getElementById('priceTo').value=puffer[1];
	document.forms[formName].submit();
}

function kaufm(x) {
  var k = (Math.round(x * 100) / 100).toString();
  k += (k.indexOf('.') == -1)? '.00' : '00';
  return k.substring(0, k.indexOf('.') + 3);
}
function setAll (field, field2){
	var len = field.length;
	if (isNaN(len)) {
		field.checked = field2.checked;
	} else {
		for (i = 0; i < len; i++)		{
			field[i].checked = field2.checked;
		}
	}
	setBackground();
}
function unSetAll (field, field2){
	var len = field.length;
	if (field2.checked == true)	{
		field2.checked = false;
	}else{
		var all = true;
		for (i = 0; i < len; i++){
			if (field[i].checked == false){
				all = false;
			}
		}
		if (all){
			field2.checked = true;
			for (i = 0; i < len; i++){
				field[i].checked=false;
			}
		}else{
			field2.checked = false;
		}
	}
	setBackground();
}
function sortListSearch(zwSp){
	var sortUrl=document.getElementById('sortListUrl').value;
	var formName=document.getElementById('formNameHidden').value;

	if(zwSp=="pUp"){
		productListSort(sortUrl,formName,0);
	}
	if(zwSp=="pDown"){
		productListSort(sortUrl,formName,1);
	}
	if(zwSp=="dUp"){
		productListSortName(sortUrl,formName,0);
	}
	if(zwSp=="dDown"){
		productListSortName(sortUrl,formName,1);
	}
	if(zwSp=="a10"){
		productListMaxRows(sortUrl,formName,10);
	}
	if(zwSp=="a20"){
		productListMaxRows(sortUrl,formName,20);
	}
	if(zwSp=="a50"){
		productListMaxRows(sortUrl,formName,50);
	}
	if(zwSp=="a100"){
		productListMaxRows(sortUrl,formName,100);
	}
}
function setBackground(){
	var formName=document.getElementById('formNameHidden').value;
	tempForm = document.forms[formName];
	for(var i = 0; i<tempForm.elements.length;i++){
		var myID =0;
		if(tempForm.elements[i].name.indexOf("searchVendor")>-1){
			myID = "product-search-vendor-"+tempForm.elements[i].value;
		}else if(tempForm.elements[i].name.indexOf("searchCat")>-1){
			myID = "product-search-cat-"+tempForm.elements[i].value;
		}
		if(myID!=0){
			//setBackgroundDiv(myID,tempForm.elements[i].checked);
		}
	}
}

function setAllVendors(){
	var formName=document.getElementById('formNameHidden').value;
	tempForm = document.forms[formName];
	for(var i = 0; i<tempForm.elements.length;i++){
		if(tempForm.elements[i].name.indexOf("searchVendor")>-1){
			tempForm.elements[i].checked=false;
		}
	}
	tempForm.elements["all_vendors"].checked=true;
	setBackground();
}
function setAllCats(){
	var formName=document.getElementById('formNameHidden').value;
	tempForm = document.forms[formName];
	for(var i = 0; i<tempForm.elements.length;i++){
		if(tempForm.elements[i].name.indexOf("searchCat")>-1){
			tempForm.elements[i].checked=false;
		}
	}
	tempForm.elements["all_cats"].checked=true;
	setBackground();
}

function unSetAll2 (field, oid){
	tempForm = document.forms["ProductSearchForm"];
	for(var i = 0; i<tempForm.elements.length;i++){
		if(tempForm.elements[i].name.indexOf(field)>-1){
			tempForm.elements[i].checked=false;
			if(tempForm.elements[i].value==oid){
				tempForm.elements[i].checked=true;
			}
		}
	}
}