//---------- [one.ngn] Content Managent System --------------
//----------    created by zerophobic.com      --------------
//-----------------------------------------------------------
// MODULE	:	misc javascript
// FUNCTION	:	tools and snippets
// AUTHOR	:	brett stanley <brett@zerophobic.com>
// CREATED	:	01/10/2001
// MODIFIED	:	11/01/2002
//-----------------------------------------------------------
//-----------------------------------------------------------

//window opener
//---------------------------------------------------------------
function openWindow(file){
	window.open(file, 'image', config='width=150, height=150');
}



//Disable right click
//---------------------------------------------------------------
function right(e) {
  	var msg = "Disabled";

	if (navigator.appName == 'Netscape' && e.which == 3) {
	 	alert(msg);
	 	return false;
	}
	
	if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) {
		alert(msg);
	 	return false;
	}
  	else return true;
}

function trap() {
	// trap right click on the page
	if(document){ 
	  	document.onmousedown = right;
	   	document.onmouseup = right;
	}
	// trap right click on any images
	if(document.images){ 
	  	for(i=0;i<document.images.length;i++) {
	   		document.images[i].onmousedown = right;
	   		document.images[i].onmouseup = right;
	  	}
	}
}

//trap();


//html editor
//---------------------------------------------------------------
function bold(field) 
{
var dark=prompt('Bold text','Text');
if (dark)
	{
		field.value+=('<b>'+dark+'</b>');
	}
}

function highlight(field) 
{
var dark=prompt('highlight text','Text');
if (dark)
	{
		field.value+=('<h>'+dark+'</h>');
	}
}

function hrrule(field)
{
field.value+=('<hr>')
}

function putemotion(field,emo)
{
	field.value+=(emo);
}

function quote(field) 
{
var quotet=prompt('Quote Text','Text');
if (quotet)
	{
		field.value+=('<blockquote>'+quotet+'</blockquote>');
	}
}

function italic(field) 
{
var ital=prompt('Italicized Text','Text');
if (ital)
	{
		field.value+=('<i>'+ital+'</i>');
	}
}

function underlined(field)
{
var underline=prompt('Underlined Text','Text');
if (underline)
	{
		field.value+=('<u>'+underline+'</u>');
	}
}

function link(field) 
{
var hyper=prompt('URL for the link','http://');
var hypertwo=prompt('Text for the link','Text');
var hyperthree=prompt('Window for the link (leave empty for current window)','_blank');
if (hyper) 
	{
		field.value+=('<a href=\"'+hyper+'\" target=\"'+hyperthree+'\">'+hypertwo+'</a>');	
	}
}

function ftplink(field) 
{
var hyper=prompt('URL for the link','ftp://');
var hypertwo=prompt('Text for the link','Text');
var hyperthree=prompt('Window for the link (leave empty for current window)','_blank');
if (hyper)
	{
		field.value+=('<a href=\"'+hyper+'\" target=\"'+hyperthree+'\">'+hypertwo+'</a>');
	}
}

function securelink(field) 
{
var hyper=prompt('URL for the link','https://');
var hypertwo=prompt('Text for the link','Text');
var hyperthree=prompt('Window for the link (leave empty for current window)','_blank');
if (hyper)
	{
		field.value+=('<a href=\"'+hyper+'\" target=\"'+hyperthree+'\">'+hypertwo+'</a>');
	}
}

function emaillink(field) 
{
var emailit=prompt('Your E-Mail Address','nobody@nowhere.com');
var emailittwo=prompt('Text for the link','Text');
if (emailit)
	{
		field.value+=('<a href=\"mailto:'+emailit+'\">'+emailittwo+'</a>');
	}
}

function image(field) 
{
var img=prompt('URL for the image','');
if (img)
	{
		field.value+=('<img src=\"'+img+'\">');
	}
}

function orderedl(field)
{
field.value+=('<ol></ol>')
}

function unorderedl(field)
{
field.value+=('<ul></ul>')
}

function newlistentry(field)
{
var newentry=prompt('Text for new entry','Text')
if (newentry)
	{
		field.value+=('<li>'+newentry+'\r\n')
	}
}



//---------------------------------------------------------------
//all the stuff for the resizer
//---------------------------------------------------------------
var d = document;
var isNav = false, isNS6 = false, isIE = false;

if(d.layers) {
	isNav = true;
	var range = "";
	var styleObj = "";
	} 
else if (d.all) {
	isIE = true;
	range = "all.";
	styleObj = ".style";
	} 
else if(d.getElementById) {
	isNS6 = true;
	var range = "getElementById('";
	var styleObj = "').style";
}

//do the resize	
function erection(iw,ih) {
	if(isIE) {
		var cx = parseInt(top.document.body.clientWidth);
		var cy = parseInt(top.document.body.clientHeight);
	}
	else {
		var cx = (window.innerWidth);
		var cy = (window.innerHeight);	
	}
	var speed = 2;
	
	//resize width
	if (cx < iw-10) {
		resizeBy(((iw-cx)/speed),0);
	}
	else if(cx > iw+10) {
		resizeBy(((iw-cx)/speed),0);
	}
	else {
		resizeBy(iw-cx,0);
	}
	
	//resize height
	if (cy < ih-10) {
		resizeBy(0,((ih-cy)/speed));
	}
	else if (cy > ih+10) {
		resizeBy(0,((ih-cy)/speed));
	}
	else {
		resizeBy(0,ih-cy);
	}
	
	if((cx != iw) || (cy != ih)) {
		setTimeout('erection('+iw+','+ih+')','20');
	}
	else {
		if(isIE) {
			if(document.all)for(var i in document.links)document.links[i].onfocus=document.links[i].blur;
			hide('loadinglayer');
		}
	}
}
		
function getObject(obj) {
	var theObj = eval("document." + range + obj + styleObj);
	return theObj;
}
		

function hide(layername) {
	if(isIE)
		eval("d.all['"+layername+"'].style.visibility = 'hidden'");
	else if(isNS6) {
		eval("d.getElementById('"+layername+"').style.visibility = 'hidden'");
		}
	else {
		eval("d."+layername+".visibility = 'hide'");
		}
}

function show(layername) {
	if(isIE)
		eval("d.all['"+layername+"'].style.visibility = 'visible'");
	else if(isNS6) {
		eval("d.getElementById('"+layername+"').style.visibility = 'visible'");
		}
	else {
		eval("d."+layername+".visibility = 'show'");
	}
}