function onOver(name,new_img) 
{
	filename = document.images[name].src;
	document.images[name].src = "/media/1/" + new_img;
}
		
function onOut(name,new_img) 
{
	filename = document.images[name].src;
	document.images[name].src = "/media/1/" + new_img;
}
function Over(hover_color)
{
	lmnt = window.event.srcElement;
	if (lmnt.tagName.toUpperCase() == 'TABLE')
	return;
	while (lmnt.tagName.toUpperCase() !='TD') 
	lmnt = lmnt.parentElement;
	lmnt.style.background = hover_color;
}

function Out(color)
{
	lmnt = window.event.srcElement;
	if (lmnt.tagName.toUpperCase() == 'TABLE')
	return;
	while (lmnt.tagName.toUpperCase() !='TD') 
	lmnt = lmnt.parentElement;
	lmnt.style.background =color;
}
function addToBasket(item,id)
{
	newURL = '/?id='+id+'&action=addToBasket&itemNumber='+item;

	if(document.getElementById(item))
	{
		itemSize = document.getElementById(item).options[document.getElementById(item).selectedIndex].text;
		newURL = newURL+'&amp;itemSize='+itemSize;
	}
	
	if(document.getElementById('color'+item))
	{
		itemColor = document.getElementById('color'+item).options[document.getElementById('color'+item).selectedIndex].text;
		newURL = newURL+'&amp;itemColor='+itemColor;
	}
	
	window.location=newURL;
}

// var fields = new Array('name','familyName','address','zipcode','city','phone','mobile')
// <SPAN id="msgname">*</SPAN>
function submitForm(fields)
{
	var x
	var doSubmit = true
	var focusField

	for(x in fields)
	{
		if(document.getElementById) {
			ref = document.getElementById(fields[x])
		}
		if(ref){
			if(window.document.getElementById(fields[x]).value == "")
			{
				if(doSubmit == true)
				{
					focusField = fields[x];
				}
				
				doSubmit = false
				window.document.getElementById('msg'+fields[x]).style.color = "#FF0000";
			}else{
				window.document.getElementById('msg'+fields[x]).style.color = "#000000";
			}
		}
	}
	
	if(doSubmit)
	{
		document.form.submit();
	}else{
	
		alert('Udfyld venligst alle felter med *');
		window.scrollTo(0, 0);
		
		function focusL()
		{
                	document.getElementById(focusField).focus();
		}
		window.onReadyState=focusL();
	}
}

