﻿// IE5.5+ PNG Alpha Fix v2.0 Alpha: Background Tiling Support
var IEPNGFix = window.IEPNGFix || {};

IEPNGFix.tileBG = function(elm, pngSrc, ready) {
	// Params: A reference to a DOM element, the PNG src file pathname, and a
	// hidden "ready-to-run" passed when called back after image preloading.

	var data = this.data[elm.uniqueID],
		elmW = Math.max(elm.clientWidth, elm.scrollWidth),
		elmH = Math.max(elm.clientHeight, elm.scrollHeight),
		bgX = elm.currentStyle.backgroundPositionX,
		bgY = elm.currentStyle.backgroundPositionY,
		bgR = elm.currentStyle.backgroundRepeat;

	// Cache of DIVs created per element, and image preloader/data.
	if (!data.tiles) {
		data.tiles = {
			elm: elm,
			src: '',
			cache: [],
			img: new Image(),
			old: {}
		};
	}
	var tiles = data.tiles,
		pngW = tiles.img.width,
		pngH = tiles.img.height;

	if (pngSrc) {
		if (!ready && pngSrc != tiles.src) {
			// New image? Preload it with a callback to detect dimensions.
			tiles.img.onload = function() {
				this.onload = null;
				IEPNGFix.tileBG(elm, pngSrc, 1);
			};
			return tiles.img.src = pngSrc;
		}
	} else {
		// No image?
		if (tiles.src) ready = 1;
		pngW = pngH = 0;
	}
	tiles.src = pngSrc;

	if (!ready && elmW == tiles.old.w && elmH == tiles.old.h &&
		bgX == tiles.old.x && bgY == tiles.old.y && bgR == tiles.old.r) {
		return;
	}

	// Convert English and percentage positions to pixels.
	var pos = {
			top: '0%',
			left: '0%',
			center: '50%',
			bottom: '100%',
			right: '100%'
		},
		x,
		y,
		pc;
	x = pos[bgX] || bgX;
	y = pos[bgY] || bgY;
	if (pc = x.match(/(\d+)%/)) {
		x = Math.round((elmW - pngW) * (parseInt(pc[1]) / 100));
	}
	if (pc = y.match(/(\d+)%/)) {
		y = Math.round((elmH - pngH) * (parseInt(pc[1]) / 100));
	}
	x = parseInt(x);
	y = parseInt(y);

	// Handle backgroundRepeat.
	var repeatX = { 'repeat': 1, 'repeat-x': 1 }[bgR],
		repeatY = { 'repeat': 1, 'repeat-y': 1 }[bgR];
	if (repeatX) {
		x %= pngW;
		if (x > 0) x -= pngW;
	}
	if (repeatY) {
		y %= pngH;
		if (y > 0) y -= pngH;
	}

	// Go!
	this.hook.enabled = 0;
	if (!({ relative: 1, absolute: 1 }[elm.currentStyle.position])) {
		elm.style.position = 'relative';
	}
	var count = 0,
		xPos,
		maxX = repeatX ? elmW : x + 0.1,
		yPos,
		maxY = repeatY ? elmH : y + 0.1,
		d,
		s,
		isNew;
	if (pngW && pngH) {
		for (xPos = x; xPos < maxX; xPos += pngW) {
			for (yPos = y; yPos < maxY; yPos += pngH) {
				isNew = 0;
				if (!tiles.cache[count]) {
					tiles.cache[count] = document.createElement('div');
					isNew = 1;
				}
				var clipR = (xPos + pngW > elmW ? elmW - xPos : pngW),
					clipB = (yPos + pngH > elmH ? elmH - yPos : pngH);
				d = tiles.cache[count];
				s = d.style;
				s.behavior = 'none';
				s.left = xPos + 'px';
				s.top = yPos + 'px';
				s.width = clipR + 'px';
				s.height = clipB + 'px';
				s.clip = 'rect(' +
					(yPos < 0 ? 0 - yPos : 0) + 'px,' +
					clipR + 'px,' +
					clipB + 'px,' +
					(xPos < 0 ? 0 - xPos : 0) + 'px)';
				s.display = 'block';
				if (isNew) {
					s.position = 'absolute';
					s.zIndex = -999;
					if (elm.firstChild) {
						elm.insertBefore(d, elm.firstChild);
					} else {
						elm.appendChild(d);
					}
				}
				this.fix(d, pngSrc, 0);
				count++;
			}
		}
	}
	while (count < tiles.cache.length) {
		this.fix(tiles.cache[count], '', 0);
		tiles.cache[count++].style.display = 'none';
	}

	this.hook.enabled = 1;

	// Cache so updates are infrequent.
	tiles.old = {
		w: elmW,
		h: elmH,
		x: bgX,
		y: bgY,
		r: bgR
	};
};
IEPNGFix.update = function() {
	// Update all PNG backgrounds.
	for (var i in IEPNGFix.data) {
		var t = IEPNGFix.data[i].tiles;
		if (t && t.elm && t.src) {
			IEPNGFix.tileBG(t.elm, t.src);
		}
	}
};
IEPNGFix.update.timer = 0;

