//Navigation functions
function step1To2(){
	var login = false;
	var username=document.getElementById('usrName').value;
	var password1=document.getElementById('psswrd').value;
	
	if ((username=='Aaron')&&(password1=='monkey')){
		login = true;
	}
	if ((username=='Stevo')&&(password1=='horse')){
		login = true;
	}
	if ((username=='ssamm')&&(password1=='chad')){
		login = true;
	}
	
	if(login==false){
		document.getElementById('errorArea').innerHTML = "Username or password failed";
	}else{
		document.getElementById('errorArea').innerHTML = "Valid";
		location.href='Adobe_Step2.asp';
	}
}

function step2To3(){
	var windowsOS;
	var macOS;
	windowsOS = document.getElementById('osIsWin').checked;
	macOS = document.getElementById('osIsMac').checked;
	if (windowsOS==true){
		if(macOS==true){
			location.href = "Adobe_Step3a_WM.asp"
		}else{
			location.href = "Adobe_Step3_WO.asp"
		}
	}else{
		if(macOS==true){
			location.href = "Adobe_Step3_MO.asp"
		}else{
			document.getElementById('errorArea').innerHTML = "Please select operating system"
		}	
	}
}

function step4To5(){
	var allChecked = true;
	for(i=1;i<=1;i++){
		allChecked = allChecked && document.getElementById('condition'+i).checked;
	}
						
	if (allChecked==false){
		document.getElementById('errorArea').innerHTML = "Please tick the certification checkbox"
			}
	else{
		
		//var answer=confirm("ARE YOU SURE ? \nOnce you have submitted your return, \nyou will not be able to change any entry")
		//if(answer)
		//if (confirm("Are you sure you want to submit? \nNo changes can be made once you have submitted your return "))
		//{

		//}
	}
}

function popUp(){
	if (emailcheck(document.getElementById("email").value) == true){
		var	popupInner = "<table><tr><td colspan='2' background='images/2-3colspan-header.jpg' class='heading1'>ARE YOU SURE?</td></tr>"
			popupInner += "<tr><td colspan='2'>Are you sure you want to submit? No changes can be made once you select Yes.</td></tr>"
			popupInner += "<tr><td align='center'><img src='images/yes.gif' onclick='javascript:step5()'></td><td align='center'><img src='images/no.gif' onclick='javascript:popDown()'></td></tr></table>"
		document.getElementById("popupConfirm").className = "popupConfirmClassOn";
		document.getElementById("popupConfirm").innerHTML = popupInner;
		document.getElementById("errorArea").innerHTML = "";
	}else{
		document.getElementById("errorArea").innerHTML = "Invalid Email Address";
	}
}

function emailcheck(value) {
	var email=value;
	if (email==""){
		return true;
	}else{
		if (email.indexOf(' ')==-1 && 0<email.indexOf('@') && 0<email.indexOf('.') && email.indexOf('@')+1 < email.length){
			iframeSave.location.href='updateEmail.asp?email='+email;
			return true;
		}
		else{
			return false;
		}
	}
}

function popDown(){
	document.getElementById("popupConfirm").innerHTML = "";
	document.getElementById("popupConfirm").className = "";
}

function step5(){
		window.open('Adobe_Step5.asp','', 'Left=0,top=0,toolbar=yes,resizable=yes,scrollbars=yes,location=yes,menubar=yes,titlebar=yes'); 
		window.opener = self;
		window.close();
}

function step4To5(){
	var allChecked = true;
	for(i=1;i<=1;i++){
		allChecked = allChecked && document.getElementById('condition'+i).checked;
	}
						
	if (allChecked==false){
		document.getElementById('errorArea').innerHTML = "Please tick the certification checkbox"
	}else{
		popUp();		
	}
}

//////////////////////////GENERAL FUNCTIONS////////////////////////////////
var errorCount = 0;
function confirmValueIsNumber(value){
	if((value/1)==value){
		return true;
	}else{
		return false;
	}
}

function confirmValueIsEntered(value){
	if(value==""){
		return false;
	}else{
		return true;
	}
}

function editCell(id){
	if(document.getElementById(id).className=='textFieldOver'){
		document.getElementById(id).className = 'textFieldIn';
	}
}

function highlightCell(id){
	if(document.getElementById(id).className=='textField'){
		document.getElementById(id).className = 'textFieldOver';
	}
}

function resumeCell(id){
	if(document.getElementById(id).className=='textFieldOver'){
		document.getElementById(id).className = 'textField';
	}
}

function saveCell(cellID,value){
	if (confirmValueIsNumber(value) == true){
		//alert("Passed through:"+cellID+"="+ value);
		iframeSave.location.href='updateCell.asp?cellID='+cellID+'&value='+value;
	}
}

function saveOS(selectWin,selectMac){
	//alert(selectWin+" "+selectMac)
	iframeSave.location.href='updateOS.asp?selectWin='+selectWin+'&selectMac='+selectMac;
}

function saveComment(Comment){
	//alert(Comment);
	iframeSave.location.href='updateComment.asp?Comment='+Comment;
}


