
	function openSearch(){
		self.name = "main";
		var newWin = window.open('/search/ns.htm','help','status=no,resizable=yes,width=640,height=405');		
	}
	
// Search run when user presses enter while in the input box
	function runSearch() {
		if (window.event.keyCode == 13) {
			openSearch();
		}
	}

	function openNewWindow(url,name,left,top) {
 			popupWin = window.open(url, 
   		name,
   		'menubar,toolbar=0,location,directories=0,status=0,scrollbars,resizable,dependent,width=500,height=500,left=' + left + ',top=' + top)
	}
	
	function openEmailWindow(url,name,left,top) {
 			popupWin = window.open(url, 
   		name,
   		'menubar,toolbar=0,location,directories=0,status=0,scrollbars,resizable,dependent,width=700,height=500,left=' + left + ',top=' + top)
	}

	function displayddlipaper() {
		if (document.wpaper.ddlipaper.selectedIndex > 0) {
			url = document.wpaper.ddlipaper[document.wpaper.ddlipaper.selectedIndex].value;
			properties = "toolbar=0,location=1,scrollbars=1,resizable=1,";
			properties = properties + "height=500,width=400";
			properties = properties + ",left=80,top=60";
			popupHandle = window.open(url, 'ddlipaper', properties);
		}
		else 
			alert('Please select a document.');
	}
	
	function jumpto() {
	if (document.resources.ddlresources.selectedIndex > 0) {
		url = document.resources.ddlresources[document.resources.ddlresources.selectedIndex].value;
		location.href = url;
	}
	else 
		alert('Please select a resource.');
	}
	
	function jumptoexperts() {
	if (document.experts.ddlexperts.selectedIndex > 0) {
		url = document.experts.ddlexperts[document.experts.ddlexperts.selectedIndex].value;
		location.href = url;
	}
	else 
		alert('Please select a expert.');
	}
	
	function jumptocountry() {
	if (document.country.ddlcountry.selectedIndex > 0) {
		url = document.country.ddlcountry[document.country.ddlcountry.selectedIndex].value;
		location.href = url;
	}
	else 
		alert('Please select a country.');
	}
	
	function jumptotestimonials() {
	if (document.testimonials.ddltestimonials.selectedIndex > 0) {
		url = document.testimonials.ddltestimonials[document.testimonials.ddltestimonials.selectedIndex].value;
		location.href = url;
	}
	else 
		alert('Please select a topic.');
	}
	
	function displayddlpbrochure() {
		var pbroch = document.resources.ddlpbrochure;
		var pbrochidx = pbroch.selectedIndex;
		if (pbroch[pbrochidx].value != '' ) {
			url = pbroch[pbrochidx].value;
			properties = "toolbar=0,location=1,scrollbars=1,resizable=1,";
			properties = properties + "height=500,width=400";
			properties = properties + ",left=50,top=50";
			popupHandle = window.open(url, 'ddlpbrochure', properties);
		}
		else 
			alert('Please select a brochure.');
	}
	
	function displayddlpff() {
		var pff = document.resources.ddlpff;
		var pffidx = pff.selectedIndex;
		if (pff[pffidx].value != '' ) {
			url = pff[pffidx].value;
			properties = "toolbar=0,location=1,scrollbars=1,resizable=1,";
			properties = properties + "height=500,width=400";
			properties = properties + ",left=50,top=50";
			popupHandle = window.open(url, 'ddlpff', properties);
		}
		else 
			alert('Please select a document.');
	}
	
	function displayddl2wpaper() {
		var wpaper = document.resources.ddlwpaper;
		var wpaperidx = wpaper.selectedIndex;
		if (wpaper[wpaperidx].value != '' ) {
			url = document.resources.ddlwpaper[document.resources.ddlwpaper.selectedIndex].value;
			properties = "toolbar=0,location=1,scrollbars=1,resizable=1,";
			properties = properties + "height=500,width=400";
			properties = properties + ",left=50,top=50";
			popupHandle = window.open(url, 'ddlwpaper', properties);
		}
		else 
			alert('Please select a white paper.');
	}
	
	function displayddlwpaper() {
		if (document.wpaper.ddlwpaper.selectedIndex > 0) {
			url = document.wpaper.ddlwpaper[document.wpaper.ddlwpaper.selectedIndex].value;
			properties = "toolbar=0,location=1,scrollbars=1,resizable=1,";
			properties = properties + "height=500,width=400";
			properties = properties + ",left=50,top=50";
			popupHandle = window.open(url, 'ddlwpaper', properties);
		}
		else 
			alert('Please select a document.');
	}
		
	function displayddlparticle() {
		if (document.resources.ddlparticle.selectedIndex > 0) {
			url = document.resources.ddlparticle[document.resources.ddlparticle.selectedIndex].value;
			properties = "toolbar=0,location=1,scrollbars=1,resizable=1,";
			properties = properties + "height=500,width=400";
			properties = properties + ",left=50,top=50";
			popupHandle = window.open(url, 'ddlparticle', properties);
		}
		else 
			alert('Please select an article.');
	}
	
	function displayddlDocTitle() {
		
			url = document.resources.ddlDocTitle[document.resources.ddlDocTitle.selectedIndex].value;
			properties = "toolbar=0,location=1,scrollbars=1,resizable=1,";
			properties = properties + "height=500,width=400";
			properties = properties + ",left=50,top=50";
			popupHandle = window.open(url, 'ddlDocTitle', properties);
		
	}
	
