//Copyright Design Solutions, All rights reserved.
//Any use without express permission from Jeff Margenau at Design Solutions is expressly prohibited.For inquiries, contact Jeff Margenau at j@xmlo.com, 920-568-3468 or by writing Jeff Margenau c/o Design Solutions, 1016 Heth, Fort Atkinson, WI 53538-1216

var de = navigator.userAgent.toLowerCase()
var mo=(de.indexOf("mozilla/")!=-1)?1:0
mt=0;if(mo){x=de.indexOf(" ")+1;mt=Number(de.substring(8,x))}
var opera=(de.indexOf("opera")!=-1)?1:0
var ns=(navigator.appName == 'Netscape' && !opera)
var mv=0;ie=de.indexOf('msie ');if(ie!=-1)mv=Number(de.substring(ie+5,ie+8))
var DOM1=document.layers?1:0
var DOM2=document.all?1:0
var DOM3=document.getElementById && !document.all?1:0
var s0=DOM1?'hide':'hidden'
var s1=DOM1?'show':'visible'
var n4=(ns && DOM1 && !opera)? 1:0
var sn=n4?'4':'';if(opera)sn='4'
var sns=(DOM2)?'':'4'
var ns5=(ns && DOM3 && !opera)?1:0
var wh=0
var eu=''
var howQuick = 70;
var iWhere = 1000000;
var pval=0
var hval=0
var now = new Date();
var dd = now.getDate();var ddd=dd
var mm = now.getMonth();var mmm=mm
var yy = now.getFullYear();var yyy=yy
var dw = now.getDay()
var da
if(document.all){da=document.all} else {da=document.getElementById}
var pOs=100
var wx=0
var names = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
var d0w = new Array('S','M','T','W','T','F','S');
var dow2 = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
var days = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
var c=""
var who
var birth
var pe=new Array("","","00/00/0000",0,0,3,0,0,1,0,1,0,0,0,0,0)
var rst=false
var Forestry=null
var wbkg
var wfade
var dc=document.personal
var imgnum
var X=0
var Y=0
var cpy='Copyright 2002-'+yy+' Design Solutions All Rights Reserved.'
function stat(){window.status=(cpy)}
stat()

function scheme(title) {
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1
        && a.getAttribute("title")) {
       a.disabled = true;
       if(a.getAttribute("title") == title) a.disabled = false;
     }
   }
}


function Jump(selItem) {
 dindex = selItem.selectedIndex
 ditem = selItem.options[dindex].value
 if (ditem != '') {
	 window.location = ditem
 }
}

N = (document.all) ? 0 : 1;
var ob;
function MD(e) {
if (N) {
ob = document.layers[e.target.name];
X=e.x;
Y=e.y;
return false;
}
else {
ob = event.srcElement.parentElement.style;
X=event.offsetX;
Y=event.offsetY;
 }
}
function MM(e) {
if (ob) {
if (N) {
ob.moveTo((e.pageX-X), (e.pageY-Y));
}
else {
ob.pixelLeft = event.clientX-X + document.body.scrollLeft;
ob.pixelTop = event.clientY-Y + document.body.scrollTop;
return false;
}
 }
}
function MU() {
ob = null;
}

//if (N) {
//document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
//}
//document.onmousedown = MD;
//document.onmousemove = MM;
//document.onmouseup = MU;

function pp(){
if(pval==0){if(hval==1){pOs=100;fadeout('help');hval=0};s(1,'person');ini();pval=1} else {pOs=100;fadeout('person');pval=0}
}

function hh(){
if(hval==0){if(pval==1){pOs=100;fadeout('person');pval=0};s(1,'help');hval=1} else {pOs=100;fadeout('help');hval=0}
}

function parse(inp){
if(inp.indexOf(",")!=-1){
esearch=inp.split(",")
document.ese.LastName.value=esearch[0]
document.ese.FirstName.value=esearch[1]
}
else if(inp.indexOf(" ")!=-1){
esearch=inp.split(" ")
document.ese.LastName.value=esearch[1]
document.ese.FirstName.value=esearch[0]
}
else{
document.ese.LastName.value=inp
document.ese.FirstName.value=""
}
}

