// JavaScript Document

function arrow_switch(active_id) {
	
		var menu_divs = new Array('section_one','section_two','section_three','section_four','section_four');
		
		for (i=0; i < menu_divs.length; i++) {
        		currentLayer = menu_divs[i];
        		identity=document.getElementById(currentLayer);
				
			if (identity.className == 'active') {
				identity.className = "inactive";
			}
			
		}	
		new_identity=document.getElementById(active_id);
		new_identity.className = "active";		
}

function menu_updater(remove_me, sub_menu) {
	var submenu_divs = new Array('sub_section_one','sub_section_two','sub_section_three','sub_section_four');
	if (document.getElementById(sub_menu).style.display=='none') {
		
		for (var i=0; i < submenu_divs.length; i++) {
			
			if (Element.visible(submenu_divs[i]))
			{
				new Effect.BlindUp(submenu_divs[i], {queue: 'front', limit: 1, duration: 0.2});
			}
		}
		new Effect.toggle(sub_menu, 'blind', {queue: 'end', limit: 1, duration: 0.5});
	}	
}

//bodycontent
var current_bodycontent_info = 'bodycontent_1';

function do_bodycontent_switch(id) {
	if (id != current_bodycontent_info) {
		new Element.hide(current_bodycontent_info);
		new Element.show(id);
		current_bodycontent_info = id;
	}
}

//tabs
var current_tab_info = 'tab_1';

function do_tab_switch(id) {
	if (id != current_tab_info) {
		new Element.hide(current_tab_info);
		new Element.show(id);
		current_tab_info = id;
	}
}

//daquiri
var current_daquiricontent_info = 'daquiricontent_1';

function do_daquiricontent_switch(id) {
	if (id != current_daquiricontent_info) {
		new Element.hide(current_daquiricontent_info);
		new Element.show(id);
		current_daquiricontent_info = id;
	}
}


//body
var current_body_info = 'body_full';

function do_body_switch(id) {
	if (id != current_body_info) {
		new Element.hide(current_body_info);
		new Element.show(id);
		current_body_info = id;
	}
}

//change style
function change(ids, newClass) {
	if ('string' == typeof ids && '' != ids) { 
		var layerSet = ids.split(' '); 
	} else { 
		return; 
	}

	for (i=0; i < layerSet.length; i++) {
		currentLayer = layerSet[i];
		identity=document.getElementById(currentLayer);
		identity.className=newClass;
	}
}

// photo slideshow
function photo_slideshow() {
	for (var i = 0; i < 3; i++) {
		new Effect.Appear('slide_photo_' + i, {queue: 'end', duration: 0.9});
		new Effect.Fade('slide_photo_' + i, {queue: 'end', duration: 0.9, delay: 2});
	}
	window.setTimeout('photo_slideshow()', 5900);
}

// photo slideshow CURRENT version Li copy from below
// (C) 2000 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this  header
// NS4-6,IE4-6
// Fade effect only in IE; degrades gracefully

// =======================================
// set the following variables
// =======================================

// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000

// Duration of crossfade (seconds)
var crossFadeDuration = 3

// Specify the image files
var Pic = new Array() // don't touch this
// to add more images, just continue
// the pattern, adding to the array below

Pic[0] = 'images/getting_started_learn_1_photo1.jpg'
Pic[1] = 'images/getting_started_learn_1_photo2.jpg'
Pic[2] = 'images/getting_started_learn_1_photo3.jpg'
Pic[3] = 'images/getting_started_learn_1_photo4.jpg'

// =======================================
// do not edit anything below this line
// =======================================

var t
var j = 0
var p = Pic.length

var preLoad = new Array()
for (i = 0; i < p; i++){
   preLoad[i] = new Image()
   preLoad[i].src = Pic[i]
}

function runSlideShow(){
   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=2)"
      document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply()      
   }
   document.images.SlideShow.src = preLoad[j].src
   if (document.all){
      document.images.SlideShow.filters.blendTrans.Play()
   }
   j = j + 1
   if (j > (p-1)) j=0
   t = setTimeout('runSlideShow()', 5900);
}

var isPaymentSubmited=false;
function disablePaymentLink(payLink){
	if (isPaymentSubmited){
		payLink.removeAttribute("href");
		return false;
	}else{
		payLink.style.color='#999999';
		isPaymentSubmited=true;
		payLink.disabled=true;
		return true;
	}
}

function openSurvey(link){
	var popup=window.open(link, 'popup_survey', 'resizable=yes,status=yes,location=no,menubar=no,toolbar=no,scrollbar=no,width=800,height=600');
//	popup.moveTo((screen.width-800)/2, (screen.height-600)/2);
//	popup.focus();
}