//	// function for all documents to open in a new window
//	function displayddldocument(object) {
//		if (object.selectedIndex > 0) {
//			url = object[object.selectedIndex].value;
//			properties = "toolbar=0,location=1,scrollbars=1,resizable=1,";
//			properties = properties + "height=500,width=400";
//			properties = properties + ",left=50,top=50";
//			popupHandle = window.open(url, 'ddldocument', properties);
//		}
//		else 
//			alert('Please select a document.');
//	}
	
	// New function for all documents to Evaluate KeyPressed
	// MKearns: 12.1.2005  If KeyPresed = ENTER KEY, then Open Document.
    function EvalDocKeyPress(object)
    {
        var rtnVar = true;
		if ((window.event.keyCode == 13) || (window.event.keyCode == 32))
		{
            rtnVar = displayddldocument(object);
        }
    
        return rtnVar;
    }

	// function for all documents to open in a new window
	// Used in Document Lib/Technical Articles/Product Resources Pages to Open Selected Docs
	// MKearns: 12.1.2005  Complete Code/Debug/Test Technical Articles Selection Page.
	function displayddldocument(object) 
	{
		if (object.selectedIndex > 0 )
		{
			//alert('TEST:DEBUG' + '\n' + 'object.slectectedIndex = ' + object.selectedIndex + '\n' + 'object = ' + object.value);
			url = object.value;
			//alert('URL: ' + url);
			//popupHandle = window.open(url);
			properties = "toolbar=0,location=1,scrollbars=1,resizable=1,";
			properties = properties + "height=800,width=800";
			properties = properties + ",left=50,top=50";
			popupHandle = window.open(url, 'ddldocument', properties);
			return true;
		}
		else
			alert('Please select a document.');
			return false;
	}
	/// End MKearns Changes:12/2005

	function displayddlinfodoc() {
		if (document.resources.ddlinfodoc.selectedIndex > 0) {
			url = document.resources.ddlinfodoc[document.resources.ddlinfodoc.selectedIndex].value;
			properties = "toolbar=0,location=1,scrollbars=1,resizable=1,";
			properties = properties + "height=500,width=400";
			properties = properties + ",left=50,top=50";
			popupHandle = window.open(url, 'ddlinfodoc', properties);
		}
		else 
			alert('Please select a document.');
	}
	
	function displayddlinfodoc1() {
		if (document.resources.ddlinfodoc1.selectedIndex > 0) {
			url = document.resources.ddlinfodoc1[document.resources.ddlinfodoc1.selectedIndex].value;
			properties = "toolbar=0,location=1,scrollbars=1,resizable=1,";
			properties = properties + "height=500,width=400";
			properties = properties + ",left=50,top=50";
			popupHandle = window.open(url, 'ddlinfodoc', properties);
		}
		else 
			alert('Please select a document.');
	}
	
	function displayddlinfodoc2() {
		if (document.resources.ddlinfodoc2.selectedIndex > 0) {
			url = document.resources.ddlinfodoc2[document.resources.ddlinfodoc2.selectedIndex].value;
			properties = "toolbar=0,location=1,scrollbars=1,resizable=1,";
			properties = properties + "height=500,width=400";
			properties = properties + ",left=50,top=50";
			popupHandle = window.open(url, 'ddlinfodoc', properties);
		}
		else 
			alert('Please select a document.');
	}
	
	function displayddlinfodoc3() {
		if (document.resources.ddlinfodoc3.selectedIndex > 0) {
			url = document.resources.ddlinfodoc3[document.resources.ddlinfodoc3.selectedIndex].value;
			properties = "toolbar=0,location=1,scrollbars=1,resizable=1,";
			properties = properties + "height=500,width=400";
			properties = properties + ",left=50,top=50";
			popupHandle = window.open(url, 'ddlinfodoc', properties);
		}
		else 
			alert('Please select a document.');
	}
	
	function displayddldoc(object) {
			if (object.selectedIndex > 0) {
				url = object[object.selectedIndex].value;
				properties = "toolbar=0,location=1,scrollbars=1,resizable=1,";
				properties = properties + "height=500,width=400";
				properties = properties + ",left=50,top=50";
				popupHandle = window.open(url, 'object', properties);
			}
			else 
				alert('Please select a document.');
		}			
		
	function displayddlrelann() {
		if (document.resources.ddlrelann.selectedIndex > 0) {
			url = document.resources.ddlrelann[document.resources.ddlrelann.selectedIndex].value;
			properties = "toolbar=0,location=1,scrollbars=1,resizable=1,";
			properties = properties + "height=500,width=400";
			properties = properties + ",left=50,top=50";
			popupHandle = window.open(url, 'ddlrelann', properties);
		}
		else 
			alert('Please select an announcement.');
	}

	function displayELetter() {
		if (document.ELetter.ddlELetter.selectedIndex > 0) {
			url = document.ELetter.ddlELetter[document.ELetter.ddlELetter.selectedIndex].value;
			properties = "toolbar=0,location=0,scrollbars=1,resizable=1,";
			properties = properties + "height=800,width=800";
			properties = properties + ",left=50,top=50";
			popupHandle = window.open(url, 'eletter', properties);
		}
		else 
			alert('Please select an eLetter.');
	}
	
	function displayddlhreport() {
		var hreport = document.hreport.ddlhreport;
		var hreportidx = hreport.selectedIndex;
		if (hreport[hreportidx].value != '' ) {
			url = hreport[hreportidx].value;
			properties = "toolbar=0,location=0,scrollbars=0,resizable=0,";
			properties = properties + "height=500,width=750";
			properties = properties + ",left=50,top=50";
			window.open(url, 'ddlhreport', properties);
		}
		else 
			alert('Please select an example.');
	}
	function EmailThisPage() {
		location.href='mailto:?subject=An invitation to visit Mainstar\'s web site.&amp;body=' + escape(document.title) + ' < ' + escape(location.href) + ' >';
	}
	
	function isEmail(string) {

	   if (!string) return false;
	   var iChars = "*|,\"<:>[]{}`\';()&$#%";

	   for (var i = 0; i < string.length; i++) {
	      if (iChars.indexOf(string.charAt(i)) != -1)
	         return false;
	   }
	   return true;
	}                      
	function isProper(string) {

	   if (!string) return false;
	   var iChars = "*|,\"<:>[]{}`\';()@&$#%";

	   for (var i = 0; i < string.length; i++) {
	      if (iChars.indexOf(string.charAt(i)) != -1)
	         return false;
	   }
	   return true;
	}                      
	function isReady(form) {
	    if (isEmail(form.REMailAddress.value) == false) {
	        alert("Please enter a valid email address.");
	        form.REMailAddress.focus();
	        return false;
	    }
	    //if (isProper(form.username.value) == false) {
	    //   alert("Please enter a valid username.");
	    //    form.username.focus();
	    //    return false;
	    // }
	    return true;
	}
	
	//gradient shading
	
	function showGrad(el) {
		document.all(el).style.filter = "progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#FFFFFF', EndColorStr='#CCCCCC')";
	}
	function showGray(el) {
		document.all(el).style.filter = "progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#808080', EndColorStr='#FFFFFF')";
	}
	function showBlue(el) {
		document.all(el).style.filter = "progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#dcdcFF', EndColorStr='#FFFFFF')";
	}
	function showRed(el) {
		document.all(el).style.filter = "progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#9d0000', EndColorStr='#A6A0A0')";
	}
		function showLRed(el) {
		document.all(el).style.filter = "progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#933B3B', EndColorStr='#A6A0A0')";
	}
	
	// this is a script for placing the curser in the 1st screen field
	var FocusNeeded = true;
	function showIt() {
		// Set the focus to the 1st screen field
	        if (FocusNeeded) {
	          document.getuser.txtUser.focus();
	        }
		}
	
	// POP UP A PREFORMATTED EMAIL MESSAGE WINDOW Change or Update email address for z/OS eLetter Subscribers
	 function popupMessageEmailChg() {  
	 	//SET MESSAGE VALUES  
	 	var to = "news@mainstar.com";  
		var cc = "";  
		var bcc = "";  
		var subject = "Email Address Update - z/OS eLetter";  
		var body = "Request for email address update:\n\n\tOld email address:\n\tNew email address:"  
	 	//BUILD MAIL MESSAGE COMPONENTS   
		//var doc = "mailto:" + to + "?cc=" + cc + "&bcc=" + bcc + "&subject=" + escape(subject) + "&body=" + escape(body);   
		var doc = "mailto:" + to + "?subject=" + escape(subject) + "&body=" + escape(body);   
	 	// POP UP EMAIL MESSAGE WINDOW  
		window.location = doc;
		}
		
		
	// POP UP A PREFORMATTED EMAIL MESSAGE WINDOW Testimonials - Customer share there's
	 function popupMessageEmailTestimonial() {  
	 	//SET MESSAGE VALUES  
	 	var to = "news@mainstar.com";  
		var cc = "";  
		var bcc = "webmaster@mainstar.com";  
		var subject = "Customer Success Stories";  
		var body = "Thank your for taking valuable time to share your success story with others.\n"   
		var body = body + "Please fill out the information below.  We may contact you for more details."
		var body = body + "\n\nName:\nCompany:\nTitle:\nPhone Number:\n\nCustomer Success Story:"  
	 	//BUILD MAIL MESSAGE COMPONENTS   
		//var doc = "mailto:" + to + "?cc=" + cc + "&bcc=" + bcc + "&subject=" + escape(subject) + "&body=" + escape(body);   
		var doc = "mailto:" + to + "?subject=" + escape(subject) + "&body=" + escape(body);   
	 	// POP UP EMAIL MESSAGE WINDOW  
		window.location = doc;
		}

				
	// POP UP A PREFORMATTED EMAIL MESSAGE WINDOW Password - Forgot my password.
	 function popupMessageEmailPassword() {  
	 	//SET MESSAGE VALUES  
	 	var to = "customerservice@mainstar.com";  
		var cc = "";  
		var bcc = "webmaster@mainstar.com";  
		var subject = "Mainstar: Forgot CASE Password";  
		var body = "Please fill out the information below to request your password."  
		var body = body + "\nWe may contact you for more details."
		var body = body + "\n\nName:\nCompany:\nE-mail Address Confirmation:\nPhone Number:"  
		var body = body + "\n\nContact mailto:customerservice@mainstar.com if you have any questions or call 1-425-455-3589."
		var body = body + "\n\nThank you,"
		var body = body + "\n\nMainstar Software Corporation"
	 	//BUILD MAIL MESSAGE COMPONENTS   
		//var doc = "mailto:" + to + "?cc=" + cc + "&bcc=" + bcc + "&subject=" + escape(subject) + "&body=" + escape(body);   
		var doc = "mailto:" + to + "?subject=" + escape(subject) + "&body=" + escape(body);   
	 	// POP UP EMAIL MESSAGE WINDOW  
		window.location = doc;
		}
	
	
		//Rotating Banner		
		var imgs1 = new Array("http://www.mainstar.com/images/OutageDisasterSM.gif","http://www.mainstar.com/images/Lightningsma-copy2.gif")
		var lnks1 = new Array("http://www.mainstar.com/services/crplusseminar/index.asp","http://www.mainstar.com/products/hsmfastaudit/index.asp")
		var alt1 = new Array("Attend a free half-day seminar","Solve your tape corruption issues fast with HSM FastAudit-MediaControls")
		var currentAd1 = 0
		var imgCt1 = 2
		function cycle1() {
		  currentAd1++
		  if (currentAd1 == imgCt1) {
		    currentAd1 = 0
		  }
		  document.adBanner1.src=imgs1[currentAd1]
		  document.adBanner1.alt=alt1[currentAd1]
		  adLink1.href=lnks1[currentAd1]
		  setTimeout("cycle1()",5 * 1000)
		}

	function radiochk(radiosel) {
		if (radiosel == "HTML") 
			document.all.RRFORMAT[0].checked = true;
		if (radiosel == "TEXT") 
			document.all.RRFORMAT[1].checked = true;
	}
	
	function showBlue(el) {
		if (navigator.appName == 'Microsoft Internet Explorer') {
			document.all(el).style.filter = "progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#dcdcFF', EndColorStr='#FFFFFF')";
			}
		}
    
	// Declaring valid date character, minimum year and maximum year
	var dtCh= "/";
	var dtColon= ":";
	var dtSpace = " ";
	var minYear=1990;
	var maxYear=2100;

	function DaysArray(n) {
		for (var i = 1; i <= n; i++) {
			this[i] = 31
			if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
			if (i==2) {this[i] = 29}
	   } 
	   return this
	}
	
	function daysInFebruary (year){
		// February has 29 days in any year evenly divisible by four,
	    // EXCEPT for centurial years which are not also divisible by 400.
	    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
	}

	function isInteger(s){
		var i;
	    for (i = 0; i < s.length; i++){   
	        // Check that current character is number.
	        var c = s.charAt(i);
	        if (((c < "0") || (c > "9"))) return false;
	    }
	    // All characters are numbers.
	    return true;
	}
	
	function stripCharsInBag(s, bag, slen){
		var i;
	    var returnString = "";
	    // Search through string's characters one by one.
	    // If character is not in bag, append to returnString.
	    for (i = 0; i < slen; i++){   
	        var c = s.charAt(i);
	        if (bag.indexOf(c) == -1) returnString += c;
	    }
	    return returnString;
	}
	
	//Date Validation
	function isDateNM(dtStr){
		var daysInMonth = DaysArray(12)
		var pos1=dtStr.indexOf(dtCh)
		var pos2=dtStr.indexOf(dtCh,pos1+1)
		var pos3=dtStr.indexOf(dtSpace,pos2+1)
		if (pos3 == -1)
			pos3 = dtStr.length;
		var strMonth=dtStr.substring(0,pos1)
		var strDay=dtStr.substring(pos1+1,pos2)
		var strYear=dtStr.substring(pos2+1,pos3)
		strYr=strYear
		if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
		if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
		for (var i = 1; i <= 3; i++) {
			if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
		}
		month=parseInt(strMonth)
		day=parseInt(strDay)
		year=parseInt(strYr)
		if (pos1==-1 || pos2==-1){
			alert("The date format should be: mm/dd/yyyy")
			return false
		}
		if (strMonth.length<1 || month<1 || month>12){
			alert("Please enter a valid month")
			return false
		}
		if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
			alert("Please enter a valid day")
			return false
		}
		if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
			alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
			return false
		}
		if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh, pos3))==false){
			alert("Please enter a valid date")
			return false
		}
	
		return true
	}