function Initialize(){
dc=document.personal
Forestry=rC("Forestry")
if(Forestry==null)Forestry=',,00/00/0000,0,0,3,0,0,1,0,1,0,0,0,0,0'
pe=Forestry.split(",")
imgnum=pe[3]
if(pe[9]==1)imgnum=Math.round(16*Math.random())
img = new Image();img.src = "images/header-"+imgnum+".jpg";
if (document.all && pe[7]!=0) document.all('head').style.background='url(images/header-'+imgnum+'.jpg)'
if(pe[7]==2){howQuick=pe[5]*10+50;sb()}
document.all('HEA').innerHTML = "<b>Patron: </b>"+pe[0]
if(pe[6]==1){s(1,'Personality')} else {s(0,'Personality')}
if(pe[8]==1){s(1,'MBAR')} else {s(0,'MBAR')}
//if(pe[7]==3){clearTimeout(wbkg);document.all("headshow").innerHTML='<img name="SlideShow" src="images/header-1.jpg" height="95" border="0">';Nx(1)}
if(pe[10]==1){s(1,'icons')} else {s(0,'icons')}
}

function dis(d){
dc=document.personal
if(d==1){dc.rand.checked=false;pe[9]=0;dc.rand.disabled=true;dc.ss.disabled=true;dc.bkg.disabled=true}
else if(d==0)
{dc.rand.checked=false;pe[9]=0;dc.rand.disabled=true;dc.ss.disabled=false;dc.bkg.disabled=false}
else if(d==2){dc.rand.disabled=false;dc.ss.disabled=true;dc.bkg.disabled=false}
}

function ini(){
if(rst==true) pe=new Array("","","00/00/0000",0,0,3,0,0,1,0,1,0,0,0,0,0)
dc=document.personal
dc.sname.value=pe[0]
dc.email.value=pe[1]
dc.bdate.value=pe[2]
dc.bkg.selectedIndex=pe[3]
dc.abkg[pe[7]].checked=true
if(pe[7]==0 || pe[7]==1){clearTimeout(wbkg);clearTimeout(wfade)}
howQuick=pe[5]*10+50
dc.ss.selectedIndex=pe[5]
if(pe[6]==1){dc.usename.checked=true}
dc.sname.focus();dc.sname.select()
dc.smen.checked=(pe[8]==1)?true:false
dc.rand.checked=(pe[9]==1)?true:false
dc.icon.checked=(pe[10]==1)?true:false
if(pe[7]==0){document.all('head').style.background='#fff';dis(1);clearTimeout(wbkg);clearTimeout(wfade);}
else if (pe[7]==1){dis(2)}
else if (pe[7]==2){dis(0)}
//if(pe[7]==3){clearTimeout(wbkg);document.all("headshow").innerHTML='<img name="SlideShow" src="images/header-1.jpg" height="95" border="0">';Nx(1)}
}

function change(w){
if(w==7 || w==3 || w==99){
img = new Image();img.src = "images/header-"+pe[3]+".jpg";
if(pe[10]==1){s(1,'icons')} else {s(0,'icons')}
if(pe[7]==1){clearTimeout(wbkg);clearTimeout(wfade)}
if(pe[7]==0 || w==99){clearTimeout(wbkg);clearTimeout(wfade);document.all('head').style.background='#fff'}
if(pe[7]==2){howQuick=pe[5]*10+50;clearTimeout(wbkg);clearTimeout(wfade);sb()}
if (document.all && pe[7]==1 || pe[7]==2){document.all('head').style.background='url(images/header-'+pe[3]+'.jpg)'}
//if(pe[7]==3){clearTimeout(wbkg);document.all("headshow").innerHTML='<img name="SlideShow" src="images/header-1.jpg" height="95" border="0">';s(1,'headshow');Nx(1)}
}
else if(w==0 || w==6){document.all('HEA').innerHTML = "<b>User: </b>"+pe[0]
if(pe[6]==1){s(1,'Personality')} else {s(0,'Personality')}}
else if (w==8){if(pe[8]==1){s(1,'MBAR')} else {s(0,'MBAR')}}
else if (w==10){if(pe[10]==1){s(1,'icons')} else {s(0,'icons')}}
}


function cC(name,value,days){
if (days){
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString()}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}

function rC(name){
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++)	{
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length)}
return null
}

function eC(name)
{cC(name,"",-1)}

//function Nx(X){
//if(X==11)X=1
//img = new Image();
//img.src = "images/header-"+(X)+".jpg";
//ix='<img name="SlideShow" src="images/header-'+X+'.jpg" border="0">'
//ix2='images/header-'+(X)+'.jpg'
//runSlideShow(ix2)
//X++
//wfade=setTimeout("Nx("+X+")",5000);
//}

