pic = new Array();

function preLoad() {
	pic[1] = '../guest/img/en-us/menu/image01.jpg';

	var preLoad = new Array();
	for(i = 1; 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 {
			var error = true;
		}
	}
	if(error) {
		return false;
	} else {
		return true;
	}
}

//	menu mouse over
function menuOver(menuObj, menuId) {
	menuObj.style.cursor = 'pointer';
	menuObj.style.backgroundColor = '#eaeaea';
	
	if(document.getElementById('sub-' + menuId)) {
		if(document.getElementById('sub-' + menuId).style.display == 'none') {
			document.getElementById('sub-' + menuId).style.display = '';
		}
	}
}

//	menu mouse out
function menuOut(menuObj, menuId) {
	menuObj.style.cursor = 'default';
	menuObj.style.backgroundColor = '#fafafa';

	if(document.getElementById('sub-' + menuId)) {
		if(document.getElementById('sub-' + menuId).style.display == '') {
			document.getElementById('sub-' + menuId).style.display = 'none';
		}
	}
}
