
/**
 *	PURPLEFINDER POPUP
 */
function purplefinder() {
	finderwin = window.open("finder_popup.php","positionfinder","width=790,height=590,toolbar=no,location=no,scrollBars=yes,resizable=no")
}

/**
 *	bool gallery( string imageid )
 */
function gallery( id ) {
	var w = galimg[id][0] + 30;
	var h = galimg[id][1] + galimg[id][2] + 70;
	gallerywin = window.open("presentfleet_gallery_popup.htm?" + id,"gallery","width=" + w+ ",height=" + h + ",toolbar=no,location=no,scrollBars=no")
	return true;
}

/**
 *	MENU
 */
var divsready = false;
var menus = new Array( "01", "02", "03", "04" );
var hassub = new Array( true, true, true, true );
var menu_offset = new Array( 23, 8, 10, 0 );
var divs = new Array();
var divsbtn = new Array();
var divmenu = false;
var tmr = new Array();
var isover = false;
var timeron;

function initDivs() {
	if( bw ) {
		for( var i = 0; i < menus.length; i++ ) {
			if( hassub[i] ) {
				divs[i] = new cDiv( "menu" +  menus[i] );
				divs[i].vis(0);
			}
		}
		divsready = true;
		fixns4();
	} else {
		window.setTimeout( "initDivs()", 50 );
	}
}

function showmenu( men ) {
	if( divsready ) {
		hideall();
		menuover();
		for( var i = 0; i < menus.length; i++ ) {
			if( menus[i] == men && hassub[i] ) {
				divs[i].x( anchorpos("anchor" + menus[i] ).x + menu_offset[i] );
				divs[i].vis(1);
			}
		}
	}	
}

function hideall() {
	if( divsready ) {
		for( var i = 0; i < menus.length; i++ )
			if( hassub[i] ) divs[i].vis(0);
	}
}

function menuover() {
	clearTimeout( timeron );
}
function menuout() {
	timeron = setTimeout( "hideall()", 600 );
}

/*
function elm( id ) {
	if( document.getElementById ) return document.getElementById(id);
	else if( document.all ) return document.all[id];
	else if( document.layers ) return document.layers[id ];
	else return false
}
function style( id ) {
  if( document.getElementById ) return document.getElementById( id ).style;
  else if( document.all ) return document.all(objectId).style;
  else if( document.layers ) return document.layers[objectId];
  else return false;
}
function vis( id, state ) {
	var v = ( state ) ? "visible" : "hidden";
	style(id).visibility = v;
}
*/

function getRef(i,p){
	p=!p?document:p.navigator?p.document:p;
	return ie5?p.all[i]:dom?(p.getElementById?p:p.ownerDocument).getElementById(i):ns4?p.layers[i]:null;
}

function getSty(i,p){
	var r=getRef(i,p);
	return r?ns4?r:r.style:null;
}

function anchorpos( id, p ) {
	var x=0,y=0,w=p?p:this.win;
	id=id?(id.substr?(ns4?w.document.anchors[id]:getRef(id,w)):id):p;
	if( ns4 ) {
		if( id && (id!=p) ) {
			x=id.x;
			y=id.y;
		}
		if(p) {
			x+=p.pageX;
			y+=p.pageY;
		}
	} else if (id && id.focus && ie5 && mac ) {
		id.onfocus = new Function('with(event){self.tmpX=clientX-offsetX;self.tmpY=clientY-offsetY}');
		id.focus();x=tmpX;y=tmpY;id.blur()
	} else while(id){
		x+=id.offsetLeft;
		y+=id.offsetTop;
		id=id.offsetParent
	}
	return{x:x,y:y};
}

window.onload = initDivs;