////////////////////////////////////////////////////////////////////////////////////
//  DateMaker1.0  - Please leave the following
//
//  Created By Sanjay Mehrotra (smehrotra@truefitsolutions.com)  Last modified 2000-02-27.
//	Modified By Rick Grande (rgrande@truefitsolutions.com)  modified 11/17/2000
//
//
//  To find out what you may do and not, see the Artistic License at:
//  http://www.opensource.org/licenses/artistic-license.html
//  If you are uncertain about something, please contact rgrande@truefitsolutions.com
//  Note that the Artistic License is not the final license for this script,
//  consider it as a guide as to what you may do.
////////////////////////////////////////////////////////////////////////////////////


function popWin(WinInfo) {
//opens the parts w/ forecasts window
	
	var URL = WinInfo.substring (0,WinInfo.indexOf([,]) );
	var WinName = WinInfo.substring ( (WinInfo.indexOf([,])+1),WinInfo.length);
			
			{
			var link = securebaseRef + URL;
			}
         subwindow = window.open(link ,WinName,"width=450,height=530,resizable=yes,location=0,status=0,menubar=0,scrollbars=yes,fullscreen=0");
         subwindow.focus() 
    }
         



function MakeArray(n)
 {
	this.length = n
	return this
	
}
	
monthNames = new MakeArray(12)
monthNames[1] = "Jan"
monthNames[2] = "Feb"	
monthNames[3] = "March"	
monthNames[4] = "April"	
monthNames[5] = "May"	
monthNames[6] = "June"	
monthNames[7] = "July"	
monthNames[8] = "August"	
monthNames[9] = "Sep"	
monthNames[10] = "October"	
monthNames[11] = "November"	
monthNames[12] = "December"


dayNames = new MakeArray(7)
dayNames[1] = "Sunday"
dayNames[2] = "Monday"	
dayNames[3] = "Tuesday"	
dayNames[4] = "Wednesday"	
dayNames[5] = "Thursday"	
dayNames[6] = "Friday"	
dayNames[7] = "Saturday"		



function customDateString(OneDate)
{
	var theDay = dayNames[OneDate.getDay() + 1];
	var theMonth = monthNames[OneDate.getMonth() + 1];
	
	if (navigator.appName == "Netscape")
		var theYear = OneDate.getYear() + 1900;
	else
		var theYear = OneDate.getYear();
		
	return theDay + ", " + theMonth + " " + OneDate.getDate() + ", " + theYear;
}

var nwidth, nheight;
var newWindow = null;
var newWishListWindow = null;
var EditWishListWindow = null;
var link;
var windowHandle = null;


function open_window(url, nwidth, nheight)
{
	if (!newWindow)
		{
		newWindow = null;	
		}	
	else
		{
		if (newWindow || newWindow.location.href !== url)	
		{
			newWindow.close();
			newWindow = null;
		}	
		}	
	
	if (!newWindow ||newWindow.closed)
	{ 
		newWindow = window.open(url, "win", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width='+nwidth +',height='+nheight);
		windowHandle = newWindow;
		newWindow.focus();
	}
	else
	{
		newWindow.focus();
	}
}

function open_window2(sPartID,sLink){	
	link = baseRef +"ShoppingCart/Cart_WishlistWindow.asp?Link="+ sLink +"&PartID="+sPartID;
	if (!newWishListWindow ||newWishListWindow.closed)
	{ 
		newWishListWindow = window.open(link, "win2", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width= 370,height= 350');
	}
	else
	{
		newWishListWindow.focus();
	}
}
function open_window3(sPage,sPartID){	
	if (sPage == 'Add') 
		link = baseRef +"ShoppingCart/EditWishList.asp?Link=Add&PartID="+sPartID;
	else
		link = baseRef +"ShoppingCart/EditWishList.asp?Link=Edit&PartID="+sPartID;
		
	if (!EditWishListWindow ||EditWishListWindow.closed)
	{ 
		EditWishListWindow = window.open(link, "win2", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width= 370,height= 350');
	}
	else
	{
		EditWishListWindow.focus();
	}
}

function move_in(img_name,img_src) {
document[img_name].src=img_src;
}

function move_out(img_name,img_src) {
document[img_name].src=img_src;
}


function validate_email(sEmail)
{

	 var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; //not valid
     var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; //valid
	 if (!reg1.test(sEmail.value) && reg2.test(sEmail.value)) 
       {
		return true;
       }
     else
       { 
        return false;
       }
}