if (window.attachEvent && !window.opera) {
	window.attachEvent('onresize', function() {
		clearTimeout(IEPNGFix.update.timer);
		IEPNGFix.update.timer = setTimeout(IEPNGFix.update, 100);
	});
}


//Modal window by Shikhar Gupta
var modalWindow = {
    parent:"body",
    windowId:null,
    content:null,
    width:null,
    height:null,

    close:function()
    {
      $(".modal-window").remove();
      $(".modal-overlay").remove();
    },

    open:function()
    {
        var modal = "";
        modal += "<div class=\"modal-overlay\"></div>";
        modal += "<div id=\"" + this.windowId + "\" class=\"modal-window\" style=\"width:" + this.width + "px; height:" + this.height + "px; margin-top:-" + (this.height / 2) + "px; margin-left:-" + (this.width / 2) + "px;\">";
        modal += this.content;
        modal += "</div>";

        $(this.parent).append(modal);
        $(".modal-window").append("<a class=\"close-window\"></a>");
        $(".close-window").click(function(){modalWindow.close();});
        $(".modal-overlay").click(function(){});
    }
};

function openDynamicModal(source,width,height)
{
    modalWindow.windowId = "myModal";
    modalWindow.width = width;
    modalWindow.height = height;
    modalWindow.content = "<iframe width='"+width+"' height='"+height+"' frameborder='0' scrolling='no' allowtransparency='true' src='"+source+"'></iframe>";
    modalWindow.open();
};

function openStaticModal(divId, width,height) {
    
    modalWindow.windowId = "myModal";
    modalWindow.width = width;
    modalWindow.height = height;
    modalWindow.content = "<div style='padding:5px;'>"+document.getElementById(divId).innerHTML+"</div>";
    modalWindow.open();
};

var slidingmodalWindow = {
    parent: "body",
    windowId: null,
    content: null,
    width: null,
    height: null,

    close: function() {
        $(".slidingmodal-window").remove();
        $(".slidingmodal-overlay").remove();
    },

    open: function() {
        var slidingmodal = "";
        slidingmodal += "<div class=\"slidingmodal-overlay\"></div>";
        slidingmodal += "<div id=\"" + this.windowId + "\" class=\"slidingmodal-window\" style=\"width:" + this.width + "px\">";
        slidingmodal += this.content;
        slidingmodal += "</div>";

        $(this.parent).append(slidingmodal);
        //$(".slidingmodal-window").css("top", targetE1.y + "px");
        //$(".slidingmodal-window").css("left", targetE1.x - widthOfimgCustcare + "px");
        $(".slidingmodal-window").append("<a class=\"closecc\"></a>");
        $(".closecc").click(function() { $(".slidingmodal-window").slideUp(500); });
        $(".slidingmodal-window").append("<a class=\"ccSlideUp\"></a>");
        $(".ccSlideUp").click(function() {
            $(".slidingmodal-window").slideUp(500);
        });
        $(".slidingmodal-overlay").click(function() { });
        $(".slidingmodal-window").slideDown(1500);

    }
};

