function doCheck(strForm, strFields, strFieldNames){
	var arrFields, arrFieldNames;
	var blnResult=true;
	var objFrm;
	objFrm = document.forms[strForm];
	arrFields = strFields.split(",");
	arrFieldNames = strFieldNames.split(",");
	for(i=0; i<arrFields.length; i++){
		if(objFrm.elements[arrFields[i]]){
			if((objFrm.elements[arrFields[i]].type == "text") || (objFrm.elements[arrFields[i]].type == "textarea") || (objFrm.elements[arrFields[i]].type == "file") || (objFrm.elements[arrFields[i]].type == "password") || (objFrm.elements[arrFields[i]].type == "hidden") || (objFrm.elements[arrFields[i]].type == "select-one")){
				if(arrFields[i]=='txtEmail' || arrFields[i]=='Email' || arrFields[i]=='E-mail' || arrFields[i]=='e-mail' || arrFields[i]=='email'){
					if(!checkEmail(objFrm.elements[arrFields[i]].value)){ 
						alert('The email is not a valid emailaddress');
						objFrm.elements[arrFields[i]].focus();
						blnResult=false;
						break;
					}
				}
				if(objFrm.elements[arrFields[i]].value + ''==''){ 
					alert('The field ' +arrFieldNames[i]+ ' is required');
					objFrm.elements[arrFields[i]].focus();
					blnResult=false;
					break;	
				}
			}else{
				var blnChecked = false;
				if(objFrm.elements[arrFields[i]].length !== "undefined"){
					for(j=0; j<objFrm.elements[arrFields[i]].length; j++){
						if(objFrm.elements[arrFields[i]][j].checked){
							blnChecked = true;
							break;
						}
					}
				}else{
					if(objFrm.elements[arrFields[i]].checked){
						blnChecked = true;
					}
				}
				if(!blnChecked){
					alert('The field ' +arrFieldNames[i]+ ' is required');
					blnResult = false;
					break;
				}				
			}	
		}
	}
	return blnResult;
}


function checkEmail(checkString){
    var newstr = "";
    var at = false;
    var dot = false;

    // Als email een '@' heeft
    if (checkString.indexOf("@") != -1) {
      at = true;

    // Als email een '.' heeft
    } else if (checkString.indexOf(".") != -1) {
      dot = true;
    }

    // Onthouden van de string
    for (var i = 0; i < checkString.length; i++) {
        ch = checkString.substring(i, i + 1)
        if ((ch >= "A" && ch <= "Z") || (ch >= "a" && ch <= "z")
                || (ch == "@") || (ch == ".") || (ch == "_")
                || (ch == "-") || (ch >= "0" && ch <= "9")) {
                newstr += ch;
                if (ch == "@") {
                    at=true;
                }
                if (ch == ".") {
                    dot=true;
                }
        }
    }
    if ((at == true) && (dot == true)) {
        return true;
    }
    else {
      return false;
    }
}
	
function changeImage(strName)
{
	document.getElementById('pic').src = 'images/pics/' + strName;
}

function changeMenuImage(id, picName)
{
	document.getElementById(id).src = 'images/site/menu/' + picName;
}

function openpopup(imgName, iLeft, iTop)
{
	var left = (document.body.clientWidth / 2) - iLeft;
	var sLeft = left + 'px';
	var sTop = iTop + 'px';
	document.getElementById('popup').style.display = 'block';
	document.getElementById('popup').style.left = sLeft;
	document.getElementById('popup').style.top = sTop;
	document.getElementById('imgHolder').src = 'images/' + imgName;
}

function closepopup()
{
	document.getElementById('popup').style.display = 'none';
}

function openImage(directory, imgNumber, amount, iLeft, iTop)
{
	var left = (document.body.clientWidth / 2) - iLeft;
	var sLeft = left + 'px';
	var sTop = iTop + 'px';
	document.getElementById('imgPrev').style.display = '';
	document.getElementById('imgNext').style.display = '';	
	document.getElementById('imgPopup').style.display = 'block';
	document.getElementById('imgPopup').style.left = sLeft;
	document.getElementById('imgPopup').style.top = sTop;
	document.getElementById('imgPopupHolder').src = 'images/' + directory + '/' + imgNumber + '.jpg';
	document.getElementById('imgNext').innerHTML = '<a href="#" class="imgNav" onclick="showNextPreviousImage(' + amount + ',\'next\');">Next >></a>';
	document.getElementById('imgPrev').innerHTML = '<a href="#" class="imgNav" onclick="showNextPreviousImage(' + amount + ',\'prev\');"><< Prev</a>';
	if(imgNumber == amount)
	{
		document.getElementById('imgNext').style.display = 'none';		
	}
	if(imgNumber ==1)
	{
		document.getElementById('imgPrev').style.display = 'none';
	}
}

