<!--- Show and hide sidebar section --->
function toggleView(hideId,showId) {
	
	if (hideId == 'sidebar') {
		document.getElementById(hideId).style.visibility = 'hidden';
		document.getElementById(showId).style.visibility = 'visible';
		document.getElementById('showButton').style.display = 'block';
		document.getElementById('showButton').style.visibility = 'visible';
		document.getElementById('hideButton').style.display = 'none';
		document.getElementById('hideButton').style.visibility = 'hidden';
		setCookie('sidebar','hidden',365);
		
		//hide the selected content too
		//find the seelcted content first
		var selectedTab = getCookie('tabselection');
		if (selectedTab != "") {
		document.getElementById(selectedTab).style.visibility = 'hidden';
		}
	}
	else if (showId == 'sidebar') {
		document.getElementById(hideId).style.visibility = 'hidden';
		document.getElementById(showId).style.visibility = 'visible';
		document.getElementById('showButton').style.display = 'none';
		document.getElementById('showButton').style.visibility = 'hidden';
		document.getElementById('hideButton').style.display = 'block';
		document.getElementById('hideButton').style.visibility = 'visible';
		setCookie('sidebar','visible',365);
		
		//show the selected content too
		var selectedTab = getCookie('tabselection');
		if (selectedTab != "") {
		document.getElementById(selectedTab).style.visibility = 'visible';
		}
	}
	else {
		document.getElementById(hideId).style.display = 'none';
		document.getElementById(hideId).style.visibility = 'hidden';
		document.getElementById(showId).style.display = 'block';
		document.getElementById(showId).style.visibility = 'visible';
	}
}

<!--- Switch view for sidebar section --->
function switchView(showId) {
	var i=0;
	for (i=1;i<=7;i++)
	{
		if (i == showId) {
		document.getElementById(i).style.display = 'block';
		document.getElementById(i).style.visibility = 'visible';
		document.getElementById('m' + i).className = 'sideTabBoxActive';
		document.getElementById('mt' + i).className = 'sideTabTextActive';
		} else {
		document.getElementById(i).style.display = 'none';
		document.getElementById(i).style.visibility = 'hidden';
		document.getElementById('m' + i).className = 'sideTabBoxInactive';
		document.getElementById('mt' + i).className = 'sideTabTextInactive';
		}
	}
	document.getElementById(showId).style.display = 'block';
	document.getElementById(showId).style.visibility = 'visible';
	setCookie('tabselection',showId,365);
}

<!--- Switch view for marketing section --->
function switchContent(showId,numElements) {
	for (i=1;i<=numElements;i++)
	{
		if (i == showId) {
		document.getElementById(i).style.display = 'block';
		document.getElementById(i).style.visibility = 'visible';
		} else {
		document.getElementById(i).style.display = 'none';
		document.getElementById(i).style.visibility = 'hidden';
		}
	}
	document.getElementById(showId).style.display = 'block';
	document.getElementById(showId).style.visibility = 'visible';
}

<!--- resize textarea. --->
function makeBigger(direction) {
  var txtarea = document.getElementById('d');
  if (direction==1) {
    txtarea.rows = txtarea.rows + 5;
  } else {
    txtarea.rows = txtarea.rows - 5;
  }
  document.getElementById("textarea_next_time").value=txtarea.cols+","+txtarea.rows;
}

<!--- validation for the textarea maxlength --->
function textAreaSize(theForm, theField, maxSize)
          {
               var ifString = "document."+theForm+"."+theField+".value.length + 1>= "+maxSize;
               if (eval(ifString))
               {
                      alert('Sorry, This field has reached its maximum size.');
                    var focusString = "document."+theForm+"."+theField+".focus();";
                    eval(focusString);          
                 }
          }

function setCookie(c_name,value,expiredays)
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getCookie(c_name) {
	if (document.cookie.length>0) {
 	c_start=document.cookie.indexOf(c_name + "=");
  	if (c_start!=-1) { 
    	c_start=c_start + c_name.length+1; 
    	c_end=document.cookie.indexOf(";",c_start);
    	if (c_end==-1) c_end=document.cookie.length;
    		return unescape(document.cookie.substring(c_start,c_end));
    	} 
  	}
	return "";
}

function getQueryVariable(variable) {
	var query = window.location.search.substring(1);
	var vars = query.split("&");
	
	for (var i=0;i<vars.length;i++) {
    	var pair = vars[i].split("=");
    	if (pair[0] == variable) {
      		return pair[1];
    	}
  	}
  	
  	return 'NotFound';
} 

function setToInvisible(variable) {
	document.getElementById(variable).style.display = "none";
}

function getVerticalPosition() {
	var v = 0;
	v = window.pageYOffset;
	return v;
}

function setVerticalPosition(formname) {
	document.forms[formname].PageY.value = getVerticalPosition();
}

function scrollDownToVPos() {
	var Vpos = 0;
	Vpos = getQueryVariable("py");
	if(Vpos>0){
		window.scrollTo(0,Vpos);
	}
}

var maxrows=5;
function doResize(box) {
	var txt=box.value;
	var cols=box.cols;
	var arrtxt=txt.split('\n');
	var rows=arrtxt.length;
	for (i=0;i<arrtxt.length;i++)
	  rows+=parseInt(arrtxt[i].length/cols);
	if (rows>box.maxrows)
		box.rows=box.maxrows;
	else
		box.rows=rows;
}
		