/*
* **************************************************************************
mvextract.js
Nick Earwaker
© LOVELL JOHNS
JavaScript file for MapVu extract ordering.
05/05 
****************************************************************************
*/
		
//****************Define if symbols to be added to the product
function showSymbols(theSet){

	//Set up the arrays to store the symbols
	var defSyms = new Array(1,2,3,4,5,6,7);
	var estateSyms = new Array(4,5,6,10,13,14,18);
	var tourismSyms = new Array(1,2,3,6,7,8,9)
	
	//Clear all check boxes
	for(var n=1;n<21;n++){
		theCheckBox = "document.symForm." + "sym" + String(n) + ".checked = false";
		eval(theCheckBox);
	}
	
	if(theSet == "default"){
		for(var n=0;n<7;n++){
			theCheckBox = "document.symForm." + "sym" + String(defSyms[n]) + ".checked = true";
			eval(theCheckBox);
		}
	}
	else if(theSet == "estate"){
		for(var n=0;n<7;n++){
			theCheckBox = "document.symForm." + "sym" + String(estateSyms[n]) + ".checked = true";
			eval(theCheckBox);
		}
	}
	else if(theSet == "tourist"){
		for(var n=0;n<7;n++){
			theCheckBox = "document.symForm." + "sym" + String(tourismSyms[n]) + ".checked = true";
			eval(theCheckBox);
		}
	}
	
}

//****************Define if symbols to be added to the product
function getSymbols(selObj){

	//--Define what symbols have been checked
	var selectedSyms = {};
	var selectedString = "";
	var cnt = -1;
	for(var n=1;n<21;n++){
		theCheckBox = "document.symForm." + "sym" + String(n) + ".checked";
		if(eval(theCheckBox)){
			cnt = cnt + 1;
			if(cnt == 7){
				cnt = cnt - 1;
				alert("Only 7 symbols may be selected.");
				eval(selObj.checked = false);
			}
			else{	
				selectedSyms[cnt] = "sym" + String(n);
			}	
		}
	}
	
	if(cnt != -1){
		for(var n=0;n<=cnt;n++){			
			if(n == 0){
				selectedString = selectedSyms[n];
			}
			else{
				selectedString = selectedString + "," + selectedSyms[n];
			}	
		}
	}
	//Store as hidden
	document.mvextract.Symbols.value = selectedString;
}

//*******************Goes to checkout page, ensuring terms and conditions have been accepted.
function gotoCheckout(){
	if(frmCart.terms.checked){
		eval("document.location='cart_userdetails.asp?discountcode=" + document.frmCart.discountcode.value + "'");
	}
	else{
		alert("Ensure that the 'Terms and conditions' have been accepted before proceeding.");	
	}	
}

//*******************Opens new window (Used for Terms and conditions, copyrights etc).
function openWindow(theURL){
	winName =  "Terms";
	features = "toolbar=no,scrollbars=yes,resizable=yes,width=600,height=600";
	window.open(theURL,winName,features);
}
/*
*****************END of Script
*/