function showNextPreviousImage(amount, type)
{
	var sPath = document.getElementById('imgPopupHolder').src;
	var iCurrent;
	var iNext;
	var iPrev;
	document.getElementById('imgPrev').style.display = '';
	document.getElementById('imgNext').style.display = '';
	if(isNaN(sPath.substr(sPath.length - 6,1)))
	{
		iCurrent = sPath.substr(sPath.length - 5,1);
	}
	else
	{
		iCurrent = sPath.substr(sPath.length - 6,2);
	}
	if(type == 'next')
	{
		iNext = parseInt(iCurrent) + 1;
		if(iNext == amount)
		{
			document.getElementById('imgNext').style.display = 'none';
		}
		document.getElementById('imgPopupHolder').src =	sPath.replace(iCurrent + '.jpg',iNext + '.jpg');
	}
	else if(type == 'prev')
	{
		iPrev = parseInt(iCurrent) - 1;
		if(iPrev == 1)
		{
			document.getElementById('imgPrev').style.display = 'none';
		}
		document.getElementById('imgPopupHolder').src =	sPath.replace(iCurrent + '.jpg',iPrev + '.jpg');
	}

}

function closeImage()
{
	document.getElementById('imgPopup').style.display = 'none';
}

function checkOrder()
{
	bResult = false;
	if((document.getElementById('chkShirt').checked) || (document.getElementById('chkCD').checked) || (document.getElementById('chkGirlie').checked) || 
		(document.getElementById('chkColorShirt').checked))
	{
		bResult = true;
	}
	if(!bResult)
	{
		alert("Choose a product before you order!");
	}
	return bResult;
}

function setManual()
{
	document.getElementById('manual').value = 1;
}

function openWindow(url, width, height)
{
	var iWidth = (screen.width/2) - width;
	var iHeight = (screen.height/2) - height;
	window.open(url,'','width='+width+',height='+height+',left='+iWidth+',top='+iHeight+';scrollbars=no,toolbar=no,location=no');
}

function generateAddress( username, hostname, domain ) {
	var atsign = "&#64;";
	var addr = username + atsign + hostname + domain;
	document.write( 
	  "<" + "a" + " " + "href=" + "mail" + "to:" + addr + ">" +
	  addr +
	  "<\/a>");
	}
	
function ShowAM()
{

	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="382" height="450">');
	document.write('<param name="movie" value="flash/answermachine.swf">');
   	document.write('<param name="quality" value="high">');             
	document.write('<embed src="flash/audio.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="382" height="450"></embed>');
	document.write('</object>');
}

function ShowAudio()
{

	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="275" height="225">');
	document.write('<param name="movie" value="flash/audio.swf">');
    document.write('<param name="quality" value="high">');             
	document.write('<embed src="flash/audio.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="275" height="225"></embed>');
	document.write('</object>');
}

function ShowVideoOne()
{
	document.write('<object width="425" height="350">');
	document.write('<param name="movie" value="http://www.youtube.com/v/jq79J-1ngu4"></param>');
	document.write('<embed src="http://www.youtube.com/v/jq79J-1ngu4" type="application/x-shockwave-flash" width="425" height="350"></embed>');
	document.write('</object>');
}

function ShowVideoTwo()
{
	document.write('<object width="425" height="350">');
	document.write('<param name="movie" value="http://www.youtube.com/v/29SKfntXYzw"></param>');
	document.write('<param name="wmode" value="transparent"></param>');
	document.write('<embed src="http://www.youtube.com/v/29SKfntXYzw" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed>');
	document.write('</object>');
}

function ShowVideoThree()
{
	document.write('<object width="425" height="350">');
	document.write('<param name="movie" value="http://www.youtube.com/v/q7fBnCDUWnQ"></param>');
	document.write('<param name="wmode" value="transparent"></param>');
	document.write('<embed src="http://www.youtube.com/v/q7fBnCDUWnQ" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed>');
	document.write('</object>');
}