function openSlidingModal(source,width,height)
{
    slidingmodalWindow.windowId = "myModal";
    slidingmodalWindow.width = width;
    slidingmodalWindow.height = height;
    slidingmodalWindow.content = "<iframe width='"+width+"' height='"+height+"' frameborder='0' scrolling='no' allowtransparency='true' src='"+source+"'></iframe>";
    slidingmodalWindow.open();
 };




	//Referring to a Form Element	
	//document.(form name).(field name).value

	//Determines Browser Type
	var ns4 = (document.layers)? true:false; //Netscape 4
	var ie4 = (document.all && !document.getElementById)? true : false; //IE 4
	var ie5 = (document.all && document.getElementById) ? true : false; //IE 5+
	var ns6 = (!document.all && document.getElementById) ? true: false; //NS 6+

	//Show / Hide objects depending on the browser type
	function showobj(obj) {
	    if (ns4) {
			document.layers[obj].visibility = 'show';
		} 
		else if (ie4) {
			document.all(obj).style.visibility = 'visible';
		}
		else if (ie5||ns6) {
			document.getElementById(obj).style.visibility = 'visible';
		}
    }

	//Show / Hide objects depending on the browser type
	function hideobj(obj) {
	    if (ns4) {
			document.layers[obj].visibility = 'hide';
		} 
		else if (ie4) {
			document.all(obj).style.visibility = 'hidden';
		}
		else if (ie5||ns6) {
			document.getElementById(obj).style.visibility = 'hidden';
		}
    }

	//Pop up a window w/ URL and w,h and centers it
	function openGLWinParam(URL, sWidth, sHeight) {
		var sx = screen.width ;
		var sy = screen.height ;
		var top = parseInt( ( sy - sHeight ) / 2 ) ;
		var left = parseInt( ( sx - sWidth  ) / 2 ) ;
		
		aWindow = window.open(URL, 'popwin', 'toolbar=0, location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width=' + sWidth + ',height=' + sHeight + ',left=' + left + ',top=' + top);
	}

	//Swaps images - used for indicating direction of sort, etc.
	function flip(name,src1, src2) {
	    if (document.images) {
			if (document.images[name].src.indexOf(src1) > 0 ) {
				document.images[name].src = src2
			} else {
				document.images[name].src = src1;
			}
		}
	}

	//Checks if a string is an integer - returns True / False
	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;
	}

	//Global vars used by the isDate function
	var dtCh= "/";
	var minYear=1800;
	var maxYear=2100;

	//Used by the isDate function
	function stripCharsInBag(s, bag){
		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 < s.length; i++){   
	        var c = s.charAt(i);
	        if (bag.indexOf(c) == -1) returnString += c;
	    }
	    return returnString;
	}

	//Used by the isDate function
	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.
	    if ((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0)))
		{
			return 29 ;
	    }
	    else
	    {
			return 28 ;
	   }
	   // return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
	}

	//Used by the isDate function	
	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
	}

	//Check if a string is a valid date in format of mm/dd/yyyy
	function isDate(dtStr){
		var daysInMonth = DaysArray(12)
		var pos1=dtStr.indexOf(dtCh)
		var pos2=dtStr.indexOf(dtCh,pos1+1)
		var strMonth=dtStr.substring(0,pos1)
		var strDay=dtStr.substring(pos1+1,pos2)
		var strYear=dtStr.substring(pos2+1)
		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){
			return false
		}
		if (month<1 || month>12){
			return false
		}
		if (day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
			return false
		}
		if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
			return false
		}
		if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
			return false
		}
	return true
	}
	
		var MonthArray = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
		var client_date = new Date; 
		var dayofmonth = (client_date.getDate() < 10) ? "0" + client_date.getDate().toString() : client_date.getDate().toString()

		var windowHandle = '';

		function popup(url,name,attributes) {
		    windowHandle = window.open(url,name,attributes);
		}

		function QueryString(key)
		{
			var value = null;
			for (var i=0;i<QueryString.keys.length;i++)
			{
				if (QueryString.keys[i]==key)
				{
					value = QueryString.values[i];
					break;
				}
			}
			return value;
		}
		QueryString.keys = new Array();
		QueryString.values = new Array();

		function QueryString_Parse()
		{
			var query = window.location.search.substring(1);
			var pairs = query.split("&");
			
			for (var i=0;i<pairs.length;i++)
			{
				var pos = pairs[i].indexOf('=');
				if (pos >= 0)
				{
					var argname = pairs[i].substring(0,pos);
					var value = pairs[i].substring(pos+1);
					QueryString.keys[QueryString.keys.length] = argname;
					QueryString.values[QueryString.values.length] = value;		
				}
			}
		}
		
		QueryString_Parse();	  
		
