
function on_load() {
  document.getElementById('test_text').style.display = "none";
}

function make_current( element )
{

	change_to_unselected();
	document.getElementById(element).style.backgroundImage = 'url("images/nav/left_on.gif")';

	var a = "_" + element;
	var div = element + "_div";
	
	a = document.getElementById(a);
	a.style.backgroundImage = 'url("images/nav/right_on.gif")';
	a.style.color = '#333';
	a.style.paddingBottom = '5px';
	
	if ( element != "home" )
	{
		document.getElementById('news_text').style.overflow = "hidden";
	}
	else
	{
		document.getElementById('news_text').style.overflow = "auto";
	}
	
	if ( element != "test" )
	{
		document.getElementById('test_div').style.overflow = "hidden";
        //To whom it may concern: I display:none seems to work better
        //as the scroll bar from the services tab (which is named 'test') 
        //was showing up on the home page. -Hunter Peress. 2008.11.27
        
		//document.getElementById('test_text').style.visibility = "hidden";

		document.getElementById('test_text').style.display = "none";
	}
	else
	{
        //FYI,display="" is better for IE as opposed to display:block. Actually
        //now that I think about it, display:"" is better than display:table-row
        //which IE had trouble with. As far as a div goes, I'm not sure if it matters.
        //-Hunter Peress. 2008.11.27

		document.getElementById('test_text').style.display = "";
		document.getElementById('test_div').style.overflow = "hidden";
		
			new Rico.Effect.FadeTo( 'test_nav', 
						   .5, // 70% opacity 
						   1, // 1ms 
						   1, // 1 step 
						   {complete:function() {setStatus('done fading element.',1500);}} );
	}
	
	document.getElementById(div).style.visibility = "visible";
	
	if ( div == "home_div" )
	{
		document.getElementById('massage_type_names').style.visibility = "visible";
	}
	else
	{	
		document.getElementById('massage_type_names').style.visibility = "hidden";
	}

}

function change_to_unselected()
{

	var a_list = new Array( "_home", "_serv", "_test", "_app" );
	var a_current;
	var div_current;
	
	for (i=0; i<4; i++)
	{
		a_current = a_list[i];
		
		div_current = a_list[i].substring(1) + "_div";
		
		document.getElementById(a_current.substring(1)).style.backgroundImage = 'url("images/nav/left.gif")';
		document.getElementById(a_current).style.backgroundImage = 'url("images/nav/right.gif")';
		document.getElementById(a_current).style.color = '#999';
		document.getElementById(a_current).style.paddingBottom = '4px';
		document.getElementById(div_current).style.visibility = "hidden";
				
			
	}
	
	
}	

var shortNews;
function moreNews()
{
	//save the short news so we can put it back later 
	shortNews = document.getElementById('news_text').innerHTML;
	
	//place a loading animation in the news_text div while the ajax is fetching the news 
	document.getElementById('news_text').innerHTML = '<div id="loading_news">loading<br /><img src="images/loading.gif"></div>';
	postDataReturnXml( 'moreNews.php', '', show_more_news );
	
}

