
var $j = jQuery.noConflict();
function openWindow (strUrl, name, width, height, scroll)
{
	
	features  = "resizable=0,location=0,directories=0,status=1,menubar=0,toolbar=0,scrollbars=";
	features += (scroll ? "1" : "0");
	features += ",width=" + width + ",height=" + height;

	window.open(strUrl, name, features);
}

function openBasketWindow (myForm, strUrl, name, width, height, scroll)
{
	strUrl +="?PID=";
	strUrl += myForm.PID.value;
	strUrl += "&number=";
	strUrl += myForm.number.value;
	strUrl += "&pgid=";
	strUrl += myForm.pgid.value;

	openWindow(strUrl, name, 500, 500, false);
}

function MM_jumpMenu (targ, selObj, restore)
{
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex = 0;
}

function MM_showHideLayers()
{ //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function switchVisibility (id)
{
	var obj = document.getElementById(id);
	obj.style.display = (obj.style.display == 'block') ? 'none' : 'block';
}

function checkKey(id) {
    	Ereignis = window.event;
   	var idbevor;
   	var idafter = id+1;

   	if (id !== 0)idbevor = id-1;
	else idbevor = id;

    if(Ereignis.keyCode === 9){ // Tab
    	if (Ereignis.shiftKey){
    		document.forms.FormProductNumberSearch['ID'+idbevor].focus();
    		return;
    	}else{
    		return;
    	}
    }
     if((Ereignis.keyCode === 8)|| (Ereignis.keyCode === 46) ){ // loeschen & entfernen
     	 document.forms.FormProductNumberSearch['ID'+idbevor].value = '';
      document.forms.FormProductNumberSearch['ID'+idbevor].focus();
    	return;
    }
    document.forms.FormProductNumberSearch['ID'+idafter].focus();
}





function deleteWholeBasket(url){
	//

	// Content-Teil
	new Ajax.Updater('basketmain', url);

	// Zusammenfassung linke Navi
	new Ajax.Updater('navi_totalprice','basket.php?ajax=1&source=navi');

	//Status-Fenster
	new Ajax.Updater('stateWindow', 'basket.php?ajax=1&source=stateWindow');

}


function deleteBasketItem(url){
	new Ajax.Updater('basketmain', url);

	// Zusammenfassung linke Navi
	new Ajax.Updater('navi_totalprice','basket.php?ajax=1&source=navi');

	//Status-Fenster
	new Ajax.Updater('stateWindow', 'basket.php?ajax=1&source=stateWindow');

}


function addToFavorite(url) {
	new Ajax.Updater('basketmain', url);
	//alert("Der Artikel wurde den Favoriten hinzugefuegt");
}


function updateBasketItem(elementID, url, inputName){

	var newQty = document.getElementById(inputName).value;
	var newurl = url + newQty;
	
	new Ajax.Updater(elementID, newurl);

	
}






function hideProcessDetails2015(vid){
	
	
	$j('#tr_' + vid).hide();
	$j('#td7_' + vid).hide();
	$j('#td6_' + vid).show();
	
	$j('#td1_' + vid).removeClass("process-selected");
	$j('#td2_' + vid).removeClass("process-selected");
	$j('#td3_' + vid).removeClass("process-selected");
	$j('#td4_' + vid).removeClass("process-selected");
	$j('#td5_' + vid).removeClass("process-selected");
	$j('#td7_' + vid).removeClass("process-selected");
	return;
	
	
	
	
	//mydata.php?ajax=1&source=detail&vid=[[VID]]&vdatum=[[VDATUM]]&vstatus=open&vwarenkb=[[VWARENKORBID]]'

	var tmp = '<a href="#" onclick="showProcessDetails(\'tr_'+vid+'\', \'div_'+vid+'\', \'mydata.php?ajax=1&source=detail&vid='+vid+'&vdatum='+vdatum+'&vwarenkb='+vwarenkorbid+'&vstatus='+vstatus+'\', '+vid+', \''+vdatum+'\', \''+vwarenkorbid+'\',\''+vstatus+'\');return false">';
		tmp = tmp + '		<img src="images/icons/13x13/lupe.gif" width="13", height="13"/>';
		tmp = tmp + '	</a>';

	document.getElementById("td_" + vid).innerHTML = tmp;
	//tr unsichtbar machen:
	document.getElementById("trHeader_" + vid).style.backgroundColor = '';
	document.getElementById(trID).className = "tr-invisible";
}





function showProcessDetails(trID, divID, url, vid){



	document.getElementById("trHeader_" + vid).style.backgroundColor = '#EE2255';
	document.getElementById("trHeader_" + vid).style.color = "#FFFFFF";
//	document.getElementById("td1_" + vid).style.color = "#FFFFFF";
//	document.getElementById("td2_" + vid).style.color = "#FFFFFF";
//	document.getElementById("td3_" + vid).style.color = "#FFFFFF";
//!	document.getElementById("td4_" + vid).style.color = "#FFFFFF";
	var tmp = '<a href="#" onclick="hideProcessDetails(\'tr_'+vid+'\', \''+vid+'\', \''+vdatum+'\', \''+vwarenkorbid+'\', \''+vstatus+'\');return false">';

	tmp = tmp + '<img src="fileadmin/images/shop/icons/13x13/close.gif" height="13" width="13" alt="schliessen"/>';
		tmp = tmp + '</a>';

	document.getElementById(trID).className = "tr-visible";
	// Ajax-Aufruf
	new Ajax.Updater(divID,url);
	document.getElementById("td_" + vid).innerHTML = tmp;


	//tr sichtbar machen:


}


function showProcessDetails2015(typo3id,  vid, vdatum, vwarenkorbid, vstatus){
	

	$j.post(
				"index.php"
				,{
					ajax: '1', 
					id: typo3id,
					source: 'detail',
					vid:vid,
					vdatum:vdatum,
					vwarenkb:vwarenkorbid,
					vstatus:vstatus
					
				},
				function(data){
					$j('#div_' + vid).html(data);
					$j('#tr_' + vid).show();
					$j('#td7_' + vid).show();
					$j('#td6_' + vid).hide();
					
					$j('#td1_' + vid).addClass("process-selected");
					$j('#td2_' + vid).addClass("process-selected");
					$j('#td3_' + vid).addClass("process-selected");
					$j('#td4_' + vid).addClass("process-selected");
					$j('#td5_' + vid).addClass("process-selected");
					$j('#td7_' + vid).addClass("process-selected");
					
				},
				''
			);
	
	return;
	

	
	
}

function showProcessDetails(trID, divID, url, vid, vdatum, vwarenkorbid, vstatus){
	
	
	
	document.getElementById("trHeader_" + vid).style.backgroundColor = '#EE2255';
	document.getElementById("trHeader_" + vid).style.color = "#FFFFFF";
//	document.getElementById("td1_" + vid).style.color = "#FFFFFF";
//	document.getElementById("td2_" + vid).style.color = "#FFFFFF";
//	document.getElementById("td3_" + vid).style.color = "#FFFFFF";
//!	document.getElementById("td4_" + vid).style.color = "#FFFFFF";
	var tmp = '<a href="#" onclick="hideProcessDetails(\'tr_'+vid+'\', \''+vid+'\', \''+vdatum+'\', \''+vwarenkorbid+'\', \''+vstatus+'\');return false">';
	
	tmp = tmp + '<img src="fileadmin/images/shop/icons/13x13/close.gif" height="13" width="13" alt="schliessen"/>';
	tmp = tmp + '</a>';
	
	document.getElementById(trID).className = "tr-visible";
	// Ajax-Aufruf
	new Ajax.Updater(divID,url);
	document.getElementById("td_" + vid).innerHTML = tmp;
	
	
	//tr sichtbar machen:
	
	
}

function hideProcessDetails(trID ,vid, vdatum, vwarenkorbid, vstatus){
	//mydata.php?ajax=1&source=detail&vid=[[VID]]&vdatum=[[VDATUM]]&vstatus=open&vwarenkb=[[VWARENKORBID]]'

	var tmp = '<a href="#" onclick="showProcessDetails(\'tr_'+vid+'\', \'div_'+vid+'\', \'mydata.php?ajax=1&source=detail&vid='+vid+'&vdatum='+vdatum+'&vwarenkb='+vwarenkorbid+'&vstatus='+vstatus+'\', '+vid+', \''+vdatum+'\', \''+vwarenkorbid+'\',\''+vstatus+'\');return false">';
		tmp = tmp + '		<img src="images/icons/13x13/lupe.gif" width="13", height="13"/>';
		tmp = tmp + '	</a>';

	document.getElementById("td_" + vid).innerHTML = tmp;
	//tr unsichtbar machen:
	document.getElementById("trHeader_" + vid).style.backgroundColor = '';
	document.getElementById(trID).className = "tr-invisible";
}


function openBasket (typo3ID)
{
	var url = 'index.php?id=' + typo3ID;
	window.location.href = url;
}




function aktiviereFarben5a ()
{

if (document.intobasket.QtyColor[0].checked)
{
	document.intobasket.Color2.disabled = true;
}
if (document.intobasket.QtyColor[1].checked)
{
	document.intobasket.Color2.disabled = false;
}

}




function aktiviereFarben5c ()
{


if (document.intobasket.QtyColor[0].checked){
		document.intobasket.Color1.disabled = false;
		document.intobasket.Color2.disabled = true;
		document.intobasket.Color3.disabled = true;
		document.intobasket.Color4.disabled = true;
	}
	if (document.intobasket.QtyColor[1].checked){
		document.intobasket.Color1.disabled = false;
		document.intobasket.Color2.disabled = false;
		document.intobasket.Color3.disabled = true;
		document.intobasket.Color4.disabled = true;
	}
	if (document.intobasket.QtyColor[2].checked){
		document.intobasket.Color1.disabled = false;
		document.intobasket.Color2.disabled = false;
		document.intobasket.Color3.disabled = false;
		document.intobasket.Color4.disabled = true;
	}
	if (document.intobasket.QtyColor[3].checked){
		document.intobasket.Color1.disabled = false;
		document.intobasket.Color2.disabled = false;
		document.intobasket.Color3.disabled = false;
		document.intobasket.Color4.disabled = false;
	}



}




function aktiviereFarben5a2Front(){
	if (document.intobasket.QtyColorFront[0].checked){
		document.intobasket.ColorFront2.disabled = true;
	}
	if (document.intobasket.QtyColorFront[1].checked){
		document.intobasket.ColorFront2.disabled = false;
	}

}

function aktiviereFarben5aBack(){
	if (document.intobasket.QtyColorBack[0].checked){
		document.intobasket.ColorBack2.disabled = true;
	}
	if (document.intobasket.QtyColorBack[1].checked){
		document.intobasket.ColorBack2.disabled = false;
	}

}



function aktiviereFarben5cBack(){



	if (document.intobasket.QtyColorBack[0].checked){
		document.intobasket.ColorBack1.disabled = false;
		document.intobasket.ColorBack2.disabled = true;
		document.intobasket.ColorBack3.disabled = true;
		document.intobasket.ColorBack4.disabled = true;
	}
	if (document.intobasket.QtyColorBack[1].checked){
		document.intobasket.ColorBack1.disabled = false;
		document.intobasket.ColorBack2.disabled = false;
		document.intobasket.ColorBack3.disabled = true;
		document.intobasket.ColorBack4.disabled = true;
	}
	if (document.intobasket.QtyColorBack[2].checked){
		document.intobasket.ColorBack1.disabled = false;
		document.intobasket.ColorBack2.disabled = false;
		document.intobasket.ColorBack3.disabled = false;
		document.intobasket.ColorBack4.disabled = true;
	}
	if (document.intobasket.QtyColorBack[3].checked){
		document.intobasket.ColorBack1.disabled = false;
		document.intobasket.ColorBack2.disabled = false;
		document.intobasket.ColorBack3.disabled = false;
		document.intobasket.ColorBack4.disabled = false;
	}


}
function aktiviereFarben5cFront(){

	if (document.intobasket.QtyColorFront[0].checked){

		document.intobasket.ColorFront1.disabled = false;
		document.intobasket.ColorFront2.disabled = true;
		document.intobasket.ColorFront3.disabled = true;
		document.intobasket.ColorFront4.disabled = true;
	}



	if (document.intobasket.QtyColorFront[1].checked){
		document.intobasket.ColorFront1.disabled = false;
		document.intobasket.ColorFront2.disabled = false;
		document.intobasket.ColorFront3.disabled = true;
		document.intobasket.ColorFront4.disabled = true;
	}
	if (document.intobasket.QtyColorFront[2].checked){
		document.intobasket.ColorFront1.disabled = false;
		document.intobasket.ColorFront2.disabled = false;
		document.intobasket.ColorFront3.disabled = false;
		document.intobasket.ColorFront4.disabled = true;
	}
	if (document.intobasket.QtyColorFront[3].checked){
		document.intobasket.ColorFront1.disabled = false;
		document.intobasket.ColorFront2.disabled = false;
		document.intobasket.ColorFront3.disabled = false;
		document.intobasket.ColorFront4.disabled = false;
	}


}

function aktiviereFarben5d(){
	if (document.intobasket.QtyColor[0].checked){
		document.intobasket.Color1.disabled = false;
		document.intobasket.Color2.disabled = true;
		document.intobasket.Color3.disabled = true;
		document.intobasket.Color4.disabled = true;
	}
	if (document.intobasket.QtyColor[1].checked){
		document.intobasket.Color1.disabled = false;
		document.intobasket.Color2.disabled = false;
		document.intobasket.Color3.disabled = true;
		document.intobasket.Color4.disabled = true;
	}
	if (document.intobasket.QtyColor[2].checked){
		document.intobasket.Color1.disabled = false;
		document.intobasket.Color2.disabled = false;
		document.intobasket.Color3.disabled = false;
		document.intobasket.Color4.disabled = true;
	}


}



function aktiviereFarben(anzahlFarben){

	switch(anzahlFarben){
		case 2:
			if (document.intobasket.QtyColor[0].checked){
				document.intobasket.Color1.disabled = false;
				document.intobasket.Color2.disabled = true;
			}
			if (document.intobasket.QtyColor[1].checked){
				document.intobasket.Color1.disabled = false;
				document.intobasket.Color2.disabled = false;
			}
			break;
		case 3:
			if (document.intobasket.QtyColor[0].checked){
				document.intobasket.Color1.disabled = false;
				document.intobasket.Color2.disabled = true;
				document.intobasket.Color3.disabled = true;
				document.intobasket.Color4.disabled = true;
			}
			if (document.intobasket.QtyColor[1].checked){
				document.intobasket.Color1.disabled = false;
				document.intobasket.Color2.disabled = false;
				document.intobasket.Color3.disabled = true;
				document.intobasket.Color4.disabled = true;
			}
			if (document.intobasket.QtyColor[2].checked){
				document.intobasket.Color1.disabled = false;
				document.intobasket.Color2.disabled = false;
				document.intobasket.Color3.disabled = false;
				document.intobasket.Color4.disabled = true;
			}
		break;
		case 4:
			if (document.intobasket.QtyColor[0].checked){
				document.intobasket.Color1.disabled = false;
				document.intobasket.Color2.disabled = true;
				document.intobasket.Color3.disabled = true;
				document.intobasket.Color4.disabled = true;
			}
			if (document.intobasket.QtyColor[1].checked){
				document.intobasket.Color1.disabled = false;
				document.intobasket.Color2.disabled = false;
				document.intobasket.Color3.disabled = true;
				document.intobasket.Color4.disabled = true;
			}
			if (document.intobasket.QtyColor[2].checked){
				document.intobasket.Color1.disabled = false;
				document.intobasket.Color2.disabled = false;
				document.intobasket.Color3.disabled = false;
				document.intobasket.Color4.disabled = true;
			}
			if (document.intobasket.QtyColor[3].checked){
				document.intobasket.Color1.disabled = false;
				document.intobasket.Color2.disabled = false;
				document.intobasket.Color3.disabled = false;
				document.intobasket.Color4.disabled = false;
			}
		break;
	}

}



function aktiviereFarbenFront(anzahlFarben){

	switch(anzahlFarben){
		case 2:
			if (document.intobasket.QtyColorFront[0].checked){
				document.intobasket.ColorFront1.disabled = false;
				document.intobasket.ColorFront2.disabled = true;
			}
			if (document.intobasket.QtyColorFront[1].checked){
				document.intobasket.ColorFront1.disabled = false;
				document.intobasket.ColorFront2.disabled = false;
			}
			break;
		case 3:
			if (document.intobasket.QtyColorFront[0].checked){
				document.intobasket.ColorFront1.disabled = false;
				document.intobasket.ColorFront2.disabled = true;
				document.intobasket.ColorFront3.disabled = true;
			}
			if (document.intobasket.QtyColorFront[1].checked){
				document.intobasket.ColorFront1.disabled = false;
				document.intobasket.ColorFront2.disabled = false;
				document.intobasket.ColorFront3.disabled = true;
			}
			if (document.intobasket.QtyColorFront[2].checked){
				document.intobasket.ColorFront1.disabled = false;
				document.intobasket.ColorFront2.disabled = false;
				document.intobasket.ColorFront3.disabled = false;
			}
		break;
		case 4:
			if (document.intobasket.QtyColorFront[0].checked){
				document.intobasket.ColorFront1.disabled = false;
				document.intobasket.ColorFront2.disabled = true;
				document.intobasket.ColorFront3.disabled = true;
				document.intobasket.ColorFront4.disabled = true;
			}
			if (document.intobasket.QtyColorFront[1].checked){
				document.intobasket.ColorFront1.disabled = false;
				document.intobasket.ColorFront2.disabled = false;
				document.intobasket.ColorFront3.disabled = true;
				document.intobasket.ColorFront4.disabled = true;
			}
			if (document.intobasket.QtyColorFront[2].checked){
				document.intobasket.ColorFront1.disabled = false;
				document.intobasket.ColorFront2.disabled = false;
				document.intobasket.ColorFront3.disabled = false;
				document.intobasket.ColorFront4.disabled = true;
			}
			if (document.intobasket.QtyColorFront[3].checked){
				document.intobasket.ColorFront1.disabled = false;
				document.intobasket.ColorFront2.disabled = false;
				document.intobasket.ColorFront3.disabled = false;
				document.intobasket.ColorFront4.disabled = false;
			}
		break;
	}

}


function aktiviereFarbenBack(anzahlFarben){

	switch(anzahlFarben){
		case 2:
			if (document.intobasket.QtyColorBack[0].checked){
				document.intobasket.ColorBack1.disabled = false;
				document.intobasket.ColorBack2.disabled = true;
			}
			if (document.intobasket.QtyColorBack[1].checked){
				document.intobasket.ColorBack1.disabled = false;
				document.intobasket.ColorBack2.disabled = false;
			}
			break;
		case 3:
			if (document.intobasket.QtyColorBack[0].checked){
				document.intobasket.ColorBack1.disabled = false;
				document.intobasket.ColorBack2.disabled = true;
				document.intobasket.ColorBack3.disabled = true;
				document.intobasket.ColorBack4.disabled = true;
			}
			if (document.intobasket.QtyColorBack[1].checked){
				document.intobasket.ColorBack1.disabled = false;
				document.intobasket.ColorBack2.disabled = false;
				document.intobasket.ColorBack3.disabled = true;
				document.intobasket.ColorBack4.disabled = true;
			}
			if (document.intobasket.QtyColorBack[2].checked){
				document.intobasket.ColorBack1.disabled = false;
				document.intobasket.ColorBack2.disabled = false;
				document.intobasket.ColorBack3.disabled = false;
				document.intobasket.ColorBack4.disabled = true;
			}
		break;
		case 4:
			if (document.intobasket.QtyColorBack[0].checked){
				document.intobasket.ColorBack1.disabled = false;
				document.intobasket.ColorBack2.disabled = true;
				document.intobasket.ColorBack3.disabled = true;
				document.intobasket.ColorBack4.disabled = true;
			}
			if (document.intobasket.QtyColorBack[1].checked){
				document.intobasket.ColorBack1.disabled = false;
				document.intobasket.ColorBack2.disabled = false;
				document.intobasket.ColorBack3.disabled = true;
				document.intobasket.ColorBack4.disabled = true;
			}
			if (document.intobasket.QtyColorBack[2].checked){
				document.intobasket.ColorBack1.disabled = false;
				document.intobasket.ColorBack2.disabled = false;
				document.intobasket.ColorBack3.disabled = false;
				document.intobasket.ColorBack4.disabled = true;
			}
			if (document.intobasket.QtyColorBack[3].checked){
				document.intobasket.ColorBack1.disabled = false;
				document.intobasket.ColorBack2.disabled = false;
				document.intobasket.ColorBack3.disabled = false;
				document.intobasket.ColorBack4.disabled = false;
			}
		break;
	}
}




function aktiviereFarben4(anzahlFarben){

	switch(anzahlFarben){
		case 2:
			if (document.intobasket.QtyColor4[0].checked){
				document.intobasket.Color41.disabled = false;
				document.intobasket.Color42.disabled = true;
			}
			if (document.intobasket.QtyColor4[1].checked){
				document.intobasket.Color41.disabled = false;
				document.intobasket.Color42.disabled = false;
			}
			break;
		case 3:
			if (document.intobasket.QtyColor4[0].checked){
				document.intobasket.Color41.disabled = false;
				document.intobasket.Color42.disabled = true;
				document.intobasket.Color43.disabled = true;
				document.intobasket.Color44.disabled = true;
			}
			if (document.intobasket.QtyColor4[1].checked){
				document.intobasket.Color41.disabled = false;
				document.intobasket.Color42.disabled = false;
				document.intobasket.Color43.disabled = true;
				document.intobasket.Color44.disabled = true;
			}
			if (document.intobasket.QtyColor4[2].checked){
				document.intobasket.Color41.disabled = false;
				document.intobasket.Color42.disabled = false;
				document.intobasket.Color43.disabled = false;
				document.intobasket.Color44.disabled = true;
			}
		break;
		case 4:
			if (document.intobasket.QtyColor4[0].checked){
				document.intobasket.Color41.disabled = false;
				document.intobasket.Color42.disabled = true;
				document.intobasket.Color43.disabled = true;
				document.intobasket.Color44.disabled = true;
			}
			if (document.intobasket.QtyColor4[1].checked){
				document.intobasket.Color41.disabled = false;
				document.intobasket.Color42.disabled = false;
				document.intobasket.Color43.disabled = true;
				document.intobasket.Color44.disabled = true;
			}
			if (document.intobasket.QtyColor4[2].checked){
				document.intobasket.Color41.disabled = false;
				document.intobasket.Color42.disabled = false;
				document.intobasket.Color43.disabled = false;
				document.intobasket.Color44.disabled = true;
			}
			if (document.intobasket.QtyColor4[3].checked){
				document.intobasket.Color41.disabled = false;
				document.intobasket.Color42.disabled = false;
				document.intobasket.Color43.disabled = false;
				document.intobasket.Color44.disabled = false;
			}
		break;
	}
	}




	function aktiviereFarben5(anzahlFarben){

	switch(anzahlFarben){
		case 2:
			if (document.intobasket.QtyColor5[0].checked){
				document.intobasket.Color51.disabled = false;
				document.intobasket.Color52.disabled = true;
			}
			if (document.intobasket.QtyColor5[1].checked){
				document.intobasket.Color51.disabled = false;
				document.intobasket.Color52.disabled = false;
			}
			break;
		case 3:
			if (document.intobasket.QtyColor5[0].checked){
				document.intobasket.Color51.disabled = false;
				document.intobasket.Color52.disabled = true;
				document.intobasket.Color53.disabled = true;
				document.intobasket.Color54.disabled = true;
			}
			if (document.intobasket.QtyColor4[1].checked){
				document.intobasket.Color51.disabled = false;
				document.intobasket.Color52.disabled = false;
				document.intobasket.Color53.disabled = true;
				document.intobasket.Color54.disabled = true;
			}
			if (document.intobasket.QtyColor5[2].checked){
				document.intobasket.Color51.disabled = false;
				document.intobasket.Color52.disabled = false;
				document.intobasket.Color53.disabled = false;
				document.intobasket.Color54.disabled = true;
			}
		break;
		case 4:
			if (document.intobasket.QtyColor5[0].checked){
				document.intobasket.Color51.disabled = false;
				document.intobasket.Color52.disabled = true;
				document.intobasket.Color53.disabled = true;
				document.intobasket.Color54.disabled = true;
			}
			if (document.intobasket.QtyColor5[1].checked){
				document.intobasket.Color51.disabled = false;
				document.intobasket.Color52.disabled = false;
				document.intobasket.Color53.disabled = true;
				document.intobasket.Color54.disabled = true;
			}
			if (document.intobasket.QtyColor5[2].checked){
				document.intobasket.Color51.disabled = false;
				document.intobasket.Color52.disabled = false;
				document.intobasket.Color53.disabled = false;
				document.intobasket.Color54.disabled = true;
			}
			if (document.intobasket.QtyColor5[3].checked){
				document.intobasket.Color51.disabled = false;
				document.intobasket.Color52.disabled = false;
				document.intobasket.Color53.disabled = false;
				document.intobasket.Color54.disabled = false;
			}
		break;
	}





}
	
	

	function showDetailOpen(typo3id, belegnr){
		
		
		$j.post(
				"index.php"
				,{
					ajax: '1', 
					id: typo3id,
					belegnr: belegnr,
					source: 'detail'
					
				},
				function(data){
					$j('#div_' + belegnr).html(data);
					$j('#tr_' + belegnr).show();
					$j('#td5_' + belegnr).show();
					$j('#td4_' + belegnr).hide();
					
					$j('#td1_' + belegnr).addClass("process-selected");
					$j('#td2_' + belegnr).addClass("process-selected");
					$j('#td3_' + belegnr).addClass("process-selected");
					$j('#td4_' + belegnr).addClass("process-selected");
					$j('#td5_' + belegnr).addClass("process-selected");
					$j('#td6_' + belegnr).addClass("process-selected");
					
				},
				''
			);
		
	}
	
	
	
	 function hideDetailKonto(i){
		 
		 	$j('#tr_' + i).hide();	
			$j('#td9_' + i).hide();
			$j('#td8_' + i).show();
			$j('#td1_' + i).removeClass("process-selected");
			$j('#td2_' + i).removeClass("process-selected");
			$j('#td3_' + i).removeClass("process-selected");
			$j('#td4_' + i).removeClass("process-selected");
			$j('#td5_' + i).removeClass("process-selected");
			$j('#td6_' + i).removeClass("process-selected");
			$j('#td7_' + i).removeClass("process-selected");
			$j('#td8_' + i).removeClass("process-selected");
			$j('#td9_' + i).removeClass("process-selected"); 
	 }
	
	 
	 
	 
	function hideDetailOpen( belegnr){
		
		$j('#tr_' + belegnr).hide();
		$j('#td5_' + belegnr).hide();
		$j('#td4_' + belegnr).show();
		$j('#td1_' + belegnr).removeClass("process-selected");
		$j('#td2_' + belegnr).removeClass("process-selected");
		$j('#td3_' + belegnr).removeClass("process-selected");
		$j('#td4_' + belegnr).removeClass("process-selected");
		$j('#td5_' + belegnr).removeClass("process-selected");
		$j('#td6_' + belegnr).removeClass("process-selected");
		
	}

	$j(document).ready(initialize);
	
	
	function initialize(){
		
		$j('a.pricescale').click(priceScaleClick);
		

		
	}
	
	
	
	function priceScaleClick(event){
		
		var elementDiv =$j(this).parent();
		var vurl = $j(this).attr('href');
		
		$j.ajax({
			  url: vurl,
			  success: function(data) {
					elementDiv.html(data);
			  }
			});
		
		event.preventDefault();
		
	}
	
function priceScaleClick2(aID, divID){
		
		
		var a = $j('#' + aID);
		var vurl = a.attr('href');
		var elementDiv =  $j('#' + divID);
		
		$j.ajax({
			  url: vurl,
			  success: function(data) {
			
					elementDiv.html(data);
			  }
			});
}


function showDataInput(){
	
	
	var pgid  = $j('#recomm_pgid').val();
	var productsn  =$j('#recomm_productsn').val();
	var id  =$j('#recomm_typo3id').val();
	
	
	var vurl = 'index.php?id=' + id + '&pgid=' + pgid  +'&source=showdata&pid=' + productsn;
	var elementDiv = $j('#div_recomm');
	
	$j.ajax({
		  url: vurl,
		  success: function(data) {
				
				elementDiv.html(data);
		  }
		});
	
	

}



function sendRecommendation(){

	var email =$j('#recomm_email').val();
	var text  =$j('#recomm_text').val();
	var productsn  =$j('#recomm_productsn').val();
	var id  =$j('#recomm_typo3id').val();
	var elementDiv = $j('#div_recomm');
	var vurl = 'index.php?id='+ id + '&recomm_email=' + email + '&text=' + text +'&productsn=' + productsn;
	
	
	$j.ajax({
		  url: vurl,
		  success: function(data) {
				alert(data);
				elementDiv.html(data);
		  }
		});
}


var aTenBrandNumbers = new Array();

$j(document).ready(function() {

	$j('.importlupe').click(function() {
		var id = $j(this).attr('id');
		
		var idtr = id.replace('a-', 'tr-');
		$j('#' + idtr).toggle();
		
		var customerid = $j('#customerid').val();
		var idtd = id.replace('a-', 'td-');
		
		var typo3id = $j('#typo3id-import').val();
		var datum = id.replace('a-', '');
		var adatum = datum.split("-");
		var url = 'index.php?source=detail&customerid='+ customerid+ '&id=' + typo3id + '&month=' + adatum[0]  + '&year=' + adatum[1]; 
		$j.get(
				url, 
				function(data){
					
					$j('#' + idtd).html(data.content);
				}, 
				'json'
		);
	});
	
	$j('.kontolupe').click(function() {
		var id = $j(this).attr('id');
		var customerid = $j('#customerid').val();
		var typo3id = $j('#typo3id-konto').val();
		var auftragsnr = $j('#auftragsnr' + id).val();
		var buchungsdatum = $j('#buchungsdatum' + id).val();
		var buchungstext = $j('#buchungstext' + id).val();
		var impjahr = $j('#impjahr' + id).val();
		var impmonat = $j('#impmonat' + id).val();
		
		buchungstext = buchungstext.replace('-<br/>', ''); 
		buchungstext = buchungstext.replace('<br/>', ''); 
		
		$j('#tr_' + id).toggle();
		
		
							//alert('id:' +  typo3id);
							//alert('auftragsnr:' +  auftragsnr);
							//alert('buchungsdatum:' +  buchungsdatum);
							//alert('buchungstext:' +  buchungstext);
							//alert('impjahr:' +  impjahr);
							//alert('impmonat:' +  impmonat);
							//alert('customerid:' +  customerid);
		
		
		if ($j('#tr_' + id).is(':visible')){
			
			 $j.post(
			 
						"index.php"
						,{
							id: typo3id,
							ajax: '1', 
							auftragsnr: auftragsnr,
							buchungsdatum: buchungsdatum,
							buchungstext: buchungstext,
							impjahr:impjahr,
							impmonat:impmonat,
							source:'detail',
							customerid:customerid
						},
						function(data){
							$j('#tddata_' + id).html(data.content);
							$j('#tr_' + id).show();
						},
						'json'
				);
		}
		return false;
	});
	
	
	$j('body').find('*').each(function(index, element) {
		
		aFound = $j(element).html().match(/@{3}[0-9]{1,3}@{3}/gi);

		if(aFound != null && aFound.length > 0) {

			for(i=0; i < aFound.length; i++) {
				
				sFound = aFound[i];
				sNumber = sFound.replace(/@/g, '');				
				
				if(jQuery.inArray(sNumber, aTenBrandNumbers) == -1) {
					sId = 'tenbrand_' + sNumber;
					
					sHtml = $j(element).html();
					sHtml = sHtml.replace(sFound, '<span id="'+sId+'" style="display:none">'+sFound+'</span>');
					$j(element).html(sHtml);
					
					aTenBrandNumbers.push(sNumber);
				}
			}
		}
	});
	
	if(aTenBrandNumbers.length > 0) {
		
		$j.post(
			"index.php?id=870"
			,{
				source: 'get-links',
				numbers: aTenBrandNumbers
			},
			function(data){
				
				for(i=0; i<aTenBrandNumbers.length; i++) {
					
					sNumber = aTenBrandNumbers[i];
					sId = 'tenbrand_' + sNumber;
					if(typeof data[sNumber] == 'undefined') {
						continue;
					}
					
					switch(data[sNumber]['Code']) {
						case -1:
							continue;
							break;
							
						case 0:
							sHref = 'javascript:pleaseLogin()';
							break;
							
						default:
							sHref = 'index.php?id=869&source=activate&code='+data[sNumber]['Code'];
							break;
					}

					$j("#"+sId)
						.html('<a href="'+sHref+'"><img src="fileadmin/images/shop/zehner-aktiviert.jpg" title="'+data[sNumber]['Aktion']+'" /></a>')
						.css('display', '')
						.addClass('tenbrand');
				}
			},
			"json"
		);
	}
});

function pleaseLogin() {
	alert('Sie m�ssen angemeldet sein um eine 10er-Marke aktivieren zu k�nnen!');
}

function showDetailKonto(typo3id, i, auftragsnr, buchungstext, impjahr, impmonat){
	
	
	 
	 $j.post(
		"index.php"
		,{
			ajax: '1', 
			id: typo3id,
			auftragsnr: auftragsnr,
			buchungstext: buchungstext,
			impjahr:impjahr,
			source:'detail',
			impmonat:impmonat
			
		},
		function(data){
			$j('#div_' + i).html(data);
			$j('#tr_' + i).show();
			
			$j('#td9_' + i).show();
			$j('#td8_' + i).hide();
			
			$j('#td1_' + i).addClass("process-selected");
			$j('#td2_' + i).addClass("process-selected");
			$j('#td3_' + i).addClass("process-selected");
			$j('#td4_' + i).addClass("process-selected");
			$j('#td5_' + i).addClass("process-selected");
			$j('#td6_' + i).addClass("process-selected");
			$j('#td7_' + i).addClass("process-selected");
			$j('#td8_' + i).addClass("process-selected");
			$j('#td9_' + i).addClass("process-selected");
			$j('#td10_' + i).addClass("process-selected");
			
			
		},
		''
);
	 
	 return false;

}