// Below here is majorly used by APM Online 
// Richard Wang Jan,30,2003

// LTrim(string) : Returns a copy of a string without leading spaces.

function LTrim(str)
{
   var whitespace = new String(" \t\n\r");
   var s = new String(str);
   if (whitespace.indexOf(s.charAt(0)) != -1) {
      var j=0, i = s.length;
      while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
         j++;
      s = s.substring(j, i);
   }
   return s;
}

// RTrim(string) : Returns a copy of a string without trailing spaces.
function RTrim(str)
{
   var whitespace = new String(" \t\n\r");
   var s = new String(str);
   if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
      var i = s.length - 1;       // Get length of string
      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
         i--;
      s = s.substring(0, i+1);
   }
   return s;
}

/* Trim(string) : Returns a copy of a string without leading or trailing spaces */
function Trim(str)
{
   return RTrim(LTrim(str));
}

/* Common submit form used in pages */
function submitMessageBoard()
{
	if(document.myregistration.userid.value == '') 
		alert('Please login to access this function.')
	else
	{
		document.myregistration.action="message_board_list.asp";
		document.myregistration.submit();
	}
}

function submitfaqs()
{
	document.myregistration.action="faqs.asp";
	document.myregistration.submit();
}

function submithelp()
{
	document.myregistration.action="help.asp";
	document.myregistration.submit();
}

function submitcontact_us()
{
	document.myregistration.action="contact_us.asp";
	document.myregistration.submit();
}

function submitTransactionHome()
{
	if(document.myregistration.userid.value == '') 
		alert('Please login to access this function.')
	else
	{
		document.myregistration.action="TransactionHome.asp";
		document.myregistration.submit();
	}
}

function submitCategoryHome()
{
	if(document.myregistration.userid.value == '') 
		alert('Please login to access this function.')
	else
	{
		document.myregistration.action="CategoryHome.asp";
		document.myregistration.submit();
	}
}

function submitBankHome()
{
	if(document.myregistration.userid.value == '') 
		alert('Please login to access this function.')
	else
	{
		document.myregistration.action="BankHome.asp";
		document.myregistration.submit();
	}
}

function submitEditAccount()
{
//'check other data field
	if(document.myregistration.userid.value == '') 
		alert('Please login to access this function.')
	else
	{
		document.myregistration.action="AccountEdit.asp";
		document.myregistration.submit();
	}
}

function submitRefillReminder()
{
	if(document.myregistration.userid.value == '') 
		alert('Please login to access this function.')
	else
	{
		document.myregistration.action="refill_reminder_detect.asp"
		document.myregistration.submit();
	}
}

function formulary_search()
{
	if(document.myregistration.userid.value == '') 
		alert('Please login to access this function.')
	else
	{
		document.myregistration.action="formulary_search_main.asp"
		document.myregistration.submit();
	}
}

function submitNewRegistration()
{
	document.myregistration.action='Register.asp';
	document.myregistration.submit();
}

function submitForgotPassword()
{
	document.myregistration.action="forgot_password_stage1.asp"
	document.myregistration.submit();
	return true;	
}

function submitForgotUserID()
{
	document.myregistration.action="forgot_user_stage1.asp"
	document.myregistration.submit();
	return true;	
}

function submitLogout()
{
	document.myregistration.action="Logout.asp";
	document.myregistration.submit();
	return true;	
}


function submitPharmacyLocator()
{
	if( (document.myregistration.userid.value).length > 0)
		document.myregistration.action="pharmacy_locator_result.asp";
	else
		document.myregistration.action="pharmacy_locator_search.asp";
	document.myregistration.submit();
	return true;	
}

/* Verify some common fields */