function show_more_news( data )
{

	//get the div we will be placing the news items into 
	var mn = document.getElementById('news_text');
	

	
	//remove the loading animation before adding the news items
	mn.innerHTML = "";
	
	//get the individual nodes into array variables to later parse 
	var titleNodes = data.getElementsByTagName("title");
	var dateNodes = data.getElementsByTagName("date");
	var newsNodes = data.getElementsByTagName("news_text");
	
	//parse through the nodes and create the news items 
	for ( var i = 0; i < titleNodes.length; i++ )
	{
		//create a new div element for each news item to live in 
		var newdiv = document.createElement('div');
		newdiv.style.borderBottom = "purple dashed 1px";
		newdiv.style.width = "310px";
		newdiv.style.marginBottom = "10px";
		
		//append the new div into our news_text div 
		mn.appendChild(newdiv);
	
		//get the first title and assign it to newtext 
		var newtext = document.createTextNode(titleNodes[i].childNodes[0].nodeValue);
		
		//create a new paragraph element for the title to live in 
		var newpara = document.createElement('p');
		
		//append the paragraph element into our news_text div 
		var para = newdiv.appendChild(newpara);
		
		//put the title text into the paragraph element 
		newpara.appendChild(newtext);
		
		//set the style for the paragraph 
		newpara.style.fontWeight = "bold";
		newpara.style.fontSize = "14px";
		newpara.style.cssFloat = "left";
		newpara.style.marginTop = "0px";
		newpara.style.color = "#777";
		
		//the above is repeated for the date and news body 
		var newtext2 = document.createTextNode(dateNodes[i].childNodes[0].nodeValue);
		var newpara2 = document.createElement('p');
		var para2 = newdiv.appendChild(newpara2);
		newpara2.appendChild(newtext2);
		
		newpara2.style.color = "#FF4E00";
		newpara2.style.fontSize = "9px";
		newpara2.style.fontStyle = "italic";
		newpara2.style.cssFloat = "right";
		newpara2.style.marginTop = "0px";
		
		var newtext3 = document.createTextNode(newsNodes[i].childNodes[0].nodeValue);
		//newtext3 = newtext3.replace(/^/, "</ br></ br>");
		var newpara3 = document.createElement('p');
		var para3 = newdiv.appendChild(newpara3);
		newpara3.appendChild(newtext3);
		newpara3.style.clear = "both";
		newpara3.style.width = "280px";
		newpara3.style.paddingLeft = "15px";
		//newpara3.style.textIndent = "2em";
		var newpara3text = newpara3.innerHTML;
		newpara3.innerHTML = newpara3text.replace(/\^/g, '<br />');
	}
	
	//mn.innerHTML = data;
	mn.style.overflow = "auto";
	
	var mnl = document.getElementById('more_news');
	mnl.innerHTML = '<a href="" onClick="lessNews(); return false;">less news</a>';
	
}

function lessNews()
{
	var mn = document.getElementById('news_text');
	mn.innerHTML = shortNews;
	mn.style.overflow = "hidden";
	
	var mnl = document.getElementById('more_news');
	mnl.innerHTML = '<a href="" onClick="moreNews(); return false;">more news</a>';
	
}


function modalities( type )
{
	
	var type2 = type.replace(" ", "_");
	
	type2 = type2.replace(" ", "_");
	
	document.getElementById('modalities').style.backgroundImage = 'url( images/services/' + type2.toLowerCase() + '.jpg )';
	
	var mod_type = new Array();
	
	new Rico.Effect.FadeTo( 'mod_text', 
						   .5, // 50% opacity 
						   1, // 1ms 
						   1, // 1 step 
						   {complete:function() {setStatus('done fading element.',1500);}} );
	
	//new Rico.Corner.round('mod_text');
	
	new Rico.Effect.FadeTo( 'mod_title', 
						   .7, // 50% opacity 
						   1, // 1ms 
						   1, // 1 step 
						   {complete:function() {setStatus('done fading element.',1500);}} );
	
	mod_type['Acupressure'] = 	'Acupressure is an ancient Asian healing art that uses fingers to press key points on the surface of the skin to release muscular tension and promote the circulation of blood and the body\'s life force energy to aid healing. All Acupressure sessions can range from gentle holding a series of points for a minute or more each to produce a pleasurable, trance-like state, which facilitates release of physical and emotional tension, to more vigorous styles of Acupressure such as Shiatsu, Thai, and Tui Na. All Acupressure styles are done with the client fully clothed.';
								
	mod_type['Acu-Stone'] = 	'A deeply penetrating and relaxing hot stone therapy blended with acupressure point therapy and bodywork. Warm stones strategically placed along meridians and on acupressure points provide a deeped level of relaxation and opening. All Acu-Stone Therapy is done with the client fully clothed. Please wear loose comfortable clothing to your session.';
								
	mod_type['Integrated'] = 	'A combination of massage styles. Can range from Acu-Stone therapy with Reiki to sports work utilizing a combination of Shiatsu, Thai, and Tui Na. All sessions are done with the client fully clothed. Please wear loose comfortable clothing to your session.';
	
	mod_type['Reflexology'] = 	'Applies pressure on “reflexes” in the feet and hands that corresponds to other parts of the body. This technique is diagnostic as well as therapeutic, relaxing and rejuvenating for the whole body. This technique can be applied with or without the use of oil. Reflexology is done with the client fully clothed. Please wear loose comfortable clothing to your session.';
								
	mod_type['Reiki'] = 		'A form of energy work that channels universal (“rei” in Japanese) life energy (known at ki in Japanese and chi in Chinese) to activate healing. Can be applied hands-on or at a distance. All in-person Reiki sessions are done with the client fully clothed. Please wear loose comfortable clothing to your session.';
	
	mod_type['Sports Tui Na'] = 'A Chinese medical massage used to heal all types of tendon, ligament, musculo-skeletal and joint injuries. Uses acupressure points and energy meridians, rocking, squeezing, joint mobilization, and stretching to enhance athletic performance, rehabilitate injuries, and reduce the possibility of future injuries from occurring. Essential for all yogis, dancers and athletes.  All Sports Tui Na sessions are done with the client fully clothed. Please wear loose comfortable clothing to your session.';
								
	mod_type['Chair & Event'] = 'Give your employees a treat, create a wellness station at your convention, or spice up your special event. Wendy brings her chair or table to you and sets up a relaxing and rejuvinating space. No room for a chair? Wendy can roam around your event offering shoulder massage as well as hand and foot Reflexology. For larger events, Wendy works with a small team of other therapists, who she screens for exceptional massage and customer service skills.';
								
	mod_type['Thai'] = 			'A style of acupressure which uses gentle hand and foot pressure along energy channels in combination with stretching the body into passive yoga postures, allowing muscles to release and joints to open. Typically practiced on a floor mat, I do a modified version on a table. All Thai massage sessions are done with the client fully clothed. Please wear loose comfortable clothing to your session. Sessions typically last from 1-1/2 hours to 2 hours.';
								
	mod_type['Zen Shiatsu'] = 	'A gentle yet invigorating form of the Japanese technique of acupressure that literally means, “finger” (shi) “pressure”(atsu). Zen Shiatsu utilizes rhythmic breathing, stretching, palming, forearms, elbows, fingers, thumbs, knees, tiger\'s palm, and squeezing. Sessions are done fully clothed on a floor mat or on a table. Please wear loose comfortable clothing to your session. ';
	
	document.getElementById('mod_title').innerHTML = type;
	document.getElementById('mod_text').innerHTML = mod_type[type];
	

	
}

