var UniqueID = 314;
var newWinOffset = 10;

function swapImage(sImg, sSrc){
	objImg = document.getElementById(sImg);
	objImg.src = sSrc;
}

function updateOrder(){
	document.frmOrder.submit();
}

function delItem(iID, sName){
	if(confirm("Are you sure you would like to delete\n"+ sName + "?") == true){
		location.href="basket.php?act=del&pid="+ iID;
	}
}

function validateCheckout(){
	var objForm = document.frmCustomer;
	var sErr = "The following errors have been detected:";
	var bOK = true;
	if(objForm.firstname.value == ""){
		sErr = sErr + "\n* Firstname can not be blank!";
		bOK = false;
	}
	
	if(objForm.surname.value == ""){
		sErr = sErr + "\n* Surname can not be blank!";
		bOK = false;
	}
	
	if(objForm.email.value == ""){
		sErr = sErr + "\n* Email can not be blank!";
		bOK = false;
	}
	
	if(objForm.phone.value == ""){
		sErr = sErr + "\n* Phone can not be blank!";
		bOK = false;
	}
	
	if(objForm.sadd1.value == ""){
		sErr = sErr + "\n* Delivery Address 1 can not be blank!";
		bOK = false;
	}
	
	if(objForm.scity.value == ""){
		sErr = sErr + "\n* Delivery City/Town can not be blank!";
		bOK = false;
	}
	
	if(objForm.scounty.value == ""){
		sErr = sErr + "\n* Delivery County can not be blank!";
		bOK = false;
	}
	
	if(objForm.spostcode.value == ""){
		sErr = sErr + "\n* Delivery Postcode can not be blank!";
		bOK = false;
	}
	
	if(objForm.scountry.value == ""){
		sErr = sErr + "\n* Delivery Country can not be blank!";
		bOK = false;
	}
	
	if(bOK == false){
		alert(sErr);
	}
	return bOK;
}

function openPlayer(sFileDesc,sFilePath) { 
	PlayWin = window.open('',UniqueID,'width=320,height=190,top=' + newWinOffset +',left=0,resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0');
	PlayWin.focus(); 
	var winContent = "<HTML><HEAD><TITLE>NEKC: " + sFileDesc + "</TITLE>"; 
	winContent += "<link href=\"/CSS/popup.css\" type=\"text/css\" rel=\"stylesheet\" /></HEAD>";
	winContent += "<BODY><h2>" + sFileDesc + "</h2>";
	winContent += "<OBJECT width='300' height='42'>"; 
	winContent += "<param name='SRC' value='" + sFilePath + "'>";
	winContent += "<param name='AUTOPLAY' VALUE='true'>"; 
	winContent += "<param name='CONTROLLER' VALUE='true'>";
	winContent += "<param name='BGCOLOR' VALUE='#C1B2D1'>";
	winContent += "<EMBED SRC='" + sFilePath + "' AUTOSTART='True' LOOP='FALSE' WIDTH='300' HEIGHT='42' CONTROLLER='TRUE' BGCOLOR='#C1B2D1'></EMBED>";
	winContent += "</OBJECT>"; 
	winContent += "<p><a href='" + sFilePath +"'>Download this file</a> (right-click or Option-click)</p>";
	winContent += "<DIV align='right'><a href='javascript:window.close();'>Close Window</a></DIV>"; 
	winContent += "</BODY></HTML>"; 
	PlayWin.document.write(winContent); 
	PlayWin.document.close(); // "Finalizes" new window 
	UniqueID = UniqueID + 1 // newWinOffset = newWinOffset + 20 // subsequent pop-ups will be this many pixels lower 
}
function openScore(sFileDesc,sFilePath) { 
	PlayWin = window.open('',UniqueID,'width=800,height=600,top=' + newWinOffset +',left=0,resizable=0,scrollbars=1,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0');
	PlayWin.focus(); 
	var winContent = "<HTML><HEAD><TITLE>NEKC: " + sFileDesc + "</TITLE>"; 
	winContent += "<link href=\"/CSS/popup.css\" type=\"text/css\" rel=\"stylesheet\" /></HEAD>";
	winContent += "<BODY><h2>" + sFileDesc + "</h2>";
	winContent += "<center><img src=\"" + sFilePath + "\"></center>";
	winContent += "<DIV align='right'><a href='javascript:window.close();'>Close Window</a></DIV>"; 
	winContent += "</BODY></HTML>"; 
	PlayWin.document.write(winContent); 
	PlayWin.document.close(); // "Finalizes" new window 
	UniqueID = UniqueID + 1 // newWinOffset = newWinOffset + 20 // subsequent pop-ups will be this many pixels lower 
} 