
function Trim(TRIM_VALUE)
{
	if(TRIM_VALUE.length < 1)
	{
		return"";
	}
	
	TRIM_VALUE = RTrim(TRIM_VALUE);
	TRIM_VALUE = LTrim(TRIM_VALUE);
	
	if(TRIM_VALUE=="")
	{
		return "";
	}
	else
	{
		return TRIM_VALUE;
	}
} //End Function

function RTrim(VALUE)
{
	var w_space = String.fromCharCode(32);
	var v_length = VALUE.length;
	var strTemp = "";
	if(v_length < 0){
	return"";
	}
	var iTemp = v_length -1;
	
	while(iTemp > -1){
	if(VALUE.charAt(iTemp) == w_space){
	}
	else{
	strTemp = VALUE.substring(0,iTemp +1);
	break;
	}
	iTemp = iTemp-1;
	
	} //End While
	return strTemp;
	
} //End Function
	
function LTrim(VALUE){
	var w_space = String.fromCharCode(32);
	if(v_length < 1){
	return"";
	}
	var v_length = VALUE.length;
	var strTemp = "";
	
	var iTemp = 0;
	
	while(iTemp < v_length){
	if(VALUE.charAt(iTemp) == w_space){
	}
	else{
	strTemp = VALUE.substring(iTemp,v_length);
	break;
	}
	iTemp = iTemp + 1;
	} //End While
	return strTemp;
} //End Function


var monthLength = new Array(31,28,31,30,31,30,31,31,30,31,30,31);

function checkDate(month, day, year)
{

	if(!day && !month && !year)
		return true;
	
	if (!day || !month || !year)
		return false;
	
	//alert(month+' '+day+' '+year);
		
	if (year/4 == parseInt(year/4))
		monthLength[1] = 29;

	if (day > monthLength[month-1])
		return false;

	monthLength[1] = 28;

	var now = new Date();
	now = now.getTime(); //NN3

	var dateToCheck = new Date();
	dateToCheck.setYear(year);
	dateToCheck.setMonth(month-1);
	dateToCheck.setDate(day);
	var checkDate = dateToCheck.getTime();

	var futureDate = (now < checkDate);
	var pastDate = (now > checkDate);
	
	return checkDate;
}
/*
var divshow=false;
var divshowid='';
var timerID = 0;

function rID( elmid ) {
    if( document.getElementById ) { return document.getElementById(elmid); }
    if( document.layers && document.layers[elmid] ) { return document.layers[elmid]; }
    if( document.all && document.all(elmid) ) { return document.all(elmid); }
    return false;
}

function HideMDiv(id) {
sub=document.getElementById('sub'+id);
   if(divshow==true)
    {
        sub.style.display = "none";
        divshowid='';
        divshow=false;
    }
}
function ShowMDiv(subid) {
    var divX=0,divY=0,i=0;
    var smtable;
    subel=rID('sub'+subid);
    if(divshow==true&&subid!=divshowid)
    {
        HideMDiv(divshowid);
    } 
    if(subel.innerHTML!='')
    {
    smtable=document.getElementById('smtable');
    divX=10;
    for(i=1;i<subid;i++)
    {
      td=document.getElementById('td'+i);
      divX+=td.offsetWidth+8;  
    }  
    td=document.getElementById('td'+subid);
    subel.style.left = divX + "px";
    subel.style.top = smtable.offsetHeight+divY + "px";
    subel.style.width=(td.offsetWidth-5)+"px";
    subel.style.overflow="hidden";
    subel.style.display = "block";
    divshow=true;
    divshowid=subid;
    } 
}

function SearchFormSubmit()
{
    if(document.forms.searchform.elements.searchtext.value=='')
    {
        alert("Enter text to search.");
        return false;
    }
    else
    {
        document.forms.searchform.submit();
        return true;
    }
}

*/
var divshow=true;
var divshowid='';
function ShowSubmenu(num,active)
{
    if(divshowid!=num && divshowid!='')
    {    
        divshow=false;
        HideSubmenu(divshowid,active);
    }
    if(divshowid==num) 
    {
        divshow=true;
        return;
    
    }
    document.getElementById('td_left_'+num).src="/images/top_nav_over_left.gif";     
    document.getElementById('td_right_'+num).src="/images/top_nav_over_right.gif";
    //document.getElementById('td_'+num).style.background="url('/images/top_nav_over_bg.jpg')";
    //document.getElementById('td_'+num).style.color="#666666"; 
    document.getElementById('td_'+num).className="topmenu_button_over"; 
    divshowid=num;
    if(document.getElementById('sub'+num)==null) return; 
    divshow=true;
    divshowid=num;
    document.getElementById('sub'+num).style.width= (document.getElementById('td_'+num).offsetWidth+45)+"px";
    document.getElementById('sub'+num).style.visibility='visible';

}

function HideSubmenu(num,active)
{ 
    if(divshowid!='')
    {
    if(active==1)
    {
       document.getElementById('td_left_'+num).src="/images/top_nav_on_left.gif";   
        document.getElementById('td_right_'+num).src="/images/top_nav_on_right.gif";
         /*document.getElementById('td_'+num).style.background="url('/images/top_nav_on_bg.jpg')";
        */
        document.getElementById('td_'+num).className="topmenu_button_on";
    }
    else
    {
        document.getElementById('td_left_'+num).src="/images/top_nav_off_left.gif";   
        document.getElementById('td_right_'+num).src="/images/top_nav_off_right.gif";
        /*document.getElementById('td_'+num).style.background="url('/images/top_nav_off_bg.jpg')";*/
        document.getElementById('td_'+num).className="topmenu_button_off";
    }
    
    if(document.getElementById('sub'+num)==null) return;
        document.getElementById('sub'+num).style.visibility='hidden';
        
       // divshow==false 
       //  alert(num);
    }
    divshowid='';
    //    divshow=false;
  //  }

}
                                            
function ShowArrow(id)
{
   document.getElementById(id+"_aa").src='/images/red_arrow.png';
    document.getElementById("li_"+id).style.background="#E6E0D0";  
   //document.getElementById(id).innerHTML='ss'; 
}
function HideArrow(id)
{
   document.getElementById(id+"_aa").src='/images/submenu_point.gif'; 
   document.getElementById("li_"+id).style.background="#d4cbb1";
}





