/* Javascript functions to support local adoption pages */

var continue_rotation = true;
var last = 0;
var rotation = setTimeout("show_tab(1,1);", 2000);

// =============================================================================
function show_tab(id, cont)
// =============================================================================
{
	// show_tab function for rounded tab css box 1.0
	if(rotation)
		clearTimeout(rotation);
	
	// hide all the divs
    document.getElementById("tab_box_1").style.display = "none";
    document.getElementById("tab_box_2").style.display = "none";
    document.getElementById("tab_box_3").style.display = "none";
    document.getElementById("tab_box_4").style.display = "none";

    // show the requested div
    document.getElementById("tab_box_" + id).style.display = "block";

	switch(id)
	{
		case 1:
			document.getElementById("tab_1").style.borderBottom = "1px solid #E1B6B5";
			document.getElementById("tab_2").style.borderBottom = "1px solid #91908F";
			document.getElementById("tab_3").style.borderBottom = "1px solid #91908F";
			document.getElementById("tab_4").style.borderBottom = "1px solid #91908F";
			break;
		case 2:
			document.getElementById("tab_1").style.borderBottom = "1px solid #91908F";
			document.getElementById("tab_2").style.borderBottom = "1px solid #9ACA99";
			document.getElementById("tab_3").style.borderBottom = "1px solid #91908F";
			document.getElementById("tab_4").style.borderBottom = "1px solid #91908F";
			break;
		case 3:
			document.getElementById("tab_1").style.borderBottom = "1px solid #91908F";
			document.getElementById("tab_2").style.borderBottom = "1px solid #91908F";
			document.getElementById("tab_3").style.borderBottom = "1px solid #C1C2DB";
			document.getElementById("tab_4").style.borderBottom = "1px solid #91908F";
			break;
		case 4:
			document.getElementById("tab_1").style.borderBottom = "1px solid #91908F";
			document.getElementById("tab_2").style.borderBottom = "1px solid #91908F";
			document.getElementById("tab_3").style.borderBottom = "1px solid #91908F";
			document.getElementById("tab_4").style.borderBottom = "1px solid #FCB460";
			break;
		default:
			alert(id);
	}

/*
	// raise up active tab
	document.getElementById("tab_1").style.marginTop = "3px;";
	document.getElementById("tab_2").style.marginTop = "3px;";
	document.getElementById("tab_3").style.marginTop = "3px;";
	document.getElementById("tab_4").style.marginTop = "3px;";

	document.getElementById("tab_" + id).style.paddingBottom = "3px;";
*/
	if (!cont) // don't rotate any more
		continue_rotation = false;	

	// check if we should continue
	if (continue_rotation)
	{
		// pick up where it left off (at the start or a selected tab)
		// eg. show 2: 2 3 4 1 2 3 4 ...
		// DRM fix - this doesn't work properly.  Instead it is showing: 2 1 2 3 4 ...

		last++;
		var next = last;

		// reset when necessary
		if(last == 4)
			last = 0;

		rotation = setTimeout("show_tab("+next+",1);", 5000);
	}
}
// =============================================================================
function reg_show_tab(id) 
// =============================================================================
{
	// reg_show_tab function for the registry box

	// hide all the divs
	document.getElementById('reg_tab_box_1').style.display = 'none';
	document.getElementById('reg_tab_box_2').style.display = 'none';
	document.getElementById('reg_tab_box_3').style.display = 'none';
	document.getElementById('reg_tab_box_4').style.display = 'none';

	// show the requested div
	document.getElementById("reg_tab_box_" + id).style.display = 'block';

	switch(id)
	{
		case '1':
			document.getElementById("reg_tab_1").style.borderBottom = '1px dashed #737520';
			document.getElementById("reg_tab_2").style.borderBottom = '1px solid #737520';
			document.getElementById("reg_tab_3").style.borderBottom = '1px solid #737520';
			document.getElementById("reg_tab_4").style.borderBottom = '1px solid #737520';

			document.getElementById("reg_tab_1").style.backgroundColor = '#FAFAF5';
			document.getElementById("reg_tab_2").style.backgroundColor = '#E9EAB0';
			document.getElementById("reg_tab_3").style.backgroundColor = '#E9EAB0';
			document.getElementById("reg_tab_4").style.backgroundColor = '#E9EAB0';
			break
		case '2':
			document.getElementById("reg_tab_1").style.borderBottom = '1px solid #737520';
			document.getElementById("reg_tab_2").style.borderBottom = '1px dashed #737520';
			document.getElementById("reg_tab_3").style.borderBottom = '1px solid #737520';
			document.getElementById("reg_tab_4").style.borderBottom = '1px solid #737520';

			document.getElementById("reg_tab_1").style.backgroundColor = '#E9EAB0'; 
			document.getElementById("reg_tab_2").style.backgroundColor = '#FAFAF5'; 
			document.getElementById("reg_tab_3").style.backgroundColor = '#E9EAB0'; 
			document.getElementById("reg_tab_4").style.backgroundColor = '#E9EAB0'; 
			break
		case '3':
			document.getElementById("reg_tab_1").style.borderBottom = '1px solid #737520';
			document.getElementById("reg_tab_2").style.borderBottom = '1px solid #737520';
			document.getElementById("reg_tab_3").style.borderBottom = '1px dashed #737520';
			document.getElementById("reg_tab_4").style.borderBottom = '1px solid #737520';

			document.getElementById("reg_tab_1").style.backgroundColor = '#E9EAB0'; 
			document.getElementById("reg_tab_2").style.backgroundColor = '#E9EAB0'; 
			document.getElementById("reg_tab_3").style.backgroundColor = '#FAFAF5'; 
			document.getElementById("reg_tab_4").style.backgroundColor = '#E9EAB0'; 
			break
		case '4':
			document.getElementById("reg_tab_1").style.borderBottom = '1px solid #737520';
			document.getElementById("reg_tab_2").style.borderBottom = '1px solid #737520';
			document.getElementById("reg_tab_3").style.borderBottom = '1px solid #737520';
			document.getElementById("reg_tab_4").style.borderBottom = '1px dashed #737520';

			document.getElementById("reg_tab_1").style.backgroundColor = '#E9EAB0'; 
			document.getElementById("reg_tab_2").style.backgroundColor = '#E9EAB0'; 
			document.getElementById("reg_tab_3").style.backgroundColor = '#E9EAB0'; 
			document.getElementById("reg_tab_4").style.backgroundColor = '#FAFAF5'; 
			break
		default: 
			;
	}			
}
// =============================================================================

