//This function returns the Height of the body tag

function getBodyHeight(){
	return document.body.scrollHeight;
}

function showHideOpac(showHide){
	
	bodyHeight = getBodyHeight();
	
	if (showHide == 'show') {
		appendElement(document.body,'div','opac','')
		document.getElementById('opac').style.height = bodyHeight + 'px';
		document.getElementById('opac').style.visibility = 'visible';
		
	}
	else {
		document.getElementById('opac').style.visibility = 'hidden';
	}
}

function appendElement(node,tag,id,htm){
	
	if (id) {
		if (!document.getElementById(id)){
			var ne = document.createElement(tag);
        	if(id) ne.id = id;
        	if(htm) ne.innerHTML = htm;
        	node.appendChild(ne);
		}
	}
}

function showHidePaperForm(showHide){
	
	if (showHide == 'show'){
		showHideOpac(showHide)
		document.getElementById('paperForm').style.visibility = 'visible';
	}
	else {
		showHideOpac(showHide)
		document.getElementById('paperForm').style.visibility = 'hidden';
	}
}

function showHidePrintingForm(showHide){
	
	if (showHide == 'show'){
		showHideOpac(showHide)
		document.getElementById('printingForm').style.visibility = 'visible';
	}
	else {
		showHideOpac(showHide)
		document.getElementById('printingForm').style.visibility = 'hidden';
	}
}

function test(){
	
	document.getElementById('paperContent').innerHTML = 'Thank you';
}

function validatePaperForm(){
	
	if (document.paper_form.customer_name.value == '') {
		alert('Please enter the Customer Name');
		return false;
	}
	if (document.paper_form.contact_person.value == '') {
		alert('Please enter the Contact Person');
		return false;
	}
	if (document.paper_form.telephone.value == '') {
		alert('Please enter the Telephone');
		return false;
	}
	return true;
}


function validatePrintingForm(){
	
	if (document.printing_form.customer_name.value == '') {
		alert('Please enter the Customer Name');
		return false;
	}
	if (document.printing_form.book_name.value == '') {
		alert('Please enter the Book Name');
		return false;
	}
	if (document.printing_form.quantity.value == '') {
		alert('Please enter the Quantity');
		return false;
	}
	if (document.printing_form.size.value == '') {
		alert('Please enter the Size');
		return false;
	}
	return true;
}
