function preLoad() {
	pic = new Array();
	pic[0] = '../guest/img/en-us/menu/menu-01-over.gif';
	pic[1] = '../guest/img/en-us/menu/menu-02-over.gif';
	pic[2] = '../guest/img/en-us/menu/menu-03-over.gif';
	pic[3] = '../guest/img/en-us/menu/menu-04-over.gif';

	preLoad = new Array();
	for(i = 0; i < pic.length; i ++) {
		preLoad[i] 		= new Image();
		preLoad[i].src 	= pic[i];
	}
}

// Centeralized Pop-up Window
// pageURL  	: URL of pop-up page
// pageName		: Name of pop-up page
// w			: Width of pop-up page
// h			: Height of pop-up page
// pageScroll	: Scrollbars view or no : 'yes' or 'no'
// pageCenter	: Center of screen view or no : 'yes' or 'no'
function makePopup(pageURL, pageName, w, h, pageScroll, pageCenter) {
	var popup = null;
	if(pageCenter == 'yes')	{
		LeftPosition = (screen.width) ? (screen.width - w) / 2 : 0;
		TopPosition = (screen.height) ? (screen.height - h) / 2 : 0;
	} else {
		LeftPosition = 10;
		TopPosition = 10;
	}

	pageConfig = 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=' + pageScroll + ', resizable=yes, width=' + w + ', height=' + h + ', left=' + LeftPosition + ', top=' + TopPosition;
	popup = window.open(pageURL, pageName, pageConfig);
	popup.focus();
}

function checkForm(fields, lang) {
	for(var i = 0; i < fields.length; i ++) {
		var formField = document.getElementById(fields[i]);
		if(formField.type != 'checkbox' && formField.type != 'radio') {
			if(!formField.value) {
				formField.style.backgroundColor = '#ffd';
				var error = true;
			} else {
				formField.style.backgroundColor = '#fafafa';
			}
		} else {
			if(!formField.checked) {
				if(lang == 'fa') {
					alert('.لطفا موارد توافقنامه را مطالعه نموده و در صورت قبول آن را علامت بزنيد');
				} else {
					alert('Please read our agreement carefully and check its check box.');
				}
				var error = true;
			}
		}
	}
	if(error) {
		return false;
	} else {
		return true;
	}
}

//	menu mouse over
function menuOver(menuObj, menuId) {
	menuObj.src = '../guest/img/en-us/menu/' + menuId + '-over.gif';
}

//	menu mouse out
function menuOut(menuObj, menuId) {
	menuObj.src = '../guest/img/en-us/menu/' + menuId + '.gif';
}

function showComment() {
	if(document.getElementById('commentFa').style.display == 'none') {
		document.getElementById('commentFa').style.display = '';
		document.getElementById('lnEn').style.display = '';
		document.getElementById('commentEn').style.display = 'none';
		document.getElementById('lnFa').style.display = 'none';
	} else {
		document.getElementById('commentEn').style.display = '';
		document.getElementById('lnFa').style.display = '';
		document.getElementById('commentFa').style.display = 'none';
		document.getElementById('lnEn').style.display = 'none';
	}
}