function moneyFormat(textObj) {
   var newValue = textObj.value;
   var decAmount = "";
   var dolAmount = "";
   var decFlag = false;
   var aChar = "";
   
   // ignore all but digits and decimal points.
   for(i=0; i < newValue.length; i++) {
      aChar = newValue.substring(i,i+1);
      if(aChar >= "0" && aChar <= "9") {
         if(decFlag) {
            decAmount = "" + decAmount + aChar;
         }
         else {
            dolAmount = "" + dolAmount + aChar;
         }
      }
      if(aChar == ".") {
         if(decFlag) {
            dolAmount = "";
            break;
         }
         decFlag=true;
      }
   }
   
   // Ensure that at least a zero appears for the dollar amount.

   if(dolAmount == "") {
      dolAmount = "0";
   }
   // Strip leading zeros.
   if(dolAmount.length > 1) {
      while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
         dolAmount = dolAmount.substring(1,dolAmount.length);
      }
   }
   
   // Round the decimal amount.
   if(decAmount.length > 2) {
      if(decAmount.substring(2,3) > "4") {
         decAmount = parseInt(decAmount.substring(0,2)) + 1;
         if(decAmount < 10) {
            decAmount = "0" + decAmount;
         }
         else {
            decAmount = "" + decAmount;
         }
      }
      else {
         decAmount = decAmount.substring(0,2);
      }
      if (decAmount == 100) {
         decAmount = "00";
         dolAmount = parseInt(dolAmount) + 1;
      }
   }
   
   // Pad right side of decAmount
   if(decAmount.length == 1) {
      decAmount = decAmount + "0";
   }
   if(decAmount.length == 0) {
      decAmount = decAmount + "00";
   }
   
   // Check for negative values and reset textObj
   if(newValue.substring(0,1) != '-' ||
         (dolAmount == "0" && decAmount == "00")) {
      textObj.value = dolAmount + "." + decAmount;

   }
   else{
      textObj.value = '-' + dolAmount + "." + decAmount;
   }
}

function isValidUserName(s)
{
	var i;
	if( s.length < 6)
		return false;
    for (i = 0; i < s.length; i++)
    {   
    // Check that current character is number or alphabet.
		var c = s.charAt(i);
	    if ( !( ((c >= "0") &&  (c <= "9")) ||    ((c >= "a") &&  (c <= "z")) || ((c >= "A") &&  (c <= "Z")) ) )
			return false;				
	}
	    // All characters are numbers.
	return true;
}

function isSameString(s1,s2)
{
	var i,c1,c2;
	if( s1.length ==0 || s2.length == 0 )
		return false; 
	if( s1.length != s2.length )
		return false; 
		
    for (i = 0; i < s1.length; i++)
    {   
    // Check each character for match.
		c1 = s1.charAt(i);
		c2 = s2.charAt(i);
	    if ( c1 != c2 )
			return false;				
	}
	    // All characters are numbers.
	return true;
}


function isValidEmail(s)
{
	var i;
	if( s.length < 8)
		return false;
    for (i = 0; i < s.length; i++)
    {   
    // Check that current character is number or alphabet.
		var c = s.charAt(i);
	    if ( !( ((c >= "0") &&  (c <= "9")) || (c == ".") || (c == "-") ||(c == "_") || (c == "@") ||((c >= "a") &&  (c <= "z")) || ((c >= "A") &&  (c <= "Z")) ) )
			return false;				
	}
	    // All characters are numbers.
	return true;
}

function verifyLetter(c)
{
	if( ((c >= "a") &&  (c <= "z")) || ((c >= "A") &&  (c <= "Z")) ) 
		return true;
	else
		return false;	
}

function filter_dash_space(s)
{
	var s1,i,c;
	s1 = '';
    for (i = 0; i < s.length; i++)
    {   
    // Check that current character is number or alphabet.
		var c = s.charAt(i);
	    if ( ((c >= "0") && (c <= "9")) || ((c >= "a") &&  (c <= "z")) || ((c >= "A") &&  (c <= "Z"))  )
		{
			s1 = s1 + c ;						
		}	
	}
	return s1;
}

function validatePolicyID(s)
{
	var i, c1, c2, c3, s2,s3;
	s3= Trim(s);
	s3 = filter_dash_space(s3)
	s2 = s3;
	if( s3.length > 3)
	{
		c1 = s3.charAt(0);	
		c2 = s3.charAt(1);		
		c3 = s3.charAt(2);	
		if ( verifyLetter(c1) && verifyLetter(c2) && verifyLetter(c3) )
			s2 = s3.substr(3 , s.length-3 );
		else
			s2 = s3;		
			
	}
	return s2;
}