function runSlideShow(ix2) {
if (document.all) {
document.images.SlideShow.style.filter="blendTrans(duration=2)";
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShow.filters.blendTrans.Apply();
}
document.images.SlideShow.src = ix2;
if (document.all) {
document.images.SlideShow.filters.blendTrans.Play();
}
}

engineurl = new Array("http://google.com/search?q=","","http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=","http://www.m-w.com/cgi-bin/thesaurus?book=Thesaurus&va=","http://wunderground.com/cgi-bin/findweather/getForecast?query=","http://www.altavista.com/web/results?itag=wrx&q=","http://search.yahoo.com/search?p=")
stxt = new Array("Google","Internet","Dictionary","Thesaurus","Weather","Alta Vista","Yahoo");stx=new Array("g","b","d","t","w","a","y")

function dS(q) {ty=q==1?'Browse ':'Search ';wh=q;document.sq.sqs.value=ty+stxt[wh];document.sq.sqz.value='';document.sq.sqz.focus();eu=engineurl[q]}


function Ds(inp){
if(inp!=null){wn=Math.round(Math.random()*100)
x=(screen.width*0.9);var y=(screen.height*0.7);
if (wh == 1) {var cx=inp.substring(0,4);if(cx != 'http'){inp='http://'+inp}}
if(DOM1)inp=inp.replace(/ /g,'+')
url=eu+inp;document.sq.sqz.focus()
window.open(url,wh+wn,'width='+x+',height='+y+',toolbar=1,directories=1,menubar=1,status=1,resizable=1,location=1,scrollbars=1,copyhistory=1,left=0,top=0,border=0')
}}


function hidem(which){
//iw=0
//pOs=100;fadeout('help');hval=0
//s(1,'box'+which)
//while (iw < 2){
//if (iw != which)s(0,'box'+iw)
//iw++
//}
}

function s(y,z) {
x=y?s1:s0
hv(x,z)
}
function hv(x,y) {
if (DOM3){la = document.getElementById(y);la.style.visibility = x}
else if (DOM1)document.layers[y].visibility = x
else if (DOM2)document.all[y].style.visibility = x
}

function moveIt(id,x) 
{
var supported = (document.getElementById); 
if (!supported) return; 
var divPath = document.getElementById(id); 
var currPos = parseInt(divPath.style.top); 
if (currPos >= x) 
{currPos -= 1; 
divPath.style.top = currPos; 
setTimeout("moveIt('" + id + "'," + x+ ")",10); 
} 
} 


function sb(){
if (DOM2){
 iWhere = iWhere - 1;
 if (iWhere < 0) iWhere = 1000000;
 document.all["head"].style.backgroundPosition = iWhere + " 0";
 wbkg=setTimeout("sb()",howQuick);
}
}

function fadeout(which){
pOs=pOs-34
wx++;whicher=which
wone=which+wx
if(pOs >= 0){da(which).filters.alpha.opacity=pOs
wone=setTimeout("fadeout(whicher)",2)}
if(pOs <= 0){pOs=0;clearTimeout(wone);s(0,which);document.all(which).filters.alpha.opacity=100}
}


function go(wh) {
if(wh=='list'){wh='this.list'}
if(wh=='list2'){wh='this.list2'}
sel = wh.selectedIndex
u=wh[sel].value
if(sel==0){return}
mw(u);wh.selectedIndex=0
}

var kjh=new Date()
var day2=kjh.getDay()

function getthedate(){
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
var dn="AM"
if(day2!=day && seconds >=2){day2=day;now = new Date();dd=now.getDate();dw=now.getDay();mm=now.getMonth();yy=now.getFullYear();yyy=yy;ddd=dd;mmm=mm}
if (hours>=12)
dn="PM"
if (hours>12){
hours=hours-12
}
{
 d = new Date();
 Time24H = new Date();
 Time24H.setTime(d.getTime() + (d.getTimezoneOffset()*60000) + 3600000);
 InternetTime = Math.round((Time24H.getHours()*60+Time24H.getMinutes()) / 1.44);
 if (InternetTime < 10) InternetTime = '00'+InternetTime;
 else if (InternetTime < 100) InternetTime = '0'+InternetTime;
}

if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
var cdate
cdate=" <b>"+dow2[day]+"</b>, "+names[month]+" "+daym+" "+year+" &nbsp; "+hours+":"+minutes+":"+seconds+" "+dn+" &nbsp;"
if (document.all)
document.all.clock2.innerHTML=cdate
else if (document.getElementById)
document.getElementById("clock2").innerHTML=cdate
else
document.write(cdate)
}

