// DigitalArtifact.Net - digiart.js
// Version 1.7 - 1 September 2005
// By Patrick Khoo

// ---------------------------------------------------------------------------- 
// General Functions

// Break out of someone else's Frame(s)
// if (window != window.top) { top.location.href = location.href; }

// Find out if you are in IE or Netscape
// var uagent=navigator.userAgent;
// var IE=0;
// if (uagent.indexOf("MSIE") > 0) { IE=1; }

// ---------------------------------------------------------------------------- 
// Global Variables

// Variables used by Scroller
var y=0;
var lasty=0;
var hop=0;

// Variables used by No Right Click
var norcmsg="Right-click Function Disabled!";


// ---------------------------------------------------------------------------- 
// DA International Jump Selector
function DA_selectgo() {    // Quick Jump Box
	var selhost = document.DAQJ.DAQJSelect.options[document.DAQJ.DAQJSelect.selectedIndex].value;
	window.location.hostname = selhost;
	}

function DA_printselgo() {   // Print Select Menu
	document.writeln('<form name="DAQJ" action="#">');
	document.writeln('International: <select name="DAQJSelect" size="1" width="15" onchange="DA_selectgo()">');
	document.writeln('<option selected="selected" value="www.datasaver.biz">English</option>');
	document.writeln('<option value="www.datasaver-japan.com">日本語</option>');
	document.writeln('</select></form>');
	}


// ---------------------------------------------------------------------------- 
// Print Current Date / Time
function printdate() {
	var curdate = new Date();
	document.writeln(curdate.toGMTString());
	}


// ---------------------------------------------------------------------------- 
// Document Scroller
function scroller(stime) {
	if (stime < 1) { hop = 0; }  // No scrolling

	if (hop > 0) {  // Scrolling On
		if (IE==1) { y = document.body.scrollTop + 1; } else { y = window.pageYOffset + 2; }
		window.scroll(0,y);
		setTimeout("scroller(" + stime + ")", stime); 
		} else {
		document.scrform.scrsel.options[0].selected=1;  
		}
	return true;
	}

function printscroller() {
	document.writeln('<form name="scrform"><font size=-2>');
	document.writeln('Scroll Speed: <select name="scrsel" onChange="window.scroll(0,lasty); hop=1; scroller(this.options[this.selectedIndex].value); return true;" onBlur="lasty=y; scroller(0); return true;">');
	document.writeln('<option value="0">No Scrolling');
	document.writeln('<option value="10">Scroll Very Fast');
	document.writeln('<option value="25">Fast Scroll');
	document.writeln('<option value="50">Medium Scroll');
	document.writeln('<option value="100">Slow Scroll');
	document.writeln('<option value="150">Very Slow Scroll');
	document.writeln('<option value="200">Even Slower');
	document.writeln('<option value="500">Slowest');
	document.writeln('</select>');
	document.writeln('</font></form>');
	document.scrform.scrsel.options[0].selected=1;
	return true;
	}

function vidwin(fn) {   // Open a new window for Video Tutorials
	var url="/support/video/";
	url += fn;
	newwinname = window.open(url,"DAW","status=0,width=820,height=630,scrollbars=0");
}

function jswebmail(mytoname,mytoemail) {    // Webmail in Window
	var url = "/cgi-bin/webmail.cgi?g=win&toname=";
	url += mytoname;
	url += "&toemail=";
	url += mytoemail;
	newwinname = window.open(url,"DAW","status=0,width=650,height=560,scrollbars=1");
	}

function jsoutput(myt,myfile) {    // Display File or Image
	var url = "/cgi-bin/output.cgi?g=win&t=";
	url += myt;
	url += "&file=";
	url += myfile;
	newwinname = window.open(url,"DAW","status=0,height=560,scrollbars=1");
	}

// ---------------------------------------------------------------------------- 
// No Right-Click Functions
function norcIE4() {   // No Right-click for IE4 and above
        if (event.button==2){
                alert(norcmsg);
                return false;
                }
        }

function norcNS4(e){   // No Right-click for NS4 and above
        if (document.layers||document.getElementById&&!document.all){
                if (e.which==2||e.which==3){
                        alert(norcmsg);
                        return false;
                        }
                }
        }

function norcactivate() {   // Activate No Right-click
	if (document.layers) {
        	document.captureEvents(Event.MOUSEDOWN);
	        document.onmousedown=norcNS4;
        	}
	        else if (document.all&&!document.getElementById) {
	        document.onmousedown=norcIE4;
        	}
	document.oncontextmenu=new Function("alert(norcmsg);return false");
	}

function norcdeactivate() {   // De-Activate No Right-click
	if (document.layers) {
        	document.captureEvents(Event.MOUSEDOWN);
	        document.onmousedown='';
        	}
	        else if (document.all&&!document.getElementById) {
	        document.onmousedown='';
        	}
	document.oncontextmenu='';
	}
