// JavaScript Document

function yoga_widget(root) {
	this.root = root;
}

yoga_widget.prototype.containerHTML = function () {
	var html = "<div style='position: relative; top: -40px;'>"
		html += this.nav_content();
		html += "<div id='" + this.root + "' style='padding-left: 12px; color: #000; padding-bottom: 26px;'></div>";	
		html += "</div>";
	return html;	
}

yoga_widget.prototype.nav_content = function() {
	
	var nav_bar = "<div style='position: relative; width: 100%; background-color: #000;"
		+ " -moz-opacity:.65; height: 40px; padding: 3px'>";
		
		nav_bar += "<div style='position: absolute; left: 6%; top: 16px;'><a id='orgin_link' class='active' onClick='orgin_controller()'>Orgins</a></div>";
		nav_bar += "<div style='position: absolute; left: 21%; top: 16px;'><a id='hatha_link' class='button' onClick='hatha_controller()'>Hatha Yoga</a></div>";
		nav_bar += "<div style='position: absolute; left: 44%; top: 16px;'><a id='karma_link' class='button' onClick='karma_controller()'>Karma Yoga</a></div>";
		nav_bar += "<div style='position: absolute; left: 66%; top: 16px;'><a id='tao_link' class='button' onClick='tao_controller()'>Taoist Yoga</a></div>";
		nav_bar += "</div>";
	return nav_bar;
}

yoga_widget.prototype.load_html = function() {
	$('content_frame').innerHTML = this.containerHTML();
	$(this.root).innerHTML = this.orgin_text();
}

yoga_widget.prototype.show_orgin = function() {
	$(this.root).innerHTML = this.orgin_text();
}

yoga_widget.prototype.show_hatha = function() {
	$(this.root).innerHTML = this.hatha_text();
}

yoga_widget.prototype.show_karma = function() {
	$(this.root).innerHTML = this.karma_text();
}

yoga_widget.prototype.show_tao = function() {
	$(this.root).innerHTML = this.tao_text();
}

yoga_widget.prototype.tao_text = function () {
	return "<div style='height: 300px'><p>Taoist Yoga incorporates the ancient Chinese meridian principle into a Hatha Yoga practice viewing asanas or poses from a Yin/Yang perspective. Meridians are pathways or channels that continuously distribute chi or prana (vital, life force energy) as well as blood throughout the body.  The strength of the meridian system is essential for maintaining balance on all levels of the human organism: mental, emotional and physical. So the primary goal of Taoist Yoga is to increase the flow of life force energy (chi) into and throughout the body.</p>" +
 
	"<p>Yin is seen as stable, receptive, unmoving, whereas Yang is viewed as assertive, moving and changing. Yang Yoga postures are rhythmic and involve repetitive movement and muscular contraction. Yin Yoga poses are static and typically held for several minutes, focusing on connective tissue (fascia, ligaments, tendons) and joints. Yang practices build strength and muscle elasticity; Yin practices encourage flexibility and a feeling of lightness and ease in the body. So Yin and Yang provide a fundamental balance to a Hatha Yoga practice and serve to enhance each other.</p></div>";
}

yoga_widget.prototype.orgin_text = function () {

		var text_content ="<div style='height: 300px'><p>Yoga's origins can be traced to the ancient Indian scriptures called the Vedas which date as far back as 4,000 B.C.<br /><br /> Yoga involves disciplined introspection with the aim of freeing oneself from identification with the ego. There are many forms of yoga including: Bhakti Yoga, the yoga of devotion; Jnana Yoga, the yoga of knowledge; Karma Yoga, the yoga of action; and Hatha Yoga, the yoga of effort or 'physical' yoga.</p></div>";
		  
		return text_content;
}

yoga_widget.prototype.hatha_text = function () {

		var text_content = "<p>Hatha Yoga is the youngest of yoga practices and the most popular in the western world. The word 'Yoga' is derived from the Sanskrit word meaning to bind, yoke or join. In philosophical terms, this refers to the union of the body with the mind, and the mind with a pure state of consciousness. 'Hatha' in Sanskrit refers to the sun and the moon, or the balance of yin and yang energy. Hatha Yoga implies effort in disciplining the mind, body and emotions toward disengaging from identification with the ego and achieving a state of higher consciousness. The physical postures and breathing exercises of Hatha Yoga were developed some 2,000 years ago for the specific purpose of self-realization, i.e. realizing one's true nature or self. The first writings on the origins of the practice and philosophy of Hatha Yoga were outlined in the Yoga Sutras by the Indian sage, Patanjali, sometime between 200-300 AD.</p>"
		+ "<p>Hatha Yoga involves a sophisticated system of exercises and stretches, or postures (asanas) combined with conscious breathing (pranayama) that can create a strong sense of physical, mental and emotional well-being. The practice improves physical balance, flexibility and stamina while mentally and emotionally generating self awareness and a sense of calmness. Unlike other forms of exercise that can strain muscles and bones, the traditional intention of Hatha Yoga is to rejuvenate the body and free the mind from tension brought about by the stress of life. </p>";
		
		text_content += "<p><h4>Postures (ASANAS)</h4>"
			+ "The postures or asanas that are employed in the practice of Hatha Yoga are commonly associated with what Yoga is in America. The regular practice of the stretches, twists, bends and inversions that comprise the asanas, along with conscious breathing (pranayama), are intended to cleanse and purify all the systems of the body removing obstructions to the flow of life force energy. While appearing to deal with the physical body alone, asanas and pranayama actually influence the nervous system and the chemical balance of the brain. So practicing Hatha Yoga not only restores strength and stamina to the body but also can help to rectify physiological and psychological disorders.</p>"
			+ "<p>Probably the most well recognized series of asanas is Surya Namaskara, or Sun Salutations. These could be commonly described as 'yoga calisthenics', and variations of these are included as a part of almost all yoga classes.</p>"
			+ "<div style='text-align: center; width: 100%'><img width='90%' style='border: 1px solid #999;' src='images/surya_namaskar_watercolor.jpg'/></div>";
		
		text_content += "<h4>Conscious Breathing (PRANAYAMA)</h4>"
			+ "<p>Pranayama, which is conscious control of breathing, is another main component of Hatha Yoga. Prana is the yogic word for Chi or the life force energy that permeates the individual, all living beings and life forms, as well as the air we breathe. Ayama is the storing or movement of that energy. So Pranayama is the practice of influencing the flow of life force energy in and  through the body using the breath.</p> "
			+ "<p>Our main source of Prana comes from the air we breathe, and the amount of Prana we circulate through our bodies greatly impacts our overall vitality. The very basics of Pranayama involve focused awareness of both the inhale and exhale, breathing through the nose, and relaxing and stabilizing the breath to support the asana practice. Exhalation becomes consciously identified with releasing. Beyond the fundamentals of Pranayama for practicing Hatha Yoga, there are various other exercises involving inhalation, exhalation and/or retention of the breath intended for specific purposes (such as increased energy, calmness, clarity, etc.). However, these need to be practiced with careful guidance and are recommended for students with experience.</p>";
		  
		return text_content;
}

yoga_widget.prototype.karma_text = function () {

		var text_content = "<div style='height: 300px'><p>Karma Yoga is the yoga of action with an attitude of selfless service. It involves engaging in action or activities without attachment to the outcome and for the purpose of the common good. Karma Yoga is the yoga of service toward others as an expression of one's true, selfless nature without attachment to the ego.</p><p>The work of the Prison Yoga Project could be considered as Karma Yoga. Mohatma Ghandi and Mother Theresa are great examples of Karma yogis.</p></div>";
		  
		return text_content;
}
