// JavaScript Document
function Void(ref){
	
}


function changeView(strUrl) {
			
    window.location.href = strUrl;
}


function setType()
	{

		if (document.type.rdbStep[0].checked == true  && document.getElementById('setday') !=null)
			{	
			document.getElementById('setday').style.display="";
			document.getElementById('setweek').style.display="none";	
			document.getElementById('setmonth').style.display="none";	
			}
		
		if (document.type.rdbStep[1].checked == true)
			{	
			document.getElementById('setday').style.display="none";
			document.getElementById('setweek').style.display="";
			document.getElementById('setmonth').style.display="none";	
			}
		if (document.type.rdbStep[2].checked == true)
			{	
			document.getElementById('setday').style.display="none";
			document.getElementById('setweek').style.display="none";
			document.getElementById('setmonth').style.display="";	
			}
		
	}


function showhideContentBox(refHead,refBox){
	var box_head = document.getElementById(refHead);
	var box_body = document.getElementById(refBox);	
	
	if(box_head.className=="content_box_hdr typ_gray12b underline minus")
	{
		box_head.className=box_head.className.replace(new RegExp(" minus\\b"), " plus");
		box_body.className=box_body.className.replace(new RegExp(" long\\b"), " short");
	}
	else
	{
		box_head.className=box_head.className.replace(new RegExp(" plus\\b"), " minus");
		box_body.className=box_body.className.replace(new RegExp(" short\\b"), " long");	
	}
}

function showhideContentBox2(refHead,refBox,refSummary){
     	var box_head = document.getElementById(refHead);
     	var box_body = document.getElementById(refBox);	
     	var box_summary = document.getElementById(refSummary);
     	
     	if(box_head.className=="content_box_hdr minus short")
     	{     		
     		box_head.className=box_head.className.replace(new RegExp(" minus\\b"), " plus");     		
     		box_summary.style.display = "none";
		box_body.style.display = "block";
     	}
     	else if(box_head.className=="content_box_hdr plus short")
     	{	
     		box_head.className=box_head.className.replace(new RegExp(" plus\\b"), " minus");     		
     		box_summary.style.display = "block";
		box_body.style.display = "none";
     	}
     	
     	//alert(box_body.className);
}

function changeTabQuickLink(ref,parentId){
	var parent = document.getElementById(parentId);
	var divArr = parent.getElementsByTagName('div');
	for (var i = 0; i < divArr.length; i++){
		if (divArr[i].parentNode.getAttribute('id') == parent.getAttribute('id'))
		{
			divArr[i+1].className=divArr[i+1].className.replace(new RegExp("show\\b"), "hide")
			divArr[i].className=divArr[i].className.replace(new RegExp(" selected\\b"), "");
			if (divArr[i] == ref){
				ref.className+=" selected";
				var ref_content = divArr[i+1];
				ref_content.className=ref_content.className.replace(new RegExp("hide\\b"), "show");
				i = i+2;
			}
		}
	}
}

function changeTabIndentMenu(tabref,contentName){
	
	var content = document.getElementById(contentName);
	var parent = content.parentNode;
	
	// identify list of siblings for the content and the tabs
	var contentSiblings = parent.getElementsByTagName('div');
	var siblings = tabref.parentNode.getElementsByTagName('li');
	
	for (var i = 0; i < siblings.length; i++)
	{
		siblings[i].className=siblings[i].className.replace(new RegExp("selected\\b"), "");	
	}
	for (var i = 0; i < contentSiblings.length; i++)
	{
		if (contentSiblings[i].parentNode == parent){
			contentSiblings[i].className=contentSiblings[i].className.replace(new RegExp("show\\b"), "hide");	
		}
	}
	tabref.className = tabref.className + "selected";
	content.className=content.className.replace(new RegExp("hide\\b"), "show");
}

function vBar(tabref){
	
	//var contentSiblings = parent.getElementsByTagName('div');
	var siblings = tabref.parentNode.getElementsByTagName('li');
	var locLI=null;
	for (var i = 0; i < siblings.length; i++)
	{
		if(siblings[i]==tabref){
			locLI=i;
			}
		
	}
	if (siblings[locLI-1].getElementsByTagName('a')[0] !=null){
	
			siblings[locLI-1].getElementsByTagName('a')[0].className+=' noBar';
	}
}

function noVBar(tabref){
	
	//var contentSiblings = parent.getElementsByTagName('div');
	var siblings = tabref.parentNode.getElementsByTagName('li');
	var locLI=null;
	for (var i = 0; i < siblings.length; i++)
	{
		if(siblings[i]==tabref){
			locLI=i;
			}
		
	}
	if (siblings[locLI-1].getElementsByTagName('a')[0] != null)	{		
		siblings[locLI-1].getElementsByTagName('a')[0].className=
			siblings[locLI-1].getElementsByTagName('a')[0].className.replace(new RegExp("noBar\\b"), "");	
	}
}

