// This code developed by RestonTech and Arthur Scott.

// 'Global' variables
var licenseFile = '/license.shtml';
var licenseText = 'License=OK';
var expDate = 'August 13, 2020';
var opts = 'width=550,height=450,scrollbars=yes,resizable=yes,dependent=yes,alwaysRaised=yes';


// Check for cookie, popup license if none found
function checkLicense() {
	if (document.cookie.indexOf(licenseText) > -1) { 
		return true;
	}	
					
	else {
		showLicense();
		return false;
		}
	}

// Popup license page
function showLicense() {
	window.open(licenseFile,'_blank',opts);
	return true;
	}

// Set cookie
function setCookie() {
	var e = new Date(expDate);
//	alert("setCookie: before: "+document.cookie);
	document.cookie = licenseText + ';expires=' + e.toGMTString();
//	alert("setCookie: after: "+document.cookie);
	return true;
	}


// These were lifted from the license page
function doform(f) {
	// Check for correct input from form
	var flag = 1;
	for (i in f.required.value.split(',')) {
		if (!f[i].value) flag = 0;
		}

	// check for data, set cookies
	if (flag) {
		setCookie();
//		if (file) f.ok_url.value="http://www.inv3.com/video/" + file;
		return true;
		}
	return false;
	

	}


function DeleteCookie (name) {
	var exp = new Date();  
	exp.setTime (exp.getTime() - 1);  
	var cval = GetCookie (name);  
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
	}