// Copyright (c) 2003 TheyerGFX Pty Ltd 
// www.theyergfx.com


// open a new window
function open_win( url ) {
	window.open( url );
}


// go back to the home page
function go_home() {
	window.replace( 'http://www.3dkitbuilder.com/main.htm' );
}


// download a file
function xppopup() {
	window.open( 'http://www.3dkitbuilder.com/xp/popup.htm', '_blank', 'toolbar=no, directories=no, location=no, status=no, menubar=no, resizable=yes, scrollbars=yes, width=500, height=600' );
}


// download a file
function download_file( url ) {
	var link = "http://www.3dkitbuilder.com/" + url;
	window.open( link, '_blank', 'toolbar=no, directories=no, location=no, status=no, menubar=no, resizable=yes, scrollbars=no, width=300, height=100' );
	window.status = 'loading...';
}

// download a file
function open_barewin( url, width, height ) {
	window.open( url, '_blank', 'toolbar=no, directories=no, location=no, status=no, menubar=no, resizable=yes, scrollbars=no, width=' + width + ', height=' + height );
	window.status = 'loading...';
}

// download a file
function download_kit( url ) {
	var link = 'http://www.theyergfx.com/kits/3DKitBuilder_' + url + '.exe';
	window.open( link, '_blank', 'toolbar=no, directories=no, location=no, status=no, menubar=no, resizable=yes, scrollbars=no, width=500, height=420' );
}

function download_fw28( url ) {
	var link = 'http://www.3dkitbuilder.com/' + url + '/downloading.htm';
	window.open( link, '_blank', 'toolbar=no, directories=no, location=no, status=no, menubar=no, resizable=yes, scrollbars=no, width=1000, height=600' );
}

// swap to the highlighted version of the label
function highlight(e) {
	if ( e.tagName == "IMG" ) {
		var url, name, regexp;
		//window.event.srcElement.hspace = 2;
		//window.event.srcElement.vspace = 2;
		url = e.src;
		regexp = /.gif/i;
		name = url.replace(regexp,"_h.gif");
		e.src = name;
	}
}


// swap to the normal version of the label
function normal(e) {
	if ( e.tagName == "IMG" ) {
		var url, name, regexp;
		//window.event.srcElement.hspace = 0;
		//window.event.srcElement.vspace = 0;
		url = e.src;
		regexp = /_h.gif/i;
		name = url.replace(regexp,".gif");
		e.src = name;
	}
}


// this code will disable the return / enter key
function stopRKey(evt) {
	var evt  = (evt) ? evt : ((event) ? event : null);
	var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
	if ((evt.keyCode == 13) && (node.type=="text")) { return false; }
}

// add the event handler 
document.onkeypress = stopRKey;

