/**
 * @author ctb
 */

function resizeStage(){
	$("#body").css("height",$(window).height()-30);
}

function showSave(target, saveURL, args){
	if (args.value <= 0) {
		$("#"+target).replaceWith("<div id='"+target+"' class=\"w-s5 top4 left\">" + "<a  href=\"javascript:document." + saveURL + ".submit()\">L&ouml;schen</a>" + "<input type=\"hidden\" name=\"StoreChangesButton\" value=\"1\" /></div>");
	}
	else{
		$("#"+target).replaceWith("<div id='"+target+"' class=\"w-s5 top4 left\">" + "<a  href=\"javascript:document." + saveURL + ".submit()\">Aktualisieren</a>" + "<input type=\"hidden\" name=\"StoreChangesButton\" value=\"1\" /></div>");
	}
}

function changeLineColor (target,color){
	$(target).css("border-bottom-color",color);
	$(target).css("background-color",'#E3D388');
}

function checkNumber(target)
{
  var val = target.value.replace(/[^\.^,\d]/g, '');
  target.value = val;
}

function checkAGB(url) {
	 if ($('#AGB').attr("checked") != true) {
	 	$('#confirm-box-error').show();
	 	return false;
	 }
	 else {
	 	window.location.href = url;
	 }
}


function setFormError(target){
	$("#"+target).css("backgroundColor","yellow");
	
}

function userFormValidate(){
	
}

function selectProduct(sname,val,img,formname){
if (!formname) formname="addToBasket";
if (img) {
	nocaching = Math.round(Math.random() / Math.random() * 100000);
	temp2 = document.images[img].src + "?" + nocaching;
	nocaching = Math.round(Math.random() / Math.random() * 100000);
	document.images[img].src = document.images[document[formname].imgID.value].src + "?" + nocaching;
	document.images[document[formname].imgID.value].src = temp2;
	document[formname].imgID.value = img;
}
for (var i=0; i < document[formname][sname].length; i++) {
	if (document[formname][sname].options[i].value == val) {
		document[formname][sname].options[i].selected = true;					
	}
}		
}
