//	JavaScript Document

//	preload images
pic = new Array();
function preLoad() {
	pic[0]  = '../guest/img/z.gif';

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

function makePopup(pageURL, pageName, w, h, pageScroll, pageCenter)
{
	var w = parseInt(w);
	var h = parseInt(h);
	if(pageCenter == 'no')	{
		LeftPosition = 10;
		TopPosition = 10;
	} else {
		LeftPosition = (screen.width) ? (screen.width-w) / 2 : 0;
		TopPosition = (screen.height) ? (screen.height-h) / 2 : 0;
	}

	var pageConfig = 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=' + pageScroll + ', resizable=yes, width=' + (w + 18) + ', height=' + (h + 18) + ', left=' + LeftPosition + ', top=' + TopPosition;
	var popup = window.open(pageURL, pageName, pageConfig);
	popup.focus();
	return popup;
}
function openNewWindow(url, w, h)
{
	w = (w==null) ? 600 : w;
	h = (h==null) ? 450 : h;
	var target = '_blank';
	var aWindow = makePopupWindow(url, target, w, h, 'yes', 'yes');
}

function makePopupWindow(pageURL, pageName, w, h, pageScroll, pageCenter)
{
	if(pageCenter == 'no')	{
		LeftPosition = 10;
		TopPosition = 10;
	} else {
		LeftPosition = (screen.width) ? (screen.width-w) / 2 : 0;
		TopPosition = (screen.height) ? (screen.height-h) / 2 : 0;
	}

	var pageConfig = 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=' + pageScroll + ', resizable=yes, width=' + (w + 18) + ', height=' + (h + 18) + ', left=' + LeftPosition + ', top=' + TopPosition;
	var popup = window.open(pageURL.replace(/&popup=[^&]*/,'')+'&popup=1', pageName, pageConfig);
	popup.focus();
	return popup;
}
function openDetail(id)
{	
	var name = "pdetail_"+id;
	$$('.productDetail').each(function(el){
			//el.myfx.hide();
			el.addClass('hidden');
	});
	$(name).removeClass('hidden');	
	//$(name).setStyle('width', '100%');
	//$(name).myfx.show();
}

function hideProductDetail()
{
	$$('.productDetail').each(function(el){
		//el.myfx = new Fx.Slide(el, {mode:'horizontal'});
		//el.myfx.hide();		
		el.addClass('hidden');
	});
	$$('.slab').each(function(el){
		//el.myfx.show();	
		el.removeClass('hidden');
	});
}