function filter_date(s)
{
	var s1,i,c;
	s1 = '';
    for (i = 0; i < s.length; i++)
    {   
    // Check that current character is number or alphabet.
		var c = s.charAt(i);
	    if ( ((c >= "0") && (c <= "9")) || (c == dtCh)  )
		{
			s1 = s1 + c ;						
		}	
	}
	return s1;
}

	function isDOBDate(dtStr){
		var dayinMonth = 0
		var pos1=dtStr.indexOf(dtCh)
		var pos2=dtStr.indexOf(dtCh,pos1+1)
		var strMonth=dtStr.substring(0,pos1)
		var strDay=dtStr.substring(pos1+1,pos2)
		var strYear=dtStr.substring(pos2+1)
		
		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)
		}

		if (pos1==-1 || pos2==-1){
			return false
		}
		month=parseInt(strMonth)
		day=parseInt(strDay)
		year=parseInt(strYr)
		if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
			return false
		}
		if (month<1 || month>12){
			return false
		}
		switch (month) 
		{ 
			case 1 : 
				dayinMonth = 31; 
			break; 
			case 2 : 
				dayinMonth = daysInFebruary(year);
			break; 
			case 3 : 
				dayinMonth = 31; 
			break; 
			case 4 : 
				dayinMonth = 30; 
			break; 
			case 5 : 
				dayinMonth = 31; 
			break; 
			case 6 : 
				dayinMonth = 30; 
			break; 
			case 7 : 
				dayinMonth = 31; 
			break; 
			case 8 : 
				dayinMonth = 31; 
			break; 
			case 9 : 
				dayinMonth = 30; 
			break; 
			case 10: 
				dayinMonth = 31; 
			break; 
			case 11: 
				dayinMonth = 30
			break; 
			case 12: 
				dayinMonth = 31; 
			break; 
		   default : 
				return false; 
		} 
		if (day<1 || day>dayinMonth){
			return false
		}
	return true
	}

	// Drodown Menu.js begin here 6/1/2010 R.W.
	var DDSPEED = 10;
	var DDTIMER = 15;

	// main function to handle the mouse events //
	function ddMenu(id, d) {
	    var h = document.getElementById(id + '-ddheader');
	    var c = document.getElementById(id + '-ddcontent');
	    if ( !(c==null) )
	        clearInterval(c.timer);
	    if (d == 1) {
	        clearTimeout(h.timer);
	        if (c.maxh && c.maxh <= c.offsetHeight) { return }
	        else if (!c.maxh) {
	            c.style.display = 'block';
	            c.style.height = 'auto';
	            c.maxh = c.offsetHeight;
	            c.style.height = '0px';
	        }
	        c.timer = setInterval(function() { ddSlide(c, 1) }, DDTIMER);
	    } else {
	        h.timer = setTimeout(function() { ddCollapse(c) }, 50);
	    }
	}

	// collapse the menu //
	function ddCollapse(c) {
	    c.timer = setInterval(function() { ddSlide(c, -1) }, DDTIMER);
	}

	// cancel the collapse if a user rolls over the dropdown //
	function cancelHide(id) {
	    var h = document.getElementById(id + '-ddheader');
	    var c = document.getElementById(id + '-ddcontent');
	    clearTimeout(h.timer);
	    clearInterval(c.timer);
	    if (c.offsetHeight < c.maxh) {
	        c.timer = setInterval(function() { ddSlide(c, 1) }, DDTIMER);
	    }
	}

	// incrementally expand/contract the dropdown and change the opacity //
	function ddSlide(c, d) {
	    var currh = c.offsetHeight;
	    var dist;
	    if (d == 1) {
	        dist = (Math.round((c.maxh - currh) / DDSPEED));
	    } else {
	        dist = (Math.round(currh / DDSPEED));
	    }
	    if (dist <= 1 && d == 1) {
	        dist = 1;
	    }
	    c.style.height = currh + (dist * d) + 'px';
	    c.style.opacity = currh / c.maxh;
	    c.style.filter = 'alpha(opacity=' + (currh * 100 / c.maxh) + ')';
	    if ((currh < 2 && d != 1) || (currh > (c.maxh - 2) && d == 1)) {
	        clearInterval(c.timer);
	    }
	}


//Dropdown.js end here




 




