    var today = new Date();
    var day = today.getDate()+1;
    var month = today.getMonth() + 1;
    var year  = y2k(today.getYear());
    var whichFormField;
    var popupCalendar;
    var cartclicked = 0;

    var timerid     = null;
    var matchString = "";
    var mseconds    = 1000;	// Length of time before search string is reset
	
function doClose(){
    window.opener.top.mainFrame.location.reload(true);
    window.opener.top.leftframe.location.reload(true);
    window.close();
    }	

function UpdateCart(){
    if (cartclicked == 0)
        {if (top.mainFrame.document.forms.length > 0)
            {top.mainFrame.document.Catalog.submit();
            cartclicked = 1
            }
        }
	else
	    alert ('Please Wait. The System Is Updating Your Order')
    }         
function refreshcart(){
    if (top.bottomframe.document.forms.length > 0)
        {top.bottomframe.document.ShoppingCart.submit();
        }
    }         
function PrintPage(){
    top.mainFrame.focus(); 
    top.mainFrame.print();
    }
    
function redirect(strNewURL) {
    top.window.location=strNewURL;
    }

function OpenNewWindow(winURL){
    var winWidth = 500
    var winHeight = 400
    var winLeft = (screen.width-winWidth)/2
    var winTop = (screen.height-winHeight)/2
    var winProperties='height='+winHeight+',width='+winWidth+',top='+winTop+',left='+winLeft+',resizable,scrollbars'
    Z=window.open (winURL, 'Z',winProperties); 
    if (parseInt(navigator.appVersion) >=5) {Z.focus();}
    }

function ShowWait(winURL){
    var winWidth = 400
    var winHeight = 250
    var winLeft = (screen.width-winWidth)/2
    var winTop = (screen.height-winHeight)/2
    var winProperties='height='+winHeight+',width='+winWidth+',top='+winTop+',left='+winLeft+',resizable=no,scrollbars=no'
    Z=window.open (winURL, 'Z',winProperties); 
    if (parseInt(navigator.appVersion) >=4) {Z.focus();}
    }

function SetFocusOnLoad(){
    //if (top.window.frames(0).length > 0){
    //    if (top.mainFrame.document.forms.length > 0){
            {top.mainFrame.document[0].elements[0].focus();}
     
    //    }
    }
function ShowCalendar(field) {
    var winWidth = 350
    var winHeight = 270
    var winLeft = (screen.width-winWidth)/2
    var winTop = (screen.height-winHeight)/2
    var winProperties='height='+winHeight+',width='+winWidth+',top='+winTop+',left='+winLeft+',resizable=no,scrollbars=no'
    whichFormField = field;
    if (field.value.length == 10) {
        var month = field.value.substring(0,2) - 0;
        var day  = field.value.substring(3,5) - 0;
        var year  = field.value.substring(6,10) - 0;
        }
    popupCalendar=window.open ('../Calendar/cal.htm', 'myname',winProperties); 
    if (popupCalendar.opener == null){
        popupCalendar.opener = self;
        popupCalendar.focus();
        }
    }

function y2k(num) {
    return (num < 1000) ? num + 1900 : num;
    }



var timerid     = null;
var matchString = "";
var mseconds    = 1000;	// Length of time before search string is reset

function TypenFind(keyCode,targ){
    keyVal      = String.fromCharCode(keyCode); // Convert ASCII Code to a string
    matchString = matchString + keyVal; // Add to previously typed characters
    elementCnt  = targ.length - 1;	// Calculate length of array -1
    for (i = elementCnt; i > 0; i--){
        selectText = targ.options[i].text.toLowerCase(); // convert text in SELECT to lower case
        if (selectText.substr(0,matchString.length) == 	matchString.toLowerCase()){
            targ.options[i].selected = true; // Make the relevant OPTION selected
        }
    }
    clearTimeout(timerid); // Clear the timeout
    timerid = setTimeout('matchString = ""',mseconds); // Set a new timeout to reset the key press string
    return false; // to prevent IE from doing its own highlight switching
    }

function CloseOpenWindow(){    // close pop-up window if it is open 
if (navigator.appName != "Microsoft Internet Explorer" || parseInt(navigator.appVersion) >=4) //do not close if early IE
  if(popWin != null) if(!popWin.closed) popWin.close() 
}

// Deletes an item from the list.
function deleteFromDestList() {
	var parentList  = window.document.forms[0].parentList;
	var len = parentList.options.length;
	for(var i = (len-1); i >= 0; i--) 
		{
		if ((parentList.options[i] != null) && (parentList.options[i].selected == true))
		    {
		    parentList.options[i] = null;
		    }
	}
	if (parentList.options[0] != null){
	    parentList.options[0].selected = true
	}
}

// Moves an item in the list.
function move(index,to) {
	var list = window.document.forms[0].parentList;
	var total = list.options.length-1;
	if (index == -1) return false;
	if (to == +1 && index == total) return false;
	if (to == -1 && index == 0) return false;
	var items = new Array;
	var values = new Array;
	for (i = total; i >= 0; i--) 
		{
		items[i] = list.options[i].text;
		values[i] = list.options[i].value;
		}
	for (i = total; i >= 0; i--) 
		{
		if (index == i) 
			{
			list.options[i + to] = new Option(items[i],values[i + to], 0, 1);
			list.options[i] = new Option(items[i + to], values[i]);
			i--;
			}
		else 
			{
			list.options[i] = new Option(items[i], values[i]);
			}
	}
	list.focus();
}

function submitForm() {
	var list = window.document.forms[0].parentList;
	var theList = "&";
	for (i = 0; i <= list.options.length-1; i++) 
		{ 
		theList += "list" + i + "=" + list.options[i].text;
		// a "&" only BETWEEN the items, so not at the end
		if (i != list.options.length-1) theList += "&";
	}
	//alert(location.href + theList);
	window.document.forms[0].action = location.href + theList;
}



function pad(num, size) {
  num = '' + num;
  while (num.length < size) num = '0' + num;
  return num;
}

function restart() {
  whichFormField.value = '' + pad(month, 2) +
    '/' + pad(day, 2) + '/' + year;

  popupCalendar.close();
}


var expDays = 30;
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function getCookieVal (offset) {  
	var endstr = document.cookie.indexOf (";", offset);  
	if (endstr == -1)    
		endstr = document.cookie.length;  
		return unescape(document.cookie.substring(offset, endstr));
	}
	
function GetCookie (name) {  
var arg = name + "=";  
var alen = arg.length;  
var clen = document.cookie.length;  
var i = 0;  
	while (i < clen) {    
		var j = i + alen;    
		if (document.cookie.substring(i, j) == arg)      
			return getCookieVal (j); 
		i = document.cookie.indexOf(" ", i) + 1;    
		if (i == 0) break;   
		}  
		return null;
	}
	
function SetCookie (name, value) { 

var argc = SetCookie.arguments.length;  
var expires = exp;
//var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;  
var domain = (argc > 4) ? argv[4] : null;  
var secure = (argc > 5) ? argv[5] : false;  
document.cookie = name + "=" + escape (value) + 
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
("; path=") +  
((domain == null) ? "" : ("; domain=" + domain)) +    
((secure == true) ? "; secure" : "");
alert('This is now your Start Page');
//alert(name + ' was set to ' + value);
}

function DeleteCookie (name) {  
var exp = new Date();  
exp.setTime (exp.getTime() - 1);  
var cval = GetCookie (name);  
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}











