var $path = new Array();
function init() {
	var $href = window.location.href;
	$path = $href.substring($href.lastIndexOf('/') + 1, $href.lastIndexOf('.')).split('-');
}

function follow($ppathindex, $ppathvalue) {
	$path[$ppathindex] = $ppathvalue;
	$tmp = new Array();
	for ($i = 0; $i <= $ppathindex; $i++) $tmp[$i] = $path[$i];
	$path = $tmp;
	window.location.href = $path.join('-') + '.htm';
}

//windows.js

function _openWindow(pURL, pName, pFeatures) {
	//window.open(pURL, pName, pFeatures).focus();
	window.open(pURL, pName, pFeatures);
}
function _preventCaching() {
	var d = new Date();
	var s = d.getFullYear().toString();
	s += d.getMonth().toString();
	s += d.getDate().toString();
	s += d.getHours().toString();
	s += d.getMinutes().toString();
	s += d.getSeconds().toString();
	return s;
}
function _align(pWidth) {
	return (window.screen) ? Math.round((screen.availWidth - pWidth) / 2) : 0;
}
function _valign(pHeight) {
	return (window.screen) ? Math.round((screen.availHeight - pHeight) / 2) : 0;
}
function mPopup(pURL, pWidth, pHeight) {
	if (pWidth == 100) pWidth = 300;
	if (pHeight == 100) pHeight = 300;
	var features = 'fullscreen=no,';
	features += 'channelmode=no,';
	features += 'toolbar=no,';
	features += 'location=no,';
	features += 'directories=no,';
	features += 'status=no,';
	features += 'menubar=no,';
	features += 'scrollbars=yes,';
	features += 'resizable=no,';
	features += 'width=' + pWidth + ',';
	features += 'innerWidth=' + pWidth + ',';
	features += 'height=' + pHeight + ',';
	features += 'innerHeight=' + pHeight + ',';
	
	var x = _align(pWidth);
	var y = _valign(pHeight);
	
	features += 'top=' + y + ',';
	features += 'screenY=' + y + ',';
	features += 'left=' + x + ',';
	features += 'screenX=' + x;
	
	_openWindow(pURL, _preventCaching(), features);
}
function mGhostPopup(pURL) {
	var w = 300;
	var h = 300;
	var features = 'fullscreen=no,';
	features += 'channelmode=no,';
	features += 'toolbar=no,';
	features += 'location=no,';
	features += 'directories=no,';
	features += 'status=no,';
	features += 'menubar=no,';
	features += 'scrollbars=yes,';
	features += 'resizable=no,';
	features += 'width=' + w + ',';
	features += 'innerWidth=' + w + ',';
	features += 'height=' + h + ',';
	features += 'innerHeight=' + h + ',';
	
	var x = 4000;
	var y = 4000;
	
	features += 'top=' + y + ',';
	features += 'screenY=' + y + ',';
	features += 'left=' + x + ',';
	features += 'screenX=' + x;
	
	_openWindow(pURL, _preventCaching(), features);
}
function mPopupEx(pURL, pName, pWidth, pHeight) {
	if (pWidth == 100) pWidth = 300;
	if (pHeight == 100) pHeight = 300;
	var features = 'fullscreen=no,';
	features += 'channelmode=no,';
	features += 'toolbar=no,';
	features += 'location=no,';
	features += 'directories=no,';
	features += 'status=no,';
	features += 'menubar=no,';
	features += 'scrollbars=yes,';
	features += 'resizable=no,';
	features += 'width=' + pWidth + ',';
	features += 'innerWidth=' + pWidth + ',';
	features += 'height=' + pHeight + ',';
	features += 'innerHeight=' + pHeight + ',';
	
	var x = _align(pWidth);
	var y = _valign(pHeight);
	
	features += 'top=' + y + ',';
	features += 'screenY=' + y + ',';
	features += 'left=' + x + ',';
	features += 'screenX=' + x;
	
	_openWindow(pURL, pName, features);
}

function mPopupEx2(pURL, pName, pWidth, pHeight, pScrollBars) {
	if (pWidth == 100) pWidth = 300;
	if (pHeight == 100) pHeight = 300;
	var features = 'fullscreen=no,';
	features += 'channelmode=no,';
	features += 'toolbar=no,';
	features += 'location=no,';
	features += 'directories=no,';
	features += 'status=no,';
	features += 'menubar=no,';
	features += (pScrollBars) ? 'scrollbars=yes,' : 'scrollbars=no';
	features += 'resizable=no,';
	features += 'width=' + pWidth + ',';
	features += 'innerWidth=' + pWidth + ',';
	features += 'height=' + pHeight + ',';
	features += 'innerHeight=' + pHeight + ',';
	
	var x = _align(pWidth);
	var y = _valign(pHeight);
	
	features += 'top=' + y + ',';
	features += 'screenY=' + y + ',';
	features += 'left=' + x + ',';
	features += 'screenX=' + x;
	
	_openWindow(pURL, pName, features);
}

function mPopupEx3(pURL, pName, pWidth, pHeight, pResizable) {
	if (pWidth == 100) pWidth = 300;
	if (pHeight == 100) pHeight = 300;
	var features = 'fullscreen=no,';
	features += 'channelmode=no,';
	features += 'toolbar=no,';
	features += 'location=no,';
	features += 'directories=no,';
	features += 'status=no,';
	features += 'menubar=no,';
	features += 'scrollbars=yes,';
	features += (pResizable) ? 'resizable=yes,' : 'resizable=no';
	features += 'width=' + pWidth + ',';
	features += 'innerWidth=' + pWidth + ',';
	features += 'height=' + pHeight + ',';
	features += 'innerHeight=' + pHeight + ',';
	
	var x = _align(pWidth);
	var y = _valign(pHeight);
	
	features += 'top=' + y + ',';
	features += 'screenY=' + y + ',';
	features += 'left=' + x + ',';
	features += 'screenX=' + x;
	
	_openWindow(pURL, pName, features);
}

function mPopupClose() {
	window.top.close();
}

function mResize(pWindow, pWidth, pHeight) {
	var w = pWidth + 10;
	var h = pHeight + 29;
	if (navigator.userAgent.indexOf('SV1') != -1) h += 20;
	pWindow.resizeTo(w, h);
	pWindow.moveTo(_align(w), _valign(h));
}