/*
	Ellis Lake Resort Specials Web Application
*/
function createAjaxObject(){var alink;try{alink=new XMLHttpRequest();}catch(e){alink=new ActiveXObject("Microsoft.XMLHTTP");}return alink;}


function docWizard_Init() {
	var h=new liteHelper(), w=h.getElement('wizard'), n=h.getElement('nav');
	w.innerHTML='<iframe id="uploadwin" src="preprocessor.php">no iframe support?</iframe>';
	n.innerHTML='&nbsp;';
	
}

function wizard_step2(){
	var h=new liteHelper(), w=h.getElement('wizard'), n=h.getElement('nav');
	
	var i=h.getElement('uploadwin');
	i.style.visibility='hidden';
	
	w.innerHTML='The wizard has detected large images present in the uploaded file and automatically resized them down to avoid creating too large of a PDF document for you.';
				
	
	n.innerHTML='<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="50%" align="left"><div class="button" onClick="docWizard_Init()">&lt; Previous</div></td>'+
				'<td width="50%" align="right"><div class="button" onClick="wizard_step3()">Next &gt;</div></td></tr></table>';
			
}

function wizard_step3(){
	var h=new liteHelper(), w=h.getElement('wizard'), n=h.getElement('nav');
	
	var i=h.getElement('uploadwin');
	i.style.visibility='hidden';
	
	w.innerHTML='The uploaded document has been successfully converted to a PDF file.<br><br>If you would like to preview this document, click the "Preview" button below, '+
				'otherwise click on the Finish button.<br><br><br><div class="button" style="margin-left: 300px;" onClick="previewPDF()">Preview</div>';
				
	
	n.innerHTML='<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="50%" align="left"><div class="button" onClick="docWizard_Init()">&lt; Previous</div></td>'+
				'<td width="50%" align="right"><div class="button" onClick="wizard_step4()">Finish</div></td></tr></table>';
}

function wizard_step4(){
	var h=new liteHelper(), w=h.getElement('wizard'), n=h.getElement('nav');
	var ajax=createAjaxObject();
	
	ajax.open('GET', 'buildfinal.php', false);
	ajax.send(null);

	
	w.innerHTML='Your specials page has now been updated.';
	
	n.innerHTML='<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="50%" align="left"><div class="button" onClick="docWizard_Init()">Start Over</div></td>'+
				'<td width="50%" align="right">&nbsp;</td></tr></table>';
}


function previewPDF() {
	window.open('processed.pdf', '_preview', 'width=760,height=540,resizable=yes');
}





window.onload = function() {
	var h=new liteHelper();
	h.centerElement('editor');
	docWizard_Init();
}

window.onresize=function() {
	var h=new liteHelper();
	h.centerElement('editor');
}


