
function tccShowSubMenu(divid, mainmenuid, mainmenucount) {
	
	for (i=1; i <= mainmenucount; i++) {
		var mainmenuoptions = document.getElementById('submenu' + i + 'options');
		if (mainmenuoptions) {
			mainmenuoptions.style.display = 'none';
		}
	}

	var mainmenuoptions = document.getElementById('submenu' + divid + 'options');

	if (mainmenuoptions) {
		var state = mainmenuoptions.style.display;
	
		if (state == 'none' || state == '' ) {
			state = 'block';
		} else {
			state = 'none';
		}
		
		mainmenuoptions.style.display = state;
	}
	
	return true;
	
}
						

function tccValidateForm(objform) {

    var validated = true;

    for (var i=0, j=objform.elements.length; i<j; i++) {
        controltype = objform.elements[i].type;
		fieldname = objform.elements[i].name;
		
		usedclass = objform.elements[i].className;
		
		if (usedclass.substring(0,3) == 'req') {
			if (objform.elements[i].disabled == false) {
				if (controltype == 'password' || controltype == 'text' || controltype == 'textarea') {
					if (objform.elements[i].value == '') {
						validated = false;
					}
				}
		
				if (controltype == 'select-one' || controltype == 'select-multiple') {
					objlist = objform.elements[i];
					if (objlist.options.selectedIndex == 0) {
						validated = false;
					}
				}
			}
		}
    }

    return validated;
}

function tccValidateContactForm() {

	var state = false;
	var objform = document.contactus;
	state = tccValidateForm(objform);

	if (state) {
		objform.submit()
	} else {
		alert('Please ensure that all the required fields have been completed.');
	}

	return state;

}

function tccShowPopUp(strName, ShowPage, intwidth, intheight, ShowScrollBar, intOffSet) {

	var leftpos = ((screen.width - intwidth - intOffSet) / 2);
	var toppos = ((screen.height - intheight - intOffSet) / 2);
	var winprops = 'toolbar=0, scrollbars=' + ShowScrollBar + ', location=0, statusbar=0, menubar=0, width=' + intwidth + ', height=' + intheight + ', left=' + leftpos + ', top=' + toppos + ', resizable=0';
    var popupwindow = window.open(ShowPage, strName, winprops);
    popupwindow.focus();
}