function app_fade()
{

	new Rico.Effect.FadeTo( 'app_rates', 
						   .5, // 50% opacity 
						   1, // 1ms 
						   1, // 1 step 
						   {complete:function() {setStatus('done fading element.',1500);}} );
	
	//new Rico.Corner.round('mod_text');
	
	new Rico.Effect.FadeTo( 'app_contact', 
						   .3, // 50% opacity 
						   1, // 1ms 
						   1, // 1 step 
						   {complete:function() {setStatus('done fading element.',1500);}} );
	
}

function services( text )
{
	document.getElementById('test_text').innerHTML= text;
	document.getElementById('test_text').style.visibility="visible";
	serv_fade();	
}

function serv_fade()
{

	new Rico.Effect.FadeTo( 'test_text', 
						   .85, // 70% opacity 
						   1, // 1ms 
						   1, // 1 step 
						   {complete:function() {setStatus('done fading element.',1500);}} );
	
}


function postDataReturnText(url, data, callback)
{ 
  var XMLHttpRequestObject = false; 

  if (window.XMLHttpRequest) {
    XMLHttpRequestObject = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    XMLHttpRequestObject = new 
     ActiveXObject("Microsoft.XMLHTTP");
  }

  if(XMLHttpRequestObject) {
    XMLHttpRequestObject.open("POST", url); 
    XMLHttpRequestObject.setRequestHeader('Content-Type', 
      'application/x-www-form-urlencoded'); 

    XMLHttpRequestObject.onreadystatechange = function() 
    { 
      if (XMLHttpRequestObject.readyState == 4 && 
        XMLHttpRequestObject.status == 200) {
          callback(XMLHttpRequestObject.responseText); 
          delete XMLHttpRequestObject;
          XMLHttpRequestObject = null;
      } 
    }

    XMLHttpRequestObject.send(data); 
  }
}




function postDataReturnXml(url, data, callback)
{ 
  var XMLHttpRequestObject = false; 

  if (window.XMLHttpRequest) {
    XMLHttpRequestObject = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    XMLHttpRequestObject = new 
     ActiveXObject("Microsoft.XMLHTTP");
  }

  if(XMLHttpRequestObject) {
    XMLHttpRequestObject.open("POST", url); 
    XMLHttpRequestObject.setRequestHeader('Content-Type', 
      'application/x-www-form-urlencoded'); 

    XMLHttpRequestObject.onreadystatechange = function() 
    { 
      if (XMLHttpRequestObject.readyState == 4 && 
        XMLHttpRequestObject.status == 200) {
          callback(XMLHttpRequestObject.responseXML); 
          delete XMLHttpRequestObject;
          XMLHttpRequestObject = null;
      } 
    }

    XMLHttpRequestObject.send(data); 
  }
}