// POP UP A PREFORMATTED EMAIL MESSAGE WINDOW Synopsis Request - DSLM Presentation 
	 function popupMessageDSLMSynopsisRequest() {  
	 	//SET MESSAGE VALUES  
	 	var to = "experts@mainstar.com";  
		var cc = "";  
		var bcc = "";  
		var subject = "Synopsis Request - DSLM Presentation";  
		var body = "Request for DSLM Presentation: \n\n\tName:\n\tCompany Name:\n\tAddress:\n\n\tPhone Number:"  
	 	//BUILD MAIL MESSAGE COMPONENTS   
		//var doc = "mailto:" + to + "?cc=" + cc + "&bcc=" + bcc + "&subject=" + escape(subject) + "&body=" + escape(body);   
		var doc = "mailto:" + to + "?subject=" + escape(subject) + "&body=" + escape(body);   
	 	// POP UP EMAIL MESSAGE WINDOW  
		window.location = doc;
		}
		
		
///MKearns Added Functions////////////
/////////////////////////////////////

function DisplayDocLib(object) 
{
	//alert('TEST:DEBUG' + '\n' + 'object.slectectedIndex = ' + object.selectedIndex + '\n' + 'object = ' + object.value);
	url = object.value;
	//alert('URL: ' + url);
	//popupHandle = window.open(url);
	properties = "toolbar=0,location=1,scrollbars=1,resizable=1,";
	properties = properties + "height=800,width=800";
	properties = properties + ",left=50,top=50";
	popupHandle = window.open(url, 'ddldocument', properties);
	return true;
}


function ReDisplay(obj) 
{   
        //alert(obj.value.length);
        if (obj.value.length > 1)
        {
            location.href="index.asp?subjkey=" + obj.value;
            return true;
        }
        else
        {
            alert("Select a subject.");
            return false;
        }
}

function ShowContains(varState)
{
    if (varState == 0)
    {   
        // Hide Contains Instructions
        document.getElementById("odivContains").style.display = 'none';
    }
    if (varState == 1)
    {
        // Show Contains Instructions
        document.getElementById("odivContains").style.display = 'inline';
    }
    return true;

}

function DocSearchReset()
{
    document.getElementById("ovarReset").value = "yes";
    //alert(document.getElementById("ovarReset").value);
    document.frmDocAdvSearch.submit();
    return true;
}

function RedirectURL(sUrl)
{
    //alert(sUrl);
    document.getElementById("ofrmProducts").action = sUrl;
    document.getElementById("ofrmProducts").submit();
    return true;
}

function ReLoadURL(url)
{
	location.href = url;
	return true;

}

/// End MKearns Added Functions  /////////////////////////////////////////////////////////
