/*
	# Copyright (c) 2001 Dennis Dayta Systems, Inc.  
	#
	# For more information, see:
	#     http://www.dennisdayta.com/
	#
*/			


/* Image Load Function */
		
function LoadGIF(image) {
	var rollover = document.images;
	if (rollover) {
		eval (image + ' = new Image()');
		eval (image + '.src  = "/images/' + image + '.gif"');
	}
}

LoadGIF('custom_software_development_on');
LoadGIF('nav_contact_on');
LoadGIF('photo_software_on');
LoadGIF('image_viewer_free_ware_on');
LoadGIF('scanner_software_on');

/* Netscape REsize Fix */

WM_netscapeCssFixCheckIn();

function WM_netscapeCssFix() {
  /*
if (is_nav) {
    Source: Webmonkey Code Library
    (http://www.hotwired.com/webmonkey/javascript/code_library/)

    Author: Taylor
    Author Email: taylor@wired.com
    Author URL: http://www.taylor.org/
    */

  // This part was inspired by Matthew_Baird@wayfarer.com
  // It gets around another unfortunate bug whereby Netscape 
  // fires a resize event when the scrollbars pop up. This 
  // checks to make sure that the window's available size 
  // has actually changed.
  if (document.WM.WM_netscapeCssFix.initWindowWidth != window.innerWidth || document.WM.WM_netscapeCssFix.initWindowHeight != window.innerHeight) {
    document.location = document.location;
  }
}

function WM_netscapeCssFixCheckIn() {
  // This function checks to make sure the version of Netscape 
  // in use contains the bug; if so, it records the window's 
  // width and height and sets all resize events to be handled 
  // by the WM_netscapeCssFix() function.
  if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) == 4)) {
    if (typeof document.WM == 'undefined'){
      document.WM = new Object;
    }
    if (typeof document.WM.WM_scaleFont == 'undefined') {
      document.WM.WM_netscapeCssFix = new Object;
      document.WM.WM_netscapeCssFix.initWindowWidth = window.innerWidth;
      document.WM.WM_netscapeCssFix.initWindowHeight = window.innerHeight;
    }
    window.onresize = WM_netscapeCssFix;
  }
}

/*
Sign Up Form Error handling
*/
// The following is used for signup validation and error handling
	
	function nameIsBad() {
	
		//alert('name is bad');
		// alert(document.nameImage.src);
		//document.signup_img.src = "/images/is_validnameemail.gif";
		alert("Please Enter a Valid Name");
		return false;
	}
	
	function emailIsBad() {
	
		//alert('email is bad');
		// document.signup_img.src = "/images/is_validnameemail.gif";
		alert("Please Enter a Valid E-Mail Address");
		return false;
	}

	// validate the name
	function check_name(nameStr) {
		//alert(nameStr);
		if (nameStr == null || nameStr == "" || nameStr == " " || nameStr == "name") {
			nameIsBad();
			return false;
		} else {
			return true;
		}
	}
	

	
	//Email field check
//return emailCheck(emailform.email.value)"
function check_email(emailStr) {
	
	var checkTLD=0;
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	var matchArray=emailStr.match(emailPat);
	
	if (matchArray==null) {
	
	//alert("Email address seems incorrect (check @ and .'s)");
	emailIsBad();
	return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];
	
	for (i=0; i<user.length; i++) {
	if (user.charCodeAt(i)>127) {
	//alert("Email address username contains invalid characters.");
	emailIsBad();
	return false;
	   }
	}
	for (i=0; i<domain.length; i++) {
	if (domain.charCodeAt(i)>127) {
	//alert("Email address domain name contains invalid characters.");
	emailIsBad();
	return false;
	   }
	}
	
	if (user.match(userPat)==null) {
	
	//alert("Email address username doesn't seem to be valid.");
	emailIsBad();
	return false;
	}
	
	
	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {
	
	
	for (var i=1;i<=4;i++) {
	if (IPArray[i]>255) {
	//alert("Email Destination IP address is invalid!");
	emailIsBad();
	return false;
	   }
	}
	return true;
	}
	 
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) {
	if (domArr[i].search(atomPat)==-1) {
	//alert("The domain name does not seem to be valid.");
	emailIsBad();
	return false;
	   }
	}
	
	if (checkTLD && domArr[domArr.length-1].length!=2 && 
	domArr[domArr.length-1].search(knownDomsPat)==-1) {
	//alert("The address must end in a well-known domain or two letter " + "country.");
	emailIsBad();
	return false;
	}
	
	if (len<2) {
	//alert("Email address is missing a hostname!");
	emailIsBad();
	return false;
	}
	
	// If we've gotten this far, everything's valid!
	return true;
}// End Email field check

function check_form(){	
	// reset the images
	// document.signup_img.src = "/images/digital_photo_software.gif";
	// alert('check form');
	var userName = document.signup.username.value;

	var email = document.signup.email.value;
	
	// validate both name and email, and submit, if both are OK
	if (check_name(userName) && check_email(email)) document.signup.submit();
	
	return false;
} // End check_form


/*
openPrivacy()
For pricvacy policy child window */
function openPrivacy() {
var openWin = window.open("/privacy-policy.html","privacy","resizable=0,location=0,status=0,menubar=0,toolbar=0,scrollbars=1,width=450,height=400,left=0,top=0,screenX=0,screenY=0");
openWin.opener = window;

openWin.focus();
}


/*
** msi_copyright.js
** Version: 004 -- 06.22.00
*/

function include_copyright(startyear) {
	var	blob="";
	var msistartyear = 1996;
	var	today=new Date(); 
	var	thisyear = get_full_year(today);
	if (startyear < thisyear && startyear >= msistartyear) {
		blob += startyear + " - ";
	}
	blob += thisyear;
	blob = "&copy; " + thisyear + " Dennis Dayta Systems Inc.  All rights reserved.";
	return blob;
}

/* 
** subroutine: get_full_year
** param1: d -> date.  any date object.
*/
function get_full_year(d) { // d is a date object
	yr = d.getYear();
	if (yr < 1000) {
	 	yr+=1900;
	}
	return yr;
}
