// JavaScript Document
// Copyright 2000-2011, DataCom/OTA, Inc.

// open window
function openFile(theFile) {
	window.open(theFile);
}

//AJAX File Request
function getFile(theFile, theDiv) {
	var pageReq = false;
	
    if (window.XMLHttpRequest) {
        pageReq = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
		try {
			pageReq = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				pageReq = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {
				pageReq = false;
			}
		}
	}
	
    pageReq.open('GET', theFile, true);
    pageReq.onreadystatechange = function() {
        if (pageReq.readyState == 4) {
			document.getElementById(theDiv).innerHTML = pageReq.responseText;
		}
    }
    pageReq.send(null);
}

//Process Forms
function postFile(theCGI, theQuery, theDiv) {
	var pageReq = false;
	
    if (window.XMLHttpRequest) {
        pageReq = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
		try {
			pageReq = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				pageReq = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {
				pageReq = false;
			}
		}
	}
	
    pageReq.open('POST', theCGI, true);
    pageReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    pageReq.onreadystatechange = function() {
        if (pageReq.readyState == 4) {
			document.getElementById(theDiv).innerHTML = pageReq.responseText;
            //updatepage(pageReq.responseText);
        }
    }
    pageReq.send(eval(theQuery)());
	document.getElementById(theDiv).innerHTML = "<h1>Sending . . . </h1>";
}

// Contact Us Form
function cu() {
    var form = document.forms['contact'];
    var fn = form.Name.value;
	var pn = form.Phone.value;
    var em = form.Email.value;
    var cm = form.Message.value;
    qstr = 'Name=' + escape(fn) + '&Phone=' + escape(pn) + '&Email=' + escape(em) + '&Message=' + escape(cm);
    return qstr;
	
}