function mw(u){
swi=Math.round((screen.width*0.9))
she=Math.round((screen.height*0.9))
windowX = Math.round(((screen.width/2)-(swi/2))) 
windowY = Math.round(((screen.height/2)-(she/2)))
wn=Math.round(Math.random()*100);nw=open(u, wn,"toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,width="+swi+",height="+she+",left="+windowX+",top="+windowY)}


function goforit(){
if (document.all||document.getElementById)setInterval("getthedate()",1000)}

var wincount=1;

function mwi(u,x,y,sc,opt,name){
wn=name==null?Math.round(Math.random()*100):name
if(sc==null)sc=1
if(opt==null)opt=1
window.open(u,wn,'width='+x+',height='+y+',toolbar='+opt+',directories='+opt+',menubar='+opt+',status='+opt+',resizable=1,location='+opt+',scrollbars='+sc+',copyhistory='+opt)
}

function Browser() {
var ua, s, i;
this.isIE= false;
this.isOP= false;
this.isNS= false;
this.version = null;
ua = navigator.userAgent;
s = "Opera";
if ((i = ua.indexOf(s)) >= 0) {
this.isOP = true;
this.version = parseFloat(ua.substr(i + s.length));
return;
}

s = "Netscape6/";
if ((i = ua.indexOf(s)) >= 0) {
this.isNS = true;
this.version = parseFloat(ua.substr(i + s.length));
return;
}

// Treat any other "Gecko" browser as Netscape 6.1.
s = "Gecko";
if ((i = ua.indexOf(s)) >= 0) {
this.isNS = true;
this.version = 6.1;
return;
}

s = "MSIE";
if ((i = ua.indexOf(s))) {
this.isIE = true;
this.version = parseFloat(ua.substr(i + s.length));
return;
}
}

var browser = new Browser();
var activeButton = null;

function buttonClick(event, menuId) {
var button;
if (browser.isIE)
button = window.event.srcElement;
else
button = event.currentTarget;
button.blur();
if (button.menu == null) {
button.menu = document.getElementById(menuId);
if (button.menu.isInitialized == null)
menuInit(button.menu);
}
if (button.onmouseout == null)
button.onmouseout = buttonOrMenuMouseout;
if (button == activeButton)
return false;
if (activeButton != null)
resetButton(activeButton);
if (button != activeButton) {
depressButton(button);
activeButton = button;
}
else
activeButton = null;
return false;
}

function buttonMouseover(event, menuId) {
var button;
if (activeButton == null) {
buttonClick(event, menuId);
return;
}

if (browser.isIE)
button = window.event.srcElement;
else
button = event.currentTarget;

if (activeButton != null && activeButton != button)
buttonClick(event, menuId);
}

function depressButton(button) {
var x, y;
button.className += " menuButtonActive";
if (button.onmouseout == null)
button.onmouseout = buttonOrMenuMouseout;
if (button.menu.onmouseout == null)
button.menu.onmouseout = buttonOrMenuMouseout;
x = getPageOffsetLeft(button);
y = getPageOffsetTop(button) + button.offsetHeight;
if (browser.isIE) {
x += button.offsetParent.clientLeft;
y += button.offsetParent.clientTop;
}

button.menu.style.left = x + "px";
button.menu.style.top= y + "px";
button.menu.style.visibility = "visible";
}

function resetButton(button) {
removeClassName(button, "menuButtonActive");
if (button.menu != null) {
closeSubMenu(button.menu);
button.menu.style.visibility = "hidden";
}
}


function menuMouseover(event) {
var menu;
if (browser.isIE)
menu = getContainerWith(window.event.srcElement, "DIV", "menu");
else
menu = event.currentTarget;
if (menu.activeItem != null)
closeSubMenu(menu);
}