/* Radio Button Control */
var _isClicked = false;
function showRadioButton(ref){
	if (ref.className !== ref.className.replace(new RegExp("X\\b"), "")) ref._isClicked = true;
	if (!ref._isClicked){
		var _class = ref.className+"X";
		ref.className = _class;
		
	}
}


/* this function is called on click of Green Event(C.A.R. MEETINGS)*/
function highlightGreenEvents(arr)
{
	flush('cell_green'); //called to flush all other events

	for(var i=0;i< arr.length;i++)
	{
		var id = arr[i]+'_wkend';
		var calCellToManipulate = document.getElementById(id);
		
		if(calCellToManipulate != null)
			{
			   calCellToManipulate.className = 'cell_green';
		}
	}
}

/* this function is called on click of week month and day*/

function highlightEvents(arr)
{
	flush('cell_selection'); //called to flush all other events

	for(var i=0;i< arr.length;i++)
	{
		var id = arr[i]+'_wkend';
		var calCellToManipulate = document.getElementById(id);
		
		if(calCellToManipulate != null)
			{
			   calCellToManipulate.className = 'cell_selected';
		}
	}
}


/* this function is called on click of blue Event(N.A.R. MEETINGS)*/
function highlightPaleEvents(arr)
{
     //alert(arr);	

     flush('cell_selected'); //called to flush all other events
	for(var i=0;i< arr.length;i++)
	{
		var id = arr[i]+'_wkend';
		var calCellToManipulate = document.getElementById(id);
		
		
			
	
		if(calCellToManipulate != null)
			{
			calCellToManipulate.className = 'cell_selected';
		}
	}
}

/* this function is called on click of orange Event(INDUSTRY EVENT)*/
function highlightOrangeEvents(arr)
{
	flush('cell_magenda');  //called to flush all other events
	for(var i=0;i< arr.length;i++)
	{
		var id = arr[i]+'_wkend';
		var calCellToManipulate = document.getElementById(id);
		if(calCellToManipulate != null)
			{
			calCellToManipulate.className = 'cell_magenda';
		}
	}
}

/* this function is called on click of yellow Event(C.A.R. EXPO)*/
function highlightYellowEvents(arr)
{
flush('cell_orange');  //called to flush all other events
	for(var i=0;i< arr.length;i++)
	{
		var id = arr[i]+'_wkend';
		var calCellToManipulate = document.getElementById(id);
		
		if(calCellToManipulate != null)
			{
			calCellToManipulate.className = 'cell_orange';
		}
	}
}

/* this function is called on click of blue Event(LOCAL EVENTS)*/
function highlightBlueEvents(arr)
{
	flush('cell_blue');  //called to flush all other events
	for(var i=0;i< arr.length;i++)
	{
		var id = arr[i]+'_wkend';
		var calCellToManipulate = document.getElementById(id);		
		if(calCellToManipulate != null)
			{
			calCellToManipulate.className = 'cell_blue';
		}
	}
}

/*called to flush all other events except the one which user has selected*/
var aryClassElements = new Array();

function flush(color) {
    aryClassElements.length = 0;
	var aryAllEvents = new Array();
	aryAllEvents[0] = "cell_green";	
	aryAllEvents[1] = "cell_selected";
	aryAllEvents[2] = "cell_magenda";
	aryAllEvents[3] = "cell_orange";
	aryAllEvents[4] = "cell_blue";
	for (var j=0; j < aryAllEvents.length ; j++){	
				getElementsByClassName(aryAllEvents[j], document.body);				
				for ( var i = 0; i < aryClassElements.length; i++ ) {
					if(aryAllEvents[j]!=color){
						aryClassElements[i].className = 'wkend';
					}
				}
	}
	}

function getElementsByClassName( strClassName, obj ) {
    if ( obj.className == strClassName ) {
        aryClassElements[aryClassElements.length] = obj;
		
    }
    for ( var i = 0; i < obj.childNodes.length; i++ )
        getElementsByClassName( strClassName, obj.childNodes[i] );
}



function hideRadioButton(ref){
	if (!ref._isClicked){
		var _class = ref.className;
		ref.className = ref.className.replace(new RegExp("X\\b"), "");
	}
}
function clickRadioButton(ref){
	ref._isClicked = true;
	clearClick(ref);
	var _class = ref.className;
	ref.className = _class;
}
function clearClick(ref){
	var siblings = ref.parentNode.getElementsByTagName('li');
	for (var i = 0; i < siblings.length; i++){
		if(siblings[i]!==ref) {
			siblings[i].className = siblings[i].className.replace(new RegExp("X\\b"), "");
			siblings[i]._isClicked = false;
		}	
	}
}
/* Radio Button Control */

function changethefont(nodeRef, classname){
	var node = document.getElementById(nodeRef);	
	node.className = classname;
}



