
//date function
RightNow=new Date();
var themonth;
var ModelIsFocus;
var PartIsFocus;
var EmailFocus=false;
var SearchFocus=false;
var DefSearchFocus=false;

var month=RightNow.getMonth()+1;
if (month==1) themonth = "January";
if (month==2) themonth = "February";
if (month==3) themonth = "March";
if (month==4) themonth = "April";
if (month==5) themonth = "May";
if (month==6) themonth = "June";
if (month==7) themonth = "July";
if (month==8) themonth = "August";
if (month==9) themonth = "September";
if (month==10) themonth = "October";
if (month==11) themonth = "November";
if (month==12) themonth = "December";

var date=RightNow.getDate();
var year=RightNow.getYear();
var day=RightNow.getDay();
if (year==100){year="2000";}
if (year==101){year="2001";}
if (year==102){year="2002";}
if (year==103){year="2003";}
if (year==104){year="2004";}
if (year==105){year="2005";}

	function newWin(name, url, width, height, args) {
		var newWin = new Object();

		newWin.args = args;
		newWin.url = url;
		newWin.name = name;
		newWin.width = width;
		newWin.height = height;

		if (document.layers) {// browser is NN
			newWin.left = window.screenX + ((window.outerWidth - newWin.width) / 2);
			newWin.top = window.screenY + ((window.outerHeight - newWin.height) / 2);
			var attr = 'screenX=' + newWin.left + ',screenY=' + newWin.top + ',width=' + newWin.width + ',height=' + newWin.height + ',' + newWin.args;
		}
		else {// browser is MSIE
			newWin.left = (screen.width - newWin.width) / 2;
			newWin.top = (screen.height - newWin.height) / 2;
			var attr = 'left=' + newWin.left + ',top=' + newWin.top + ',resizable=yes,width=' + newWin.width + ',height=' + newWin.height + ',' + newWin.args;
		}

		newWin.win=window.open(newWin.url, newWin.name, attr);
		newWin.win.opener=self;
		newWin.win.focus();
	}
	
	//Added for the new ModelSearch&PartSearch function -- 07/04
	function Model_OnClick(bModel)
	{
		if(navigator.appName != "Netscape"){
			if(bModel == 1){
				document.all.menu_PartNum.value = ""	;		
				ModelIsFocus = true;
				PartIsFocus = false;
			}
			else
			{
				document.all.menu_ModelNum.value = ""	;		
				ModelIsFocus = false;
				PartIsFocus = true;
			}
		}
	}
	
	//Added for the new ModelSearch&PartSearch function for default page only-- 07/04
	function Model_OnClickDef(bModel)
	{
		if(navigator.appName != "Netscape"){
			if(bModel == 1){
				document.all.PartNum.value = ""	;		
				ModelIsFocus = true;
				PartIsFocus = false;
			}
			else{
				document.all.ModelNum.value = ""	;		
				ModelIsFocus = false;
				PartIsFocus = true;
			}
		}
	}	
	function val_msg()
	{
		//alert("hello")
		//alert(document.AdvancedSearch.PartNum.value);
		if (document.AdvancedSearch.ModelNum.value == "" && document.AdvancedSearch.PartNum.value == "")
		{
			if (ModelIsFocus)
				alert ("Please provide a model number, e.g. \"LAT9206BAE\".\nIf you don't know your complete model number, try entering just the beginning, e.g. \"LAT9206\".");
			else if (PartIsFocus)
				alert ("Please provide a part number, e.g. \"211125\".\nThe entire part number is required, e.g. not \"211\" but \"211125\"");
			else
				alert ("Please provide a model number or a part number");
			return false;
		}
		else
			return true;
	}	
	function CheckFrameParent()
	{
		var redirectUrl;
		var midUrl;
		var imgNum; 				
		if (top.location.href.indexOf("ModelFrames") < 0){			
			redirectUrl = top.location.href;			
			midUrl = top.location.href;			
			midUrl = midUrl.substring(midUrl.indexOf("//")+2, midUrl.length);				
			midUrl = midUrl.substring(midUrl.indexOf("/")+1, midUrl.indexOf(".aspx"));			
			redirectUrl = redirectUrl.substring(0,redirectUrl.indexOf("&Mark"));				
			redirectUrl = redirectUrl.replace(midUrl,"ModelFrames");			
			midUrl = top.location.href;				
			midUrl = midUrl.substring(midUrl.indexOf("&Mark")+6, midUrl.indexOf("&Mark")+7);				
			redirectUrl = redirectUrl + "&Mark=" + midUrl;			
			top.location.href = redirectUrl ; // top.location.href.replace("PartLists","ModelFrames");			
			//top.location.href = top.location.href.substring(0, top.location.href.indexof("Type"));
		}
	//	if(self.location.href.indexOf("PartLists") > 0)
	//	{
	//		top.contents.location.replace("/FrameImgList.aspx?ModelID=145798&ModelNum=lat1000gge&ManufactureID=1&Selected=LW13-17&Position=0&mfg=Maytag&Type=Appliance#5");
	//	}
		
	}
	
	//Added on Dec 31, 2003 for combining the search boxes
	function keyPress(key)
	{
		if (key == '13'&& (EmailFocus == true || SearchFocus == true || DefSearchFocus == true))
		{
			if(EmailFocus == true)
			{				
				document.getElementById('infobar_btn_Submit').focus();										
			}
			else if(SearchFocus == true)
			{
				document.getElementById('menu_SearchButton').focus();
			//	document.getElementById('menu_SearchButton').click();
			}
			else if(DefSearchFocus == true)
			{
				document.getElementById('ImageButton1').focus();
			//	document.getElementById('ImageButton1').click();				
			}			
		}
		else if(key == '13')
		{
			document.getElementById('ImageButton1').focus();
		}
	}
	
	function Email_OnClick()
	{
		if(navigator.appName != "Netscape"){				
			EmailFocus = true;
			SearchFocus = false;			
		}
	}
	function Search_OnClick()
	{
		if(navigator.appName != "Netscape"){				
			EmailFocus = false;
			SearchFocus = true;			
		}
	}
	function DefModelSearch_OnClick()
	{
		if(navigator.appName != "Netscape"){				
			EmailFocus = false;
			DefSearchFocus = true;			
		}
	}
	function displayDefinition()
	{		
		var definition;	
		var PartType = document.PartLocator.PartType;
		definition = PartType.options[PartType.selectedIndex].value;		
		if (definition.length == 0)
		{			
			document.getElementById("txt_ExpandedDef").innerHTML = "";
		}
		else 
		{				
			document.getElementById("txt_ExpandedDef").innerHTML = "<font color=\"AD2121\">Expanded Definition:</font><br><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">" 
			+ definition + "</font>";
		}
	}
	
	