function menuItemMouseover(event, menuId) {
var item, menu, x, y;
if (browser.isIE)
item = getContainerWith(window.event.srcElement, "A", "menuItem");
else
item = event.currentTarget;
menu = getContainerWith(item, "DIV", "menu");
if (menu.activeItem != null)
closeSubMenu(menu);
menu.activeItem = item;
item.className += " menuItemHighlight";
if (item.subMenu == null) {
item.subMenu = document.getElementById(menuId);
if (item.subMenu.isInitialized == null)
menuInit(item.subMenu);
}


if (item.subMenu.onmouseout == null)
item.subMenu.onmouseout = buttonOrMenuMouseout;
x = getPageOffsetLeft(item) + item.offsetWidth;
y = getPageOffsetTop(item);
var maxX, maxY;
if (browser.isIE) {
maxX = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) +
(document.documentElement.clientWidth != 0 ? document.documentElement.clientWidth : document.body.clientWidth);
maxY = Math.max(document.documentElement.scrollTop, document.body.scrollTop) +
(document.documentElement.clientHeight != 0 ? document.documentElement.clientHeight : document.body.clientHeight);
}
if (browser.isOP) {
maxX = document.documentElement.scrollLeft + window.innerWidth;
maxY = document.documentElement.scrollTop+ window.innerHeight;
}
if (browser.isNS) {
maxX = window.scrollX + window.innerWidth;
maxY = window.scrollY + window.innerHeight;
}
maxX -= item.subMenu.offsetWidth;
maxY -= item.subMenu.offsetHeight;
if (x > maxX)
x = Math.max(0, x - item.offsetWidth - item.subMenu.offsetWidth
+ (menu.offsetWidth - item.offsetWidth));
y = Math.max(0, Math.min(y, maxY));
item.subMenu.style.left = x + "px";
item.subMenu.style.top= y + "px";
item.subMenu.style.visibility = "visible";
if (browser.isIE)
window.event.cancelBubble = true;
else
event.stopPropagation();
}

function closeSubMenu(menu) {
if (menu == null || menu.activeItem == null)
return;
if (menu.activeItem.subMenu != null) {
closeSubMenu(menu.activeItem.subMenu);
menu.activeItem.subMenu.style.visibility = "hidden";
menu.activeItem.subMenu = null;
}
removeClassName(menu.activeItem, "menuItemHighlight");
menu.activeItem = null;
}

function buttonOrMenuMouseout(event) {
var el;
if (activeButton == null)
return;
if (browser.isIE)
el = window.event.toElement;
else if (event.relatedTarget != null)
el = (event.relatedTarget.tagName ? event.relatedTarget : event.relatedTarget.parentNode);
if (getContainerWith(el, "DIV", "menu") == null) {
resetButton(activeButton);
activeButton = null;
}
}

function menuInit(menu) {
var itemList, spanList;
var textEl, arrowEl;
var itemWidth;
var w, dw;
var i, j;
if (browser.isIE) {
menu.style.lineHeight = "2.5ex";
spanList = menu.getElementsByTagName("SPAN");
for (i = 0; i < spanList.length; i++)
if (hasClassName(spanList[i], "menuItemArrow")) {
spanList[i].style.fontFamily = "Webdings";
spanList[i].firstChild.nodeValue = "4";
}
}
itemList = menu.getElementsByTagName("A");
if (itemList.length > 0)
itemWidth = itemList[0].offsetWidth;
else
return;
for (i = 0; i < itemList.length; i++) {
spanList = itemList[i].getElementsByTagName("SPAN");
textEl= null;
arrowEl = null;
for (j = 0; j < spanList.length; j++) {
if (hasClassName(spanList[j], "menuItemText"))
textEl = spanList[j];
if (hasClassName(spanList[j], "menuItemArrow"))
arrowEl = spanList[j];
}
if (textEl != null && arrowEl != null) {
textEl.style.paddingRight = (itemWidth 
- (textEl.offsetWidth + arrowEl.offsetWidth)) + "px";
if (browser.isOP)
arrowEl.style.marginRight = "0px";
}
}

if (browser.isIE) {
w = itemList[0].offsetWidth;
itemList[0].style.width = w + "px";
dw = itemList[0].offsetWidth - w;
w -= dw;
itemList[0].style.width = w + "px";
}
menu.isInitialized = true;
}

function getContainerWith(node, tagName, className) {
while (node != null) {
if (node.tagName != null && node.tagName == tagName &&
hasClassName(node, className))
return node;
node = node.parentNode;
}
return node;
}

function hasClassName(el, name) {
var i, list;
list = el.className.split(" ");
for (i = 0; i < list.length; i++)
if (list[i] == name)
return true;
return false;
}

function removeClassName(el, name) {
var i, curList, newList;
if (el.className == null)
return;
newList = new Array();
curList = el.className.split(" ");
for (i = 0; i < curList.length; i++)
if (curList[i] != name)
newList.push(curList[i]);
el.className = newList.join(" ");
}

function getPageOffsetLeft(el) {
var x;
x = el.offsetLeft;
if (el.offsetParent != null)
x += getPageOffsetLeft(el.offsetParent);
return x;
}

function getPageOffsetTop(el) {
var y;
y = el.offsetTop;
if (el.offsetParent != null)
y += getPageOffsetTop(el.offsetParent);
return y;
}
